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

Need Help Designing an API for my system

So I run the Star Wars Saga Edition quite frequently. I am somewhat  familiar with scripting and JS specifically, but I have trouble starting a file. I can modify existing scripts decently, but I don't know where to start with this one. The Problem:  I need a better way to keep track of a character's Force Power Suite.  The Specifics: Per the rules of the game, a character has a set number of uses of each power per encounter, not per day like spells in DnD. The powers chosen and the amount of uses vary based on Ability Score and Feats, and will change, obviously, as the character levels. I need a way to keep track of the suite and when the macro is run for the power it takes the power from the suite. Powers return to the suite quite frequently, even in the encounter, so resetting the suite and buying back specific powers needs to be an easy thing.  My thoughts: I have a basic understanding of how this would need to be written, but not really an understanding of how to start. I haven't started with my own writing of it, but I'm fixing to. As I flesh it out I will post what I have, and I'd appreciate help refining it.  How I'd Like it to Work in the End: Jumi, a Level 1 Jedi, has the following force suite:  Move Object      x1 Mind Trick        x1 Force Slam     x2 She has a macro set up for each power, plus a macro to output her entire Suite, a macro to reset her entire suite, and a macro to buy back in individual use of a power.  On her first turn, she uses Move Object. The macro ends with !fsuite move_object -1 and one use of that power is removed leaving 0. On her second turn she uses Force Slam. One use is removed, leaving 1.  On her third turn she checks her suite, showing she only has one use of Mind Trick and one use of Force Slam. She needs to move something, so she spends a Force Point to regain one use of Move Object. It adds back to her suite. She uses it and rolls a Nat 20 on her Use The Force skill check. Per the system, this means she gets all  of her uses back, so she resets her suite completely.  Last turn she uses Force Slam, and the battle ends after that, so she resets again, for the next encounter.  Later On She has now reached Level 3 and gets more powers to her Suite. She needs to modify her suite to add more uses of different powers.  If anyone can help, I'd appreciate it.  
1593739754
GiGs
Pro
Sheet Author
API Scripter
Is this just for keeping track of how many uses of each power? If so, you could use the ammo or chatsetAttrs scripts for that.  Assuming each power has an attribute with a current and maximum value, you'd have a macro which lets them select which power to use, and would then reduce the reserve by 1. Each character could have a reset macro, which resets each power to its max. Finally you could have a macro which whispers to chat the current values of each pool. That part wouldnt require a script at all.
....... Yup.  I forgot the Ammo Script called various types of ammo that are unique.