creating macros with a macro

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: creating macros with a macro

Post by wolph42 »

this is aliasmasks cup of t. However I havent' seen him here for a while, usually he's quite active though.
The only way I can help you with is suggesting an entirely different approach, with the use of a virtual menu...: http://forums.rptools.net/viewtopic.php?f=8&t=16304

TheyCallMeTomu
Kobold
Posts: 13
Joined: Thu Aug 04, 2011 3:11 pm

Re: creating macros with a macro

Post by TheyCallMeTomu »

Thanks, though I don't think that works for what I'm trying to do.

I mean, there are a few workaround ideas for what I'm trying to do, so I'll just try one of those.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: creating macros with a macro

Post by aliasmask »

TheyCallMeTomu wrote:Urghlefurgle.

I hate necroing old threads, but I couldn't find any other references on the forums after a search, so try not to burn the witch for thread necromancy. Anyway:

So I appear to be having the opposite problem; I'm not having issues creating macros with a macro, but I'm having difficulty modifying a property of a macro that already exists.

Relevant code:

Code: Select all

[h:setMacroProps(getMacroButtonIndex(),"sortBy=XDaily")]
[h:setMacroProps(getMacroButtonIndex()+1,"applyToSelected=true;")]
[h:setMacroProps(getMacroButtonIndex()+1,"sortBy=XDaily")]

[h:setMacroCommand(getMacroButtonIndex()+1,'

[getMacroProps(getMacroButtonIndex())]

')]
Everything works EXCEPT the applyToSelected part. I've tried it with "applyToSelected=1" with "applyToSelected=true", "applyToSelected=true;" ... am I doing something wrong here or what? I've hit a number of "OH! That's what's wro-" moments that immediately turn into "well that doesn't help at all."
As a test, I dropped a token on to the map and renamed it test. I then impersonated the token by right clicking and selecting Impersonate. In the chat I typed:

Code: Select all

[setMacroProps("test","applyToSelected=1")]
I verified on the token that it worked and it did. I used "true" and it also worked. Your problem may lie somewhere else like "getMacroButtonIndex()+1" which doesn't guarantee that it exists.

TheyCallMeTomu
Kobold
Posts: 13
Joined: Thu Aug 04, 2011 3:11 pm

Re: creating macros with a macro

Post by TheyCallMeTomu »

It works for other things though. I'm able to successfully set the command of getMacroButtonIndex()+1.

What I'm doing is I'm creating a series of "Spell Slot" macros, each of which will call on a library macro based on either the name of the spell slot macro, or an input. The called macro then affects an adjacent macro (that I explicitly created in sequential order, just to make sure that the indexes line up) to set the command so that any state toggles or secondary attacks can be utilized.

Unfortunately, the apply to selected aspect doesn't seem to work, so instead I've gone for a workaround that involves the primary spell slot macros ALWAYS being unchecked whereas the secondaries are always checked, and using the button color in order to determine which macro to run (the primary or the secondary, with the adjacent macros just being state toggles).

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: creating macros with a macro

Post by aliasmask »

The macro index is not a static number and can change for several reasons. So, even if its index is 1 more than another macro at one time, it could change. That's why you should either use the name on the macro or get the index value.

TheyCallMeTomu
Kobold
Posts: 13
Joined: Thu Aug 04, 2011 3:11 pm

Re: creating macros with a macro

Post by TheyCallMeTomu »

Not an option; the exercise is designed such that I can call on macros on the basis of the button names.

What exactly would cause the index numbers to change, for any given token?

Basically, my set up is like this:

Level 17 slot, Level 17 Slot Secondary, Level 23 slot, Level 23 slot secondary.

I want both the Level 17 slot button and the Level 23 slot button, each of which can have names that change on a regular basis, to be able to call on the same set of different library macros. The library macro will change the name of the secondary buttons (along with the names of the slot buttons), but the same macro has to be able to be used by each of the three slots, so I have to have notation for the secondary slot that's relative (ala getMacroButtonIndex()+1).

Post Reply

Return to “Macros”