Welcome to the Builder Academy

Question Trigger of the Day - Dice Game

More
27 Feb 2013 14:02 #1567 by Rumble
Code:
* By Cati 1) Name : Hi-Low game of dice 2) Intended for : Rooms 3) Trigger types: Command 4) Numeric Arg : 100 5) Arguments : * 6) Commands: if %actor.is_pc% *check that they are typing 'roll dice' so as to not interfere with the social. if %cmd% == roll && %arg% == dice %echo% %actor.name% rolls the dice. wait 2 *roll the first dice eval num1 %random.10% *roll the second dice eval num2 %random.10% *add the total of the two dice together (this is better than rolling a 20 sided *die and adding 1 to the roll if they rolled a 1 because it then has the proper *probability of each outcome eval combined %num1% + %num2% *show them the outcome of their first die %send% %actor% The first die lands on a %num1% wait 2s;*show them the outcome of their second dice %send% %actor% The second die lands on a %num2% %send% %actor% For a total of: %combined% *show the room what they rolled %echoaround% %actor% %actor.name% rolled a %combined%. *check if they rolled two ones if %combined% == 2 *send them s special message if they did. %send% %actor% SNAKE-EYES! You lose! elseif %combined% == 10 %send% %actor% 50-50 shot at winning - or losing. elseif %combined% == 20 %send% %actor% A natural 20. You've got this round all sewn up. end elseif %cmd% == emote && %arg% /= rolled %force% %actor% say I tried cheating using emote, and I should be disqualified! else *send the command to the mud if they type: 'roll' but not 'roll dice' *so as to not interfere with the social or any other scripts on nearby objects/mobs/rooms return 0 end 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.155 seconds