mIRC Paint

By sunslayer on Oct 05, 2009

its been done before, i know but this is my first real attempt at using picwins.
besides who doesn't love paint? :)

it has all of the /draw commands:Dot Line Rectangle Fill Text and replace it also allows you to save/open pics

dialog paint {
  title "mIRC Paint"
  size 25 100 58 154
  option dbu
  box "Options", 7, 0 0 57 101
  radio "Draw Dot", 8, 5 10 50 8
  radio "Draw Line", 9, 5 20 50 8
  radio "Draw Rectangle", 10, 5 30 50 8
  radio "Draw Fill", 11, 5 40 50 8
  radio "Draw Text", 12, 5 50 50 8
  button "Rotate", 13, 5 60 50 10
  button "Change Colors", 14, 5 70 50 10
  text "Size:", 15, 5 81 12 8
  edit "5", 16, 20 80 35 10
  text "Color:", 17, 4 91 15 8
  edit "4", 18, 20 90 35 10
  button "Save", 19, 1 102 23 10
  button "Open", 20, 32 102 23 10
  button "Close", 21, 32 113 23 10
  box "Mouse Position", 22, 1 124 56 30
  text "X:", 23, 5 134 7 8
  edit "", 24, 30 133 25 10, read
  text "Y:", 25, 5 144 8 8
  edit "", 26, 29 143 25 10, read
  button "Clear", 27, 1 113 23 10
  menu "&File", 1
  item "&New", 2, 1
  item "&Open", 3, 1
  item "&Save As", 4, 1
  item "break", 5, 1
  item "Close", 6, 1
}
on *:dialog:paint:*:*: {
  if ($devent == init) {
    if ($window(@Paint)) window -c $v1
    window -apk0 @Paint
    did -c $dname 8
  }
  elseif ($devent == menu) {
    if ($did == 2) clear @Paint
    elseif ($did == 3) { clear @Paint | drawpic @Paint 1 1 $qt($$sfile($mircdirPaint\*.*,Open Image...)) }
    elseif ($did == 4) drawsave @Paint $qt($$sfile($mircdirPaint\*.bmp,Save File As...))
    elseif ($did == 6) { dialog -x $dname | window -c @Paint }
  }
  elseif ($devent == sclick) {
    if ($istok(8 9 10 11 12,$did,32)) unset %paint.*
    if ($did == 13) drawrot @paint $input(How many Degrees?,e,Rotate) 0 0
    elseif ($did == 14) drawreplace @paint $$?="What color do you want to change? $crlf 1-15" $$?="What color do you want to change it to? $crlf 1-15"
    elseif ($did == 19) drawsave @Paint $qt($$sfile($mircdirPaint\*.bmp,Save File As...))
    elseif ($did == 20) { clear @Paint | drawpic @Paint 1 1 $qt($$sfile($mircdirPaint\*.*,Open Image...)) }
    elseif ($did == 21) { dialog -x $dname | window -c @Paint }
    elseif ($did == 27) Clear @paint
  }
  elseif ($devent == close && $window(@Paint)) { window -c $v1 }
}
menu @paint {
  sclick:{
    var %dlg = Paint,%col = $did(%dlg,18),%size = $did(%dlg,16),%x = $did(%dlg,24),%y = $did(%dlg,26)
    if ($did(%dlg,8).state) drawdot @Paint %col %size %x %y
    elseif ($did(%dlg,9).state) {
      if (!%paint.click) set %paint.click %x %y
      else { drawline @Paint %col %size %paint.click %x %y | unset %paint.click }
    }
    elseif ($did(%dlg,10).state) {
      if ($numtok(%paint.rect,32) < 3) set %paint.rect $addtok(%paint.rect,$+(%x,|,%y),32)
      else { 
        drawline @paint %col %size $replace(%paint.rect,$chr(124),$chr(32)) $str(%x %y $chr(32),2) $replace($gettok(%paint.rect,1,32),$chr(124),$chr(32))
        unset %paint.rect 
      }
    }
    elseif ($did(%dlg,11).state) drawfill @Paint %col 0 0 0 0
    elseif ($did(%dlg,12).state) drawtext @paint %col %x %y $$?="What do you want to type?"
  }
  mouse: {
    if ($mouse.key & 1) drawdot @paint $did(paint,18) $did(paint,16) $mouse.x $mouse.y
    paint.mupdate
  }
}
on *:close:@Paint:if ($dialog(Paint)) dialog -x $v1
menu channel,status,menu { 
  mIRC Paint:paint
}
alias paint dialog $+(-,$iif($dialog(Paint),-v,mo paint)) paint
alias -l paint.mupdate { did -ra Paint 24 $mouse.x | did -ra Paint 26 $mouse.y }
on *:load:if (!$isdir(Paint)) mkdir Paint

Comments

Sign in to comment.
sunslayer   -  Dec 30, 2009

i dont mind

 Respond  
[Plornt]   -  Dec 30, 2009

WOW this is going to come in handy, i was making a paint server DCC chat thingy and i made a 2 user paint script (with just free hand drawing).

heh now i can use this and add in the dcc bit... Ill add it here when im done :)

if thats ok with you that is

 Respond  
sunslayer   -  Oct 09, 2009

added freehand draw
but i have no idea how to do the second one, any ideas?

 Respond  
knoeki   -  Oct 09, 2009

Heh, much nicer than my version in a way, but it has some issues...

1) draw dot only draws one dot at the time, I was hoping it'd be freehand drawing like in mine.

2) draw fill seems to fill the whole screen, rather than the rectangle I clicked inside :x

Very nice regardless. :_)

 Respond  
sunslayer   -  Oct 06, 2009

thanks :)

 Respond  
PATX   -  Oct 06, 2009

very coo. good job.

 Respond  
sunslayer   -  Oct 06, 2009

what are you trying to draw?
if your trying to draw a line or a rectangle it will only show once you give enough parameters, e.g. a line needs 2 clicks and a rect needs 4

 Respond  
blitzz   -  Oct 05, 2009

I like how you set the Mouse Position :)..not really useful but good to see you try to make something with mIRC that windows already have..one problem..a bit slower when drawing..need 1sec - 2sec for the result/draw appear..9/10 dude..

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.