Whats wrong with this mac...

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

Moderator: MacroQuest Developers

theafkxper
a hill giant
a hill giant
Posts: 207
Joined: Sun Sep 08, 2002 6:41 pm

Whats wrong with this mac...

Post by theafkxper » Wed Sep 24, 2003 10:30 pm

http://macroquest2.com/phpBB2/viewtopic.php?t=2895

ive messed with it, walked through the code quite a few times, and i still cant figure out why it hangs on the 10th mob, any ideas?

/afk

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Sep 24, 2003 10:38 pm

Where does it hang?

theafkxper
a hill giant
a hill giant
Posts: 207
Joined: Sun Sep 08, 2002 6:41 pm

Post by theafkxper » Wed Sep 24, 2003 11:35 pm

Code: Select all

clears alert 1 
adds alert for yadda_yadda00
adds alert for yadda_yadda01
adds alert for yadda_yadda02
adds alert for yadda_yadda03
adds alert for yadda_yadda04
clears alert 2
all that works till we get to:

Code: Select all

cleared alert 10
added alert for big_mob_00
*Hang*
dosent finish adding the alerts, and dosent check anymore spawns, just hangs after adding the first instance of the tenth mob.

/afk

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Thu Sep 25, 2003 12:44 am

Keep going, what line does it hang on?

theafkxper
a hill giant
a hill giant
Posts: 207
Joined: Sun Sep 08, 2002 6:41 pm

Post by theafkxper » Thu Sep 25, 2003 12:48 am

right there

says it added alert big_mob00 then the mac dosent do anything else, thats it. Not sure if youve used this particular mac before, but it should add another 4 alert for the same mob and then begin its tracking loop, instead it stays hung right at the first instance of the tenth alert.
/afk

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Fri Sep 26, 2003 12:59 am

In the code, as is, only runs through the for loop that reads the ini file 10 times. This will cause 2 problems. The macro stores the number of alerts in a(0,0) once it gets NOTFOUND trying to read the next entry. If there is 10 or more this will never happen and it will move on without adding the number of alerts. The other thing that will happen is the next for loop, which uses that index at a(0,0) will have problems. It looks like you can just up the for loop to a larger number.

Change the red to

Code: Select all

/for v3 1 to 100
In this:

Code: Select all

Sub AlertSetup
   |** Clear Alerts **|
   /varset v1 "$zone"
   /for v3 1 to 100
      /varset a(0,$v3) 0 |Clear NPC name listing
      /varset a(1,$v3) 0 |Clear Alert Status listing
      /varset a(2,$v3) 0 |Clear Info Listing
   /next v3

   |** Get Alerts from alert.ini **|
   [color=red]/for v3 1 to 10[/color]
      /if "$ini("INIPATH","$zone","$v3")"=="NOTFOUND" {
         /varset a(0,0) $int($calc($v3-1))
         /goto :FoundItems
      } else {
         /varset a(0,$v3) "$ini("INIPATH","$zone","$v3")"
      }
   /next v3

   :FoundItems
      |** Set Alerts **|
      /if $a(0,0)==0 {
         /echo No NPC alerts set for $zone.
         /goto :FinishedInfo
      } else { 
Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack