Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Question about global token macros versus abilities?

1471848640
Doc
Marketplace Creator
Sorry if this is somewhere else, I looked but didn't find anything. So I had a set of macros that looked like this: /me Attacks @{target|token_name} for: [[1d10! + @{Attack}]] %{target|defend} These worked fine as abilities, but then instantly went to crap when I loaded them as token macros from settings. This is day one macro building for me, so I got no clue what I should be doing differently. Thanks in advance for the help (I hope)!
1471850026

Edited 1471850139
Jakob
Sheet Author
API Scripter
When they're not abilities, the macro doesn't know where to pull the attack from. Replace @{Attack} with @{selected|Attack} to take the selected character's attack. To be clear, in character sheet macros or abilities, you're automatically in the character's namespace (to take a programming term), so any @{attribute} automatically refers to @{character_name|attribute}. That does not happen for global macros.
1471850457
Doc
Marketplace Creator
Man you rock! ...and the follow up problem, lol: so the macro chain goes like this: attack: /me Attacks @{target|token_name} for: [[1d10! + @{selected|Attack}]] %{target|defend} Which then triggers: /as "@{target|token_name}"Defends against @{selected|token_name} with: [[1d10! +@{target|Defend}]] While the first part now works, the dice roll on the defend is busted. Any thoughts?
1471850628
Doc
Marketplace Creator
Pretty sure I'm doing something wrong with:  [[1d10! +@{target|Defend}]] in that second macro.
1471850657

Edited 1471850790
vÍnce
Pro
Sheet Author
Try removing the " ! "  I believe that is only used to call an API script. edit: exploding dice...  does that work inside an inline...?
Doc said: Pretty sure I'm doing something wrong with:  [[1d10! +@{target|Defend}]] in that second macro. The Exploding Dice shouldn't be an issue. What do you get when you enter @{target|Defend} into the Text Chat?
1471851196
Doc
Marketplace Creator
So @{target|Defend} by itself works fine. I think the issue I'm running into is I have a targeting macro that calls on another targeting macro. This is done that way so the rolls appear separate in the chat.
1471851442
Doc
Marketplace Creator
When I start from the attack macro, it pops up fine, but then returns:  test blitzer: test blitzer2|defend instead of the roll. When I use the second macro alone, it asks for a target and rolls fine. Ultimately what I intended, and what was working before gave me this: test blitzer Attacks Copy of test blitzer for: 7 Copy of test blitzer: Rolls Defend2
1471852839

Edited 1471852978
Doc said: I think the issue I'm running into is I have a targeting macro that calls on another targeting macro. Could you post the text/code of the latter 'targeting macro'? (i.e. what is the Current value of the 'defend' Attribute?) This is done that way so the rolls appear separate in the chat. It sounds like you're attempting to split one inline roll ([[1d10! +@{target|Defend}]]) into multiple inline rolls using @{target|Defend}. Inline rolls are very particular about their contents; if @{target|Defend} does not resolve to a number (or a valid expression ), chances are it will break inline rolls (as it seems to currently be doing).
1471853421
Doc
Marketplace Creator
Attack-target macro: /me Attacks @{target|token_name} for: [[1d10! + @{selected|Attack}]] %{target|defend} Attack macro: /me Rolls Attack [[1d10! + @{selected|Attack}]] Defend macro: /as "@{target|token_name}"Defends against @{selected|token_name} with: [[1d10! +@{target|Defend}]] Attributes used, and their values: Attack 4/4 Defend 6/6 You are totally correct, I'm wanting to resolve the attack and defend roll with one macro click. This did work flawlessly before, when they were set as abilities. Thanks again for all the help on this!
Could you double-check that all of the Tokens you're been targeting during your tests Represent a Character? I don't see anything that should be an issue with those Macros/Attributes.
1471855007
Doc
Marketplace Creator
Check. Each is attached to test blitzer and test blitzer 2 respectively. worst comes to worst I can just reattach the macros as abilities. The reality is this is for a module I'm hoping to sell in the marketplace, as a closed module. So if I end up reverting it won't be the biggest deal. 
If you'd like, PM me the join link to your game and I can take a look.
1471892299
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Just noticed something about your macros above. Are you planning on having players use these macros? "/as" only works for the gm, so that macro will probably fail when a player tries it, if these are for the GM only, then that is of course not an issue.
1471940254
Doc
Marketplace Creator
That makes sense now that I played with it, thanks Scott! off to workaround land :)