Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Simulating dice game Crabs

Hi everybody

I've been trying to simulate the dice game Crabs also called Seven Eleven. For those of you who don't know how the game works: https://de.wikipedia.org/wiki/Craps

This is what I have so far:
(set:$diceroll1 to (random: 1,6))
(set:$diceroll2 to (random: 1,6))
(set:$diceroll1 + $diceroll2 to $result1)
(if: $result1 = 7,11)[Natural!]
(if: $result1 = 2,3,12)[Fail!]
(if: $result1 = 4,5,6,8,9,10)[Point!]

Just shows me a whole lot of errors though. What am I doing wrong? I'm using Twine 2 and Harlow.

Thanks for the help

Comments

  • First. Craps =/= Crabs. :)

    Second. Everything after your first two macro invocations is incorrect. Try something like the following:
    {
    (set: $diceroll1 to (random: 1,6))
    (set: $diceroll2 to (random: 1,6))
    (set: $result1 to $diceroll1 + $diceroll2)
    (if: $result1 is 7 or it is 11)[Natural!]
    (else-if: $result1 is 2 or it is 3 or it is 12)[Fail!]
    (else-if: ($result1 >= 4 and it <= 6) or (it >= 8 and it <= 10))[Point!]
    }
    
  • That worked. Thanks.

    I created nine re-roll passages just to be safe. After 4 re-rolls you usually get a win or fail. I used this code:
    {
    (set: $diceroll1 to (random: 1,6))
    (set: $diceroll2 to (random: 1,6))
    (set: $result2 to $diceroll1 + $diceroll2)
    (if: $result2 is $result1)[(print: $result2) - [[On point!]]]
    (else-if: $result2 is 7)[(print: $result2) - [[Crap!]]]
    (else-if: ($result2 is not $result1) and (it is 2 or it is 3 or it is 4 or it is 5 or it is 6 or it is 8 or it is 9 or it is 10 or it is 11 or it is 12))[(print: $result2) - [[Point!]]]
    }
    

    Time to do some gambling ;D

Sign In or Register to comment.