Rock Paper Scissors Game

By vSkyzv on Nov 05, 2008

This is an update to vaseline28's script here: http://www.hawkee.com/snippet/4381/ since it has not been updated in two years.

Update 11/05/08:

  • Bug fixed: In his older version, he used "isin $1" which allowed people to type something like"!rockpaperscissors i" and actually have "i" recognized as a legitimate choice. I've fixed this problem by changing the isin to regex.
  • Shortened command: The previous command was "!rockpaperscissors". With my new regex update, I can shorten the command to "!rps" or whatever you like.

Update 2 11/05/08:

  • Added score tracking
on *:text:!rps*:#: {
  if ($calc( $regex( $2 ,rock) + $regex( $2 ,paper) + $regex( $2 ,scissors) ) != 1) { msg $chan [4 $+ $nick $+ ] You've got to choose Rock, Paper or Scissors! | halt }
  var %PlayerChoice $2 | /var %PlayerChoiceNum $replace(%PlayerChoice,Paper,2,Rock,1,Scissors,0) | /var %ScriptChoiceNum $rand(0,2) | /var %ScriptChoice $replace(%ScriptChoiceNum,2,Paper,1,Rock,0,Scissors)
  if (%PlayerChoice == %ScriptChoice) {
    msg $chan [4 $+ $nick $+ ] <Your Choice:4 $replace($($upper($left(%PlayerChoice,1)) $+ $right(%PlayerChoice,-1)),$chr(32),$chr(32)) > <My Choice:4 %ScriptChoice > It's a draw! 
    halt
  }
  elseif (($calc(%ScriptChoiceNum - %PlayerChoiceNum) == 1) || ($calc(%ScriptChoiceNum - %PlayerChoiceNum) == -2)) { var %winner $me | inc %rps. [ $+ [ %winner ] ] }
  else { var %winner $nick | inc %rps. [ $+ [ %winner ] ] }
  msg $chan [4 $+ $nick $+ ] <Your Choice:4 $replace($($upper($left(%PlayerChoice,1)) $+ $right(%PlayerChoice,-1)),$chr(32),$chr(32)) > <My Choice:4 %ScriptChoice > [4 $+ %Winner $+ ] has won! <Score: %rps. [ $+ [ %winner ] ] $+ >
}

Comments

Sign in to comment.
neesh121   -  Nov 12, 2015

At evenfall its be in poor health children roaming residential streets all in report to intensity of Ground At darkish it's sr. children and tiny youth years terrorizing these assonant neighborhoods. Testo Roar Ulterior it is the experienced teens theoretical children and newborn and not therefore actress adults. Mix in lightproof costumes that slip saliency and mobility and you jazz a recipe for error. http://guidemesupplements.com/is-testo-roar-scam/

 Respond  
dma   -  Nov 12, 2015

nice short game

 Respond  
wizard38   -  Nov 06, 2008

can you put this game with a timer?60 seconds?the player picks and 60 seconds after the scipt give the answer
thanks

 Respond  
napa182   -  Nov 05, 2008

it works fine for me

instead of this line

if ($calc( $regex( $2 ,rock) + $regex( $2 ,paper) + $regex( $2 ,scissors) ) != 1) { msg $chan [4 $+ $nick $+ ] You've got to choose Rock, Paper or Scissors! | halt }

you can use

if (!$regex($2,/^(rock|paper|scissors)$/i)) { msg $chan [4 $+ $nick $+ ] You've got to choose Rock, Paper or Scissors! | halt }

or

if (!$istok(rock paper scissors,$2,32)) { msg $chan [4 $+ $nick $+ ] You've got to choose Rock, Paper or Scissors! | halt }

they both work just fine.

 Respond  
vSkyzv   -  Nov 05, 2008

I am not sure if that will work, but thanks for the comment anyways.

Edit: Does not seem to work.

 Respond  
napa182   -  Nov 05, 2008

you could just use $istok

if (!$istok(rock paper scissors,$2,32)) {

or for the regex this will work

if (!$regex($2,/^(rock|paper|scissors)$/i)) {
 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.