Rock, Paper, and Scissors!

By EMMURE on Apr 27, 2009

I made this RPS script when i finally decided to make a game. i had never seen one so i figured RPS would be easy. well, here it is. i have not fully tested it, but it should work. if any bug occurs just type !End to unset the games variables.

on *:text:!RPS:#ethan: {
  if ( %RPS == $null ) {
    msg # 4 $+ $nick 14has started 9ROCK, PAPER, SCISSORS! 
    msg # 14 $+ Who would like to accept 4 $+ $nick $+ 's 14challenge? Just type 8!Accept
  set %RPS 1 | set %challenger1 $nick | Halt }
  if ( RPS != $null ) { msg # 14There is currently a game of RPS going on. }
}
on *:text:!Accept:#ethan: {
  if ( %RPS == 1 ) { msg # 9 $+ $nick 14has accepted 4 $+ %challenger1 $+ 's 14challenge. | set %challenger2 $nick | set %RPS 2 | msg # 14To Chose Rock, Paper, or Scissors, Type 8/Notice $me <Rock, Paper, Scissors> }
  if ( %RPS == $null ) { msg # 14You must first initiate the RPS game by saying 8 $+ !RPS }
}

on *:text:!End:#ethan: {
  if ( $nick == %challenger1 || $nick == %challenger2 || $nick isop #Ethan ) {
    msg # 4 $+ $nick 14has decided to call it quits. | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt
  }
  if (( $nick != %challenger1 ) && ( $nick != %challenger1 ) && ( $nick !isop #ethan )) { 
    msg # 14 $+ You must be participating to end the RPS duel. 
  }
}

on *:notice:*:?: {
  if ( %RPS == 1 ) { notice $nick There has to be 2 contenders. }
  if ( %RPS == 2 ) { 
    if ( $nick == %challenger1 ) {
      if ( $1 == Rock ) { notice %challenger1 You've chosen Rock. | set %challenger1.choice 1 }
      if ( $1 == Paper ) { notice %challenger1 You've chosen Paper. | set %challenger1.choice 2 }
      if ( $1 == Scissors ) { notice %challenger1 You've chosen Scissors. | set %challenger1.choice 3 }
      if (( $1 == $null ) || (( $1 != Rock ) && ( $1 != Paper ) && ( $1 != Scissors )) { notice %challenger1 You must choose Rock or Paper or Scissors }
    }
    if ( $nick == %challenger2 ) {
      if ( $1 == Rock ) { notice %challenger2 You've chosen Rock. | set %challenger2.choice 1 }
      if ( $1 == Paper ) { notice %challenger2 You've chosen Paper. | set %challenger2.choice 2 }
      if ( $1 == Scissors ) { notice %challenger2 You've chosen Scissors. | set %challenger2.choice 3 }
      if (( $1 == $null ) || (( $1 != Rock ) && ( $1 != Paper ) && ( $1 != Scissors )) { notice %challenger2 You must choose Rock or Paper or Scissors }
    }
    if (( $nick != %challenger1 ) || ( $nick != %challenger2 )) { notice $nick You'll have to wait until a free round if you want to play. }
  }
  if ( %RPS == $null ) { /notice $nick You must first initiate the game by saying !RPS and then follow the instructions. }
}

on *:Text:!Finished:#ethan: {
  if ( %RPS == $null ) { msg # 14You must first initiate RPS by typing !RPS }
  if ( %RPS == 1 ) { msg # 14You need 2 contenders before the game can start. }
  if ( %RPS == 2 ) { 
    if ( $nick != %challenger1 && $nick != %challenger2 ) { msg # You must be a contender in order to finish the round. | Halt }
    if ( %challenger1.choice == $null || %challenger2.choice == $null ) { msg # 14You must wait for 11both 14contenders to decide on their weapon. }
    if ( %challenger1.choice != $null && %challenger2.choice != $null ) {
      if ( %challenger1.choice == 1 && %challenger2.choice == 1 ) { msg # 4 $+ %challenger1 14chose: 8Rock. 9 $+ %challenger2 14chose: 8Rock. 4TIE GAME! NO WINNER! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 1 && %challenger2.choice == 2 ) { msg # 4 $+ %challenger1 14chose: 8Rock.  9 $+ %challenger2 14chose: 8Paper. 9 $+ %challenger2 14has beaten 4 $+ %challenger1 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 1 && %challenger2.choice == 3 ) { msg # 4 $+ %challenger1 14chose: 8Rock. 9 $+ %challenger2 14chose: 8Scissors.  4 $+ %challenger1 14has beaten 9 $+ %challenger2 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 2 && %challenger2.choice == 1 ) { msg # 4 $+ %challenger1 14chose: 8Paper. 9 $+ %challenger2 14chose: 8Rock. 4 $+ %challenger1 14has beaten 9 $+ %challenger2 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 2 && %challenger2.choice == 2 ) { msg # 4 $+ %challenger1 14chose: 8Paper. 9 $+ %challenger2 14chose: 8Paper. 4TIE GAME! NO WINNER! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 2 && %challenger2.choice == 3 ) { msg # 4 $+ %challenger1 14chose: 8Paper. 9 $+ %challenger2 14chose: 8Scissors. 9 $+ %challenger2 14has beaten 4 $+ %challenger1 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 3 && %challenger2.choice == 1 ) { msg # 4 $+ %challenger1 14chose: 8Scissors. 9 $+ %challenger2 14chose: 8Rock.  9 $+ %challenger2 14has beaten 4 $+ %challenger1 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 3 && %challenger2.choice == 2 ) { msg # 4 $+ %challenger1 14chose: 8Scissors. 9 $+ %challenger2 14chose: 8Paper. 4 $+ %challenger1 14has beaten 9 $+ %challenger2 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 3 && %challenger2.choice == 3 ) { msg # 4 $+ %challenger1 14chose: 8Scissors. 9 $+ %challenger2 14chose: 8Scissors. 4TIE GAME! NO WINNER! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
    }
  }

Comments

Sign in to comment.
Somsubhra1   -  Jan 14, 2016

It's works fine. Just one suggestion: Remove the !finished command and make it declare the results automatically, as soon as both the players have chosen.

 Respond  
CadetAndrew   -  May 15, 2009

try this:

on *:text:!RPS:$chan: {
  if ( %RPS == $null ) {
    msg # 4 $+ $nick 14has started 9ROCK, PAPER, SCISSORS! 
    msg # 14 $+ Who would like to accept 4 $+ $nick $+ 's 14challenge? Just type 8!Accept
  set %RPS 1 | set %challenger1 $nick | Halt }
  if ( RPS != $null ) { msg # 14There is currently a game of RPS going on. }
}
on *:text:!Accept:$chan: {
  if ( %RPS == 1 ) { msg # 9 $+ $nick 14has accepted 4 $+ %challenger1 $+ 's 14challenge. | set %challenger2 $nick | set %RPS 2 | msg # 14To Chose Rock, Paper, or Scissors, Type 8/Notice $me <Rock, Paper, Scissors> }
  if ( %RPS == $null ) { msg # 14You must first initiate the RPS game by saying 8 $+ !RPS }
}

on *:text:!End:$chan: {
  if ( $nick == %challenger1 || $nick == %challenger2 || $nick isop #Ethan ) {
    msg # 4 $+ $nick 14has decided to call it quits. | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt
  }
  if (( $nick != %challenger1 ) && ( $nick != %challenger1 ) && ( $nick !isop #ethan )) { 
    msg # 14 $+ You must be participating to end the RPS duel. 
  }
}

on *:notice:*:?: {
  if ( %RPS == 1 ) { notice $nick There has to be 2 contenders. }
  if ( %RPS == 2 ) { 
    if ( $nick == %challenger1 ) {
      if ( $1 == Rock ) { notice %challenger1 You've chosen Rock. | set %challenger1.choice 1 }
      if ( $1 == Paper ) { notice %challenger1 You've chosen Paper. | set %challenger1.choice 2 }
      if ( $1 == Scissors ) { notice %challenger1 You've chosen Scissors. | set %challenger1.choice 3 }
      if (( $1 == $null ) || (( $1 != Rock ) && ( $1 != Paper ) && ( $1 != Scissors )) { notice %challenger1 You must choose Rock or Paper or Scissors }
    }
    if ( $nick == %challenger2 ) {
      if ( $1 == Rock ) { notice %challenger2 You've chosen Rock. | set %challenger2.choice 1 }
      if ( $1 == Paper ) { notice %challenger2 You've chosen Paper. | set %challenger2.choice 2 }
      if ( $1 == Scissors ) { notice %challenger2 You've chosen Scissors. | set %challenger2.choice 3 }
      if (( $1 == $null ) || (( $1 != Rock ) && ( $1 != Paper ) && ( $1 != Scissors )) { notice %challenger2 You must choose Rock or Paper or Scissors }
    }
    if (( $nick != %challenger1 ) || ( $nick != %challenger2 )) { notice $nick You'll have to wait until a free round if you want to play. }
  }
  if ( %RPS == $null ) { /notice $nick You must first initiate the game by saying !RPS and then follow the instructions. }
}

on *:Text:!Finished:#chan: {
  if ( %RPS == $null ) { msg # 14You must first initiate RPS by typing !RPS }
  if ( %RPS == 1 ) { msg # 14You need 2 contenders before the game can start. }
  if ( %RPS == 2 ) { 
    if ( $nick != %challenger1 && $nick != %challenger2 ) { msg # You must be a contender in order to finish the round. | Halt }
    if ( %challenger1.choice == $null || %challenger2.choice == $null ) { msg # 14You must wait for 11both 14contenders to decide on their weapon. }
    if ( %challenger1.choice != $null && %challenger2.choice != $null ) {
      if ( %challenger1.choice == 1 && %challenger2.choice == 1 ) { msg # 4 $+ %challenger1 14chose: 8Rock. 9 $+ %challenger2 14chose: 8Rock. 4TIE GAME! NO WINNER! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 1 && %challenger2.choice == 2 ) { msg # 4 $+ %challenger1 14chose: 8Rock.  9 $+ %challenger2 14chose: 8Paper. 9 $+ %challenger2 14has beaten 4 $+ %challenger1 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 1 && %challenger2.choice == 3 ) { msg # 4 $+ %challenger1 14chose: 8Rock. 9 $+ %challenger2 14chose: 8Scissors.  4 $+ %challenger1 14has beaten 9 $+ %challenger2 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 2 && %challenger2.choice == 1 ) { msg # 4 $+ %challenger1 14chose: 8Paper. 9 $+ %challenger2 14chose: 8Rock. 4 $+ %challenger1 14has beaten 9 $+ %challenger2 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 2 && %challenger2.choice == 2 ) { msg # 4 $+ %challenger1 14chose: 8Paper. 9 $+ %challenger2 14chose: 8Paper. 4TIE GAME! NO WINNER! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 2 && %challenger2.choice == 3 ) { msg # 4 $+ %challenger1 14chose: 8Paper. 9 $+ %challenger2 14chose: 8Scissors. 9 $+ %challenger2 14has beaten 4 $+ %challenger1 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 3 && %challenger2.choice == 1 ) { msg # 4 $+ %challenger1 14chose: 8Scissors. 9 $+ %challenger2 14chose: 8Rock.  9 $+ %challenger2 14has beaten 4 $+ %challenger1 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 3 && %challenger2.choice == 2 ) { msg # 4 $+ %challenger1 14chose: 8Scissors. 9 $+ %challenger2 14chose: 8Paper. 4 $+ %challenger1 14has beaten 9 $+ %challenger2 $+ 14!!! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
      if ( %challenger1.choice == 3 && %challenger2.choice == 3 ) { msg # 4 $+ %challenger1 14chose: 8Scissors. 9 $+ %challenger2 14chose: 8Scissors. 4TIE GAME! NO WINNER! | unset %challenger1 | unset %challenger2 | unset %RPS | unset %challenger1.choice | unset %challenger2.choice | halt }
    }
  }
 Respond  
wizard38   -  Apr 28, 2009

choose between paper, scissors and stone, and bet your points

you choose paper and betting 50 points, waiting for my turn

1 minute later .....

I choose rock, rock beats paper and you lose 50 points
this is what i'm talking about, and nobody makes this game

 Respond  
PackRat   -  Apr 28, 2009

There are a couple of things I would've done differently, like there's no real reason to halt the script if %RPS is false (!%RPS or %RPS == $null) and instead of checking if $1 is null or != rock I'd use if/else if/else if/else.

 Respond  
Aucun50   -  Apr 27, 2009

Looks nice could be a bit shorter. Something you could do is "if ( %RPS == $null )" to "if (!%RPS)" it's the same thing but less typing, for your on notice add a else so if they type papr or rokc as a typo it well notice them back that there was an error and show to commands or words they can use.

 Respond  
EMMURE   -  Apr 27, 2009

idk many of the $command things. :/ although i could have 3 statements for the first player, then the diff outcomes of %challenger2.choice. :L

 Respond  
PATX   -  Apr 27, 2009

lol my bad, but yeah thatta way it will work on all channels.

 Respond  
EMMURE   -  Apr 27, 2009

lol. i was ganna say... :L never saw that one :P

 Respond  
Zeppelin382   -  Apr 27, 2009

Too many if statements, it all looks the same.

Also, I'm sure there's a better way to decide who won rather than those 9 if statements.

One more thing, add halt's for things you don't want, like the !rps !accept thing I told you about.

 Respond  
PATX   -  Apr 27, 2009

ooo. its not %chan its $chan dollar sign

 Respond  
PATX   -  Apr 27, 2009

no $chan is all chans... change it!

 Respond  
EMMURE   -  Apr 27, 2009

%chan? but wouldnt you have to set it? or is it a preset var with the current chan? o.O

 Respond  
PATX   -  Apr 27, 2009

rating: 5 (average)
reason: change #ethan to $chan. code is mediocre meaning sloppy.

 Respond  
chadbdurham   -  Apr 27, 2009

You should change #ethan to %chan or #

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.