alias set_players { }
alias stop_hangman {
if (%hangman.status == Running) {
msg %hangman.chan The current game has been stopped.
set %hangman.status off | unset %player* | unset %curr* | hfree Players | unset %nick* | unset players*
}
else { msg %hangman.chan The game is not running right now! | halt }
}
alias start_hangman {
if (%hangman.chan == $null) {
set %hangman.chan $input(Enter the name of the channel hangman will play in:,egoq)
begin
}
else { begin | set %hangman.status on | set %players 1 }
}
alias begin {
if (%hangman.status == off) {
if ($hget(Players) == $null) {
hmake -s Players 10
msg %hangman.chan Hangman is now started. To participate, please do !join, remember up to 5 people at a time please.
}
else {
msg %hangman.chan Hangman is now started. To participate, please do !join, remember up to 5 people at a time please.
}
}
elseif (%hangman.status == Running) {
msg %hangman.chan Hangman is currently being played. To turn it off type !hmstop.
}
else { halt }
}
on *:text:*:%hangman.chan: {
if ($1 == !hmstop) { stop_hangman }
if ($1 == !hmstart) { start_hangman }
if ($1 == !join) {
if (%hangman.status == off) || (%hangman.status == $null) {
msg %hangman.chan Hangman is not currently running, we will not be accepting players at this time, sorry. | halt
}
else {
if (%hangman.status == Running) {
msg %hangman.chan Hangman is currently running, please wait until the game is over to sign up. | halt
}
else {
if (%players < 6) {
if ($hget(Players,$+($nick,.joined)) = $true ) {
msg %hangman.chan Sorry but you already have registered, let other people play.
}
else {
msg %hangman.chan Ladies and Gentlemen, $nick has joined the game! We now have %players Players ready to play.
hadd Players $+($nick,.joined) $true
inc %players
}
}
elseif (%players > 4) {
msg %hangman.chan We have all 5 players registered and ready to play. Game will begin.
start
}
}
}
}
if ($1 == !guess) {
if ($2 == $null) {
msg %hangman.chan $nick Sorry but you need to actually guess the letter (Syntax: !guess <letter>)
halt
elseif ($2 == A) or ($2 == a) { set %curr.letter $2 | set %curr.letter $reptok(%curr.word.masked,%curr.letter,1,46) }
elseif ($2 == B) or ($2 == b) { set %curr.letter $2 | set %curr.letter $reptok(%curr.word.masked,%curr.letter,1,46) }
elseif ($2 == C) or ($2 == c) { set %curr.letter $2 | set %curr.letter $reptok(%curr.word.masked,%curr.letter,1,46) }
elseif ($2 == D) or ($2 == d) { set %curr.letter $2 | set %curr.letter $reptok(%curr.word.masked,%curr.letter,1,46) }
elseif ($2 == E) or ($2 == e) { set %curr.letter $2 | set %curr.letter $reptok(%curr.word.masked,%curr.letter,1,46) }
elseif ($2 == F) or ($2 == f) { set %curr.letter $2 | set %curr.letter $reptok(%curr.word.masked,%curr.letter,1,46) }
}
}
}
alias addhangword { }
alias addhangsent { }
alias remhangword { }
alias remhangsent { }
alias start {
set %hangman.status Running
set %curr.round 1
msg %hangman.chan Round %curr.round is now underway and our first word is:
set %curr.word $read($scriptdir\words.txt)
set %curr.word.masked $str($+(_,$chr(32)),$len(%curr.word))
msg %hangman.chan %curr.word.masked
}