Exploding Dice

General program usage, discussion on writing generators for IPad Pro.

Exploding Dice

Postby tog23 » Mon Apr 16, 2012 8:28 pm

I'm working on a roller for the BASH! RPG, and I've come up against a problem.

When doubles are rolled in BASH, dice explode - if the two d6s you're rolling match, roll another d6 and add it to the result, and, if THAT d6 either result, roll again etc.

So this is the code I have so far:

Code: Select all
Table: BASH Roll
Set: var1 ={1d6}

Set: var2 ={1d6}

Set: var3 ={1d6}

Define: vart ={!{$var1}+{$var2}}
##vart = total of roll so far

Set: vart =[when] {$var1} = {$var2} [do] {{$vart}+{$var3}}[end]
##if doubles are rolled, add var3

Total of {$vart} ({$var1},{$var2},{$var3}
##Print stuff out for debugging purposes)


The variable "vart" is supposed to contain the total of the rolls. Only, the [when] statement doesn't seem to work - it's not comparing var1 and var2 properly, and it's not adding var3 to them if they are equal. Additionally, the output is all messed up, viz:
Code: Select all
Total of  0 (5,5,1

Total of  0 (6,6,3

Total of  0 (2,2,6

Total of  (6,3,2

Total of  (2,3,4

Total of  (6,1,2

Total of  0 (3,3,2

Total of  (6,3,6

Total of  0 (1,1,2

Total of  (1,5,4

Total of  (4,3,2


I can't help but feel it's a syntax problem, but I can't figure it out.
tog23
Torch Bearer
 
Posts: 4
Joined: Tue Apr 10, 2012 8:45 pm

Return to Inspiration Pad Pro General

Who is online

Users browsing this forum: No registered users and 0 guests

cron