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

Can what I want be done using the API?

I've been getting to know Roll20 for a few months now and I'm planning on using it as an aid for table top games once things are back to normal, more than for running ones online.  I've been trying out the different system my group tends to use and working out the necessary macros, in a few intances I've come across the problem that what I want it to do, can't be done using macros, so I'm now looking towards the API.  However I have no knowledge of computer programming, so before I upgrade to a Pro account and sign up with CodeAcademy to learn JavaScript I wanted to make sure that what I was trying to do could be done through the API. The first issue was writing to token bars.  I was planning on using the token bars to represent Hit Points, Temporary Hit Points and Healing Surges in D&D 4th edition, when a power gives the caster or an ally temporary hit points is it possible for it to be automated, could a similar script also be used to apply damage to hit points and reduction in healing surges when they are used. The second one i have come across is with systems that use a Trait + Skill dice roll, where any trait can be combined with any skill, such as the old Whitewolf Vampire system.  In Vampire there are 9 traits and over 30 skills so that is a lot of macros to write to do all the possibilities.  The obvious option for me was to write a macro that asked for the trait and then for the skill and then rolled that number of dice, but it appears that a query can't pull the information from the character sheet that way.  The only way to do it at the moment, is to do the macro with a dice pool query and then work out the dice pool manually by opening up the character sheet to get the trait and skill levels.  I'm partially sighted and the character sheet takes up most of the width of a 24" monitor so i can read it, having to open and close it constantly gets rather annoying, unfortunately I don't have room for a bigger monitor and certainly not for a second one. These are problems I have come across so far, no doubt there are other issues I will find the more I delve into it. So would the API help with this and is it time I started banging my head against the brick wall of computer programming and tried to learn JavaScript.  Any advice to a complete novice would be welcome.
1595141964

Edited 1595142097
GiGs
Pro
Sheet Author
API Scripter
Most people who upgrade to Pro never need to learn how to script. There are so many scripts already available, that most people get what they need just be adding other people's scripts. Your tokenbar question can be at least partly handled by the script TokenMod, and I think I've seen a script for handling temporary hit points and healing surges properly. There are three scripts for handling long and short rests in D&amp;D 5e Oenanthe said: The second one i have come across is with systems that use a Trait + Skill dice roll, where any trait can be combined with any skill, such as the old Whitewolf Vampire system.&nbsp; In Vampire there are 9 traits and over 30 skills so that is a lot of macros to write to do all the possibilities.&nbsp; The obvious option for me was to write a macro that asked for the trait and then for the skill and then rolled that number of dice, but it appears that a query can't pull the information from the character sheet that way .&nbsp;&nbsp; A query absolutely can pull the information from the character sheet that way. I answered your question about this showing how to do it just the other day here: <a href="https://app.roll20.net/forum/permalink/8965509/" rel="nofollow">https://app.roll20.net/forum/permalink/8965509/</a> If there's something unclear there, I'd be happy to explain in more detail. But it uses 2 queries, where the user selects the stat and skill by name, and then grabs the values for those stats and skills from the character sheet.
Sorry I intended to go back to that thread, I tried the macro you suggested, changing the skills to match what was in the system and it just keips coming up 'TypeError c is undefined', it doesnt' seem to matter what I try and alter, it just doesn't seem to want to give me the option to pick a stat and a skill for the dice roll. I guess it is one reason i'm wondering if learning at least the basics of JavaScript will help me work out what i'm doing wrong, at the moment I'm pretty much flying blind, coping other peoples work without knowing why I'm doing things and why I have to use certain symbols in certain places for it to work.&nbsp; I could see me having the same problem with using ready made scripts, if they didn't do quite what i wanted I wouldn't be able to change them to make them do it.
1595147392
GiGs
Pro
Sheet Author
API Scripter
What character sheet are you using? I'll check it out and create a working macro. Don't be afraid to ask for help here on the forums when something doesnt work. Things might not always work the first time, but we'll get there.
1595147627
GiGs
Pro
Sheet Author
API Scripter
You'd be better off learning the basics of how roll20 works before jumping in to the deep end of the API. The wiki is a great source for figuring out how to write macros, for example.&nbsp;
The character sheet is one from the drop down box that comes up when i create a game.&nbsp; It is Vampire the Masquerade 20 Anerversary Edition under the Storyteller System sub heading. I've been spending a lot of time on the Wiki and it has been very helpful, and when it can't answer the question the forums have been wonderful.&nbsp; The whole of Roll20 could make my GMing so much easier if I can get it to do what I need it to.
1595153155

