alias picwinchat {
var %x 50,%y 50,%w 300,%h 300
window -BfdpC @chat -1 -1 400 400
;make the window full white
drawrect -fr @chat 16777215 0 0 0 400 400
drawrect -r @chat 0 0 %x %y %w %h
;we substract 10 to the real width because we will use a 5 pixel margin on both left/right
var %n $wrap($1-,verdana,10,$calc(%w - 10),1,0)
;the margin
var %xstart %x + 5 ,%ystart %y + 5,%a 1,%pos 0
while (%a <= %n) {
drawtext -rp @chat 0 verdana 10 %xstart %ystart %ctrlcode $+ $wrap($1-,verdana,10,$calc(%w - 10),1,%a)
inc %pos $len($wrap($1-,verdana,10,$calc(%w - 10),1,%a))
var %ctrlcode $controlat($1-,%pos)
inc %a
inc %ystart 20
}
}