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

Is there a way to change attributes with a Macro value?

December 09 (11 years ago)

Edited December 21 (11 years ago)
Is there a way to change attributes with a Macro value? Right now i have a attributes that keep track of the ammo my gun holds. I think it would be great if when i used my macro to attack it also changed my ammo attribute so I don't have to do it by hand.
December 09 (11 years ago)
Gauss
Forum Champion
No, you cannot currently change attributes using a macro.
December 10 (11 years ago)
thank you
December 10 (11 years ago)

Edited December 10 (11 years ago)
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
With API you could.

In fact... it would tell you when you are out of bullets and not fire or if ammo was getting low... could also do "three round bursts."
December 10 (11 years ago)
How would one do that with the API?
December 20 (11 years ago)
This would be great functionality for the suggestion forum. I'm finding the new macro functionality in Rugged Reroll to be great and would love to be able to set token attribute values in a macro without needing to use an API.
December 21 (11 years ago)
Sam
Pro
Sheet Author
I've seen this question come up at least 10 separate times now. That's including instances in the suggestion forms. I feel like I should write a suggestion post that links to all of them to show the support for this idea.
December 21 (11 years ago)
The problem I see with that, is that it's too vague. Tons of systems, and adding human errors (bad macro, double clicking) is A LOT of extra resources. It makes more sense to do it via API and keep it GM specific.
December 21 (11 years ago)
Sam
Pro
Sheet Author
How does it have anything to do with the game system being used? Just like macros, the underlying question would be game system agnostic. What we're asking is the ability to set the value stored in an attribute through a macro. That's all.

Example: The tracker somewhat does this already. If you type /r 1d20 &{tracker} it will set the value of your token's turn in the turn order. If you type /r 1d20 &{tracker:+} then it will instead add the result of the roll to your current turn value.

What we're asking is simply having the ability a macro to target an ability and then set the value. One possible example of this syntax could be &{selected|Ammo:24} or &{selected|Ammo:@{selected|Ammo} - 1} or even change it so the at sign could have a dual purpose: @{selected|Ammo:@{selected|Ammo} - 1}. In short, order of operations apply here.

  1. Script encounters a colon in the attribute call.
  2. Get everything after the colon to the ending brace.
  3. Script finds @{selected|Ammo} - 1 and attempts to evaluate it.
  4. Script fails to find a colon in the attribute reference call so the script pulls the attribute value which happens to be 24.
  5. Performing a replace operation our expression is now 24 - 1. Which evaluates to 23.
  6. Script has now finished evaluating all mathematical expressions.
  7. Script now stores the new value in @{selected|Ammo} overwriting the previous.

Once again, it is system agnostic. You say that this adds more human errors? It can have no more harm than a poorly written macro. This really isn't all that different from what already is available. If the developers allowed contributions I would go in there right now and implement it. I'm quite serious about that that by the way, Riley :).
December 21 (11 years ago)
This is my second day with the system and this is the thing I was looking to do. It was cool to find this on the forum discussion so quickly. I shall wait patiently for this change to come to pass. :)
December 22 (11 years ago)
Tom
Plus
Sheet Author
I know macros can access the data in a tokens radial bar. Can they change that data?
December 22 (11 years ago)
No.
December 23 (11 years ago)
I personally did not understand why I could not use the same syntax as I do to input my initiative into the tracker to change an attribute.

[[d20+@{Bonus} &{tracker}]] which adds my result to the tracker
[[d6+@{Damage_Bonus} &{target|target|bar1:-}]] which totals my damage and applies it to the target

My Xmas wishlist for Roll20 is an If/Else for Hit/Miss, Success/Fail (I can live without Else if), blind @{target} calls (so the value of GM mobs only goes to GMs), and Macro attribute modification (to place damage on mobs).

Then I could automate combat rolls and go straight to the flavor!
December 23 (11 years ago)
I wouldn't even ask that Russell, I'd just ask that it returns a 0-1 boolean to >'s and <'s.... Being a mentor and being able to mess with the values through API are great, I can make those things works easily, and concerning OP, make them affect the original stats/bars for a character. What I'd love is for a macro to be able to assess those same attributes (even if it's through a common medium, such as AC where most systems utilize it) to affect the actual handouts and bars.
December 24 (11 years ago)

Edited December 24 (11 years ago)
I've been trying to change token attribute and token bar values all day. Thought I was just bad at coding the macros, and then this thread.
January 05 (11 years ago)
+1