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

change in character attribute triggers macro

Hey all- I'm looking for a script that will automatically trigger a macro when a character attribute changes. This is for my Conan 2d20 game. I do have a PRO account and i created a special FX macro that will generate blood splatter from a token combined with a painful grunt sound effect (using audio master). There is an attribute for "wounds", which I have assigned to one of the token bars. I want to make it so that if that attribute is changed to "1" or higher, it automatically triggers the FX macro.
1551472977
Jakob
Sheet Author
API Scripter
Please don't spread misinformation, Ammo. Of course API scripts can react to attribute changes as well as token changes. They can react to other stuff as well, like chat messages.
deleted my post
Also, could you please provide a reference to what on(...) event handler the OP would use to do what they wanted to do directly off of an attribute value change?   That would be a better response to my post, which did contain a reference to a solution.    And for the record, I did not say they could not handle chat events.
1551482622
The Aaron
Roll20 Production Team
API Scripter
Events are detailed here:&nbsp; <a href="https://wiki.roll20.net/API:Events" rel="nofollow">https://wiki.roll20.net/API:Events</a> It’s a little hard to follow, but basically any type of object from here:&nbsp; <a href="https://wiki.roll20.net/API:Objects" rel="nofollow">https://wiki.roll20.net/API:Objects</a> can be observed for any of the events: “add”, “change”, and “destroy”. You can further specify which property changed, for example:&nbsp; on("change:attribute:current", someFunction); (in the rare case where you’re observing one that starts with an _, you must specify the _)
I'm much better at "reverse engineering" scripts than I am at building them. Is there one that does something similar to what I'm seeking to do that I should take a look at?
And also, if I could whip something up that accomplishes the same thing by changing 'bar1' as opposed to the attribute, directly, that would work as well.
1551527947
The Aaron
Roll20 Production Team
API Scripter
Look at OnMyTurn it triggers an Ability when a character’s Token’s turn comes up in the turn order: &nbsp; <a href="https://app.roll20.net/forum/post/6608405/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6608405/slug%7D</a>
The Aaron said: Look at OnMyTurn it triggers an Ability when a character’s Token’s turn comes up in the turn order: &nbsp; <a href="https://app.roll20.net/forum/post/6608405/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6608405/slug%7D</a> Thanks!