I was going to post it.... but I just gave up. After working on it for at least 5 hours, and finally getting a small, but difficult problem, I just said *beep* it. But here's the final code:

Code:
/for {
  if ($1 isnum) {
    set %place 1
    while ($gettok($3-,%place,59) != $null) {
      ;executes each section seperately, divided by $chr(59)
      set %tok $gettok($3-,%place,59)
      set %subplace 1

      if (%place == 1) {
        ;first section. Initializes variables, in "variable = value" format. Each statement seperated by commas.
        while ($gettok(%tok, %subplace, 44) != $null) {
          set %subtok $remove($gettok(%tok, %subplace, 44),$chr(32))

          set $+(%,$gettok(%subtok,1,61)) $gettok(%subtok,2,61)
          inc %subplace
        }
      }
      else if (%place == 2) {
        set %tok $gettok($3-,%place,59)

        set %evalfirst $gettok(%tok,1,32)
        set %evalmid $gettok(%tok,2,32)
        set %evallast $gettok(%tok,3,32)
        set %evalwhile $gettok(%tok,1,32) $gettok(%tok,2,32) $gettok(%tok,3,32)

      }
      else if (%place == 3) {
        ;anything made within the third section is done at the end. Can have more than one command with seperation of either | or ,
        if ($replace($gettok($3-,%place,59),$chr(44),$chr(124)),1 != $null) {
          set %exec $replace($gettok($3-,%place,59),$chr(44),$chr(124))
        }
      }
      inc %place
    }
    set %forcount $1
    while (for !isin $read($2,%forcount)) {
      inc %forcount
    }
    inc %forcount
    write -c for.txt 0

    while (:FOREND !isin $read($2,%forcount)) {
      write for.txt $read($2,%forcount)
      msg # $read($2,%forcount)
      inc %forcount
    }
    msg # %evalfirst %evalmid %evallast

    while (%evalwhile) {
      echo -a got here
      set %forcount 1

      while ($read(for.txt,%forcount) != $null) {
        msg # got here
        / $+ $read(for.txt,%forcount)
        / $+ %exec
        inc %forcount
      }
    }
  }
}
 


under the format:

Code:
/testing {
  for $scriptline aliases.txt lol = 3; %lol < 5 ;inc %lol
  say hi 
  :FOREND
}  


As you can see, it's a bit cluttered. $1 refers to the script line that the forloop is in. $2 refers to the _text_ file that the for loop is in (not the code for the for loop). You need to have the text script file that the forloop is in as a .txt. This takes out the "n539=".

The problem that I encountered was when a variable was being passed as a value, not a string, which isnt what I wanted. When I tried to fix it, everything jus got sour. So, here's the code, and good luck. And if you manage to fix it, please pst it back in here. I'd like to see my code NOT go to waste.

Last edited by Chappy; 07/09/05 11:48 AM.