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*
}
elseif (%hangman.status == Offline) {
msg %hangman.chan The bot is not running. If you want to start it up, type !hmstart | halt
}
elseif (%hangman.status == on) {
msg %hangman.chan Hangman is not running but the bot is running. If you want to shut it down, type !hmshutdown | halt
}
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
}
elseif (%hangman.status == Running) {
msg %hangman.chan Hangman is already running! | halt
}
elseif (%hangman.status == Offline) {
msg %hangman.chan The bot is not running. If you want to start it up, type !hmrun | halt
}
elseif (%hangman.status == Online) { begin | set %hangman.status On }
else { begin | set %hangman.status on }
}
alias begin {
if (%hangman.status == Online) {
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 == !hmshutdown) { set %hangman.status Offline | msg %hangman.chan Hangman is now offline, sorry, maybe another time. | halt }
if ($1 == !hmrun) { set %hangman.status Online | msg %hangman.chan Hangman is now online, you may start a game with !hmstart | halt }
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 < 3) {
if ($hget(Players,$+($nick,.joined)) = $true ) {
msg %hangman.chan Sorry but you already have registered, let other people play.
}
else {
hadd Players $+($nick,.joined) $true
inc %players
set %players.left $calc(%players - %players.left)
msg %hangman.chan $nick has joined the game! We have %players out of %players.left to possibly join.
}
}
elseif (%players > 3) {
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) || ($2 == a) { set %curr.letter $2 | set %curr.letter.guess $reptok(%curr.word.masked,%curr.letter.guess,1,46) }
elseif ($2 == B) || ($2 == b) { set %curr.letter $2 | set %curr.letter.guess $reptok(%curr.word.masked,%curr.letter.guess,1,46) }
elseif ($2 == C) || ($2 == c) { set %curr.letter $2 | set %curr.letter.guess $reptok(%curr.word.masked,%curr.letter.guess,1,46) }
elseif ($2 == D) || ($2 == d) { set %curr.letter $2 | set %curr.letter.guess $reptok(%curr.word.masked,%curr.letter.guess,1,46) }
elseif ($2 == E) || ($2 == e) {
set %curr.letter $2 | set %curr.letter.guess $reptok( %curr.word.masked, %curr.letter.guess,1,46)
echo -a All: $reptok(%curr.word.masked,%curr.letter.guess ,1,46)
echo -a Masked: %curr.word.masked
echo -a Letter: %curr.word.letter
}
elseif ($2 == F) || ($2 == f) {
set %curr.letter $2 | set %curr.letter.guess $reptok(%curr.word.masked,%curr.letter.guess,1,46)
echo -a $reptok(%curr.word.masked,%curr.letter.guess,1,46)
echo -a Masked: %curr.word.masked
echo -a Letter: %curr.word.letter
}
}
}
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
}