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

[Request] Need some help to develop a script (Bets)

I never used the API roll20 and I need some directions to get started. What I want to do All players have to bet a numerical quantity, that will not be revealed until everyone has given his quantity. As I want to do When you send a message to chat with a specific code identified by the application, it has to store the message and not display it until all players have sent their message. How can I make a custom command, (i.e: "/bet X", where X = numerical value )? How can I store and delay a message?
1445003581
The Aaron
Pro
API Scripter
So, the basic process would be as follows: 1) intercept the api message 2) store the contents 3) at some point, show them all For 1), you'll want an API command. &nbsp;API commands start with a ! and are the only thing you can enter in the chat box that is not immediately displayed. So, something like: !bet 23 For 2), you'll likely need to to store the information in the state, a persisted object that is always available to you. &nbsp;It's best to create an object in the state object that holds only your data, as the state object is shared by all the api scripts. 3) is the hardest part. &nbsp;Determining when all the bets are in is probably harder than just knowing when you should trigger it. &nbsp;I'd suggest having another command that just reveals all the bets: !show ... Ok, I did all that. &nbsp;I figure limiting to just numbers might be a problem, so the bet is just whatever you typed after !bet. Each player/character can place a bet with !bet, and it will tell everyone that the player has placed a bet for that character, but not what it was. &nbsp;It will whisper to the player that they placed the particular bet for the particular character. When the GM decides that everyone has placed their bets, they just execute !show and it prints all the bets with the character name (player name). Here's what it looks like: The script should serve as a reasonable guide to how working with the API works. &nbsp;Let me know if you have any questions or want to to talk about the specifics, or even if you want help changing it into something more! Git:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/Be" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Be</a>...
Thank you very much, I can't express how much win your help is. It's awesome to have such helpfull people in the comunity.
1445018085
The Aaron
Pro
API Scripter
No problem! &nbsp;=D
I'm finding an issue that the script terminates, throwing an error, after attempting to start a new !bet after the !show Error message generated is: "/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot set property '-K0pq5L6JNbWS6zBPjYwCyberspark' of undefined at handleInput (evalmachine.&lt;anonymous&gt;:33:50) at eval ("
1445881492
The Aaron
Pro
API Scripter
Ah! &nbsp;Thanks for pointing that out. &nbsp;I just pushed a fix up for that.
The Aaron said: Ah! &nbsp;Thanks for pointing that out. &nbsp;I just pushed a fix up for that. Np, thanks for the script. It's really cool. Changing how we do a lot of things in our sessions. Big help ^^
1445915900
The Aaron
Pro
API Scripter
:) Happy to help!