Is it possible to have nested For Next loops

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Xecros
a lesser mummy
a lesser mummy
Posts: 54
Joined: Tue Apr 22, 2003 9:24 am

Is it possible to have nested For Next loops

Post by Xecros » Mon Sep 01, 2003 11:08 pm

I'd test it out myself if i were home and had access to EQ. I'm currently overseas for another month and have no access to EQ.

I've successfully gotten MQ compiled, now i'm trying to write scripts that i can use right away for when i get home.

Xec

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Thu Sep 04, 2003 9:29 pm

taken from track.mac:

Code: Select all

....
|Set Alerts 
/if $a(0,0)==0 { 
/echo No NPC alerts set for $zone. 
/goto :FinishedInfo 
} else { 
[b]/for v3 1 to $a(0,0) [/b]
  /alert clear $v3 
  |changes "an orc pawn" to "an_orc_pawn" for alert setting 
  /varset v20 "$a(0,$v3)" 
  /varset l1 $int($strlen("$v20")-1) 
[b]  /for l0 0 to $l1  [/b]
   /if "$mid($l0,1,"$v20")"==" " /varset v20 "$left($l0,"$v20")_$right($int($l1-$l0),"$v20")" 
   /doevents 
[b]  /next l0 [/b]
/varset v20 "$v20" 

|Add alerts in "an_orc_pawn00" settings 
  /alert add $v3 npc "$v20""00" 
  /alert add $v3 npc "$v20""01" 
  /alert add $v3 npc "$v20""02" 
  /alert add $v3 npc "$v20""03" 
  /alert add $v3 npc "$v20""04" 
  /alert add $v3 npc "$v20""05" 
  /doevents 
[b]/next v3 [/b]
/echo $a(0,0) alerts for $zone set. 
} 
....
nested /for /next's there =D