How to add Roll-and-Keep, ORE, Fate functions to Dicetool
Posted: Thu Mar 05, 2015 4:44 pm
Okay, from what I read here http://forums.rptools.net/viewtopic.php?f=5&t=22487, no changes will be made to the existing Dicetool code until after the new version of MapTools is released.
So, is there any way to add new functions in the meantime? Well, it turns out that there is. Note that the steps I'll put here are somewhat technical and will require familiarity with your operating system's command line interface. The steps assume you are using Windows, but similar steps can be used in Linux and Mac.
DiceTool version 1.0.b34 has an internal engine that parses and runs javascript functions. We can open up the jar file, overwrite the javascript file with a new one that has new functions, recreate the jar file and Voila! New functions in old DiceTool.
Pre-requisites:
Because we are opening up and recreating a jar file, you will need to install the Java Development Kit (JDK) from Oracle [see http://www.oracle.com/technetwork/java/ ... index.html]
1. Download dicetool-1.0.b34.zip from http://www.rptools.net/downloadsw/ into a new directory, we'll call it "dicetool-custom".
2. Download the functions.js file that is attached below into the "dicetool-custom" directory.
2. Unzip the zip file into the "dicetool-custom" directory.
This will give you a "lib" directory, and the dicetool-1.0.b34.jar file.
3. Open a command prompt and change directory to the "dicetool-custom" directory.
4. Java jar files are essentially zip files, but they have some special structure. Use Java's jar.exe command to expand the dicetool-1.0.b34.jar file.
Since you have JDK installed, you should be able to just run the jar command. If the command is not recognized, you may have to enter in the full path for where your java\bin directory was installed.
For example:
Or (with full path). Note that you must include the double quotes:
This will create a "META-INF" directory, and a "net" directory.
5. Next, copy the functions.js file on top of (replace) the functions.js file in the dicetool-custom\net\rptools\dicetool\expression\function directory.
6. Now we will recreate the jar file:
Or (with full path). Note that you must include the double quotes:
You have now successfully created your new custom DiceTool!
To run the custom DiceTool, run the following from the command line:
Or (with full path). Note that you must include the double quotes:
So, is there any way to add new functions in the meantime? Well, it turns out that there is. Note that the steps I'll put here are somewhat technical and will require familiarity with your operating system's command line interface. The steps assume you are using Windows, but similar steps can be used in Linux and Mac.
DiceTool version 1.0.b34 has an internal engine that parses and runs javascript functions. We can open up the jar file, overwrite the javascript file with a new one that has new functions, recreate the jar file and Voila! New functions in old DiceTool.
Pre-requisites:
Because we are opening up and recreating a jar file, you will need to install the Java Development Kit (JDK) from Oracle [see http://www.oracle.com/technetwork/java/ ... index.html]
1. Download dicetool-1.0.b34.zip from http://www.rptools.net/downloadsw/ into a new directory, we'll call it "dicetool-custom".
2. Download the functions.js file that is attached below into the "dicetool-custom" directory.
2. Unzip the zip file into the "dicetool-custom" directory.
This will give you a "lib" directory, and the dicetool-1.0.b34.jar file.
3. Open a command prompt and change directory to the "dicetool-custom" directory.
4. Java jar files are essentially zip files, but they have some special structure. Use Java's jar.exe command to expand the dicetool-1.0.b34.jar file.
Since you have JDK installed, you should be able to just run the jar command. If the command is not recognized, you may have to enter in the full path for where your java\bin directory was installed.
For example:
Code: Select all
jar xvf dicetool-1.0.b34.jar
Code: Select all
"C:\Program Files\Java\jdk1.8.0\bin\jar" xvf dicetool-1.0.b34.jar
5. Next, copy the functions.js file on top of (replace) the functions.js file in the dicetool-custom\net\rptools\dicetool\expression\function directory.
6. Now we will recreate the jar file:
Code: Select all
jar cvfm dicetool-custom-1.0.b34.jar META-INF\MANIFEST.MF net
Code: Select all
"C:\Program Files\Java\jdk1.8.0\bin\jar" cvfm dicetool-custom-1.0.b34.jar META-INF\MANIFEST.MF net
To run the custom DiceTool, run the following from the command line:
Code: Select all
java -jar dicetool-custom-1.0.b34.jar
Code: Select all
"C:\Program Files\Java\jdk1.8.0\bin\java" -jar dicetool-custom-1.0.b34.jar