;###SNIPPET INFORMATION###
; Name: /text_outline
; Author: zonIRC
; Version: 1
; mIRC Version: 6.35
; Contact: zonirc@email.com
;          #klkite (network: undernet)
;          zonirc (yahoo messenger)
; Tested: mIRC 6.35+Windows XP Home
;
;
; Description:
; Drawing an outline text on picture window.
;
; Syntax:
; /text_outline [-ocf] @win x y [w h] color outline [size font] text
;
; [-ocf] : a set of switches where 
;          - o make the text bold
;          - c the [w h] have been specified and text would be clipped if it extend beyond the x y [w h] area.
;          - f the [size font] have been specified
; @win : a picture window name and it must be created first
; x : the text left position
; y : the text top position
; [w h] : the width(w) and height(h) area of the text. Only needed when -c been specified.
; color : the text color in rgb values
; outline : the outline color in rgb values.
; [size font] : the font size(size) and its name(font) where the fontname must be quoted if its contain a space(e.g: "times new roman"). Only needed when -f been specified. by default script would use the specified window font setting.
; text : the text that would be drawn into picture window
; NOTE: you can get rgb value by using $rgb(<red>,<green>,<blue>) such as $rgb(255,0,0) that would return '255' for the red color.
;
; Distribution:
; You are allowed to re-distribute it into any form(such as website, magazine, etc) that you wish.
; Please leave the snippet information section as it is.
; You are allowed to edit the code but need to inform the user about that.
; 
;Example:
; /text_outline @test 100 10 255 1 sample text for testing purpose only
; /text_outline -o @test 100 10 255 1 sample text for testing purpose only
; /text_outline -of @test 100 10 255 1 32 "times new roman" sample text for testing purpose only
; /text_outline -ocf @test 100 10 200 20 255 1 32 "times new roman" sample text for testing purpose only
;
; The below example will drawn a 3d text look a like.
alias 3dtext {
  window -pa @cir
  var %loop 1, %max $iif($1,$1,10)
  while (%loop < %max) {
    text_outline -of @cir $calc(100 + %loop) $calc(10 + %loop) 255 1 32 "times new roman" sample text for testing purpose only
    inc %loop
  }
}
;###END OF INFORMATION###

