Number Game
Platform: mIRC
Published Aug 26, 2010
Updated Apr 22, 2012
This little snippet will let u try and guess a number it has picked in the least amount of guess's. It will also let you know if your to high or to low on each guess, and it keeps the lowest score and the nick. Load it into a clean remote and save it as NumberGame.mrc. It will automatically create a file called highscore.ini and the rest is easy. It isnt much but at least i'm trying, Got to start somewhere hehehe.
Also if u decide to unload it you can click unset switches in the channel menu before you unload it and it will unset the games switches.
Triggers:
1. !startgame = To start the game
2. !guessnumber = To try and guess the number
3. !stopgame = To stop the game
4. !!help = To play these instructions at anytime.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Scripted on 8-1-10 ;;
;; Updated: 12-9-10 ;;
;; Updated: 6-13-11 ;;
;; updated: 12-23-11 ;;
;; Author Jon_2 AKA Warriorii ;;
;; Tested By Luvme4me ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;You can only play in one channel at a time or all the channels will use the same guess's and scores
;=======================================================================================
on *:load: { echo 12 -a Jon_2's Number Game has been loaded. Type 4 !!help 12 for instructions at any time }
on *:unload: { unset -s %gswitch %tries %rn %guesses %high }
menu channel {
Number Game
.List Channel: if ($read numbergame.txt == $null) echo $+ $ja $+ 0,12 No Channel Has Been Set $+ $ja | else /.play -e numbergame.txt
;.List Channel: /.play -e numbergame.txt
.Check Low Score: if (%high == 50) echo 12 There is no Low Score yet | else echo $ja $+ 8,1 $read(highscore.ini) With %high Guesses $+ $ja | { halt }
.Remove User: write -c highscore.ini | unset -s %high $chan
.Open Highscore.ini:run notepad $scriptdirhighscore.ini
.-
.Send To $$1:send $$1 $script | /msg $chan 12Move NumberGame.mrc To main mIRC dir | /msg $chan 12then type===> 4 /load -rs NumberGame.mrc
.Unset Switches: unset -s %rn %gswitch %high %tries %guesses
.Add Channel: {
if (!$read(numbergame.txt , w ,$chan)) {
write numbergame.txt $chan
echo 0,12 $chan added to numbergame.txt
}
else echo 0,12 $chan Is already in numbergame.txt
}
.Del Channel: {
if ($read(numbergame.txt , w ,$chan)) {
write -ds $+ $chan numbergame.txt
echo $ka2 $+ 8,4 $chan Removed from numbergame.txt $+ $ka2
}
else echo $ka $+ 9,1 $chan Is not in numbergame.txt $+ $ka
}
}
on *:text:!numbergame*:#: {
if (!$read(numbergame.txt , w ,$chan)) { return }
msg $chan 12For help with triggers type !!help
if (%high == $null) set %high 50
if (%gswitch == on) { msg $chan $ja $+ 8,1 There is a game in progress, Please finish this game first. Type !guess and your number or you can type !stopgame then type !numbergame $+ $ja | { halt } }
else set %rn $rand(0,1000) | { set %gswitch on | msg $chan 4 A new game is started. Type !guess and a number from 1 to 1000 | echo 3 -a %rn }
if (%high == 50) { msg $chan 4Low score and it's owner will be shown at the end of this game. }
else { msg $chan $ja $+ 8,1 $read(highscore.ini) holds Low Score of %high $+ $ja }
}
on 1:text:!stopgame:#: {
if (!$read(numbergame.txt , w ,$chan)) { return }
if (%gswitch != on) msg $chan $ja $+ 8,1 There is no game to stop :/ $+ $ja
if (%rn != $null) .msg $chan $ja $+ 8,1 The game has been stopped. The number was %rn $+ . $+ $ja
.timermsg1 off
.timerguess1 off
.timerguess off
set %gswitch off | unset %tries | unset %rn | unset %guesses
}
on +1:text:*!guess*:#: {
if (!$read(numbergame.txt , w ,$chan)) { return }
inc %guesses
inc %tries
if (%gswitch != on) { msg $chan $ja $+ 9,1 There is no game in progress. To start a new game type !numbergame $+ $ja | unset %tries | unset %guesses | halt }
.timermsg1 1 60 msg $chan $ja $+ 8,1 Game has auto stopped. $+ $ja
.timerguess1 1 60 set %gswitch off
.timerguess 1 60 unset %tries unset %rn unset %guesses
if (%guesses => %high) { msg $chan $ja $+ 9,1 Sorry $nick $+ , you did not beat $read(highscore.ini) $+ 's low score of %high $+ $ja | .timermsg1 off | .timerguess1 off | .timerguess off | set %gswitch off | unset %tries %rn %guesses $+ $ja | halt }
;if (%guesses => %high) { msg $chan $ja $+ 8,1 Sorry you did not beat $read(highscore.ini) $+ 's low score of %high $+ $ja | set %gswitch off | unset %tries | unset %rn | unset %guesses $+ $ja | halt }
if (!$2) { msg $chan 0,4 ALERT!! 0,12MORON IN THE CHANNEL!!0,4 ALERT!! 0 7You must also type a number :/ | halt }
elseif ($2 > 1000) { msg $chan 12That number is out of range $nick $+ , Please enter a valid number from 1 to 1000 | halt }
elseif ($2 < %rn) { msg $chan Sorry that number is to low try again $nick | HALT }
elseif ($2 > %rn) { msg $chan Sorry that number is to high, try again $nick | HALT }
elseif ($2 == %rn) { msg $chan $ja $+ 9,1 Congratulations $nick you guessed the number. It was %rn $+ $ja | set %gswitch off | unset %guesses }
.timermsg1 off
.timerguess1 off
.timerguess off
unset %rn
msg $chan $ja $+ 9,1 You got the correct answer in %tries tries $+ $ja
if (%high == 50) { msg $chan 4Creating highscore.ini file and writing 1st low score nick. | write -c highscore.ini $nick | set %high %tries | .timer1 1 4 msg $chan 12All Finished $nick }
elseif (%tries < %high) { msg $chan $ja $+ 8,1 $read(highscore.ini) Held old record with %high tries $+ $ja | write -c highscore.ini $nick | set %high %tries }
unset %tries %rn
}
alias ja return 14,5«15,4¤14,5»
on 1:text:!!help:#: {
notice $nick 1. To start the game type !numbergame | notice $nick 2. To guess the number type !guess your number here | notice $nick 3. To stop the game type !stopgame
}