Welcome to the Builder Academy

Question Trigger of the Day Intermediate - Cup Game

More
13 Oct 2012 23:42 #896 by Rumble
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
If this was helpful please vote or leave a review for TBA.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.165 seconds