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

[Help] New Script Builder: Will this script work?

August 04 (10 years ago)
So, I am taking my first step into the Roll20 API. I was a programmer in a past life (mostly XML, SQL, and a bit of Python) so I am working on learning Java and so far so good. I have a script in mind for an upcoming campaign and wanted to run if by some of you with more expertise to see I am thinking about the API in the right way. All I’m really looking for “Yes, that will work” or “No the API can’t do that (but it can do this)”. I am happy (and looking forward to) doing the leg work to get this to work, I just don't want to spend huge amounts of time on something that has no chance of success or has an obvious and fatal design flaw within the constraints of the Roll20 API.

So, the script is designed for the Pathfinder Serpent’s Skull AP. There are a number of camps in the jungle with their own stats and have to make a number of rolls each day.

Design Specifics:
-Each Camp will be represented by a token linked to a character sheet with a number of attributes for Defense, Exploration, and Supply.
-With a camp token selected you will run an API command that does the following:

Defense:
-Make four rolls (in Roll20) for wandering monsters (morning, midday, afternoon, night)
-For each roll that is successful, make a roll on a rollable table (in Roll20) to determine what the baddie is
-Calculate the DC based on the rollable table result and make a roll (d20 + campstat [from character sheet])
-Based on the success or failure of a roll add points to a Destruction pool via one of the bars on the camp token.
-All of this will be output into a roll template or some other chat log text that highlights what happened.

The Exploration and Supply rolls are variations of the one above so I won't spell them out.
August 04 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter
Yes, that's completely doable. You don't even need to have a rollable table for that if you don't want to, nor put any of the dice rolls in chat.
August 04 (10 years ago)
Awesome! Thanks Brian! I'll start seeing what I can do... I may be back with more questions though.
August 14 (9 years ago)
The Aaron
Pro
API Scripter
Also, if you're diving into Javascript, I highly recommend Javascript: The Good Parts by Douglas Crockford.  It's a short little book and will help you to use the elegant parts of javascript while bypassing the parts that are traps.
August 14 (9 years ago)
Thanks! I will definitely give that a read. I am hoping that the more short-term and fun goal of improving my Roll20 campaigns will help me a develop a skill I can use on less exciting but more professional things, so this should definitely help with that.
August 14 (9 years ago)
The Aaron
Pro
API Scripter
I work for Answers.com.  After working on the Roll20 API for fun for 6 months or so, one of the founders of Answers came to me and said "Hey, we need to write a Chrome extension that does this..."  18 hours later, I was done and had published it to the Chrome Web Store.

I can certainly say that the knowledge is transferable into real things.  Previous to Roll20 API and reading that book, I hated Javascript like most developers I know.  That book, among other things, teaches you that what you really hate is the browser DOM, but Javascript done correctly is actually quite nice.  =D
August 15 (9 years ago)
Lithl
Pro
Sheet Author
API Scripter

The Aaron said:

what you really hate is the browser DOM
... and Internet Explorer.

August 15 (9 years ago)
The Aaron
Pro
API Scripter
Well, that goes without saying!!!  =D