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

resource management macro

Hello, SO I am running a home brew and one of my players has created an arcane warrior of sorts that uses Arcane Points for his attacks. I have the macro working to add or subtract points depending on which skill he uses, the problem I am having is the macro exceeding the max value of the resource, arcane points in this instance. How would I go about stopping it from adding 1 to the value if its already at the max allowed? !setattr --charid @{Dekkar|character_id} --mod --Arcane points|-1 {Arcane points}
1552163868
The Aaron
Roll20 Production Team
API Scripter
You could specify the value with an inline roll like this: !setattr --charid @{Dekkar|character_id} --mod --Arcane points|[[ {@{Arcane points}+1,@{Arcane points|max}}kl1} ]] {Arcane points} I'm not sure of the precise syntax for the script, but that should illustrate the idea.
The Aaron said: You could specify the value with an inline roll like this: !setattr --charid @{Dekkar|character_id} --mod --Arcane points|[[ {@{Arcane points}+1,@{Arcane points|max}}kl1} ]] {Arcane points} I'm not sure of the precise syntax for the script, but that should illustrate the idea. this is increasing the value by 4 each click. My macro is working for the adding and subtraction. I just need it to limit the addition to a max of 4 and not drop below zero
1552167730
The Aaron
Roll20 Production Team
API Scripter
Yeah, sorry, I don't know that script well.  There might be a built in way to handle it, but try this: !setattr --charid @{Dekkar|character_id} --set --Arcane points|[[ {@{Arcane points}+1,0}kh1} ]] {Arcane points}
1552209186
GiGs
Pro
Sheet Author
API Scripter
If you ask this question in the ChatSetAttr thread , Jakob will see it and you should get an answer.