Switch Case?? - 06/08/06 12:34 AM
have switch..case in mirc??
i hope to see it on the next version.
i hope to see it on the next version.

switch ($time(HH:nn)) { case (10:00) { ; $time(HH:nn) is 10:00 break } case (11:00) { ; $time(HH:nn) is 11:00 break } default { ; $time(HH:nn) is neither of the above } ; Here is where the script will go to when mIRC hits a break statement. ; Without the break statements mIRC would just fall through to the next case. }
ON ^*:JOIN:*:echo $color(info) $chan $nick joined $chan at $switch($time(h:n:tt)) | haltdef alias switch { tokenize 58 $1 goto $iif((($2) && ($isid) && ($1 isnum 1-12) && ($2 isnum 0-59)),$iif($istok(0 15 30 45,$2,32),$2,$iif($2 < 30,past,to)),error) :0 return exactly $1 o'clock $3 :15 return a quarter past $1 $3 :30 return half past $1 $3 :past return $2 $iif($2 == 1,minute,minutes) past $1 $3 :45 return a quarter to $iif($1 == 12,1 $3,$calc($1 + 1) $iif($3,$iif($1 == 11,$iif($3 == am,pm,am),$3))) :to return $calc(60 - $2) $iif($2 == 59,minute,minutes) to $iif($1 == 12,1 $3,$calc($1 + 1) $iif($3,$iif($1 == 11,$iif($3 == am,pm,am),$3))) :error echo $color(wallops) -a SWITCH statement called incorrectly }
alias switch { set %~SwitchEval $1 | return $null } alias case { return $iif($1 == %~SwitchEval, $true, $false) } alias case-switch-test { var %Test 1 $switch(%Test) { if ($case(1)) { echo -s Testing 1 } if ($case(2)) { echo -s Testing 2 } } }