alias text_outline {
  ;/text_outline [-ocf] @win x y [w h] color outline [size font] text

  ;set each paremeter into its own variable
  var %switch $iif(-* iswm $1,$1), %win $($+($,$numtok(%switch @,32)),2), %x $($+($,$numtok(%switch @ x,32)),2)
  var %y $($+($,$numtok(%switch @ x y,32)),2), %o $iif(o isincs %switch,o), %f $iif(f isincs %switch,f), %c $iif(c isincs %switch,c)
  if (%c) var %w $($+($,$numtok(%switch @ x y w,32)),2), %h $($+($,$numtok(%switch @ x y w h,32)),2)
  var %color $($+($,$numtok(%switch @ x y %w %h c,32)),2), %outline $($+($,$numtok(%switch @ x y %w %h c o,32)),2)
  var %size $iif(%f,$($+($,$numtok(%switch @ x y %w %h c o s,32)),2),$window(%win).fontsize)
  var %font $iif("* iswm $iif(%f,$($+($,$numtok(%switch @ x y %w %h c o s f,32),-),2),$qt($window(%win).font)),$gettok($v2,1,34),$gettok($v2,1,32))
  var %text $($+($,$numtok(%switch @ x y %w %h c o $iif(%f,%size %font) t,32),-),2)
  var %do drawtext $+(-nr,%o,%c) %win %outline $qt(%font) %size, %echo echo -ftsc info * /text_outline:

  ;error handler
  if ($window(%win).type != picture) %echo $iif($v1,invalid window type,no such window)
  elseif ($+(%x,%y) !isnum) %echo invalid left/top position
  elseif (%c) && ($+(%w,%h) !isnum) %echo invalid width/height
  elseif ($+(%color,%outline) !isnum) %echo invalid text/outline color
  elseif (%f) && (%size !isnum) %echo invalid font size
  elseif (!%text) %echo insufficient parameter
  else {
    ;set the left and top position for the outline
    var %bx $calc(%x - 1), %by $calc(%y - 1), %ax $calc(%x + 1), %ay $calc(%y + 1)

    ;draw the outline first
    %do %bx %by %w %h %text
    %do %bx %y %w %h %text
    %do %bx %ay %w %h %text

    %do %x %by %w %h %text
    %do %x %y %w %h %text
    %do %x %ay %w %h %text 

    %do %ax %by %w %h %text
    %do %ax %y %w %h %text
    %do %ax %ay %w %h %text

    ;draw the text
    $puttok(%do,%color,4,32) %x %y %w %h %text

    ;refresh window
    drawdot %win
  }
}


; Author:    FiberOPtics
;
; Email:     mirc.fiberoptics@gmail.com
;
; Usage:     /pause <s|ms> <N>, where s stands for seconds, and ms for milliseconds.
;
; Examples:  //echo -a hi | pause s 3 | echo -a sup
;            //echo -a 1 2 3... | pause ms 1500 | echo -a 4
;
; Purpose:   Will pause the script engine on the current thread from processing, until
;            the specified interval in seconds (s) or milliseconds (ms) has passed.
;
; Reqs:      mIRC 5.9
;           /pause with param 's' works on all Windows versions
;           /pause with param 'ms' works on Windows OS'es from Win2k and higher
;
;
; Notes:  -  If you want to use this in an event, use a signal, as otherwise it would pause the event,
;            making successive triggerings of the event queued.
;
;         -  The reason the millisecond property only works from Win2k on, is because pathping.exe
;            only started to be shipped from that OS. So in theory, you could use this snippet
;            on all Windows versions, as long as it has pathping.exe installed.
;
;         -  Remember that mIRC has the functionality of timers (/help /timer), so look into using,
;            timers before resorting to /pause.
;
;         -  Online has already created a great /sleep snippet that works on all Windows OS'es
;            that don't have Windows Scripting disabled, so why did I release this snippet?
;
;            *  /pause doesn't have to do disk access in order to work, which makes it more
;                efficient and less slow.
;
;            *  /pause is more accurate in respecting the specified interval to pause
;               (don't expect it to be right on the spot though, there will always be
;                some variation)
;
;            *  /pause doesn't trigger anti-spyware/anti-virus programs, something /sleep
;                suffers from with for example MS Windows AntiSpyware, because it executes
;                a Windows Scripting file, which is often seen as malicious. This was the
;                primary reason to release /pause.
;


alias pause {
  var %e = !echo $color(info) -a * /pause:
  if ($version < 5.91) {
    %e this snippet requires atleast mIRC version 5.91
  }
  elseif (!$regex(pause,$1-,/^m?s \d+$/Si)) {
    %e incorrect/insufficient parameters. Syntax: /pause <s|ms> <N>
  }
  elseif ($1 == ms) && ($istok(95 98 ME,$os,32)) {
    %e cannot use milliseconds parameter on OS'es beneath Win2k
  }
  elseif ($2 !isnum 1-) {
    %e must specify a number within range 1-
  }
  else {
    var %wsh = wsh $+ $ticks, %cmd
    if ($1 == s) %cmd = ping.exe -n $int($calc($2 + 1)) 127.0.0.1
    else %cmd = pathping.exe -n -w 1 -q 1 -h 1 -p $iif($2 > 40,$calc($2 - 40),$2) 127.0.0.1
    .comopen %wsh wscript.shell
    .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c %cmd >nul,uint,0,bool,true)
  }
}

;**********************************************************************************************

alias startti
{
  set %ruudun_arvo 0
}

alias ruutu {
  ;if (set %ruudun_arvo 0 == 0) {
  window -pek @cir
  ;  set %ruudun_arvo 0 == 1

  ;}
}


; timer 1 5 /run http://www.jyu.fi
;/timer 5 10 .... will run after 10 seconds, and repeat itself 5 times (it will run at 10, 20, 30, 40 and 50 seconds after starting it)



;  timer 1 2 drawdot @cir 2 50 $rand(0,1000) $rand(0,1000)

on 1:TEXT:demo*:#:{  msg $chan $nick ajaa efektin
  ;Create a picture (-p) window (@cir)
  window -pek @cir

  ;Draw a circle (on window (@cir) with color 4 (red), size of 50 at coordinates (200,200)
  drawdot @cir 4 50 200 200


  ;timer 1 2 drawdot @cir 2 50 $rand(0,1000) $rand(0,1000)

  ; for (int i = 0; i < 100; ++i) { float x = 0.1 * float(i); effect(i, sin(x)); }





  var %i = 1
  while (%i <= 100) {
    ;timer 1 0
    drawdot @cir $rand(0,10) $rand(0,150) $rand(0,1000) $rand(0,1000)

    /text_outline  -of @cir 100 10 255 1 32 "times new roman" $nick halusi palloja
    ;text_outline 
    pause ms 100
    inc %i
  }

}

on 1:TEXT:sini*:#:{  msg $chan $nick ajaa efektin
  window -pek @cir

  var %e = 1
  ;var %x = 0
  while (%e <= 1000)
  {
    ;timer 1 0
    drawdot @cir $rand(0,10) $rand(0,150) $rand(0,1000) $rand(0,1000)
    ;drawdot @cir 1 2 100+(e) 100+(0.1*e)
    pause ms 100
    inc %e
  }

}
