New Trigger Of The Day: Generic Craps Game.
You roll two dice. If you roll a 2, 3, or a 12, you lose. If you roll a 7 or a 11, you win. Otherwise, you keep on rolling the dice.
If you roll a 7, you lose. If you match the first number you rolled, you win.
Who knows? In some alternate universe, this might be a first homework question for an intro programming course. Or not.
* Trigger 59010
* waybread, potpie, grapes, lollipop, cookies and cream
set prize_vec 10 3009 6346 34080 1758
%send% %actor% You hand over some gold coins to the dealer.
nop %actor.gold(-10000)%
wait 2 s
%send% %actor% The dealer says, 'Right, let's play a game.'
wait 2 s
%send% %actor% The dealer takes out a pair of dice, and he throws them up in the air!
wait 2 s
%send% %actor% The dice come tumbling down...
wait 2 s
set d1 %random.6%
set d2 %random.6%
%send% %actor% The first die showed a {cR%d1%{cx!
wait 2 s
%send% %actor% The second die showed a {cR%d2%{cx!
eval first_roll %d1% + %d2%
wait 2 s
%send% %actor% The total sum is {cY%first_roll%{cx!
wait 2 s
if %first_roll% == 7 || %first_roll% == 11
%send% %actor% You win! YAY!
wait 2 s
%send% %actor% The dealer gives you a prize!
set pnum %random.5%
%load% obj %prize_vec.wordat(%pnum%)% %actor%
wait 2 s
%send% %actor% Do you want to play again?
elseif %first_roll% == 2 || %first_roll% == 3 || %first_roll% == 12
%send% %actor% You lose! Bummer!
wait 2 s
%send% %actor% The dealer smirks and says: Better luck next time, pal!
else
* roll until you get back your previous roll
set this_roll 0
%send% %actor% The dealer says, 'Since the sum of the dice was not a 2,3,7,11, or 12, I'll roll them again!'
wait 2 s
%send% %actor% He continues, 'You will win if I roll back a %first_roll%, and lose if I roll a 7.
wait 2 s
%send% %actor% Otherwise, I'll keep on rolling the dice.'
set counter 1
while %counter% < 2
*while (%this_roll% != 7 && %this_roll% != %first_roll%)
wait 2 s
%send% %actor% The dealer takes out a pair of dice, and he throws them up in the air!
wait 2 s
%send% %actor% The dice come tumbling down...
wait 2 s
set d1 %random.6%
set d2 %random.6%
%send% %actor% The first die showed a {cR%d1%{cx!
wait 2 s
%send% %actor% The second die showed a {cR%d2%{cx!
eval this_roll %d1% + %d2%
wait 2 s
%send% %actor% The total sum is {cY%this_roll%{cx!
wait 2s
* some weird stuff about multi arguments for while
if %this_roll% == %first_roll%
set counter 10
elseif %this_roll% == 7
set counter 10
else
%send% %actor% The dealer says, 'Gotta roll again!'
endif
done
if %this_roll% == 7
%send% %actor% You lose! Bummer!
wait 2 s
%send% %actor% The dealer smirks and says: Better luck next time, pal!
else
%send% %actor% You managed to get back the value of the first roll!
wait 2 s
%send% %actor% You win! YAY!
wait 2 s
%send% %actor% The dealer gives you a prize!
set pnum %random.5%
%load% obj %prize_vec.wordat(%pnum%)% %actor%
wait 2 s
%send% %actor% Do you want to play again?
endif
endif
* This mob will be 1s of Recall ; at least until a copyover is done.