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 Request: Add/remove Macros from macro bar/token bar.

1416336022

Edited 1416336182
Ok, so I have no idea if this is even possible since the API doesn't allow for deletion of obects but I would really love a way to have characters equip their weapons and have that determine which macros appear in their bar. I run shadowrun 5E so it'd be nice to be able to let players choose between fire modes instead of just [shoot automatics] and tie it into The Aaron's ammo manager. SR 5E uses limits for success tests based on a weapons accuracy, i usually just set the damage and accuracy with variables because they tend to change weapons and ammo types a lot. It would also be really nice for when my hackers switch over to hacking so that their bar isn't cluttered with macros for combat and hacking. This combo would also allow me to actively change their Matrix attributes on the fly rather than manual set the limits for each roll with a variable(though that's not really a big deal to me.) Any ideas?
1416338502
The Aaron
Roll20 Production Team
API Scripter
You can certainly create macros (and abilities) with the API, and more importantly to your case, you can change whether or not they are displayed. My UsePower script turns off DnD4e Daily and Encounter powers automatically. If I understand correctly, what you want is mechanically similar. Let me see if I've got it: You want an API script that will monitor whatever attribute the ShadowRun character sheet uses to track equipped gear, and find (or create) the associated character ability (i.e. token macro) and turn off/on whether it is displayed when the token is highlighted. Sound about right?
1416366332

Edited 1416366356
Almost exactly, but i also want to be able to change current or primary equipment with a command so that i could say: have a hacker equip a gun (and remove the hacking macros) or a have the hacker equip his Deck and not only have the macros change but change his initiative dice to match going into VR mode. Have a mage switch from weapons to spell listings in their macro bar, etc. I could also use it to change the macros for someone entering astral space since all of their physical abilities become useless. I hope that's clear enough(and also not a repeat of what you just said but jumbled up).
1416368705
The Aaron
Roll20 Production Team
API Scripter
:). So I think all the technical parts of what you want are possible. It would come down to enumerating the trigger cases for each, and coming up with a reasonable way of configuring. The UsePower script I mentioned has you run a command to list abilities on a character, then run it again with additional parameters telling it which type of power each is. For something like your are talking about, is probably use a similar technique to define named groups of powers, then use other commands to tie showing those powers to a particular trigger event. It's definitely possible, but not something I want to tackle right now. (Way behind on commitments as it is! :/ ). I'm happy to help if you want to work on it though. :)
Don't sweat it. I've got a few ideas but i need to dig more into how some other scripts work before i try and monkey with them. I only know how to make macros and that i learned about a week ago so it's gonna be a minute before i have anything conclusive. I'll take any help your willing to offer though. :)
1416370421
The Aaron
Roll20 Production Team
API Scripter
If you want to get into API coding, I highly recommend Javascript: the Good Parts by Douglas Crockford . It's an easy read and does a great job of paring the language down to a very clean function core.
Reading it now.
1416403406
The Aaron
Roll20 Production Team
API Scripter
Great! :)