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

Sure we have an Ammo API but what about Spell Components? Gold? Experience?

It would be nice to set up spell components like ammo and allow the player to expend them when they cast spells. Also it would be handy to have an easy way to subtract or add money and experience to a player by just typing quick command or having a macro button you can pop up that gives you an easy menu. Sure I could make it work myself but I'm not super good at all of that coding.
1533053567

Edited 1533053623
Pantoufle
Pro
Sheet Author
Translator
Hello! Some API for gold and experience already exist... check the api forum (easy experience, lazy experience, cashmaster...) :)
This would be better in the API forum rather than the Suggestion forums.
1533067137
Gen Kitty
Forum Champion
This is not a Suggestions-worthy thread, as API is largely done by your fellow Roll20 members.  Moving this thread to API to release the vote.
1533067813
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Red C. said: It would be nice to set up spell components like ammo and allow the player to expend them when they cast spells. Also it would be handy to have an easy way to subtract or add money and experience to a player by just typing quick command or having a macro button you can pop up that gives you an easy menu. Sure I could make it work myself but I'm not super good at all of that coding. So, as Pantoufle says a lot of these exist as dedicated scripts. The ammo scripts (like Aaron's !ammo) don't have to be used for ammo, they can be used for affecting the numerical value of any attribute. And then you have the grandmaster attribute modification script, Jakob's chatSetAttr which can do anything to any attribute.
I did look through the API and I didn't see anything that really stood out. I'm really super not tech savvy so when names and things are unclear or named weird its hard for me to know what they're about. Thanks for the recommendations though it helps a lot!
1533124380

Edited 1533124444
GM Michael
API Scripter
You could do the gold part with CashMaster using the dropWithReason command, though it wouldn't disallow the casting if you didn't have enough...
Heck even ChatSetAttr would be able to handle each of these individual requests.
I'll echo what Kyle said, ChatSetAttr can do everything you've just asked.  As long as said amount/pool/whatever is defined, somewhere as attribute, it can handle it. Examples (used in macros): Decrements a spell slot every time the macro is fired to cast the spell. !setattr --charid @{selected|character_id} --modb --lvl1_slots_expended|-1 --silent Decrements ammo whenever the weapon macro is fired to perform an attack. !setattr --charid @{selected|character_id} --modb --other_resource|-1 --silent   (your ammo location/field may be different) I do the same thing for Lay On Hands healing pools, Divine Sense uses, etc.  You just have to define an attribute to hold the min/max value. No need to have a dedicated API script for each little thing you want to do if, in the end, its just adding to or taking away from a pool or collection of items.  Of course, if you're wanting to do more than just adding and subtracting from a pool, then yes, you'll want something a little more robust.
Thank you this is super helpful! I really appreciate this guys thanks! Craig L. said: I'll echo what Kyle said, ChatSetAttr can do everything you've just asked.  As long as said amount/pool/whatever is defined, somewhere as attribute, it can handle it. Examples (used in macros): Decrements a spell slot every time the macro is fired to cast the spell. !setattr --charid @{selected|character_id} --modb --lvl1_slots_expended|-1 --silent Decrements ammo whenever the weapon macro is fired to perform an attack. !setattr --charid @{selected|character_id} --modb --other_resource|-1 --silent   (your ammo location/field may be different) I do the same thing for Lay On Hands healing pools, Divine Sense uses, etc.  You just have to define an attribute to hold the min/max value. No need to have a dedicated API script for each little thing you want to do if, in the end, its just adding to or taking away from a pool or collection of items.  Of course, if you're wanting to do more than just adding and subtracting from a pool, then yes, you'll want something a little more robust.