Posted May 11, 2024 by Robot Face
#Tutorial #Hacking
So, I chose to calculate stat modifiers according to the "most popular" RPG instead of a common GLOG method. Many users might wish to change it to use (stat/3)-3 instead of (stat-10)/2.
You can do this by selecting File>Properties>Script.
Here's the function where the formula is defined. Everything in the deck uses this function when it wants to calculate a stat modifier.
The lines with # at the beginning are comments. As you can see, I've already included several examples. To switch to one of them, add a # before the first line, then remove it from the line you want to use.
I used the (stat-10)/2 calculation in a couple places, we'll need to change it in each one.
First, change your tool from "Interact" to "Widgets".
Then, double-click any of the stat bars, and then click "Prototype".
Then, from the top menu, select "Prototype" then "Script..."
Here, I've used the following bit of code in three places:
-10)/2
Edit it to the following:
/3)-3
Press ctrl+s to save, then return home with File>Close Script and Prototype>Close.
The second place I calculate modifiers is in the d20 roller. Double-click it and go to its prototype, then to the prototype's script. You should see the formula twice near the top. Replace it just like you did earlier.
Next... I'm really sorry about this. All six stat roll buttons in this prototype use the code, twice, in the middle of a larger formula.
Double-click the button, then look at the button's script.
Replace `-10)/2` with `/3)-3` in both places. Be careful not to mess with surrounding parentheses.
You'll have to do this individually for each button.
I didn't want to update this tool a lot since existing character saves won't get new features, but this really feels like it warrants an update. In the next version, I'll definitely edit these to all point at one function that you can easily edit it in one place and have the change apply everywhere.
Also, I already have plans for the d20 roller to log all previous rolls instead of just being a big white space with a single number. So I can bring both these changes to you at once.
File>Save As. Make sure the filename ends in .html.
Open the html file in notepad or your text editor of choice.
Find and replace `-10)/2` with `/3)-3`.
Save, then open the html file again in decker.