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

Alternate Drinking API — Could this DnD 5E Drinking homebrew be turned into a functioning API?

1609917110

Edited 1609917233
Hello, I've a bit of what seems like a mountainous task, at least if you're me who has never scripted anything themselves.  I am aware of the existence of the Drunk API, but both my players and I are big fans of this set of 5E homebrew Drinking rules , which are quite a bit more complex than ones Drunk API is based on. For someone like me, who has no idea what he's doing in regards to anything beyond basic macros without having to ask for help, I am curious if it would be possible to even make something like this.  From my understanding, the API would need to be able to perform the following tasks/arguments:   — Individually generate a custom 'Intoxication Threshold' by PC, equal to a given PC's Constitution Score +1  — Track a PC's current level of Intoxication, comparing to their Threshold to determine when they gain "Liquid Courage"  — Run queries for which strength of drink a PC is consuming (maybe another for number of drinks), and add it to current level of Intoxication        — Also force a DC 10 Constitution Save vs unconsciousness for 1d6x10 minutes when consuming the 'Deadly' strength drink  — Grant effects of "Liquid Courage" when Intoxication Threshold is reached, prompting a d4 table roll for one of four potential benefits  — Implement the rolled benefit, as well as the set drawbacks, in an ideally automatic fashion that is trackable on a PC's token or sheet  — Force a Constitution Save of variable DC (8 + drink strength + level of exhaustion) when consuming drinks beyond the PC's Threshold        — Add a level of exhaustion  on fail, failing by 5 or more prompts a d4 roll for falling unconscious for that many hours  — Sync with a Resting API to decrease current levels of intoxication on rest (-2 on short, reset on long)        — I currently use 5E Resting in Style  — Separately track exhaustion gained manually, and exhaustion gained by drinking (if at all possible)        — Recognize a character as "Hungover" when exhaustion from drinking is >0 and current Intoxication is 0              — Implement the drawbacks of being Hungover in an ideally automatic and streamlined fashion that is trackable on a PC's token or sheet        — Remove Hungover status after a long rest (or Greater Restoration)  — A way to remove levels of intoxication via Restoration spells (4 for Lesser, all for Greater) From the perspective of someone who has never coded a thing in his life, this looks impossible, but, there is definitely trackable math and logic that I'm sure put this somewhere within the realm of possibility. Perhaps this could all be tracked in a Chat-based menu accessed by a command or macro that has a few displays for threshold, current intoxication, and current status effects, with buttons that prompt the drinking queries and deduction of intoxication levels from Restoration spells (and resting if that can't be made dependent on a separate API).  I suppose this is also me saying that I do not believe myself capable of creating something like this, as I have none of the know-how to make it happen. But if anyone reading this wants to take a shot at making it work, more power to you, I am happy to be a guinea pig for script testing! 
1609940024
The Aaron
Roll20 Production Team
API Scripter
I'll just throw out here that all of this is possible with the API, with varying levels of difficulty. The hardest part would be implementing all the effects automatically on existing character sheets. Easier would be to notify players of their condition when they take various actions with a follow up message.  I personally don't have the capacity to work on this, but I'd be happy to provide help to someone that is. 
1609952619

Edited 1609952631
That makes sense, keeping it as its own entity that only interacts with the character sheet when reading the Constitution Score to determine the Threshold. Then it could track the custom drinking exhaustion in a far simpler fashion as well.  If no one takes a stab at it, maybe one day I'll try to experiment, but as of right now, I no idea where to even begin, haha. 
1609953120
The Aaron
Roll20 Production Team
API Scripter
Well, I can help with that. =D Start with learning (or honing) your Javascript skills.&nbsp; There are lots of sites out there, this one is pretty nice:&nbsp; <a href="http://jsforcats.com/" rel="nofollow">http://jsforcats.com/</a> Then delve into writing API scripts. Here are some links that talk about writing API scripts: <a href="https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern" rel="nofollow">https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern</a> <a href="https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1</a> <a href="https://app.roll20.net/forum/post/6237754/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6237754/slug%7D</a> And of course, ask lots of questions, try lots of things.&nbsp; I usually tell people a few good starting learner scripts are: Write a script that responds to the !parrot command and repeats the arguments back to chat with some small change, like adding "Polly says " to the front.&nbsp; Write a script that reports the name of a token that is moved, and how far it went.&nbsp; Write a script that whispers to the DM how many duplicate numbers where rolled in the last dice roll.&nbsp; That should give you a nice tour of the API's features without being too ambitious.&nbsp;
Thanks for the tips, looks like I'll be giving scripting a whirl in the near future! :D
1609953650
The Aaron
Roll20 Production Team
API Scripter
Woot!&nbsp; YOU WILL BE ASSIMILATED!&nbsp; =D
The Aaron said: Well, I can help with that. =D Start with learning (or honing) your Javascript skills.&nbsp; There are lots of sites out there, this one is pretty nice:&nbsp; <a href="http://jsforcats.com/" rel="nofollow">http://jsforcats.com/</a> Then delve into writing API scripts. Here are some links that talk about writing API scripts: <a href="https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern" rel="nofollow">https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern</a> <a href="https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1</a> <a href="https://app.roll20.net/forum/post/6237754/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6237754/slug%7D</a> And of course, ask lots of questions, try lots of things.&nbsp; I usually tell people a few good starting learner scripts are: Write a script that responds to the !parrot command and repeats the arguments back to chat with some small change, like adding "Polly says " to the front.&nbsp; Write a script that reports the name of a token that is moved, and how far it went.&nbsp; Write a script that whispers to the DM how many duplicate numbers where rolled in the last dice roll.&nbsp; That should give you a nice tour of the API's features without being too ambitious.&nbsp; I knew that I should not be following this thread...&nbsp;
1610038668
The Aaron
Roll20 Production Team
API Scripter
MUHAHAHAHAHA