Calling macros from hotkeys

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

Moderator: MacroQuest Developers

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Calling macros from hotkeys

Post by Cr4zyb4rd » Sat Jul 31, 2004 1:30 am

I'm trying to do something like this...

Code: Select all

/custombind set MacroAndStuff /multiline ; /if (!${Macro.Name.Equal[mymacro.mac]}) /macro mymacro ; /otherstuff
So that if I use the keybind, my macro is called only if it's not already running (I don't want to lose state information, or do the startup overhead again) but when called like this ${Macro} seems to always return NULL. The ${Macro} variable works fine when echoed or referenced in my HUD.ini, so I guess it has something to do with how binds work, or with multiline (I guess I could test multiline..hadn't thought of it until just now)

At any rate is there another/better way to do this? I tried some forum searching but didn't find anything too enlightening.

dok
a ghoul
a ghoul
Posts: 127
Joined: Mon Mar 15, 2004 3:38 pm

Post by dok » Sat Jul 31, 2004 1:52 am

well, you could always try setting a global var (not outer) in your macro and checking if thats set with command.

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Sat Jul 31, 2004 4:33 am

This occured to me, but I can't think of a way to do it that's not unwieldy, since the variables exist even after the macro exits. I'd have to do

Code: Select all

/varset MyMacroName whatever.mac

at the top of each macro, along with an if ($Defined...) if I didn't want to do the /declare elsewhere, and seems to defeat the whole purpose of having the ${Macro} variable in the first place. If I'm going to go that route, I'd much rather just make everything into a monolithic super-macro and control it with hotkeys to /varset or event triggers. I'm considering doing this anyway, but it would make my code that much harder to share with others.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Sat Jul 31, 2004 9:05 am

Why not just put this in a hotkey:

Code: Select all

/if (!${Macro.Name.Equal[mymacro.mac]}) /macro mymacro
Seems like it should work well enough like that, or am I missing something?

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Sat Jul 31, 2004 12:15 pm

If it worked, would I have posted asking why it doesn't work? /boggle

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sat Jul 31, 2004 3:48 pm

I'm guessing because it has the period in there. Just a guess.