Changing variables on the fly?

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Diazepam
a lesser mummy
a lesser mummy
Posts: 31
Joined: Thu Mar 11, 2004 6:26 pm

Changing variables on the fly?

Post by Diazepam » Thu Jun 03, 2004 11:28 am

I don't have EQ handy atm, so I can't test this myself right now. I'm hoping one of you knows this off the top of your head.

I have a brain-dead cleric alt that I want to be part of a CH chain. Here's the code I have for the CH part now:

Code: Select all

#include SpellCast.inc 

Sub Main 
   /declare CastTime int outer
   /varset CastTime 126
   /echo Starting CH chain
   :HealLoop
   /call cast "Complete Heal" 
   /delay CastTime
   /goto :HealLoop 
/return
Real simple. At some point, though, I want to change CastTime in the script above (pushing it out to 160 or 180). If I created a hotkey that just had:

Code: Select all

/varset CastTime 160
...would hitting that hotkey while this macro was running change CastTime appropriately?

If not, can you think of easy ways to change a variable like this while the macro is running?

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Thu Jun 03, 2004 11:53 am

That would work yes, although, in your code it should be.

Code: Select all

/delay ${CastTime}
You could also set up an event that looks for echoes to screen and use those to change the variable.

s16z
a ghoul
a ghoul
Posts: 97
Joined: Thu Apr 01, 2004 12:03 pm

Post by s16z » Thu Jun 03, 2004 12:42 pm

Actually, if scoping is done right, it will not work. Change the declare to

Code: Select all

/declare CastTime int global
Of course you should also get rid of CastTime as a delcared variable sometime or MQ will complain.

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Thu Jun 03, 2004 1:02 pm

The variable does not have to be global to change it while the macro is running.....