alias -l scramble {
var %a,%b $1
while ($numtok(%a,32) < $len($1)) var %a $addtok(%a,$r(1,$len($1)),32)
return $regsubex(%a,/(\S+(?: |$))/g,$mid(%b,\1,1))
}
alias -l s_new {
var -g %s_word $read(words.txt),%s_scramble $scramble(%s_word)
msg $1 The scrambled word is: %s_scramble $+ . Type !guess to guess
msg $1 You have [20] seconds.
.timerscramble 1 20 s_fail $1
}
alias -l s_fail {
msg $1 No one got it! The word was: %s_word
msg $1 Time for new word...
unset %s_word
.timerscramble 1 3 s_new $1
}
alias -l s_cleanup {
.timerscramble off
unset %s_word %s_scramble
}
on *:TEXT:!scramble &:#: {
if ($2 == start) {
if (%s_scramble) notice $nick The game is already going... Type !word to see what the scrambled word it is
else s_new #
}
elseif ($2 == stop) {
if (%s_scramble) {
msg # Game stopped by $nick $+ .
s_cleanup
}
}
}
on *:TEXT:!guess &:#: {
if (%s_word) {
if ($2 == %s_word) {
msg # Great work $nick $+ ! You correctly guessed the scrambled word was: %s_word
msg # Time for new word...
unset %s_word
.timerscramble 1 3 s_new #
}
elseif ($2 != %s_word) msg # Wrong $nick $+ , try again. You have [[ $+ $timer(scramble).secs $+ ]] seconds left.
}
}
on *:TEXT:!word:#: if (%s_word) notice $nick The scrambled word is: %s_scramble $+ , you have [[ $+ $timer(scramble).secs $+ ]] seconds left.