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] Empowered Spell 5e

1605951064

Edited 1605968700
Oosh
Sheet Author
API Scripter
empowered Spell 5e v0.4 -- Github link -- So this is pretty much Baby's First Script. It's a wildly over-engineered lump of code designed to automate the Empowered Spell metamagic for 5e Sorcerers. Basically, I just needed something to do to start playing around with the API and learning, and this little niche is what I chose. I spent far more time than I should have putting the lists & menu together... it's certainly an unusual way to build a GUI, but it was a fun journey! It's (hopefully) pretty easy to use. Players or Characters need to be registered with the script before their spell damage rolls will be picked up. This is pretty easily done. If you're a player: !empower --addme This will add you as a player, then prompt you to add a default character. A default character is linked to your player id, so if the script can't find character details from chat window content (custom macro or whatever), it'll fall back to your linked character sheet. This part is optional. Adding someone as a Player and Character ensures their rolls will be picked up regardless of chat settings or whatever. And if you're DM setting up one of your players/NPC's, you can just use the menu: !empower --list and click on the buttons. There are command line arguments as well, mostly covered on the Git page or in the !empower --help dialogue. There are a couple of settings as well, accessed with !empower --settings . The Response Mode is the more useful one - the default mode is 'Full' response mode, where the script will prompt a registered player for Empowered every time they cast a damaging spell. The Empowered dialogue can be shortened by changing this to "quick" mode, or removed entirely with "manual" mode. Manual will pick up and store the roll, but won't prompt the Sorcerer for anything - they will need a macro button in this case, which needs to send !empower --empowerSelect to chat. When a spell is Empowered, it presents the Sorcerer with a menu showing their lowest X rolls from the spell's damage rolls, X being determined by their character's charisma mod. It presents X number of buttons, ranked from lowest roll to highest roll, and the Sorcerer just needs to click on, for example, the 3rd box, to reroll the lowest 3 dice. The script will pick up damage 1, damage 2, crits 1 & 2, higher level cast, higher level crit, and will also separate out a split roll (where damage 1 and damage 2 are different die types) and order the rolls lowest to highest accorder to % of max roll. So a 3 (d6) is a "higher" roll than a 4 (d10). I'm not sure if Ice Knife is the only split roll in 5e.... but that took me a while to add after I noticed it. Thanks, Ice Knife! Here's a quick gif of adding a character, then casting a fireball. So easy my Grandma could do it. Though she'd need a True Resurrection first, she's been dead for quite some time: Probably enough explanation for a script with such a narrow application it'll never get used. But at least I had a good time!
1605959526
The Aaron
Roll20 Production Team
API Scripter
Baby steps show you to be a pretty good walker already!  That's pretty clean code, I take it you're an experienced programmer—or you should be! I think you're the first person to use my schema version stuff the way I do. =D i haven't tried it out, but it looks pretty useful for sorcerers. You should post a few pictures of the interface at work.
1605968482
Oosh
Sheet Author
API Scripter
Oh, absolute novice here - the only reason the code is at all clean is GiGs pointing me to ESLint for VS Code... there was soooo much red on the screen when I got that installed. But thanks for the encouragement :) The codecademy JS course and reading posts from you and GiGs is about all the education I've had. It took me a while to understand the boilerplate I pinched from you, but there were some really informative old posts about revealing module pattern and whatnot - I think it was that thread where you explained how you use the schema version, too. It wasn't really necessary, since it  was only me who was needing to update the script, but I figured "if Aaron does it, it must be a good idea!". I'm sure there's a million ways to improve it, though it's already pretty bloated for something so niche.
1605971015
The Aaron
Roll20 Production Team
API Scripter
Lol!  Regardless, I'm looking forward to seeing what you make next. =D