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

Bardic Inspiration - Macro Troubleshoot / Tidy Up

Hi All, Just looking for some help to tidy up a Bardic Inspiration macro. I currently have a macro which, when used, will deduct 1 from a class resource: !modbattr --silent --sel --class_resource|-1 !token-mod --set statusmarkers|BARD-png /em Buster &{template:atk} {{desc=**Uses Bardic Inspiration** }} This allows the Bard to track his usage between rests and works well. The only problem is he is not able to select a character and cast it on them, and it puts the BARD symbol on his character. So I dug a little deeper (read: scrounged forum for macro) and came up with this: !modbattr --silent --sel --class_resource|-1 !token-mod --set statusmarkers|BARD-png --ids @{target|token_id} /em Buster &{template:atk} {{desc=**Uses Bardic Inspiration** on @{target|token_name} }} This macro allows the Bard to select a character token and run the macro. It will place the BARD symbol on the selected character and post the message however it does not track usage and generates an error message: (From ChatSetAttr): Errors No target characters. You need to supply one of --all, --allgm, --sel, --allplayers, --charid, or --name. I'm guessing it's an error somewhere around distinguishing between the caster and the target. (my knowledge on such stuff is extremely limited!). Is it possible to combine these two macros in a way that both functions are completed?
1603875857
Ziechael
Forum Champion
Sheet Author
API Scripter
Using the @{target.... syntax deselects the original token sadly... since the messages are sent and processed at the same time there is no real way to order the API calls ahead of the deselection (that I know of... I'm sure GiGs or Oosh will be along shortly with a mind blowing alternative!). Feels like this should be doable without too many workarounds that add complexity or effort but it's too early in the AM for me right now... will have a play around later and see what I can come up with :/
Thanks Ziechael, I have tidied and set them up as separate macros for our Bard, who is quite happy with the result. It would be nice though to be able to have it in one macro.
1603888258

Edited 1603888412
Oosh
Sheet Author
API Scripter
Ziechael said: I'm sure GiGs or Oosh will be along shortly with a mind blowing alternative! Sadly, my solution is painfully simple and not worthy of an epic Bard poem. Just use @{target|character_id} on the Bard to grab their character_id, and use --charid for the chatSetAttr line instead of the --sel argument. Also makes it easier for the Bard, so they can run the macro without having to make sure their token is selected. There's no real need for this kind of macro to be universal. You could also use their name, but --charid will keep working if they decide to change their character name. It's also a good idea to use tags with @{target} calls. The word doesn't matter, but it'll mean you only need one click instead of two - also worth remembering that @{target|hp|max} will not work - you must supply a tag when calling |max Attributes with this syntax. Like so (obviously the char_id here needs to be changed): !modbattr --silent --charid -MKICBc9807weqoHXW --class_resource|-1 !token-mod --set statusmarkers|BARD-png --ids @{target|ally|token_id} /em Buster &{template:atk} {{desc=**Uses Bardic Inspiration** on @{target|ally|token_name}}}
1603891912
The Aaron
Roll20 Production Team
API Scripter
You can use @{selected|character_id} to get the bard's character ID instead of hard coding it.  The @{selected|...} will still work when you use @{target|...}.
Excellent! Thanks all - works a treat. Appreciate the help. Thanks also for the tip re: tags. Will keep it in mind in the future.
1603971152
Oosh
Sheet Author
API Scripter
The Aaron said: You can use @{selected|character_id} to get the bard's character ID instead of hard coding it.  The @{selected|...} will still work when you use @{target|...}. Ah, of course. Sneaky order of operations...