Code:
Name: 'Cup Game', VNum: [ 273], RNum: [ 165]
Trigger Intended Assignment: Rooms
Trigger Type: Command , Numeric Arg: 100, Arg list: bet
Commands:
*define the minimum and maximum amounts of gold a player can bet
set low_bet 1
set high_bet 10000
*check if they typed wager and a bet amount
if %cmd% == bet && %arg.car% >= %low_bet% && %arg.car% <= %high_bet%
*see if they chose a valid cup
if %arg.cdr% == left || %arg.cdr% == right || %arg.cdr% == middle
*just an anal check to make sure the wording of the message is correct
if %arg.cdr% == left || %arg.cdr% == right
%echo% %actor.name% points to the cup on the %arg.cdr%
else
%echo% %actor.name% points to the cup in the middle.
end
*let's see which cup the ball is actually under.
switch %random.3%
case 1
set cup left
break
case 2
set cup right
break
case 3
set cup middle
break
done
wait 2 s
*let's compare the correct cup to the cup they chose
if %arg.cdr% == %cup%
*if they chose the right cup
%echoaround% %actor% %actor.name% has chosen the correct cup and won!
%send% %actor% You won!
nop %actor.gold(%arg.car%)%
else
*if they didn't choose the right cup
%echoaround% %actor% %actor.name% has chosen the incorrect cup, the ball was under the %cup% cup.
%send% %actor% Unfortunately you have lost, the ball was under the %cup% cup.
nop %actor.gold(-%arg.car%)%
end
else
*if they typed bet # followed by nothing or by something other left, right, or middle.
%send% %actor% There are only three cups, please type: bet <amount of gold> <left, middle, or right>
end
else
%send% %actor% Please place a bet between %low_bet% and %high_bet%.
*If they type an amount that's not a valid bet or don't type a numerical value at all following the word bet
end
for TBA.