Administrators chain Posted February 13, 2010 Administrators Report Share Posted February 13, 2010 I was talking to my m8 on irc and he wanted to learn how to script.I said I'm not the best scripter, but I'd help as much as I could So he asked if I could show him how to make a Rock Paper Scissors script so I did. Just load it into your bots remotes and simply type !rps name It's currently only set to do it on any channel with .!@ all triggering the same thing. Type !roundup, @roundup, or .roundup to view your current score. It shows your total games, wins, losses, and draws. There may be a few mistakes, but it still works. Any feedback? Pm me on swiftirc, my nick is Mark|. Credits go to Kylar for helping with $calc(%var), and other #msl helpers for a few mismatches and stuff >alias logo return 14*** 14(04 $+ $1- $+ 14)on $*:TEXT:/^[@!.]rps */Si:#:{ if ($nick !isreg $chan) { if (!$2) { $iif($left($1,1) == @,msg $chan,notice $nick) $logo(Error!) You have to specify someone to play with!! | halt } else { var %list Rock|Paper|Scissors inc %games [ $+ [ $nick ] ] set %opponent $2 set %opponenthand $gettok(%list,$r(1,$numtok(%list,124)),124) set %nickhand $gettok(%list,$r(1,$numtok(%list,124)),124) msg $chan $logo(Rock-Paper-Scissors) 04 $+ $nick 14has challenged04 %opponent 14to a "Rock, Paper, Scissors" match! describe $chan watches both competators shaking fists up and down 3 times then waits... if (%nickhand == %opponenthand) { inc %draws [ $+ [ $nick ] ] .timer 1 2 msg $chan $logo(DRAW) Both04 $nick 14and04 %opponent 14have the same hand shape! It's a 04draw! .timer 1 2 notice $nick $logo(Round-Up) You have drew04 %draws [ $+ [ $nick ] ] 14 time(s)! | halt } if (%nickhand == Rock) && (%opponenthand == Scissors) { inc %wins [ $+ [ $nick ] ] .timer 1 2 msg $chan $logo(WIN) 04 $+ $nick $+ 's %nickhand 14smashes14 %opponent $+ 's Scissors 14making04 $nick 14take the victory! .timer 1 2 notice $nick $logo(Round-Up) You have won04 %wins [ $+ [ $nick ] ] 14time(s)! To view your overall performance, type !roundup | halt } if (%nickhand == Scissors) && (%opponenthand == Rock) { inc %losses [ $+ [ $nick ] ] .timer 1 2 msg $chan $logo(LOSE) 04 $+ $nick $+ 's Scissors14 were smashed by04 %opponent $+ 's Rock 14making04 %opponent 14take the victory! .timer 1 2 notice $nick $logo(Round-Up) You have lost04 %losses [ $+ [ $nick ] ] 14time(s)! To view your overall performance, type !roundup | halt } if (%nickhand == scissors) && (%opponenthand == paper) { inc %wins [ $+ [ $nick ] ] .timer 1 2 msg $chan $logo(WIN) 04 $+ $nick $+ 's %nickhand 14chops up14 %opponent $+ 's paper 14making04 $nick 14take the victory! .timer 1 2 notice $nick $logo(Round-Up) You have won04 %wins [ $+ [ $nick ] ] 14time(s)! To view your overall performance, type !roundup | halt } if (%nickhand == paper) && (%opponenthand == scissors) { inc %losses [ $+ [ $nick ] ] .timer 1 2 msg $chan $logo(LOSE) 04 $+ $nick $+ 's paper14 gets chopped up by04 %opponent $+ 's scissors 14making04 %opponent 14take the victory! .timer 1 2 notice $nick $logo(Round-Up) You have lost04 %losses [ $+ [ $nick ] ] 14time(s)! To view your overall performance, type !roundup | halt } if (%nickhand == Rock) && (%opponenthand == Paper) { inc %losses [ $+ [ $nick ] ] .timer 1 2 msg $chan $logo(LOSE) 04 $+ %opponent $+ 's %opponenthand 14covers over04 $nick $+ 's %nickhand 14making04 $nick 14take the victory! .timer 1 2 notice $nick $logo(Round-Up) You have lost04 %losses [ $+ [ $nick ] ] 14time(s)! To view your overall performance, type !roundup | halt } if (%nickhand == Paper) && (%opponenthand == Rock) { inc %wins [ $+ [ $nick ] ] .timer 1 2 msg $chan $logo(WIN) 04 $+ %opponent $+ 's %opponenthand 14gets stuck under04 $nick $+ 's %nickhand 14making04 %opponent 14take the victory! .timer 1 2 notice $nick $logo(Round-Up) You have won04 %wins [ $+ [ $nick ] ] 14time(s)! To view your overall performance, type !roundup | halt } } } else { notice $nick $logo(NOOOO) You're not using it! | halt }}on $*:TEXT:/^[@!.]roundup\b/Si:#:{ if (%games [ $+ [ $nick ] ] >= 1) { $iif($left($1,1) == @,msg $chan,notice $nick) $logo(Round-Up) 04 $+ $nick $+ 14's personal score: Total number of games04 %games [ $+ [ $nick ] ] $+ 14, Total wins:04 $calc(%wins [ $+ [ $nick ] ] ) 14, Total losses:04 $calc(%losses [ $+ [ $nick ] ] ) 14, And total number of draws:04 $calc(%draws [ $+ [ $nick ] ] ) 14. | halt } else { $iif($left($1,1) == @,msg $chan,notice $nick) $logo(Round-Up) Silly04 $nick 14! You must start your own game before you get scores! | halt }} Link to comment Share on other sites More sharing options...