Top

Rock Paper Scissors Game


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Nov 05, 2008
Last Updated  Nov 05, 2008
Tags  game  paper  rock  rps  scissors 

Introduction

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

Grab the Code

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

  (4)  RSS
napa182
Comments: 1,455
 
mIRC Snippet:  Rock Paper Scissors Game
Posted on Nov 5, 2008 11:09 pm
you could just use $istok
Code:
if (!$istok(rock paper scissors,$2,32)) {


or for the regex this will work
Code:
if (!$regex($2,/^(rock|paper|scissors)$/i)) {

vSkyzv
Comments: 22
 
mIRC Snippet:  Rock Paper Scissors Game
Posted on Nov 5, 2008 11:15 pm
I am not sure if that will work, but thanks for the comment anyways.

Edit: Does not seem to work.
napa182
Comments: 1,455
 
mIRC Snippet:  Rock Paper Scissors Game
Posted on Nov 5, 2008 11:36 pm
it works fine for me

instead of this line
Code:
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
Code:
if (!$regex($2,/^(rock|paper|scissors)$/i)) { msg $chan [4 $+ $nick $+ ] You've got to choose Rock, Paper or Scissors! | halt }


or
Code:
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.
wizard38
Comments: 24
 
mIRC Snippet:  Rock Paper Scissors Game
Posted on Nov 6, 2008 7:00 am
can you put this game with a timer?60 seconds?the player picks and 60 seconds after the scipt give the answer
thanks

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom