RPTools.net

Discussion and Support

Skip to content

It is currently Tue Oct 17, 2017 7:13 pm 






Reply to topic  [ 2 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Thu Mar 05, 2015 4:31 pm
Posts: 11
 Post subject: How to add Roll-and-Keep, ORE, Fate functions to Dicetool
PostPosted: 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/javase/downloads/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:
jar xvf dicetool-1.0.b34.jar

Or (with full path). Note that you must include the double quotes:
Code:
"C:\Program Files\Java\jdk1.8.0\bin\jar" xvf dicetool-1.0.b34.jar

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:
Code:
jar cvfm dicetool-custom-1.0.b34.jar META-INF\MANIFEST.MF net

Or (with full path). Note that you must include the double quotes:
Code:
"C:\Program Files\Java\jdk1.8.0\bin\jar" cvfm dicetool-custom-1.0.b34.jar META-INF\MANIFEST.MF net


You have now successfully created your new custom DiceTool!

To run the custom DiceTool, run the following from the command line:
Code:
java -jar dicetool-custom-1.0.b34.jar

Or (with full path). Note that you must include the double quotes:
Code:
"C:\Program Files\Java\jdk1.8.0\bin\java" -jar dicetool-custom-1.0.b34.jar


functions.js [5.74 KiB]
Downloaded 58 times
Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Mar 05, 2015 4:31 pm
Posts: 11
 Post subject: Re: How to add Roll-and-Keep, ORE, Fate functions to Dicetoo
PostPosted: Thu Mar 05, 2015 6:01 pm 
Using the new functions:

Three new functions have been added: Roll-and-Keep (with explode on highest value), One-Roll-Engine, and Fate.

Roll-and-Keep with Explode:
Legend of the Five Rings uses this type of roll. You roll a number of dice (all with the same number of sides), and keep a smaller number of the best rolls. If the highest value is rolled on any die (explode), the die is rolled again and the new value added. This can repeat if the highest value is again rolled. A '+' in the label column indicates that a die has exploded.

Syntax:
EK(number_of_sides, number_of_dice_to_roll, number_of_dice_to_keep)

Example:
EK(10, 3, 2) -- Roll 3d10 and choose the best 2 values.
Attachment:
roll-and-keep-explode.png
roll-and-keep-explode.png [ 13.82 KiB | Viewed 991 times ]


One-Roll-Engine:
Reign, Wild Talents and other settings use this type of roll. A number of d10 dice are rolled and matches are identified by coloring on the row. The roll column for the top row shows the number of matches.

Syntax:
ore(number_of_d10s) -- Roll some d10s and color rows that match. Aliases for this function can also be used: reign(number_of_d10s) and r(number_of_d10s)

Example:
ore(6) -- Roll 6d10 and color rows that match.
Attachment:
one-roll-engine.png
one-roll-engine.png [ 15.85 KiB | Viewed 991 times ]


Fate:
Roll 4 d6 dice, where each d6 die is considered to have 2 negative sides, 2 positive sides, and 2 zero sides; then sum up the values.

Syntax:
r4dF() -- Aliases are: r4df(), fate(), fudge()
Attachment:
fate.png
fate.png [ 15.64 KiB | Viewed 991 times ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 2 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman