Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; there are 4 parts
- ;; Part one, starting the game
- on *:TEXT:!rps:#*:{
- if ( !%rps.playerone ) {
- /msg $chan Type !joinRPS to join in the fun :)
- /set %rps.playerone $nick
- /set %rps.chan $chan
- /halt
- }
- /msg $chan There is already a game being played. Try agin in a bit.
- }
- ;; Part two player #2 joining the game
- ;; also messages players on how to make a selection
- on *:TEXT:!joinrps:#*:{
- if ( !%rps.playerone ) { /msg $chan Type !rps to start a new game. | halt }
- if ($nick == %rps.playerone ) { /msg $chan So... you like playing with yourself, do you? Very naughty ;) Type !rpsbot for that ;) | /unset %rps.* | /halt }
- /set %rps.playertwo $nick
- /notice %rps.playerone Type /msg PsiBot !rpschoice <rock, paper, scissors>
- /notice %rps.playertwo Type /msg PsiBot !rpschoice <rock, paper, scissors>
- }
- ;; Part three receiving the players choices and evaluating them
- ;; also messages the outcome and ends the game
- on *:TEXT:!rpschoice*:?:{
- if ( !%rps.playerone ) { /msg $nick Type !rps to start a new game. | halt }
- if ( !%rps.playertwo ) { /msg $nick So... you like playing with yourself, do you? Very naughty ;) Type !rpsbot for that ;) | /unset %rps.* | /halt }
- if ( !$2 ) { /msg $nick You need to make a selection | halt }
- /set %rps.choice none
- if ( $2 == rock ) /set %rps.choice Rock
- if ( $2 == paper ) /set %rps.choice Paper
- if ( $2 == scissors ) /set %rps.choice Scissors
- if ( %rps.choice == none ) { /unset %rps.choice | /msg $nick Please make a propper selection | /halt }
- if ( $nick != %rps.playerone ) {
- if ( $nick != %rps.playertwo ) {
- /unset %rps.choice
- /msg $nick Sorry, you aren't in this game, try again next time
- /halt
- }
- }
- if ( %rps.playerone == $nick ) {
- /set %rps.onechoice %rps.choice
- if ( !%rps.twochoice ) { /unset %rps.choice | /msg %rps.chan Waiting on %rps.playertwo to take thier turn. | /halt }
- }
- if ( %rps.playertwo == $nick ) {
- /set %rps.twochoice %rps.choice
- if ( !%rps.onechoice ) { /unset %rps.choice | /msg %rps.chan Waiting on %rps.playerone to take thier turn. | /halt }
- }
- if ( %rps.onechoice == Rock ) {
- if ( %rps.twochoice == Rock ) /msg %rps.chan %rps.playerone and %rps.playertwo both picked Rock. It is a TIE!
- if ( %rps.twochoice == Paper ) /msg %rps.chan %rps.playerone picked Rock and %rps.playertwo picked Paper. %rps.playertwo WINS!
- if ( %rps.twochoice == Scissors ) /msg %rps.chan %rps.playerone picked Rock and %rps.playertwo picked Scissors. %rps.playerone WINS!
- }
- if ( %rps.onechoice == Paper ) {
- if ( %rps.twochoice == Rock ) /msg %rps.chan %rps.playerone picked Paper and %rps.playertwo picked Rock. %rps.playerone WINS!
- if ( %rps.twochoice == Paper ) /msg %rps.chan %rps.playerone and %rps.playertwo both picked Psper. It is a TIE!
- if ( %rps.twochoice == Scissors ) /msg %rps.chan %rps.playerone picked Paper and %rps.playertwo picked Scissors. %rps.playertwo WINS!
- }
- if ( %rps.onechoice == Scissors ) {
- if ( %rps.twochoice == Rock ) /msg %rps.chan %rps.playerone picked Scissors and %rps.playertwo picked Rock. %rps.playertwo WINS!
- if ( %rps.twochoice == Paper ) /msg %rps.chan %rps.playerone picked Scissors and %rps.playertwo picked Paper. %rps.playerone WINS!
- if ( %rps.twochoice == Scissors ) /msg %rps.chan %rps.playerone and %rps.playertwo both picked Scissors. It is a TIE!
- }
- /unset %rps.*
- }
- ;;Part four: terminating the game
- ;; if one of the participants leaves, this option allows for the game to be terminated
- on *:TEXT:!rpskill:#*:{ /unset %rps.* | /msg $chan done }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement