;EmeraldBOT GHOST ;(C) 2002-2006 Andrew Fader ;This script may be freely used and distributed provided this message and the !ghost credits message remain present alias lose { ;syntax: lose ;record that $1 has lost a game in records.ini if ($readini records.ini $1 l != $null) { set %lost $readini records.ini $1 l } else { writeini records.ini $1 l 0 %lost = 0 } inc %lost writeini records.ini $1 l %lost } alias gaminc { ;syntax gaminc ;record that $1 has played a game in records.ini ;this is necessary because records.ini finds out wins by doing (games - losses) if ($readini records.ini $1 g != $null) { set %games $readini records.ini $1 g } else { writeini records.ini $1 g 0 %games = 0 } inc %games writeini records.ini $1 g %games } alias egain { ;this does the endgame money distribution for regular ghost set -s %egainplayer 1 set -s %winners $null while %egainplayer <= %players { if ($eval(% $+ turn $+ %egainplayer, 2) != %loser) { set -s %amount $eval(% $+ wager $+ $eval(% $+ turn $+ %egainplayer, 2), 2) set -s %loseamount $eval(% $+ wager $+ %loser, 2) set -s %egain $calc((%amount / (%origpot - %loseamount)) * %pot) %egain = $ceil(%egain) moneygive $eval(% $+ turn $+ %egainplayer, 2) %egain set -s %winners %winners $eval(% $+ turn $+ %egainplayer, 2) gets € $+ %egain $+ ; } inc %egainplayer } msg $chan %winners } alias superegain { ;this does the endgame money distribution for superghost set -s %egainplayer 1 set -s %winners $null while %egainplayer <= %superplayers { if ($eval(% $+ superturn $+ %egainplayer, 2) != %loser) { set -s %amount $eval(% $+ superwager $+ $eval(% $+ superturn $+ %egainplayer, 2), 2) set -s %loseamount $eval(% $+ superwager $+ %loser, 2) set -s %egain $calc((%amount / (%superorigpot - %loseamount)) * %superpot) %egain = $ceil(%egain) moneygive $eval(% $+ superturn $+ %egainplayer, 2) %egain set -s %winners %winners $eval(% $+ superturn $+ %egainplayer, 2) gets € $+ %egain $+ ; } inc %egainplayer } msg $chan %winners } alias xegain { ;this does the endgame money distribution for xghost set -s %egainplayer 1 set -s %winners $null while %egainplayer <= %xplayers { if ($eval(% $+ xturn $+ %egainplayer, 2) != %loser) { set -s %amount $eval(% $+ xwager $+ $eval(% $+ xturn $+ %egainplayer, 2), 2) set -s %loseamount $eval(% $+ xwager $+ %loser, 2) set -s %egain $calc((%amount / (%xorigpot - %loseamount)) * %xpot) %egain = $ceil(%egain) moneygive $eval(% $+ xturn $+ %egainplayer, 2) %egain set -s %winners %winners $eval(% $+ xturn $+ %egainplayer, 2) gets € $+ %egain $+ ; } inc %egainplayer } msg $chan %winners } alias recordchallenge { if ($readini records.ini $1 ch != $null) { var %ch $readini records.ini $1 ch } else { writeini records.ini $1 ch 0 %ch = 0 } inc %ch writeini records.ini $1 ch %ch } alias recordlosingchallenge { if ($readini records.ini $1 lch != $null) { var %lch $readini records.ini $1 lch } else { writeini records.ini $1 lch 0 %lch = 0 } inc %lch writeini records.ini $1 lch %lch } alias recordbluff { if ($readini records.ini $1 bf != $null) { var %bf $readini records.ini $1 bf } else { writeini records.ini $1 bf 0 %bf = 0 } inc %bf writeini records.ini $1 bf %bf } alias recordlosingbluff { if ($readini records.ini $1 lbf != $null) { var %lbf $readini records.ini $1 lbf } else { writeini records.ini $1 lbf 0 %lbf = 0 } inc %lbf writeini records.ini $1 lbf %lbf } alias landonword { if ($readini records.ini $1 land != $null) { var %land $readini records.ini $1 land } else { writeini records.ini $1 land 0 %land = 0 } inc %land writeini records.ini $1 land %land } alias challengenot { ;if a challenge succeeds in regular ghost, call this set -s %bonus $floor($calc(.1 * %origpot)) msg $chan %currentword is not a word beginning and %lastplayer loses... $nick gets a challenge bonus of %bonus $+ ! moneygive $nick %bonus recordchallenge $nick set -s %loser %lastplayer egain lose %lastplayer recordlosingbluff %lastplayer set %ghost 0 set %lastplayer $null set %currentword $null } alias superchallengenot { ;if a challenge succeeds in superghost, call this set -s %bonus $floor($calc(.2 * %superorigpot)) msg $chan %supercurrentword is not a word middle and %superlastplayer loses... $nick gets a challenge bonus of %bonus $+ ! moneygive $nick %bonus recordchallenge $nick set -s %loser %superlastplayer superegain lose %superlastplayer recordlosingbluff %superlastplayer set %superghost 0 set %superlastplayer $null set %supercurrentword $null } alias xchallengenot { ;if a challenge succeeds in xghost, call this set -s %bonus $floor($calc(.3 * %xorigpot)) msg $chan %xcurrentword is not a word skeleton and %xlastplayer loses... $nick gets a challenge bonus of %bonus $+ ! moneygive $nick %bonus recordchallenge $nick set -s %loser %xlastplayer xegain lose %xlastplayer recordlosingbluff %xlastplayer set %xghost 0 set %xlastplayer $null set %xcurrentword $null } alias challengeyes { ;if a challenge fails in regular ghost, call this msg $chan %currentword actually starts a word, $read(WORDLIST.TXT, $readn $+ ) $+ , and $nick loses... set -s %loser $nick egain lose $nick recordlosingchallenge $nick recordbluff %lastplayer set %ghost 0 set %lastplayer $null set %currentword $null } alias superchallengeyes { ;if a challenge fails in superghost, call this msg $chan %supercurrentword actually is in a word, $read(WORDLIST.TXT, $readn $+ ) $+ , and $nick loses... set -s %loser $nick superegain lose $nick recordlosingchallenge $nick recordbluff %superlastplayer set %superghost 0 set %superlastplayer $null set %supercurrentword $null } alias xchallengeyes { ;if a challenge fails in xghost, call this msg $chan %xcurrentword actually is a word skeleton, $read(WORDLIST.TXT, $readn $+ ) $+ , and $nick loses... set -s %loser $nick xegain lose $nick recordlosingchallenge $nick recordbluff %xlastplayer set %xghost 0 set %xlastplayer $null set %xcurrentword $null } on 1:TEXT:!ghost*:*:{ ;main ghost command - the beginning of the game is all handled in here. later, it moves to !gu calcorg if $2 = off { requirechan if %ghost = 1 { if %determineturn = 0 { set -s %returnplayer 1 while %returnplayer <= %players { set -s %amount $eval(% $+ wager $+ $eval(% $+ turn $+ %returnplayer, 2), 2) moneygive $eval(% $+ turn $+ %returnplayer, 2) %amount inc %returnplayer } } else { msg $chan Please !begin before ending the game. halt } set %ghost 0 set %lastplayer $null msg $chan Ending 6Ghost... } elseif %ghost = 2 { msg $chan 6Ghost is under maintenance at the moment. Sorry for the inconvenience. } } elseif $2 = on { requirechan if %ghost = 0 { if %superghost = 0 { if %xghost = 0 { set -s %ghost 1 set -s %gchan $chan set -s %currentword $null msg $chan Beginning a game of 6Ghost... msg $chan Type !turn to determine turn order and place your wager, and then type !begin to start the game. set -s %pot 0 set -s %determineturn 1 set -s %cturn 0 } else { msg $chan Sorry, you can't run 6Ghost and 11X6ghost (in %xgchan $+ ) simultaneously. } } else { msg $chan Sorry, you can't run 6Ghost and 8Super6ghost (in %sgchan $+ ) simultaneously. } } elseif %ghost = 1 { msg $chan A game of 6Ghost is currently running, in %gchan $+ . } elseif %ghost = 2 { msg $chan 6Ghost is under maintenance at the moment. Sorry for the inconvenience. } } elseif $2 = superoff { requirechan if %superghost = 1 { if %superdetermineturn = 0 { set -s %returnplayer 1 while %returnplayer <= %superplayers { set -s %amount $eval(% $+ superwager $+ $eval(% $+ superturn $+ %returnplayer, 2), 2) moneygive $eval(% $+ superturn $+ %returnplayer, 2) %amount inc %returnplayer } } else { msg $chan Please !begin before ending the game. halt } set %superghost 0 set %superlastplayer $null msg $chan Ending 8Super6ghost... } elseif %superghost = 2 { msg $chan 8Super6ghost is under maintenance at the moment. Sorry for the inconvenience. } } elseif $2 = superon { requirechan if %superghost = 0 { if %xghost = 0 { if %ghost = 0 { set -s %superghost 1 set -s %sgchan $chan set -s %supercurrentword $null msg $chan Beginning a game of 8Super6ghost... msg $chan Type !turn to determine turn order and place your wager, and then type !begin to start the game. set -s %superpot 0 set -s %superdetermineturn 1 set -s %supercturn 0 } else { msg $chan Sorry, you can't run 8Super6ghost and 6Ghost (in %gchan $+ ) simultaneously. } } else { msg $chan Sorry, you can't run 8Super6ghost and 11X6ghost (in %xgchan $+ ) simultaneously. } } elseif %superghost = 1 { msg $chan A game of 8Super6ghost is currently running, in %sgchan $+ . } elseif %superghost = 2 { msg $chan 8Super6ghost is under maintenance at the moment. Sorry for the inconvenience. } } elseif $2 = xoff { requirechan if %xghost = 1 { if %xdetermineturn = 0 { set -s %returnplayer 1 while %returnplayer <= %xplayers { set -s %amount $eval(% $+ xwager $+ $eval(% $+ xturn $+ %returnplayer, 2), 2) moneygive $eval(% $+ xturn $+ %returnplayer, 2) %amount inc %returnplayer } } else { msg $chan Please !begin before ending the game. halt } set %xghost 0 set %xlastplayer $null msg $chan Ending 11X6ghost... } elseif %xghost = 2 { msg $chan 11X6ghost is under maintenance at the moment. Sorry for the inconvenience. } } elseif $2 = xon { requirechan if %xghost = 0 { if %superghost = 0 { if %ghost = 0 { set -s %xghost 1 set -s %xgchan $chan set -s %xcurrentword $null msg $chan Beginning a game of 11X6ghost... msg $chan Type !turn to determine turn order and place your wager, and then type !begin to start the game. set -s %xpot 0 set -s %xdetermineturn 1 set -s %xcturn 0 } else { msg $chan Sorry, you can't run 11X6ghost and 6Ghost (in %gchan $+ ) simultaneously. } } else { msg $chan Sorry, you can't run 11X6ghost and 8Super6ghost (in %sgchan $+ ) simultaneously. } } elseif %xghost = 1 { msg $chan A game of 11X6ghost is currently running, in %xgchan $+ . } elseif %superghost = 2 { msg $chan 11X6ghost is under maintenance at the moment. Sorry for the inconvenience. } } elseif $2 = help { ;todo: update this crappy help command. also see !help !ghost, etc. notice $nick This is soon to be updated! 6Ghost is a word game in which each player says a letter and tries not to make a real English word that is more than three letters long. If someone has a beginning that doesn't really start a word, the player can be challenged and will lose the game. To say a letter in EmeraldBOT's 6Ghost, use !gu without the brackets. To challenge, use !challenge. } elseif $2 = credits { ;don't remove this calcorg msg %origin 6Ghost was written by Andrew Fader (andre@facadecomputer.com). It may be freely used and distributed provided this credits message remains present. This program uses the ENABLE2K word list (http://personal.riverusers.com/~thegrendel/software.html). Thanks to Dan Pemberton and Domingo Galdos. For more information, see 12http://andre.facadecomputer.com/ghost/ } elseif $2 = fun { ;this is just silly calcorg msg %origin Jan 02, 2002 «09:17:19» damn this is fun } elseif $2 = records { ;check in records.ini for wins/losses/games played/win% and spit it out calcorg if $3 != $null { var -s %recordnick111 $3 } elseif $3 = $null { var -s %recordnick111 $nick } var %losses $readini records.ini %recordnick111 l var %game $readini records.ini %recordnick111 g var %curwins $calc(%game - %losses) var %chall $readini records.ini %recordnick111 ch var %lchall $readini records.ini %recordnick111 lch var %bluff $readini records.ini %recordnick111 bf var %lbluff $readini records.ini %recordnick111 lbf var %land $readini records.ini %recordnick111 land if %curwins < 0 { var %curwins 0 } if ($readini records.ini %recordnick111 l == $null) { var %losses 0 } if ($readini records.ini %recordnick111 g == $null) { var %game 0 } if ($readini records.ini %recordnick111 ch == $null) { var %chall 0 } if ($readini records.ini %recordnick111 lch == $null) { var %lchall 0 } if ($readini records.ini %recordnick111 bf == $null) { var %bluff 0 } if ($readini records.ini %recordnick111 lbf == $null) { var %lbluff 0 } if ($readini records.ini %recordnick111 land == $null) { var %land 0 } var %winpctg $calc(100*(%curwins / %game)) msg %origin Records for %recordnick111 $+ : Wins: %curwins Losses: %losses Games Played: %game Challenge Bonuses: %chall Failed Challenges: %lchall Successful Bluffs: %bluff Failed Bluffs: %lbluff Landed on Words: %land Win Rate: %winpctg $+ % } else { ;you typed something I don't understand, but here's what you can do calcorg msg %origin !ghost options: off on superoff superon xoff xon help credits fun records } } on 1:text:!turn*:*:{ ;join the game and wager calcorg checkpass $nick var %2wager $$2 if (%ghost == 1) { if (%determineturn == 1) { ;gotta make sure we're actually figuring out turns right now if ($$2 != $null) { if ($floor($$2) > 0 || $$2 = all) { ;no negative bets please if ($$2 isnum || $$2 = all) { if ($$2 = all) { if $funds($nick) > 0 { var %2wager $funds($nick) } } ;numbers, please if (%2wager <= $funds($nick)) { set -s %backupcturn %cturn :n if $nick = $eval(% $+ turn $+ %cturn, 2) { msg %origin You have already determined your turn order. set -s %cturn %backupcturn halt } ;the following two ifs: check to see if you're trying to use two nicks to play, with the same host if $nick = $ial($eval(% $+ turn $+ %cturn, 2)) { msg %origin $eval(% $+ turn $+ %cturn, 2) $+ / $+ $nick $+ : You have already determined your turn order. set -s %cturn %backupcturn halt } if $address($nick,1) = $address($eval(% $+ turn $+ %cturn, 2),2) { msg %origin $eval(% $+ turn $+ %cturn, 2) $+ / $+ $nick $+ : You have already determined your turn order. set -s %cturn %backupcturn halt } if %cturn = 0 { goto m } dec -s %cturn goto n :m set -s %cturn %backupcturn inc %cturn set -s $eval(% $+ turn $+ %cturn, 1) $nick set -s $eval(% $+ wager $+ $nick, 1) $floor(%2wager) gaminc $nick moneygive $nick - $+ $floor(%2wager) inc -s %pot %2wager msg %gchan %cturn $+ : $nick $+ . } else { msg %origin Insufficient funds. (Type !welfare to apply for a welfare loan.) halt } } else { msg %origin Invalid wager. halt } } } } } elseif %superghost = 1 { ;this is like the ghost version, just a little different if (%superdetermineturn == 1) { if ($$2 != $null) { if ($floor($$2) > 0 || $$2 = all) { ;no negative bets please if ($$2 isnum || $$2 = all) { if ($$2 = all) { if $funds($nick) > 0 { var %2wager $funds($nick) } } ;numbers, please if (%2wager <= $funds($nick)) { set -s %backupcturn %supercturn :n if $nick = $eval(% $+ superturn $+ %supercturn, 2) { msg %origin You have already determined your turn order. set -s %supercturn %backupcturn halt } if $nick = $ial($eval(% $+ superturn $+ %supercturn, 2)) { msg %origin $eval(% $+ superturn $+ %supercturn, 2) $+ / $+ $nick $+ : You have already determined your turn order.You have already determined your turn order. set -s %supercturn %backupcturn halt } if $address($nick,1) = $address($eval(% $+ superturn $+ %supercturn, 2),2) { msg %origin $eval(% $+ superturn $+ %supercturn, 2) $+ / $+ $nick $+ : You have already determined your turn order. set -s %supercturn %backupcturn halt } if %supercturn = 0 { goto m } dec -s %supercturn goto n :m set -s %supercturn %backupcturn inc %supercturn set -s $eval(% $+ superturn $+ %supercturn, 1) $nick set -s $eval(% $+ superwager $+ $nick, 1) $floor(%2wager) gaminc $nick moneygive $nick - $+ $floor(%2wager) inc -s %superpot %2wager msg %sgchan %supercturn $+ : $nick $+ . } else { msg %origin Insufficient funds. (Type !welfare to apply for a welfare loan.) halt } } else { msg %origin Invalid wager. halt } } } } } elseif %xghost = 1 { ;same deal as the super and regular versions if (%xdetermineturn == 1) { if ($$2 != $null) { if ($floor($$2) > 0 || $$2 = all) { ;no negative bets please if ($$2 isnum || $$2 = all) { if ($$2 = all) { if $funds($nick) > 0 { var %2wager $funds($nick) } } ;numbers, please if (%2wager <= $funds($nick)) { set -s %backupcturn %xcturn :n if $nick = $eval(% $+ xturn $+ %xcturn, 2) { msg %origin $eval(% $+ xturn $+ %xcturn, 2) $+ : You have already determined your turn order. set -s %xcturn %backupcturn halt } if $nick = $ial($eval(% $+ xturn $+ %xcturn, 2)) { msg %origin $eval(% $+ xturn $+ %xcturn, 2) $+ / $+ $nick $+ : You have already determined your turn order. set -s %xcturn %backupcturn halt } if $address($nick,1) = $address($eval(% $+ xturn $+ %xcturn, 2),2) { msg %origin $eval(% $+ xturn $+ %xcturn, 2) $+ / $+ $nick $+ : You have already determined your turn order. set -s %xcturn %backupcturn halt } if %xcturn = 0 { goto m } dec -s %xcturn goto n :m set -s %xcturn %backupcturn inc %xcturn set -s $eval(% $+ xturn $+ %xcturn, 1) $nick set -s $eval(% $+ xwager $+ $nick, 1) $floor(%2wager) gaminc $nick moneygive $nick - $+ $floor(%2wager) inc -s %xpot %2wager msg %xgchan %xcturn $+ : $nick $+ . } else { msg %origin Insufficient funds. (Type !welfare to apply for a welfare loan.) halt } } else { msg %origin Invalid wager. halt } } } } } } on 1:text:!begin:#:{ ;start the game after determining turn order if (%ghost == 1) { if (%cturn > 1) { if (%determineturn == 1) { set -s %origpot %pot inc -s %pot $calc(%pot / 3) msg $chan Beginning 6Ghost with %cturn players and a pot of € $+ %pot $+ . It is currently %turn1 $+ 's turn. set -s %turn 1 set -s %players %cturn set -s %currentplayers %players set -s %cturn 0 set -s %determineturn 0 } } } elseif (%superghost == 1) { if (%supercturn > 1) { if (%superdetermineturn == 1) { set -s %superorigpot %superpot inc -s %superpot $calc(%superpot / 3) msg $chan Beginning 8Super6ghost with %supercturn players and a pot of € $+ %superpot $+ . It is currently %superturn1 $+ 's turn. set -s %superturn 1 set -s %superplayers %supercturn set -s %currentsuperplayers %superplayers set -s %supercturn 0 set -s %superdetermineturn 0 } } } elseif (%xghost == 1) { if (%xcturn > 1) { if (%xdetermineturn == 1) { set -s %xorigpot %xpot inc -s %xpot $calc(%xpot / 3) msg $chan Beginning 11X6ghost with %xcturn players and a pot of € $+ %xpot $+ . It is currently %xturn1 $+ 's turn. set -s %xturn 1 set -s %xplayers %xcturn set -s %xsuperplayers %xplayers set -s %xcturn 0 set -s %xdetermineturn 0 } } } } on 5:TEXT:!gadmin*:#:{ ;administrative commands if $2 = clear { ;reset ghost set %ghost 0 set %lastplayer $null set %currentword $null set %determineturn 0 } if $2 = sclear { ;reset superghost set %superghost 0 set %superlastplayer $null set %supercurrentword $null set %superdetermineturn 0 } if $2 = xclear { ;reset xghost set %xghost 0 set %xlastplayer $null set %xcurrentword $null set %xdetermineturn 0 } if $2 = aclear { ;reset all set %xghost 0 set %xlastplayer $null set %xcurrentword $null set %xdetermineturn 0 set %superghost 0 set %superlastplayer $null set %supercurrentword $null set %superdetermineturn 0 set %ghost 0 set %lastplayer $null set %currentword $null set %determineturn 0 } elseif $2 = edit { set %ghost 2 | set %currentword $null } elseif $2 = xedit { set %xghost 2 | set %scurrentword $null } elseif $2 = sedit { set %sghost 2 | set %xcurrentword $null } if %ghost = 0 { set %ghoststat OFF } elseif %ghost = 1 { set %ghoststat ON } elseif %ghost = 2 { set %ghoststat MAINTENANCE } if %xghost = 0 { set %xghoststat OFF } elseif %xghost = 1 { set %xghoststat ON } elseif %xghost = 2 { set %xghoststat MAINTENANCE } if %superghost = 0 { set %sghoststat OFF } elseif %superghost = 1 { set %sghoststat ON } elseif %superghost = 2 { set %sghoststat MAINTENANCE } notice $nick Ghost_ Game: %ghoststat $+ . Current Word: %currentword $+ . Superghost_ Game: %sghoststat $+ . Current Word: %supercurrentword $+ . Xghost_ Game: %xghoststat $+ . Current Word: %xcurrentword $+ . } on 1:TEXT:!gu*:#:{ ;the meat of the game is in here, the !gu command - short for guess, though that's not really what you're doing ;a better name would be !add, but I don't want to change it ;this used to be three commands for each variant, but now it's condensed into one if ($2 !isalpha) { halt } if %ghost = 1 { if %determineturn = 0 { if $nick = $eval(% $+ turn $+ %turn, 2) { if ($len($2) = 1) { if ($2 isletter) { set %currentword %currentword $+ $2 msg $chan The current word is " $+ %currentword $+ ." if ($read(WORDLIST.TXT, tw, %currentword) != $null) { if $len(%currentword) > 3 { msg $chan %currentword is a word! The game is over, and $nick loses... set -s %loser $nick egain lose $nick landonword $nick set %ghost 0 set %currentword $null set %lastplayer $null } } set -s %lastplayer $eval(% $+ turn $+ %turn, 2) if (%turn < %players) { inc %turn } else { %turn = 1 } :checkfornullturn if ($eval(% $+ turn $+ %turn, 2) == $null) { inc %turn goto checkfornullturn } if ($ial($eval(% $+ turn $+ %turn, 2)) == $null) { inc %turn goto checkfornullturn } if (%ghost == 1) { msg $chan It is currently $eval(% $+ turn $+ %turn, 2) $+ 's turn. } } } elseif ($len($2) != 1) { msg $chan Your so-called letter is $len($2) characters long... letters are only one character long! } } else { msg $chan Not your turn, $nick $+ . } } else { msg $chan Currently determining turn order. } } elseif %superghost = 1 { if %superdetermineturn = 0 { if $nick = $eval(% $+ superturn $+ %superturn, 2) { if ($len($2) == $calc($len(%supercurrentword) + 1)) { if ($2 isalpha) { if %supercurrentword == $null { goto proceed } if (%supercurrentword isin $2) { :proceed set %supercurrentword $2 msg $chan The current word is " $+ %supercurrentword $+ ." if ($read(WORDLIST.TXT, tw, %supercurrentword) != $null) { if $len(%supercurrentword) > 3 { msg $chan %supercurrentword is a word! The game is over, and $nick loses... set -s %loser $nick superegain lose $nick landonword $nick set %superghost 0 set %supercurrentword $null set %superlastplayer $null } } set -s %superlastplayer $eval(% $+ superturn $+ %superturn, 2) if (%superturn < %superplayers) { inc %superturn } else { %superturn = 1 } :checkfornullturn if ($eval(% $+ superturn $+ %superturn, 2) == $null) { inc %superturn goto checkfornullturn } if (%superghost == 1) { msg $chan It is currently $eval(% $+ superturn $+ %superturn, 2) $+ 's turn. } } else { msg $chan Please add a letter to the existing word. } } } else { msg $chan You may only add one letter to the word at a time. } } else { msg $chan Not your turn, $nick $+ . } } else { msg $chan Currently determining turn order. } } elseif %xghost = 1 { if %xdetermineturn = 0 { if $nick = $eval(% $+ xturn $+ %xturn, 2) { if ($len($2) == $calc($len(%xcurrentword) + 1)) { if ($2 isalpha) { if %xcurrentword == $null { set -s %xasterword * goto proceed } set -s %cfl 1 if %xasterword iswm $2 { goto proceed } else { msg $chan Please add a letter to the existing word. halt } } :proceed set -s %xcurrentword $2 set -s %xasterword * set -s %findoutletters 1 while %findoutletters <= $len(%xcurrentword) { set -s %xasterword %xasterword $+ $mid(%xcurrentword,%findoutletters,1) set -s %xasterword %xasterword $+ * inc %findoutletters } msg $chan The current word is " $+ %xcurrentword $+ ." if ($read(WORDLIST.TXT, tw, %xcurrentword) != $null) { if $len(%xcurrentword) > 3 { msg $chan %xcurrentword is a word! The game is over, and $nick loses... set -s %loser $nick xegain lose $nick landonword $nick set %xghost 0 set %xcurrentword $null set %xlastplayer $null } } set -s %xlastplayer $eval(% $+ xturn $+ %xturn, 2) if (%xturn < %xplayers) { inc %xturn } else { %xturn = 1 } :checkfornullturn if ($eval(% $+ xturn $+ %xturn, 2) == $null) { inc %xturn goto checkfornullturn } if (%xghost == 1) { msg $chan It is currently $eval(% $+ xturn $+ %xturn, 2) $+ 's turn. } } else { msg $chan You may only add one letter to the word at a time. } } else { msg $chan Not your turn, $nick $+ . } } else { msg $chan Currently determining turn order. } } else { msg $chan An 6Ghost game is not running! Use !ghost (x/super)on to start one! } } on 1:TEXT:!challenge:#:{ ;challenging happens here. also used to be 3 commands, but now is combined ;checks to see if the word could become something in the wordlist, and then calls one of two aliases: (super/x)challengeyes, or (super/x)challengenot ;challengeyes means "yes, it could be a word. your challenge fails! you lose!" ;challengenot means "no, it can't be a word. you win the game! if (%ghost == 1) { if ($nick == $eval(% $+ turn $+ %turn, 2)) { if ($len(%currentword) > 1) { if ($read(WORDLIST.TXT, w, %currentword $+ *) == $null) { set %challenge 0 } else { set %challenge 1 } if (%challenge == 0) { challengenot } elseif (%challenge == 1) { challengeyes } } else { ;it's a 1-letter word, stupid msg $chan You can't challenge yet. } } } elseif (%superghost == 1) { if ($nick == $eval(% $+ superturn $+ %superturn, 2)) { if ($len(%supercurrentword) > 1) { if ($read(WORDLIST.TXT, w, * $+ %supercurrentword $+ *) == $null) { set %challenge 0 } else { set %challenge 1 } if (%challenge == 0) { superchallengenot } elseif (%challenge == 1) { superchallengeyes } } else { msg $chan You can't challenge yet. } } } elseif (%xghost == 1) { if ($nick == $eval(% $+ xturn $+ %xturn, 2)) { if ($len(%xcurrentword) > 1) { if ($read(WORDLIST.TXT, w, %xasterword) == $null) { set %challenge 0 } else { set %challenge 1 } if (%challenge == 0) { xchallengenot } elseif (%challenge == 1) { xchallengeyes } } else { msg $chan You can't challenge yet. } } } } ;on 1:TEXT:!leavegame:#:{ ; ;some complicated way to leave the game while you're playing. this almost never happens so I don't know why I wrote it ; if (%ghost == 1) { ; if %determineturn = 0 { ; set -s %figureout 1 ; :figureout ; if $eval(% $+ turn $+ %figureout, 2) == $nick { ; set -s $eval(% $+ turn $+ %figureout, 1) $null ; msg $chan $nick has left the game. ; dec -s %currentplayers ; if $eval(% $+ turn $+ %turn, 2) = $nick { ; inc %turn ; msg $chan It is currently $eval(% $+ turn $+ %turn, 2) $+ 's turn. ; } ; } ; else { ; inc %figureout ; goto figureout ; } ; if %currentplayers = 1 { ; set -s %whoisleft 1 ; while ($eval(% $+ turn $+ %whoisleft, 2) = $null) { ; inc %whoisleft ; } ; msg $chan Nobody else is left, so the game will end. $eval(% $+ turn $+ %whoisleft, 2) gets € $+ %pot $+ , as the only remaining player. ; moneygive $eval(% $+ turn $+ %whoisleft, 2) %pot ; %currentword = $null ; %ghost = 0 ; %lastplayer = $null ; } ; } ; } ; elseif (%superghost == 1) { ; if %superdetermineturn = 0 { ; set -s %figureout 1 ; :figureout ; if $eval(% $+ superturn $+ %figureout, 2) == $nick { ; set -s $eval(% $+ superturn $+ %figureout, 1) $null ; msg $chan $nick has left the game. ; dec -s %currentsuperplayers ; if $eval(% $+ superturn $+ %superturn, 2) == $nick { ; inc %superturn ; msg $chan It is currently $eval(% $+ superturn $+ %superturn, 2) $+ 's turn. ; } ; } ; else { ; inc %figureout ; goto figureout ; } ; if %currentsuperplayers = 1 { ; set -s %whoisleft 1 ; while ($eval(% $+ superturn $+ %whoisleft, 2) = $null) { ; inc %whoisleft ; } ;msg $chan Nobody else is left, so the game will end. $eval(% $+ superturn $+ %whoisleft, 2) gets € $+ %superpot $+ , as the only remaining player. ;moneygive $eval(% $+ superturn $+ %whoisleft, 2) %superpot ;%supercurrentword = $null ;%superghost = 0 ;%superlastplayer = $null ;} ;} ;} ;elseif (%xghost == 1) { ;if %xdetermineturn = 0 { ;set -s %figureout 1 ;:figureout ;if $eval(% $+ xturn $+ %figureout, 2) == $nick { ;set -s $eval(% $+ xturn $+ %figureout, 1) $null ;msg $chan $nick has left the game. ;dec -s %currentxplayers ;if $eval(% $+ xturn $+ %xturn, 2) == $nick { ; inc %xturn ; msg $chan It is currently $eval(% $+ xturn $+ %xturn, 2) $+ 's turn. ;} ;} ;else { ;inc %figureout ;goto figureout ;} ;if %currentxplayers = 1 { ;set -s %whoisleft 1 ;while ($eval(% $+ xturn $+ %whoisleft, 2) = $null) { ; inc %whoisleft ;} ;msg $chan Nobody else is left, so the game will end. $eval(% $+ superturn $+ %whoisleft, 2) gets € $+ %xpot $+ , as the only remaining player. ;moneygive $eval(% $+ xturn $+ %whoisleft, 2) %xpot ;%xcurrentword = $null ;%xghost = 0 ;%sxlastplayer = $null ;} ;} ;} ;} on 5:TEXT:!forceleavegame*:#:{ ;same thing as !leavegame, except I can do it to you. if (%ghost == 1) { if %determineturn = 0 { set -s %figureout 1 :figureout if $eval(% $+ turn $+ %figureout, 2) == $2 { set -s $eval(% $+ turn $+ %figureout, 1) $null msg $chan $2 has left the game. dec -s %currentplayers if $eval(% $+ turn $+ %turn, 2) = $2 { inc %turn msg $chan It is currently $eval(% $+ turn $+ %turn, 2) $+ 's turn. } } else { inc %figureout goto figureout } if %currentplayers = 1 { set -s %whoisleft 1 while ($eval(% $+ turn $+ %whoisleft, 2) = $null) { inc %whoisleft } msg $chan Nobody else is left, so the game will end. $eval(% $+ turn $+ %whoisleft, 2) gets € $+ %pot $+ , as the only remaining player. moneygive $eval(% $+ turn $+ %whoisleft, 2) %pot %currentword = $null %ghost = 0 %lastplayer = $null } } } elseif (%superghost == 1) { if %superdetermineturn = 0 { set -s %figureout 1 :figureout if $eval(% $+ superturn $+ %figureout, 2) == $2 { set -s $eval(% $+ superturn $+ %figureout, 1) $null msg $chan $2 has left the game. dec -s %currentsuperplayers if $eval(% $+ superturn $+ %superturn, 2) == $2 { inc %superturn msg $chan It is currently $eval(% $+ superturn $+ %superturn, 2) $+ 's turn. } } else { inc %figureout goto figureout } if %currentsuperplayers = 1 { set -s %whoisleft 1 while ($eval(% $+ superturn $+ %whoisleft, 2) = $2) { inc %whoisleft } msg $chan Nobody else is left, so the game will end. $eval(% $+ superturn $+ %whoisleft, 2) gets € $+ %superpot $+ , as the only remaining player. moneygive $eval(% $+ superturn $+ %whoisleft, 2) %superpot %supercurrentword = $null %superghost = 0 %superlastplayer = $null } } } elseif (%xghost == 1) { if %xdetermineturn = 0 { set -s %figureout 1 :figureout if $eval(% $+ xturn $+ %figureout, 2) == $2 { set -s $eval(% $+ xturn $+ %figureout, 1) $null msg $chan $2 has left the game. dec -s %currentxplayers if $eval(% $+ xturn $+ %xturn, 2) == $2 { inc %xturn msg $chan It is currently $eval(% $+ xturn $+ %xturn, 2) $+ 's turn. } } else { inc %figureout goto figureout } if %currentxplayers = 1 { set -s %whoisleft 1 while ($eval(% $+ xturn $+ %whoisleft, 2) = $2) { inc %whoisleft } msg $chan Nobody else is left, so the game will end. $eval(% $+ xturn $+ %whoisleft, 2) gets € $+ %xpot $+ , as the only remaining player. moneygive $eval(% $+ xturn $+ %whoisleft, 2) %xpot %xcurrentword = $null %xghost = 0 %xlastplayer = $null } } } } on 1:TEXT:!next:*:{ ;check who the next player is calcorg if %ghost = 1 { if %turn >= %players { var %nturn 1 } else { set -s %nturn $calc(%turn + 1) } while $eval(% $+ turn $+ %nturn, 2) = $null { inc %nturn } msg %origin After $eval(% $+ turn $+ %turn, 2) is $eval(% $+ turn $+ %nturn, 2) $+ . } elseif %superghost = 1 { if %superturn >= %superplayers { var %nturn 1 } else { set -s %nturn $calc(%superturn + 1) } while $eval(% $+ superturn $+ %nturn, 2) = $null { inc %nturn } msg %origin After $eval(% $+ superturn $+ %superturn, 2) is $eval(% $+ superturn $+ %nturn, 2) $+ . } elseif %xghost >= 1 { if %xturn = %xplayers { var %nturn 1 } else { set -s %nturn $calc(%xturn + 1) } while $eval(% $+ xturn $+ %nturn, 2) = $null { inc %nturn } msg %origin After $eval(% $+ xturn $+ %xturn, 2) is $eval(% $+ xturn $+ %nturn, 2) $+ . } } on 1:TEXT:!word*:*:{ ;this is a thing that can be used while you're not playing, that can run searches on the wordlist ;it can also spit out a random word ;useful for figuring out when people started bluffing if %ghost = 0 { if %superghost = 0 { if %xghost = 0 { calcorg if $2 = $null { msg %origin Random word: $read(WORDLIST.TXT) } else { if $read(WORDLIST.TXT, w, $2) != $null { msg %origin Word match: $read(WORDLIST.TXT, w, $2) } else { msg %origin No matches for $2 $+ . } } } } } }