Edited 1595164029
GiGs
Pro
Sheet Author
API Scripter
Here's a macro that includes all the skills and a very basic dice roll (it doesnt account for difficulty, etc., it just demonstrates the queries): /roll ?{Stat| Strength, @{selected|Strength}| Dexterity, @{selected|Dexterity}| Stamina, @{selected|Stamina}| Charisma, @{selected|Charisma}| Manipulation, @{selected|Manipulation}| Appearance, @{selected|Appearance}| Perception, @{selected|Perception}| Intelligence, @{selected|Intelligence}| Wits,@{selected|Wits}} + ?{Skill| Alertness, @{selected|Alertness}| Athletics, @{selected|Athletics}| Brawl, @{selected|Brawl}| Dodge, @{selected|Dodge}| Empathy, @{selected|Empathy}| Expression, @{selected|Expression}| Intimidation, @{selected|Intimidation}| Leadership, @{selected|Leadership}| Streetwise, @{selected|Streetwise}| Subterfuge, @{selected|Subterfuge}| Animal Ken, @{selected|AnimalKen}| Craft, @{selected|Crafts}| Drive, @{selected|Drive}| Etiquette, @{selected|Etiquette}| Firearms, @{selected|Firearms}| Larceny, @{selected|Larceny}| Melee, @{selected|Melee}| Performance, @{selected|Performance}| Stealth, @{selected|Stealth}| Survival, @{selected|Survival}| Academics, @{selected|Academics}| Computer, @{selected|Computer}| Finance, @{selected|Finance}| Investigation, @{selected|Investigation}| Law, @{selected|Law}| Medicine, @{selected|Medicine}| Occult, @{selected|Occult}| Politics, @{selected|Politics}| Science, @{selected|Science}| Technology, @{selected|Technology}}d10 There were two Vampire sheets, which have different skill names, so if you get an error mentioning the skills Larceny and Animal Ken (among others), let me know and I'll change it to match the skills for the other sheet. This gives a very long dropdown for the skills, so you might find it useful to use three macros, one for the each of the three categories of skills. That would make the skill dropdown more manageable. They would be: /roll ?{Stat| Strength, @{selected|Strength}| Dexterity, @{selected|Dexterity}| Stamina, @{selected|Stamina}| Charisma, @{selected|Charisma}| Manipulation, @{selected|Manipulation}| Appearance, @{selected|Appearance}| Perception, @{selected|Perception}| Intelligence, @{selected|Intelligence}| Wits,@{selected|Wits}} + ?{Skill| Alertness, @{selected|Alertness}| Athletics, @{selected|Athletics}| Brawl, @{selected|Brawl}| Dodge, @{selected|Dodge}| Empathy, @{selected|Empathy}| Expression, @{selected|Expression}| Intimidation, @{selected|Intimidation}| Leadership, @{selected|Leadership}| Streetwise, @{selected|Streetwise}| Subterfuge, @{selected|Subterfuge}}d10 /roll ?{Stat| Strength, @{selected|Strength}| Dexterity, @{selected|Dexterity}| Stamina, @{selected|Stamina}| Charisma, @{selected|Charisma}| Manipulation, @{selected|Manipulation}| Appearance, @{selected|Appearance}| Perception, @{selected|Perception}| Intelligence, @{selected|Intelligence}| Wits,@{selected|Wits}} + ?{Skill| Animal Ken, @{selected|AnimalKen}| Craft, @{selected|Crafts}| Drive, @{selected|Drive}| Etiquette, @{selected|Etiquette}| Firearms, @{selected|Firearms}| Larceny, @{selected|Larceny}| Melee, @{selected|Melee}| Performance, @{selected|Performance}| Stealth, @{selected|Stealth}| Survival, @{selected|Survival}}d10 /roll ?{Stat| Strength, @{selected|Strength}| Dexterity, @{selected|Dexterity}| Stamina, @{selected|Stamina}| Charisma, @{selected|Charisma}| Manipulation, @{selected|Manipulation}| Appearance, @{selected|Appearance}| Perception, @{selected|Perception}| Intelligence, @{selected|Intelligence}| Wits,@{selected|Wits}} + ?{Skill| Academics, @{selected|Academics}| Computer, @{selected|Computer}| Finance, @{selected|Finance}| Investigation, @{selected|Investigation}| Law, @{selected|Law}| Medicine, @{selected|Medicine}| Occult, @{selected|Occult}| Politics, @{selected|Politics}| Science, @{selected|Science}| Technology, @{selected|Technology}}d10 These all assume you are using tokens whose Represents dropdown is set to a character. When you have the token selected, and run the macro, it will draw values from that sheet. You could make the output prettier by using a rolltemplate. That will be a bit trickier if you want to use the rolltemplate in the sheet, but it is possible.
Thank you so much for that, the drop down menus work beautifully, I'm sure I can adjust that as need be myself now you have done the basic one for me.&nbsp; I need to work on the dice rolling bit a bit more, but I've managed to sort it in set rolls, so Its just a case of working out how to fit it in to the rest of that macro, from what I read it is a bit more complicated than some other systems.
1595164172
GiGs
Pro
Sheet Author
API Scripter
You're welcome :)