isnt there an easier way for params?

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

Moderator: MacroQuest Developers

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

isnt there an easier way for params?

Post by loadingpleasewait » Tue May 18, 2004 10:15 am

isnt there an easier/smarter way to do the toggle parameters of a macro?

I have my auto archery macro that does all sortsa stuff that are toggled via parameters when starting the macro. but the code is messy, it works, but ya gotta enter the params in a specified order and stuff.. I know theres got to be an easier way.. can you help?

Code: Select all

/if (${Defined[Param0]} && ${String[${Param0}].Equal[snare]}) { 
   /echo "Auto-Snare enabled" 
   /varset snaretoggle 1
   /varset needsnare 1
   } 
/if (${Defined[Param0]} && ${String[${Param0}].Equal[taunt]}) { 
   /echo "Auto-Taunt enabled" 
   /varset taunttoggle 1
   } 
/if (${Defined[Param1]} && ${String[${Param1}].Equal[taunt]}) { 
   /echo "Auto-Taunt enabled" 
   /varset taunttoggle 1
   } 
/if (${Defined[Param0]} && ${String[${Param0}].Equal[forage]}) { 
   /echo "Auto-Forage enabled" 
   /varset foragetoggle 1
   } 
/if (${Defined[Param1]} && ${String[${Param1}].Equal[forage]}) { 
   /echo "Auto-Forage enabled" 
   /varset foragetoggle 1
   } 
/if (${Defined[Param2]} && ${String[${Param2}].Equal[forage]}) { 
   /echo "Auto-Forage enabled" 
   /varset foragetoggle 1
   } 
thats how I have it set up now, but its bulky..
LOADING PLEASE WAIT...

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

Post by dman » Tue May 18, 2004 10:36 am

While untested I think this is closer to what you are looking for, benefits include not having to have a specifc order as well and easier to add in new commands.

Code: Select all

/declare i int local
/for i 0 to 2
  /if (${Defined[Param${i}]}) {
     /if (${Param${i}.Equal[snare]}) {
         /echo "Auto-Snare enabled" 
         /varset snaretoggle 1 
         /varset needsnare 1 
         }
      /if (${Param${i}.Equal[taunt]}) {
         /echo "Auto-Taunt enabled" 
         /varset taunttoggle 1 
         }
      /if (${Param${i}.Equal[forage]}) {
         /echo "Auto-Forage enabled" 
         /varset foragetoggle 1 
         }
   }
/next i

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Tue May 18, 2004 11:05 am

Exactly what I was looking for, tested it, and it works = ) thanks so very much!
LOADING PLEASE WAIT...

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Tue May 18, 2004 2:51 pm

You can also use ${Macro.Params} (gives you the # of parameters passed) in your /for instead of using the ${Defined} thing
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0