I'm trying to make a bot I would be able to re-script remotely, but it's giving me trouble...

This is a section of the code that seats in mIRC:
Code:

;;The Support commands, for internal use.

alias exc $replace($reptok($reptok($reptok($reptok($reptok($1-,var,_set,0,32),set,_set,0,32),unset,_unset,0,32),inc,_inc,0,32),dec,_dec,0,32),<&>,$chr(36),<!>,%zBOT_)
alias reval $return $eval($replace($1-,<&>,$chr(36),<!>,$chr(37)),1)

alias _set set %ZBOT_ $+ $1 $2-
alias _unset unset %ZBOT_ $+ $1
alias _inc inc %ZBOT_ $+ $1 $2-
alias _dec dec %ZBOT_ $+ $1 $2-

;;Built-in event section;;

on *:text:*:*:{
  var %file = $mircdirzBOT\ $+ $event 
  var %i = 1
  while %i <= $lines(%file) && $read($mircdirmSS\Config,5) == 1 {
    var %line = $read(%file,%i)
    tokenize 32 %line
    if $1 == <&>if {
      tokenize 32 $eval($replace(%line,<&>,$chr(36),<!>,%zBOT_),1)
      if $2- {
        inc %i
        var %line = $eval($replace($read(%file,%i),<&>,$chr(36),<!>,%zBOT_),1)
        var %i = %line
      }
      else {
        inc %i 2
        var %line = $eval($replace($read(%file,%i),<&>,$chr(36),<!>,%zBOT_),1)
        var %i = %line         
      }
    } 
    elseif $1 == <&>goto {
      var %i = $2
    }
    else {
      exc $1-
      inc %i
    }
  }
}




This code is from $mircdirzBOT\Text:

Code:
#1:<&>if <&>left(<&>1,1) == &
#2:4
#3:17
#4:<&>if <&>read(<&>mircdirzBOT\users,s,<&>address(<&>nick,10)) >= <&>gettok(<&>read(<&>mircdirzBOT\commands,s,<&>mid(<&>1,2,<&>calc(<&>len(<&>1)-1))),2,32)
#5:7
#6:17
#7:set <!>i 1
#8:<&>if <!>i <= <&>lines(<&>mircdirzBOT\command_ <&>+ <&>mid(<&>1,2,<&>calc(<&>len(<&>1)-1)))
#9:11
#10:15
#11:set <!>line <&>reval(<&>read(<&>mircdirzBOT\command_ <&>+ <&>mid(<&>1,2,<&>calc(<&>len(<&>1)-1)),<!>i))
#12:exc <!>line
#13:inc <!>i
#14:<&>goto 8
#15:unset <!>i
#16:unset <!>line
#17:noop



It just gives me
7 Unknown command
8 Unknown command
VAR Unknown command

And those are when it doesn't freeze mIRC up...

Edit: And yes, I am aware of the slight changes you can make to the 'inc %i's, I felt that was not important enough for now.
Edit#2: Added line number indicators to the second code.
Edit#2: Added the $reval alias.

Edit#3: Ok, this is the up-to-date code. Now it just starts an infinite loop... smirk
I stopped the loop, thanks to that "&& $read($mircdirmSS\Config,5) == 1", this is what I saw:
1) A ton load of "EXC Unknown Command" in the status window.
2) The vars:
%ZBOT_i 2351
%ZBOT_line $reval($read($mircdirzBOT\command_ $+ $mid($1,2,$calc($len($1)-1)),i))

Edit#4: Made some changes with places where there's a %zBOT_ $+, basically addind [[]]s. Now that ",i))" turned into %zBOT_i.
Still get an infinite loop of "Exc Unknown command" -_-


Any help would be appreciated!
ziv.

Last edited by ziv; 26/06/10 10:28 AM.