Again, the idea here was to keep it compact. The script randomly picks one type for itself and then uses math(s) to determine who the winner is.
I've been seeing a number of Rock,Paper,Scissors games around and decided to make one for myself.
Script is prompted by !RockPaperScissors <your choice of Rock,Paper,Scissors> .
The math(s) works simply that the way it is worked out, whichever wins, the only available winning calculations are 1 or -2. All others lose.
This also converts the user's first letter of their word to capital (!Rockpaperscissors rock would turn to "Rock")
Examples:
<~Goofy|Around> !RockPaperScissors pencilsharpenings
**[ Goofy|Around ]** You've got to choose Rock, Paper or Scissors! <~Goofy|Around> !RockPaperScissors scissors **[ Goofy|Around ]** It's a draw! <~Goofy|Around> !RockPaperScissors Rock **[ Goofy|Around ]** **Goofy|Around** has won! ***Thanks to Goofy|Around (Scakk here) for the endless testing and the script for changing the first letter of the user's input to a capital!*** ```mirc on *:text:!RockPaperScissors*:#: { if ($2 !isin $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 ] It's a draw! halt } elseif (($calc(%ScriptChoiceNum - %PlayerChoiceNum) == 1) || ($calc(%ScriptChoiceNum - %PlayerChoiceNum) == -2)) { var %winner $me } else { var %winner $nick } msg $chan [4 $nick ] [4 %Winner ] has won! } ``` var -s %PlayerChoice $2 | /var -s %PlayerChoiceNum $replace(%PlayerChoice,Paper,2,Rock,1,Scissors,0) | /var -s %ScriptChoiceNum $rand(0,2) | /var -s %ScriptChoice $replace(%ScriptChoiceNum,2,Paper,1,Rock,0,Scissors)
can\'t that be changed to
var -s %PlayerChoice $2, -s %PlayerChoiceNum $replace(%PlayerChoice,Paper,2,Rock,1,Scissors,0), -s %ScriptChoiceNum $rand(0,2), -s %ScriptChoice $replace(%ScriptChoiceNum,2,Paper,1,Rock,0,Scissors)
8/10 good script i had to change it some so its easier to use.
on *:text:!rps*:#: {
if ($2 == p) { var %PlayerChoice Paper | goto rps }
if ($2 == r) { var %PlayerChoice Rock | goto rps }
if ($2 == s) { var %PlayerChoice Scissors | goto rps }
if ($2 == paper) { var %PlayerChoice $2 | goto rps }
if ($2 == rock) { var %PlayerChoice $2 | goto rps }
if ($2 == scissors) { var %PlayerChoice $2 | goto rps }
else { msg $chan [4 $nick ] You\'ve got to choose Rock, Paper or Scissors! | halt }
:rps
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 }
var %PlayerChoiceNum $replace(%PlayerChoice,Paper,2,Rock,1,Scissors,0)
if (($calc(%ScriptChoiceNum - %PlayerChoiceNum) == 1) || ($calc(%ScriptChoiceNum - %PlayerChoiceNum) == -2)) { var %winner $me }
else { var %winner $nick }
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!
}
all those \'4\'s in my script are sopose to have the color box.. it isn\'t showing up in code... i wonder why?