RPTools.net
http://forums.rptools.net/

Simple West End Games Ghostbusters Roll Macro
http://forums.rptools.net/viewtopic.php?f=20&t=27055
Page 1 of 1

Author:  Meldovni [ Sun Jan 15, 2017 6:24 am ]
Post subject:  Simple West End Games Ghostbusters Roll Macro

I did a forum search and didn't see one already done, so I'm posting the one I made, because I wanted to share it. I'm sure it had basis on something else, but don't remember what I cobbled it together from.

Code:
<!-- Bring up the dice pool prompt to fill the pool variable and let it be smoothly canceled. -->
[h:query=input("pool|1|Dice Pool|Text|")]
[h:abort(query)]

<!-- Lower the dice pool by 1 to make room for the ghost die. -->
[h:pool=pool -1]

<!-- Collect pool rolls individually for later reporting and add them up. -->
[h: listOfRolls = ""]
[h: sum = 0]
[h, count(pool), code: {
    [t: r = roll(1, 6)]
    [h: sum = sum+r]
    [h: listOfRolls = listAppend(listOfRolls, r," + ")]
}]

<!-- Add the ghost die back in and derive the final roll total. -->
[h:ghost=1d6-1]

<!-- Determine if a ghost is rolled, output text, and total it all. -->
[h,if(ghost == 0): output="You rolled a ghost!"; output=""]
[h,if(ghost == 0): GDC="#FF5555"; GDC="#55FF55"]
[h: sum = sum+ghost]
You rolled <b style="background-color:#eeeeee;"> [r: listOfRolls] </b>
+
<b style="background-color:[r: GDC];">[t:ghost]</b> = [r: sum].
<br><b style="background-color:#FF5555;">[r:output]</b>

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/