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

[Script] Simple Set Attribute to Value.

1388684459

Edited 1393001512
This is really my first API script. It takes the selected token(s) and sets the defined attribute to the defined value. If the token does not have an associated character, or if the attribute does not exist, it spits out an error. Simple and efficient. Working for me! I used to have a version of this that would create the attribute if it did not exist, but it was very buggy and I moved on to another script. It now spits out an error if it does not exist. To call the script, put this in chat: !attrib [attribute name]|[new attribute value] For example: !attrib hp|17 <a href="https://gist.github.com/sturtus/8222956" rel="nofollow">https://gist.github.com/sturtus/8222956</a>
Looks good.
Thanks. Turns out Honey badger DOES give a sh*t.
Nah, if I gave a shit... I'd point out where you made mistakes or how you could make it better. :D
Why is it when I plug in the gist code again, with revisions made, it copies only the 1st version?
Something about cacheing... I dunno. That's why I don't use gist and just post directly on the forums.
Well, for anybody interested, follow the gist link to the code and it's been updated as a function in case of calling from other scripts.
This looks like a great script. What is the format for the input string to set the attribute? Every time I select a token and call !attrib I get a " ReferenceError: getCharacterObj is not defined " error.
1392876437
Lithl
Pro
Sheet Author
API Scripter
HoneyBadger said: Something about cacheing... I dunno. That's why I don't use gist and just post directly on the forums. I make wiki pages under my userpage. :D
Brian said: HoneyBadger said: Something about cacheing... I dunno. That's why I don't use gist and just post directly on the forums. I make wiki pages under my userpage. :D I like the crit macro on your wiki! Still not sure what I'm doing wrong with this macro though. A use case would be helpful to see a sample input that produces something without the error.
This looks really useful, but API is greek to me. How do you call the script? Ie what would I type in my chat box to change an attribute, say HP, by subtracting 3?
Hey guys. I will update ASAP. I started a library of functions that I call from all of my scripts, and I never updated the description at the top of this forum posting. I will include a link to that library, do some cleaning up, and post an update today.
On second thought, I will simply include the function in my gist. updating now.
Ok, it's been updated. Instructions are in the original post. If the gist has not replicated to this forum, please visit the gist link for the latest version. Thanks for checking it out.
Works beautifully now. Thanks for the update!