All pastes #621612 Raw Edit

By Couch

public text v1 · immutable
·published 2007-07-16 09:03 UTC
rendered paste body
menu NickList {
  Picture Window Chat:PicWinChat $$1
}
alias PicWinChat {
  var %user = $1,%Win = @PicWinChat
  window -c %Win
  window -ak0el20pd +bstn %Win
  clear %Win
  titlebar %Win with %user - By Couch
  hadd -m $pic Nicks $addtok(%user,$hget($pic,Nicks),124)
  hadd -m $pic Size 5
  hadd -m $pic Type Dot
  hadd -m $pic Colour 0,0,0
  PicWinChat.info
}
alias PicWinChat.Echo {
  if ($window(@PicWinChat)) aline -l @PicWinChat $$1-
}
menu @PicWinChat {
  sclick: {
    if ($hget($pic,Type) == dot) {
      drawdot $+(-r,$hget($pic,Switch)) @PicWinChat $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) $mouse.x $mouse.y
      PicWinChat.MsgAll Draw Dot $+(-r,$hget($pic,Switch)) $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) $mouse.x $mouse.y
      hadd -m $pic Click $true
    }
    elseif ($hget($pic,Type) == Rect) {
      hadd -m $pic Rect $mouse.x $mouse.y
    }
    elseif ($hget($pic,Type) == Line) {
      hadd -m $pic Line $mouse.x $mouse.y
    }
    elseif ($hget($pic,Type) == Text) {
      var %Text = $input(Type the text you would like to write,e,Picture Window Chat Text)
      drawtext $+(-r,$hget($pic,Switch)) @PicWinChat $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $mouse.x $mouse.y %Text
      PicWinChat.MsgAll Draw Text $+(-r,$hget($pic,Switch)) $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $mouse.x $mouse.y %Text
    }
    elseif ($hget($pic,Type) == circle) {
      hadd -m $pic Circle $mouse.x $mouse.y
    }
    PicWinChat.Info
  }
  mouse: {
    if ($hget($pic,Click) == $true) {
      drawdot $+(-r,$hget($pic,Switch)) @PicWinChat $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) $mouse.x $mouse.y
      hadd -m $pic String $addtok($mouse.x $mouse.y,$hget($pic,String),32)
      if ($gettok($hget($pic,String),0,32) => 80) {
        PicWinChat.MsgAll Draw Dot $+(-r,$hget($pic,Switch)) $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) $hget($pic,String)
        hdel $pic String
      }
      PicWinChat.Info
    }
  }
  uclick: {
    if ($hget($pic,Click) == $true) {
      if ($hget($pic,String)) {
        PicWinChat.MsgAll Draw Dot $+(-r,$hget($pic,Switch)) $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) $v1
        hdel $pic String
      }
      hadd -m $pic Click $false
    }
    elseif ($hget($pic,Rect) != $null) {
      var %x = $token($v1,1,32),%y = $token($v1,2,32)
      drawrect $+(-r,$hget($pic,Switch)) @PicWinChat $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) %x %y $calc($mouse.x - %x) $calc($Mouse.y - %y)
      PicWinChat.MsgAll Draw Rect $+(-r,$hget($pic,Switch)) $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $&
        $hget($pic,Size) %x %y $i($calc(%x - $mouse.x)) $i($calc(%y - $Mouse.y))
      hdel $pic Rect
    }
    elseif ($hget($pic,Line) != $null) {
      var %x = $token($v1,1,32),%y = $token($v1,2,32)
      drawline $+(-r,$hget($pic,Switch)) @PicWinChat $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) %x %y $mouse.x $Mouse.y
      echo -a PicWinChat.MsgAll Draw Line $+(-r,$hget($pic,Switch)) $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $&
        $hget($pic,Size) %x %y $mouse.x $Mouse.y
      hdel $pic Line
    }
    elseif ($hget($pic,Circle) != $null) {
      var %x = $token($v1,1,32),%y = $token($v1,2,32)
      drawrect $+(-red,$hget($pic,Switch)) @PicWinChat $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $hget($pic,Size) %x %y $calc($mouse.x - %x) $calc($Mouse.y - %y)
      PicWinChat.MsgAll Draw Rect $+(-red,$hget($pic,Switch)) $rgb( [ $gettok($hget($pic,Colour),1,32) ] ) $&
        $hget($pic,Size) %x %y $i($calc(%x - $mouse.x)) $i($calc(%y - $Mouse.y))
      hdel $pic Circle
    }
    PicWinChat.Info
  }
  -
  PicWinChat
  .Size
  ..$iif($hget($pic,Size) == 1,$style(1)) 1:hadd -m $pic Size 1
  ..$iif($hget($pic,Size) == 5,$style(1)) 5:hadd -m $pic Size 5
  ..$iif($hget($pic,Size) == 10,$style(1)) 10:hadd -m $pic Size 10
  .Type
  ..$iif($hget($pic,Type) == Dot,$style(1)) Dot:hadd -m $pic Type Dot
  ..$iif($hget($pic,Type) == Rect,$style(1)) Rectangle:hadd -m $pic Type Rect
  ..$iif($hget($pic,Type) == Line,$style(1)) Line:hadd -m $pic Type Line
  ..$iif($hget($pic,Type) == Text,$style(1)) Text:hadd -m $pic Type Text
  ..$iif($hget($pic,Type) == Circle,$style(1)) Circle:hadd -m $pic Type Circle
  .Colour
  ..$iif($hget($pic,Colour) == $rgb($color(0)),$style(1)) White:hadd -m $pic Colour $rgb($color(0))
  ..$iif($hget($pic,Colour) == $rgb($color(1)),$style(1)) Black:hadd -m $pic Colour $rgb($color(1))
  ..$iif($hget($pic,Colour) == $rgb($color(2)),$style(1)) Blue:hadd -m $pic Colour $rgb($color(2))
  ..$iif($hget($pic,Colour) == $rgb($color(3)),$style(1)) Green:hadd -m $pic Colour $rgb($color(3))
  ..$iif($hget($pic,Colour) == $rgb($color(4)),$style(1)) Red:hadd -m $pic Colour $rgb($color(4))
  ..$iif($hget($pic,Colour) == $rgb($color(5)),$style(1)) Brown:hadd -m $pic Colour $rgb($color(5))
  ..$iif($hget($pic,Colour) == $rgb($color(6)),$style(1)) Purple:hadd -m $pic Colour $rgb($color(6))
  ..$iif($hget($pic,Colour) == $rgb($color(7)),$style(1)) Orange:hadd -m $pic Colour $rgb($color(7))
  ..$iif($hget($pic,Colour) == $rgb($color(8)),$style(1)) Yellow:hadd -m $pic Colour $rgb($color(8))
  ..$iif($hget($pic,Colour) == $rgb($color(9)),$style(1)) Light Green:hadd -m $pic Colour $rgb($color(9))
  ..$iif($hget($pic,Colour) == $rgb($color(10)),$style(1)) Dark Cyan:hadd -m $pic Colour $rgb($color(10))
  ..$iif($hget($pic,Colour) == $rgb($color(11)),$style(1)) Cyan:hadd -m $pic Colour $rgb($color(11))
  ..$iif($hget($pic,Colour) == $rgb($color(12)),$style(1)) Light Blue:hadd -m $pic Colour $rgb($color(12))
  ..$iif($hget($pic,Colour) == $rgb($color(13)),$style(1)) Pink:hadd -m $pic Colour $rgb($color(13))
  ..$iif($hget($pic,Colour) == $rgb($color(14)),$style(1)) Dark Grey:hadd -m $pic Colour $rgb($color(14))
  ..$iif($hget($pic,Colour) == $rgb($color(15)),$style(1)) Light Grey:hadd -m $pic Colour $rgb($color(15))
  ..$iif($token($hget($pic,Colour),2,32) == Custom,$style(1)) Custom Colour: {
    var %c = $input(Choose an RGB (Example: 135,35,35),e,RGB Colours)
    hadd -m $pic Colour %c Custom
  }
  .Other
  ..$iif(*f* iswm $hget($pic,Switch),$style(1)) Fill:hadd -m $pic Switch $iif(*f* iswm $hget($pic,Switch),$remove($hget($pic,Switch),f),$hget($pic,Switch) $+ f)
  ..$iif(*d* iswm $hget($pic,Switch),$style(1)) Round:hadd -m $pic Switch $iif(*d* iswm $hget($pic,Switch),$remove($hget($pic,Switch),d),$hget($pic,Switch) $+ d)
  ..$iif($window(@PicWinChat).ontop,$style(1)) Ontop:window $iif($window(@PicWinChat).ontop,-u,-o) @PicWinChat
  .Clear: {
    clear @PicWinChat
    PicWinChat.Info
  }
  -
}
on ^*:Text:*:?: {
  if ($istok($hget($pic,Nicks),$nick,124)) {
    if (!$window(@PicWinChat)) PicWinChat $nick
    if ($1 == Textbox) {
      PicWinChat.Echo < $+ $nick $+ > $$2-
      haltdef
    }
    if ($1 == Draw) {
      PicWinChat.Draw $$2-
      haltdef
    }
    PicWinChat.Info
  }
}
alias pic return PicWinChat
alias PicWinChat.Close {
  if ($1) window -c $1
  hfree $pic
}
on *:INPUT:@PicWinChat: {
  PicWinChat.Echo < $+ $me $+ > $$1-
  PicWinChat.MsgAll Textbox $$1-
}
on *:Close:@PicWinChat: {
  PicWinChat.Close $pic
}
alias PicWinChat.MsgAll {
  var %x = 1
  while ($gettok($hget($pic,Nicks),%x,124)) {
    .msg $v1 $$1-
    inc %x
  }
}
alias PicWinChat.Draw {
  var %event = $+(draw,$1),%switch = $2,%col = $3,%size = $4,%x = $5,%y = $6,%w = $7,%h = $8
  %event %switch @PicWinChat %col %size $int(%x) $int(%y) $int(%w) $int(%h)
}
alias PicWinChat.info {
  var %string = Colour: $hget($pic,Colour) Size: $hget($pic,Size) Type: $hget($pic,Type)
  drawrect -rnf @PicWinChat $rgb(255,255,255) 1 2 2 $calc($len(%string) *5.5) 14
  drawtext -rn @PicWinChat 0 10 2 %string
  drawdot @PicWinChat
}
alias i return $remove($1-,-)