Grayed out Dice

Simulated dice for role playing games
Post Reply
Posts: 1
Joined: Wed Mar 04, 2015 8:00 pm
IQ Test: Orange

Grayed out Dice

Post by elbebo » Wed Mar 04, 2015 8:24 pm

So when rolling for example 2d+6H1 the lowest die becomes grayed out. When I try the same for a formula like d+6 V d+4 the lowest die is no longer grayed out. I have also tried High1(d+6 , d+4) with the same result of the lowest die not being grayed out. Is there any way I can specify to have the lower die grayed out at the end of the roll like the first formula? I know functionality is there it's just more aesthetically pleasing and easier to follow the dice when you know which one is the valid one you rolled. Thanks.

Posts: 1464
Joined: Wed Feb 04, 2004 6:02 pm

Re: Grayed out Dice

Post by gandreas » Mon Mar 09, 2015 2:43 pm

Here's the current solution:

Code: Select all

@X ← d+6 ∨ d+4.
:badge:(“:disable:”, 3 - indexof(@X, $1, $2)).
So you've got the first part figured out, but the next line uses the :badge: system function to mark one of the dice as disabled - to do so, it looks at the value of the higher one, finds it in the index of a reference to the first and second dice in the formula (which you could also store into separate variables instead of using the "reference" form) that matches the higher value, and then disable it. Finally, return the value.

To extend it to three dice:

Code: Select all

@X ← d+6 ∨ d+4 ∨ d+8.
:badge:(“:disable:”, 1).
:badge:(“:disable:”, 2).
:badge:(“:disable:”, 3).
:badge:(“:enable:”, indexof(@X, $1, $2, $3)).
(i.e., start by marking all the dice as disabled, and then enable the one that matches the highest die).

In a future version, I'll extend the language to support non-homogenious dice into reducers (like "H"), so you'd be able to do something like:

Code: Select all

[ d+6, d+4, d+8 ]H1

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests