;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MIRCDEBUG ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;info: ; ; by wiebe @ QuakeNet ; version 1.0 (written and tested on mIRC 6.12) ; ; last edit: Wed Apr 28 2004 ; ; ;What does this script do? ; you can execute mIRC code on a bot from a channel (similair to !tcl scripts on eggdrops) ; write '!raw ' or '!mirc ' in a channel where the bot is ; ; ;Some examples: ; wiebe is me, and dev-mirc is my bot ; ; [13:01:02] <@wiebe> !raw if ($nick isop $chan) { return $true } ; [13:01:03] <@dev-mirc> result: $true - duration: 0 ms ; ; [13:01:41] <@wiebe> !mirc $fulladdress ; [13:01:42] <@dev-mirc> result: wiebe!wiebe@Wiebe.users.quakenet.org - duration: 0 ms ; ; [13:03:15] <@wiebe> !raw var %x = 1 | while (%x <= 5) { msg $chan x is now %x | inc %x } ; [13:03:16] <@dev-mirc> x is now 1 ; [13:03:16] <@dev-mirc> x is now 2 ; [13:03:16] <@dev-mirc> x is now 3 ; [13:03:16] <@dev-mirc> x is now 4 ; [13:03:16] <@dev-mirc> x is now 5 ; [13:03:17] <@dev-mirc> result: - duration: 20 ms ; ; [13:04:36] <@wiebe> !mirc if ( ; [13:04:37] <@dev-mirc> result: * /if: insufficient parameters (line 1, aliases.ini) - duration: 10 ms ; ; ;How to use this script? ; make sure *ONLY* you and *YOU ALONE* can use this. ; the script gives *TOTAL* control over mIRC (and thus over your PC) ; by default a user with level 9999 has access to this, ; so to use this script add yourself with level 9999 (or change the level required in the script) ; ; ;How does this script work? ; simply said, it creates an alias from the given code and calls this as an identifier ; ; ;Why is this script useful? ; this script works better then $eval(code..), why? ; $eval can not handle command seperator |, if, elseif, else and while loops ; also return can be used this way ; ; script can be used to explain mIRC code to other users, like in script help channels or to test/debug code ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; a channel on text event, make sure you set a userlevel that only you have! ; this script gives TOTAL control over mIRC ; if you change the level, make sure the $ prefix stays on $9999:text:/^(!raw|!mirc)\b/i:#:{ ; save the value that '$ticks' has at this moment var %x = $ticks ; no code part if ($0 == 1) { ; calculate the difference between the saved var '%x' and the current value of '$ticks', send the message msg $chan result: usage $1- - duration: $calc($ticks - %x) ms ; stop return } ; start a timer which will message '$chan' if a possible error is found ; we use a mircdebugerror identifier, we give it the number of lines in 'status window' for this moment .timer $+ $cid $+ .mircdebug. $+ %x 1 0 msg $chan result: $$!mircdebugerror( $line(status window,0) ) - duration: $!calc( $!ticks - %x ) ms ; remove the alias using a timer .timer 1 0 .alias mircdebugalias ; create an alias with the code '$2-' ; we add 'tokenize 32 $!1-' here, if we do not do this, '$1' will be 1 string (with spaces included if any) ; ; this is because $alias(string one,string two) ; in the alias, '$1' will be 'string one' and '$2' will be 'string two' ; and '$1-' will be 'string one string two' ; this is fixed by adding the above code ; ; if the code starts with a '$' or a '%' then we include 'return' aswell, ; so '!raw $thing' or '!raw %thing' works ; . command prefix is used to hide any output from a command .alias mircdebugalias tokenize 32 $!1- $chr(124) $iif($istok($ %,$left($2,1),32),return) $2- ; in the msg to '$chan' we call the alias as an identifier with '$1-' as parameters and get the result, var %result = $iif($mircdebugalias($1-) != $null,$ifmatch,) ; kill the error timer .timer [ $+ [ $cid ] $+ ] .mircdebug. [ $+ [ %x ] ] off ; we are still connected ; no need to continue if /quit or /server or whatever was used that disconnected us from irc if ($status == connected) { ; calculate the difference between the saved var '%x' and the current value of '$ticks', send the message msg $chan result: %result - duration: $calc($ticks - %x) ms } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS MIRCDEBUGERROR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; for errors that happen outside the alias created above ; this alias gets a possible error from the status window, ; $1 = number of lines in status window at start of script alias -l mircdebugerror { ; check if the new total lines in 'status window' has increased, we are connected if ($line(status window,0) > $1) && ($status == connected) { ; set a var to the total number of lines in 'status window' at this moment var %line = $line(status window,0) ; loop through the new lines, backwards while (%line > $1) { ; line matches '* /if: insufficient parameters (line 1, aliases.ini)' ; $chr(42) * (line *, *) check if '(line N,', if N is a number if ($chr(42) * $chr(40) $+ line *, * $+ $chr(41) iswm $line(status window,%line)) && ($left($gettok($line(status window,%line),-2,32),-1) isnum) { ; save the file in a var var %file = $left($gettok($line(status window,%line),-1,32),-1) ; check if the file in the error is indeed a script or an alias file if ($script(%file)) || ($alias(%file)) { ; return that line return $line(status window,%line) } } ; decrease the var dec %line } } }