on *:TEXT:!numbers*:#:{
if ($read(over.txt) == Started) { halt }
set %rnum $rand(1,25)
write join.txt [ $+ [ $chan ] ] $nick
msg $chan $nick has started the random number game. 2 minutes till game starts, type !join to join in.
timer 0 120 write over.txt Started
}
on *:TEXT:!join*:#:{
if ($read(over.txt) == Started) { timers off | halt }
if ($lines(over.txt) = 10) { msg $chan We now have 10 players, type !guess 1-25 to start }
if ($lines(over.txt) > 10) { notice $nick There is already a game going on! | halt }
write join.txt [ $+ [ $chan ] ] $nick
msg $chan We now have $lines(join.txt) players.
}
on *:!guess*:#:{
if ($read(over.txt) == Started) {
if ($read(over.txt,$chan,$nick)) {
write guess.txt [ $+ [ $chan ] ] $2
msg $chan $nick guessed $2 and was...
if ($2 == %rnum) {
timer 0 5 msg $chan RIGHT!
unset %rnum
remove over.txt
remove join.txt
}
else {
timer 0 5 msg $chan $nick was WRONG. He was apprx, $calc(%rnum / $2 ($rand(-,+) 3)) off.
}
}
}
}