Intro: This is a remake of the very first version of a Mafia game I ran, and is considered to be a demo bot of the one ran on #Mafia on SwiftIRC. The code has been simplified for those who can't script too well, so it's easily adjustable, but at the same time I made it slightly more efficient. I've had two friends help me with various bits and pieces because at 3 AM I sometimes lose the ability to think.
About the game: Simply put, to win the game be the last team standing. There are three teams: Civilian Team (civilians, doctor, homeless bum, and detective), Mafia Team (mafia 1, mafia 2, etc), and Killer Team (killer alone). Before the game starts, the bot will query (PM) everybody to accept or reject a role, and that's how you know what role you are. If you reject, you'll either be given a different role if one is rejected, or you'll be a civilian. Every night everybody except the civilians have something to do, and the bot PMs everyone with his/her actions. During the day there's an optional voting to hang a person, if that person is hung, he/she dies and is taken out of the game.
Installation: To set up the bot, it's fairly easy, just copy the code below into the mIRC Remotes or Aliases tab (alt+R to get there). Upon loading the script it will set the very minimum variables it needs, such as the colors, and the like. By default the bot's nick will be MafiaGameBot, the password to identify via NickServ is PASSWORDGOESHERE, and the game channel is #MafiaGameChannel. To change either the nick or password use /set %BotsNick nick-here or /set %BotsPass password-here, or use an operator command, which is also talked about below. To change the gaming channel, use /set %GameChannel #Channel-here Upon connecting to the server the bot will join the channel, identify it's nick, and be ready to start playing.
Basic staff commands: There aren't very many of them, but then again, the original didn't have a lot anyway, and this does have just a few more than that one did. To register a user into the game, even if it's already playing, just use !reguser nick while being opped and/or halfopped. To stop the game, or prevent it from being played until a staff member allows it, use !stop, then either !start, !reg, or !reguser to get it going again. To end the registration process early and skip right to the role give out phase, staff can use the !endreg command. If for whatever reason the bot become unidentified with NickServ, staff can force it to change its nick to the proper nick and identify using the !ident command. Ops can also change a couple of variables for the bot, such as the colors, the nick's password, and so forth. This command is !set, and its syntax is as followed: !set VariableName value. The colors are probably going to be the most often ones change, and they are c1, c2, c3, c4, and c5 ordered from primary, secondary, and so on. To change the primary color, use !set c1 new-color-here. In example: !set c1 04. It has to be two digits, if not, it'll just give you an error. The rest of the set commands are just !set GameChanne, !set BotsNick, and !set BotsPass, fairly basic, which is key. !TakeOut will take the specified user out of the game.
Short list of commands: Not wanting to go into what each command does, but here's a short list of what they are: !start, !reg, !unreg, !killme, !reguser, !endreg, !stop, !endreg, !kick, !set, !kill, !check, !heal, !cancel, !yes, !no, !all, !stat, !q, !dur, !gamestat, !night, !sideswon, !invite, !takeout
Rules: The rules for this game can be found on the forum, which is http://mafbot.com/forum/index.php Though the most important part is to not play against your role, and don't give away your role to anybody that's currently in the game.
Conclusion: The bot has been tested, but as always, bugs/glitches/errors/mistakes/typos are expected, so if something doesn't go right, feel more than free to fix it yourself, or post on the forum, and it will be fixed. The same can be said you'd like something to be changed/tweaked/updated/added. Because this is open source, you can mess with the code as you please.
;LOAD THIS PART INTO THE REMOTES TAB
alias c1 { return $+(,%c1,$1-) }
alias c2 { return $+(,%c2,$1-) }
alias c3 { return $+(,%c3,$1-) }
alias c4 { return $+(,%c4,$1-) }
alias c5 { return $+(,%c5,$1-) }
on *:load:set %c1 14 | set %c2 10 | set %c3 07 | set %c4 05 | set %c5 11 | set %GameChannel #MafiaGameChannel | set %BotsNick MafiaGameBot | set %BotsPass PASSWORDGOESHERE | set %CiviliansWon 0 | set %MafiaWon 0 | set %KillerWon 0 | set %Ties 0 | set %GameCount 0 | set %Visitors 0
on *:text:!set*:?:{
if ($nick !isop %GameChannel) return
if (!$2) { msg $nick $c2(You must first specify a parameter! | return }
if (!$3) msg $nick $c2(Missing parameter!)
if (($2 == c1) || ($2 == c2) || ($2 == c3) || ($2 == c4) || ($2 == c5) {
if (!$3) { msg $nick $c2(Enter a digit from 00 to 15. | return }
if ($len($2) != 2) { msg $nick $c2(Please enter a two digit number. In example: 04 for red, or 12 for blue.) | return }
if (($3 > 15) || ($3 < 0)) { msg $nick $c2(The parameter must be between 00 and 12. | return }
set % $+ $2 $3
msg $nick $c1(The value of) $c2($2) $c1(has been changed to) $c3($3)
return
}
elseif ($2 == BotsNick) {
if (!$3) { msg $nick $c2(Enter a nick that is alphanumeric or contains the following character: `^()|/ and does not start with a number) | return }
set %BotsNick $3
}
elseif ($2 == BotsPass) {
if (!$3) { msg $nick $c2(Please specify a password without spaces) | return }
set %BotsPass $3
}
elseif ($2 == GameChannel) {
if (!$3) { msg $nick $c2(Please specify a new game channel for the bot!) }
if ($me !ison $3) { msg $nick $c2(I must first be on the channel and have operator status | return }
if ($me !isop $3) { msg $nick $c2(I must first operator status in that channel) | return }
if ($nick !isop $3) { msg $nick $c2(You must first obtain operator status in the channel before using this command) | return }
set %GameChannel $3
}
}
on *:text:!start:%GameChannel:StartTheGame $nick
on *:text:!done*:%GameChannel:{
if ((%GameIsPlayig == false) || ($GameIsStopped == true) || (%Voting == no) || ($nick != %CiviliansVictim)) return
else { timers off | EndVoting }
}
on *:text:!cancel:?:{
if ((%GameIsPlaying == false) || (%GameIsStopped == true)) return
if (($WhatIs($nick) == Detective) && (%DetectiveMoved == 1)) { set %DetectiveMoved 0 | msg %GameChannel $c1(For some reason the) $c3(detective) $c1(decided it would be best to rethink the plot and went home) }
if (($read($m.txt,1) == $1) && (%MafiaMoved == 1)) { set %MafiaMoved 0 | msg %GameChannel $c1(For some reason the) $c3(mafia) $c1(wanted to switch out targets and went back to the drawing board) }
if (($WhatIs($nick) == Doctor) && (%DoctorMoved == 1)) { set %DoctorMoved 0 | msg %GameChannel $c1(For some reason the) $c3(detective) $c1(decided it would be best to rethink the plot and went home) }
}
on *:text:!stat:%GameChannel:msg # $AllActiveRoles
on *:text:!yes*:%GameChannel:VoteFor $nick
on *:text:!no*:%GameChannel:VoteAgainst $nick
on *:text:!dur:%GameChannel:if ($GameIsPlaying == true) # $c1(The game has been going on for) $c2($duration($calc($ctime - %dur))))
on *:text:!dur:?:if ($GameIsPlaying == true) $nick $c1(The game has been going on for) $c2($duration($calc($ctime - %dur))))
on *:text:!day:%GameChannel:if (%GameIsPlaying == true) {
if (($nick isop $chan) | ($nick ishop $chan)) Day
}
on *:text:!ident:%GameChannel:if (($nick isop $chan) || ($nick ishop $chan) { /ns ghost %BotsNick %BotsPass | /nick %BotsNick | /ns identify %BotsPass }
on *:text:!gamestat:%GameChannel:if (%GameIsPlaying == true) msg # $c1(Number of players:) $c2(%NumberOfPlayer) $c1(nights passed:) $c2(%nights) $c1(number of roles:) $c2($calc(%TotalMafia + %TotalDetective + %TotalKiller + %TotalDoctor + %TotalHomeless))
on *:text:!gamestat:?:if (%GameIsPlaying == true) msg $nick $c1(Number of players:) $c2(%NumberOfPlayer) $c1(nights passed:) $c2(%nights) $c1(number of roles:) $c2($calc(%TotalMafia + %TotalDetective + %TotalKiller + %TotalDoctor + %TotalHomeless))
on *:text:!nights:GameChannel:if (%GameIsPlaying == true) msg # $c1(There have been) $c2(%nights) $c1(nights so far.)
on *:text:!nights:?:if (%GameIsPlaying == true) msg $nick $c1(There have been) $c2(%nights) $c1(nights so far.)
on *:text:!games:%GameChannel:msg $chan $c1(There have been) $c2(%played) $c1(games in total...)
on *:text:!games:?:$nick $c1(There have been) $c2(%played) $c1(games in total...)
on *:text:!sideswon:%GameChannel:msg # $c1(The) $c3(civilians) $c1(have won) $c2(%CiviliansWon) $c1(times,) $c1(the) $c3(mafia) $c1(have won) $c2(%MafiaWon) $c1(times,) $c1(the) $c3(killer) $c1(has won) $c2(%KillerWon) $c1(times,) $c1(and there have been a total of) $c2(%Ties) $c1(ties.)
on *:text:!sideswon:?:msg $nick $c1(The) $c3(civilians) $c1(have won) $c2(%CiviliansWon) $c1(times,) $c1(the) $c3(mafia) $c1(have won) $c2(%MafiaWon) $c1(times,) $c1(the) $c3(killer) $c1(has won) $c2(%KillerWon) $c1(times,) $c1(and there have been a total of) $c2(%Ties) $c1(ties.)
on *:text:!rules:?: /msg $nick $c1(The basic rules of the game is to make sure that your team succeeds in surviving, and you do so according to your role. There are the) $c3(civilians, mafia, detective, killer, homeless bum) |msg $nick $c1(For more information about the roles, please type in) $c2(!roles)
on *:text:!roles:?:msg $nick $c1(The) $c3(civilians) $c3(can't do a whole lot at night, they wait for the day, when they vote. The) $c3(Detective) $c1(can either check a player's role by) $c2(!check target) $c1(or kill one by) $c2(!kill target) $+ ($c1.) $c3(Mafia) $c1(can only kill, and it's the same way as the) $c3(detective) $c1(and the) $c3(killer) $c1(The) $c3(homeless) $c1(can only check, and same way as the) $c3(detective) $c1(while the) $c3(doctor) $c1(can heal a killed peson with) $c2(!heal) | /msg $nick $c1(For more information at what what happens in the day time, please type in) $c2(!day)
on *:text:!day:?:msg $nick $c1(Right after everybody has made their moves, the day time comes. This is where everything that has been done is revealed, and those who are killed, are taken out of the game. Then we have the voting to see who the people (this includes everybody in the game) want to kill, giving the civilians a chance to get involved, for there's a lot of them. The voting is done by typing in) $c2(!nick) | msg $nick $c1(After that is done, the people decide on whether or not to hang the chosen one, by typing either) $c2(!yes) $c1(or) $c2(!no)
on *:text:!q:%GameChannel:/msg # $c1(There are currently) $c2(%NumberOfPlayers) $c1(players.)
on *:text:!q:?:/msg $nick $c1(There are currently) $c2(%NumberOfPlayers) $c1(players.)
on *:text:!roles:%GameChannel:if (%GameIsPlaying == true) msg %GameChannel $c1(In total:) $c3(civilians -) $c2(%TotalCivilian) $c3(mafia -) $c2(%TotalMafia) $c3(killer -) $c2(%TotalKiller) $c3(doctor -) $c2(%TotalDoctor) $c3(detective -) $c2(%TotalDetective) $c3(homeless bum -) $c2(%TotalHomeless)
on *:text:!endreg:%GameChannel:if (($nick isop $chan) || ($nick ishop #)) timers off | GiveOutRoles
on *:connect:set %GameIsPlaying false | /ns ghost %BotsNick %BotsPass | /nick %BotsNick | /ns identify %BotsPass | join %GameChannel
on *:text:!reguser*:%GameChannel:ReggedByOp $2 $nick
on *:text:!reguser*:?:ReggedByOp $2 $nick
on *:text:!reg:%GameChannel:reg $nick
on *:text:!reg:?:reg $nick
on *:text:!yes:?:AcceptRole $nick
on *:text:!no:?:RejectRole $nick
on *:text:!check*:?:check $2 $nick $3-
on *:text:!kill*:?:kill $2 $nick $3-
on *:text:!heal*:?:heal $2 $nick $3-
on *:devoice:if ($nick != $me) %GameChannel:TakeOut $vnick
on *:text:!killme:%GameChannel:TakeOut $nick
on *:part:%GameChannel:Leaving $nick
on *:quit:Leaving $nick
on *:text:!unreg:%GameChannel:if (%Registration == on) TakeOut $nick
on *:text:!Stop:%GameChannel: {
if (($nick !isop #) && ($nick !ishop #)) return
if (%GameIsStopped == true) return
timers off
set %GameIsStopped true
set %GameIsPlaying false
msg # $c2(The game has been stopped, and now only a staff member of the channel may start it!)
}
on *:text:!Stop:?: {
if (($nick !isop %GameChannel) && ($nick !ishop %GameChannel)) return
if (%GameIsStopped == true) return
timers off
set %GameIsStopped true
set %GameIsPlaying false
msg %GameChannel $c2(The game has been stopped, and now only a staff member of the channel may start it!)
}
on *:text:!TakeOut*:%GameChannel:if (($nick isop %GameChannel) || ($nick ishop %GameChannel)) TakeOut $2
on *:text:!*:%GameChannel:ThoseVoted $nick $1
on *:join:%GameChannel:JoinGameChannel $nick
on *:text:!invite *:%CivilianChannel:if (($WhatIs($nick) == detective) || ($WhatIs($nick) == homeless)) invite $2 $chan | msg $2 $c1(You have been invited to $c2(%CivilianChannel)
on *:text:!r *:#:if (($2 isnum) && ($3 isnum) && ($2 < $3) ($c1(Your random number is:) $c2($r($1,$2))
on *:kick:%GameChannel:Takeout $knick
on *:nick:ChangedNick $nick $newnick
on *:text:!version:*:msg $nick $c1(This version of the $c2(Mafia)$c1(/)$c2(Warewolf) $c2(game bot is) $c3(AV2 1.2.5)
on *:text:!ver:*:msg $nick $c1(This version of the $c2(Mafia)$c1(/)$c2(Warewolf) $c2(game bot is) $c3(AV2 1.2.5)
;LOAD THIS PART INTO THE ALIASES TAB
InGame {
set %x 1
if ((%NumberOfPlayers == 0) || (%GameIsPlaying == false)) return no
while ($read(l.txt,%x) != $null) {
if ($1 == $read(l.txt,%x)) return yes
inc %x
}
return no
}
EndRoles {
timers off
msg %GameChannel $c1(The game has been played for) $c2($duration($calc($ctime - %dur)))) $+ $c1(.)
inc %Played
if (%Nights > %MostNights) set %MostNights %Nights
unset %Nights
msg %GameChannel $c1(The roles were:)
%x = 1
while ($read(w.txt,%x)) {
%Player = $read(w.txt,%x)
if (%Player != $null) msg %GameChannel $c3(Mafia %x $+ :) $c2(%Player)
inc %x
}
set %Player %WasKiller
if (%Player) msg %GameChannel $c3(Killer:) $c2(%Player)
set %Player %WasDoctor
if (%Player) msg %GameChannel $c3(Doctor:) $c2(%Player)
set %Player %WasDetective
if (%Player) msg %GameChannel $c3(Detective:) $c2(%Player)
set %Player %WasHomeless
if (%Player) msg %GameChannel $c3(Bum:) $c2(%Player)
EndGame
}
Punt {
if ((!$1) || (%GameIsPlaying != true)) return
set %x 1
while ($read(l.txt,%x) != $null) {
if ($read(l.txt,%x) == $1) write -dl %x l.txt
if ($read(m.txt,%x) == $1) write -dl %x m.txt
inc %x
}
if ($1 ison %GameChannel) mode %GameChannel -v $1
if ($2) {
if ($2 ison %GameChannel) mode %GameChannel -v $2
}
if ($WhatIs($1) == Detective) unset %Detective
if ($WhatIs($1) == killer) unset %Killer
if ($WhatIs($1) == Doctor) unset %Doctor
if ($WhatIs($1) == Homeless) unset %Homeless
}
BotsMoves {
if ((%GameIsPlaying == false) || ($InGame($1) == no)) return
if ($WhatIs($1) == Civilian) {
msg %GameChannel $c1(The bot had to take real action:) $c3(civilian) $c2($1) $c1(was put face-first into a wall, and shot in the back!)
if ($InGame($1) == yes) { dec %TotalCivilian | kick $1 %CivilianChannel You died. }
}
if ($WhatIs($1) == detective) {
msg %GameChannel $c1(The was sitting in the bar when the) $c3(detective) $c2($1) $c1(got too drunk and started a fight, but ended up headless on the floor!)
if ($InGame($1) == yes) { dec %TotalDetective | kick $1 %CivilianChannel You died. | set %DetectiveMoved }
}
if ($WhatIs($1) == mafia) {
msg %GameChannel $c1(The mob messed with the wrong target, so the bot too a glance at) $c3(mafia) $c2($1) $c1(and shot a pistol right into the eye socket!)
if ($InGame($1) == yes) { dec %TotalMafia | kick $1 #mazone You died. | set %MafiaMoved }
}
if ($WhatIs($1) == doctor) {
msg %GameChannel $c1(The bot found illegal drugs being traced to the:) $c3(doctor) $c2($1) $c1(and punished the doc by death!)
if ($InGame($1) == yes) { dec %TotalDoctor | kick $1 %CivilianChannel You died. | set %DoctorMoved }
}
if ($WhatIs($1) == killer) {
msg %GameChannel $c1(The bot had to do some dirty work of its own and too the) $c3(killer) $c2($1) $+ $c1('s life!)
if ($InGame($1) == yes) { dec %TotalKiller | kick $1 %CivilianChannel You died. | set %KillerMoved }
}
if ($WhatIs($1) == homeless) {
msg %GameChannel $c1(The bot accidentally stepped on the) $c3(homeless bum) $c2($1) $+ $c1('s head and crushed it!)
if ($InGame($1) == yes) { dec %TotalHomeless | kick $1 %CivilianChannel You died. | set %HomelessMoved }
}
if ($InGame($1) == yes) dec %NumberOfPlayers
punt $1
}
StartTheGame {
if (%GameIsPlaying == true) return
if (%GameIsStopped == true) {
if (($1 !isop %GameChannel) && ($1 !ishop %GameChannel)) { msg $1 $c2(You don't have access to use that command.) | return }
else msg %GameChannel $c2(The bot shall run as normal)
}
EndGame
part %MafiaChannel $c1(Game over)
part %CivilianChannel $c1(Game over)
msg %GameChannel $c1(Registration into the game has start, you may use) $c2(!reg) $c1(to register) $+ $c1(! The registration lasts) $c3(2 minutes and 10 seconds)
set %NumberOfPlayers 0
set %GameIsStopped false
set %GameIsPlaying true
set %Registration on
set %TimeToAccept false
set %TotalPlayers 0
set %TotalMafia 0
set %TotalKiller 0
set %TotalHomeless 0
set %TotalDoctor 0
set %TotalCivilian 0
remove m.txt
remove l.txt
remove w.txt
remove a.txt
unset %WasDetective %WasDoctor %WasKiller %WasHomeless %Detective %Killer %Homeless %Doctor
set %BeginVoting no
set %Voting no
set %EndVoting no
set %TotalVoted 0
set %For 0
set %Against 0
timerReg1 1 65 msg %GameChannel $c1(Registration is in progress, you may join the game by using) $c2(!reg) $c1(Time left until the game starts:) $c3(1 minute and 5 seconds)
timerReg2 1 140 msg %GameChannel $c1(Well the registrtaion is now over, and the roles are about to be given out!)
timerReg3 1 145 GiveOutRoles
set %CivilianChannel $+(#Civilians,$r(1,99999))
set %MafiaChannel $+(#Mafia,$r(1,99999))
join %CivilianChannel
join %MafiaChannel
set %dur $ctime
}
TakeOut {
if (%GameIsPlaying == false) return
if ($InGame($1) == yes) return
if ($GotKicked($1) > 0) return
if (%GameIsStopped == true) return
if (%Registration == on) {
Punt $1
msg %GameChannel $c2($1) $c1(is no longer in the game...)
dec %NumberOfPlayers
return
}
if ($1 ison %GameChannel) mode %GameChannel -v $1
msg %GameChannel $c2($1) $c1(you are crazy, but you will be eliminated once the day/night comes...)
write q.txt $1
if (%Voting == yes) {
if (%CiviliansVictim == $1) { set %Voting no | timer1 off | timer1 1 5 Night }
}
if (%YesNoVoting == yes) {
if (%CiviliansVictim == $1) { %YesNoVoting = 0 | timer1 off | timer1 1 5 Night }
}
}
GiveOutRoles {
set %Registration off
set %TotalPlayers %NumberOfPlayers
set %DetectiveAccepted no
if (%TotalPlayers < 3) { msg %GameChannel $c2(The game cannot start due to the lack of players. You only have) $c3(%TotalPlayers out of 3) $C2(needed to play!) | set %GameIsPlaying false | endgame | return }
set %TimeToAccept true
mode %GameChannel m
set %TotalMafia $round($calc(((%TotalPlayers - 3)/3)+1),0)
set %TotalDetective 1
if (%TotalPlayers > 3) { set %TotalDoctor 1 | set %DoctorAccepted no }
else set %TotalDoctor 0
if (%TotalPlayers > 4) { set %TotalKiller 1 | set %KillerAccepted no }
else set %TotalKiller 0
if (%TotalMafia > 2) { set %TotalHomeless 1 | set %HomelessAccepted no }
else set %TotalHomeless 0
set %TotalCivilian $calc(%TotalPlayers - (%TotalMafia + %TotalDoctor + %TotalKiller + %TotalHomeless + %TotalDetective))
GiveOutD
if (%TotalDoctor != 0) GiveOutH
if (%TotalKiller != 0) GiveOutK
if (%TotalHomeless != 0) GiveOutB
StartMafiaGiveOut
timerStartGame 1 65 StartGame
}
StartMafiaGiveOut {
set %xx 1
while (%xx < %TotalMafia) {
GiveOutM
inc %xx
}
}
GiveOutD {
:PickAnotherPerson
set %RandomNick $read(l.txt,$rand(1,%TotalPlayers))
if ($WhatIs(%RandomNick) != civilian) goto PickAnotherPerson
msg %RandomNick $c1(You are being offered to be the) $c3(Detective) $+ $c1(! Do you accept this role? To accept (!yes) or to reject (!no))
set %Detective %RandomNick
set %WasDetective %RandomNick
}
GiveOutM {
:PickAnotherPerson
set %RandomNick $read(l.txt,$rand(1,%TotalPlayers))
if ($WhatIs(%RandomNick) != civilian) goto PickAnotherPerson
write $1 m.txt %RandomNick
write $1 w.txt %RandomNick
write no a.txt
msg %RandomNick $c1(You are being offered to be the) $c3(Mafia) $+ $c1(! Do you accept this role? To accept (!yes) or to reject (!no))
}
GiveOutH {
:PickAnotherPerson
set %RandomNick $read(l.txt,$rand(1,%TotalPlayers))
if ($WhatIs(%RandomNick) != civilian) goto PickAnotherPerson
msg %RandomNick $c1(You are being offered to be the) $c3(Doctor) $+ $c1(! Do you accept this role? To accept (!yes) or to reject (!no))
set %Doctor %RandomNick
set %WasDoctor %RandomNick
}
GiveOutK {
:PickAnotherPerson
set %RandomNick $read(l.txt,$rand(1,%TotalPlayers))
if ($WhatIs(%RandomNick) != civilian) goto PickAnotherPerson
msg %RandomNick $c1(You are being offered to be the) $c3(Killer) $+ $c1(! Do you accept this role? To accept (!yes) or to reject (!no))
set %Killer %RandomNick
set %WasKiller %RandomNick
}
GiveOutB {
:PickAnotherPerson
set %RandomNick $read(l.txt,$rand(1,%TotalPlayers))
if ($WhatIs(%RandomNick) != civilian) goto PickAnotherPerson
msg %RandomNick $c1(You are being offered to be the) $c3(Homeless bum) $+ $c1(! Do you accept this role? To accept (!yes) or to reject (!no))
set %Homeless %RandomNick
set %WasHomeless %RandomNick
}
EndVoting {
set %EndVoting yes
msg %GameChannel $c1(Ok, time to decide whether or not) $c2(%CiviliansVictim) $c1(should be hung... Is it worth it? Vote people!) $c2(!yes/!no) $c1(You have 1 minute!)
notice %GameChannel Civilians, time to vote!
set %For 0
set %Against 0
set %TotalVoted 0
set %Voting no
if ($hget(VotingResults)) hfree VotingResults
hmake VotingResults $calc(%NumberOfPlayers -1)
timer1 1 60 YesNoVoting
}
AcceptRole {
if ((%TimeToAccept == false) || ($WhatIs($1) == civilian) || (%AllConfirmed == yes)) return
if ($WhatIs($1) == detective) {
if (%DetectiveAccepted == yes) return
invite $1 %CivilianChannel
msg $1 $c1(Granted, you have been given your role. Please join $c3(%CivilianChannel))
set %Detective $1
msg %GameChannel $c1(It seems like the) $c2(detective) $c1(has accepted the role)...
set %WasDetective $1
set %DetectiveAccepted yes
}
if ($WhatIs($1) == doctor) {
if (%DoctorAccepted == yes) return
msg $1 $c1(Granted, you have been given your role)
set %Doctor $1
msg %GameChannel $c1(It seems like the) $c2(doctor) $c1(has accepted the role)...
set %WasDoctor $1
set %DoctorAccepted yes
}
if ($WhatIs($1) == killer) {
if (%KillerAccepted == yes) return
msg $1 $c1(Granted, you have been given your role)
set %Killer $1
/msg %GameChannel $c1(It seems like the) $c2(killer) $c1(has accepted the role)...
set %WasKiller $1
set %KillerAccepted yes
}
if ($WhatIs($1) == homeless) {
if (%HomelessAccepted == yes) return
invite $1 %CivilianChannel
msg $1 $c1(Granted, you have been given your role. Please join $c3(%CivilianChannel))
set %Homeless $1
/msg %GameChannel $c1(It seems like the) $c2(homeless) $c1(has accepted the role)...
set %WasHomeless $1
set %HomelessAccepted yes
}
if ($WhatIs($1) == mafia) {
set %TempVar $MafiaNumber($1)
if ($read(a.txt,t,%TempVar) == yes) return
write -l %t a.txt yes
invite $1 %MafiaChannel
msg $1 $c1(Granted, you have been given your role. Please join $c3(%MafiaChannel))
/msg %GameChannel $c1(It seems like the) $c2(mafia) $c1(has accepted the role)...
write l w.txt $1
}
if ($AllAccepted == yes) { timers off | StartGame }
}
StartVoting {
VictoryAchieved
set %BeginVoting yes
set %TimeToVote yes
set %Voting yes
set %CiviliansVictim $null
set %VotedVictim 0
if ($c == true) { EndGame | return }
else {
if ($hget(VotingResults)) hfree VotingResults
hmake VotingResults %NumberOfPlayers
msg %GameChannel $c1(Well, who is responsible for everything? You have 2 minutes! To vote:) $c2(!<Nick/Number>) $c1(or) $c2(!!night) $c1(if you don't want to hang anyone...)
ShowPlayers %GameChannel
notice %GameChannel People, time to vote!
timerToVote 1 120 Voting
}
}
RejectRole {
if ((%TimeToAccept == false) || ($WhatIs($1) == civilian) || (%AllConfirmed == yes)) return
if ($WhatIs($1) == detective) {
if (%DetectiveAccepted == yes) return
msg $1 $c1(Your role will be given to somebody else)
msg %GameChannel $c1(It seems like the) $c2(detective) $c1(has rejected the role)...
unset %detective
GiveOutD
}
if ($WhatIs($1) == doctor) {
if (%DoctorAccepted == yes) return
msg $1 $c1(Your role will be given to somebody else)
/msg %GameChannel $c1(It seems like the) $c2(doctor) $c1(has rejected the role)...
unset %doctor
GiveOutH
}
if ($WhatIs($1) == killer) {
if (%KillerAccepted == yes) return
msg $1 $c1(Your role will be given to somebody else)
/msg %GameChannel $c1(It seems like the) $c2(killer) $c1(has rejected the role)...
unset %killer
GiveOutK
}
if ($WhatIs($1) == homeless) {
if (%HomelessAccepted == yes) return
msg $1 $c1(Your role will be given to somebody else)
/msg %GameChannel $c1(It seems like the) $c2(homeless) $c1(has rejected the role)...
unset %homeless
GiveOutB
}
if ($WhatIs($1) == mafia) {
set %TempVar $fif(m.txt,$1)
write -dl %TempVar m.txt
write -dl %TempVar w.txt
set %RandomNick $MafiaNumber($1)
msg $1 $c1(Your role will be given to somebody else)
msg %GameChannel $c1(It seems like the) $c2(mafia) $c1(has rejected the role)...
GiveOutM %RandomNick
}
}
Voting {
set %BeginVoting no
%TimeToVote = no
if (%VotedVictim < 2) {
msg %GameChannel $c1(During the entire day, the people didn't achive anything!)
timer1 1 10 /night
return
}
if (%z == 1) {
msg %GameChannel 10The day was wasted, and there was no decision!
timer1 1 10 /night
return
}
if (%CiviliansVictim == 1night) {
msg %GameChannel 10The people have decided not to hang anybody today!
timer1 1 10 /night
return
}
set %Voting yes
msg %GameChannel $c1(Certain people agree that) $c2(%CiviliansVictim) $c1(should be blamed for what was done at night!)
msg %GameChannel $c1(What do you have to say for yourself dear) $c2%CiviliansVictim) $c3(!done) $c1(to end... You have no more than 10 seconds!)
timer1 1 10 EndVoting
}
AllActiveRoles {
if ((%GameIsPlaying == false) || (%Registration == on) || (%GameIsStopped == 1)) return
set %ActiveRoles $c1(In total there are:)
if (%TotalCivilian > 0) %ActiveRoles = %ActiveRoles $c2(civilians -) $c3(%TotalCivilian) $+ $c1($chr(44))
if (%TotalDetective > 0) %ActiveRoles = %ActiveRoles $c2(detective) $+ $c1($chr(44))
if (%TotalMafia > 0) %ActiveRoles = %ActiveRoles $c2(mafia -) $c3(%TotalMafia) $+ $c1($chr(44))
if (%TotalDoctor > 0) %ActiveRoles = %ActiveRoles $c2(doctor) $+ $c1($chr(44))
if (%TotalKiller > 0) %ActiveRoles = %ActiveRoles $c2(killer) $+ $c1($chr(44))
if (%TotalHomeless > 0) %ActiveRoles = %ActiveRoles $c2(homeless bum) $+ $c1(..)
%ActiveRoles = $left(%ActiveRoles,-1)
return %ActiveRoles
}
StartGame {
set %TimeToAccept false
if ($AllConfirmed == no) {
set %Xy 1
msg %Detective Please join $c3(%CivilianChannel))
if (%TotalHomeless == 1) msg %Homeless $c1(Please join) $c3(%CivilianChannel))
while ($read(w.txt,%Xy)) {
if ($read(m.txt,w,$+($read(w.txt,%Xy))) == $null)
{
write m.txt $read(w.txt,%Xy)
msg $read(w.txt,%Xy) $c1(Please join) %$c2(%MafiaChannel)
write -dl %Xy w.txt
}
inc %Xy
}
}
msg %GameChannel $c1(The roles have been given out, and the game is about to start...)
msg %GameChannel $AllActiveRoles
/NightChecks
}
NightChecks {
if ($read(q.txt,1) == $null) { Night | return }
else {
PlayersGone
if ($VictoryAchieved == true) {
EndGame
return
}
}
timer1 1 10 Night
}
SleepyPeople {
if ($read(q.txt,1) == $null) { DetectivesMove | return }
else {
PlayersGone
remove q.txt
timerNextMove 1 15 DetectivesMove
}
}
ShowPlayers {
if (%GameIsPlaying == false) return
%ListOfPlayers = $c1(List of players:)
%x = 1
while (%x <= %NumberOfPlayers) {
%ListOfPlayers = %ListOfPlayers $c3(%x) $+ .4 $read(l.txt,%x)
inc %x
}
msg $1 %ListOfPlayers
}
Night {
VictoryAchieved
%NightTime = yes
%DetectiveMoved = 0
%MafiaMoved = 0
%DoctorMoved = 0
%KillerMoved = 0
%BumMoved = 0
%DetectivesVictim = $null
%MafiasVictim = $null
%DoctorsVictim = $null
%KillersVictim = $null
%BumsVictim = $null
%DWords = $null
%MWords = $null
%HWords = $null
%KWords = $null
%BWords = $null
inc %nights
msg %GameChannel $c1(It is now the) $c3(night) $c1(time, the people are sleeping tight, after a hard day of work. The only ones who are up, are those you are looking for trouble. The night will last 3 minutes 10!!)
if (%Detective != $null) { msg %Detective $c2(Who's the victim?) $c1(To check:) $c3(!check <Nick/Number> [phrase]) $c1(to kill:) $c3(!kill <Nick/Number> [phrase]) | ShowPlayers %Detective }
if ($read(m.txt,1) != $null) { msg $read(m.txt,1) $c2(Who's the victim?) $c1(To kill:) $c3(!kill <Nick/Number> [phrase]) | ShowPlayers $read(m.txt,1) }
if (%Doctor != $null) { msg %Doctor $c2(Who's the victim?) $c1(To heal:) $c3(!heal <Nick/Number> [phrase]) | ShowPlayers %Doctor }
if (%killer != $null) { msg %Killer $c2(Who's the victim?) $c1(To kill:) $c3(!kill <Nick/Number> [phrase]) | ShowPlayers %Killer }
if (%Homeless != $null) { msg %Homeless $c2(Who's the victim?) $c1(To check:) $c3(!check <Nick/Number> [phrase]) | ShowPlayers %Homeless }
notice %GameChannel Players, time to make your move!
if (%Detective == $null) %DetectiveMoved = 1
if ($read(m.txt,1) == $null) %MafiaMoved = 1
if (%Doctor == $null) %DoctorMoved = 1
if (%Killer == $null) %KillerMoved = 1
if (%Homeless == $null) %BumMoved = 1
timerToEndNight 1 180 Day
}
PlayersGone {
set %x 1
while ($read(q.txt,%x) != $null) {
set %Quitter $read(q.txt,%x)
if (%Quitter != $null) TakeOut %Quitter
inc %x
}
}
Day {
VictoryAchieved
msg %GameChannel $c1(Finally the) $c3(day) $c1(has come, they sun is shining bright, and the birds are singing. There is a cry heard through out the town "help!" A member of the town is now dead...)
FoundOutRole %Detective
FoundOutRole %Homeless
set %NightTime no
set %healed 0
timerDay 1 5 DetectivesMove
}
DetectivesMove {
if ((%DetectivesVictim == $null) && (%TotalDetective > 0)) { BotAttacks %Detective | timerNextMove 1 15 MafiasMove | return }
if (%DetectiveChecked == yes) {
msg %GameChannel $c1(The) $c3(detective) $c1(could have been doing something better last night, but at least he now knows who is) $c2(%DetectivesVictim) $c1(is! $iif(%DWords != $null,Detective's words were:12 %DWords))
timerNextMove 1 15 MafiasMove
}
else {
if (%healed == 0) {
if (%DoctorsVictim == %DetectivesVictim) {
set %healed 1
msg %GameChannel $c1(The) $c3(detective) $c1(took many shots last night and almost killed) $c2(%DetectivesVictim) $c1($iif(%DWords != $null,Detective's words were:12 %DWords))
msg %GameChannel $c3(%DoctorsVictim) $c1(was near death, but thankfully the) $c3(doctor) $c1(knew what he was doing, and saved the poor soul! $iif(%HWords != $null,The doctor's words were:12 %HWords))
timerNextMove 1 15 MafiasMove
return
}
}
if ($WhatIs(%DetectivesVictim) == civilian) {
msg %GameChannel $c1(The) $c3(detective) $c1(got in a fight and lost control of himself so he shot the) $c3(civilian) $c2(%DetectivesVictim) $+ $c1(! $iif(%DWords != $null,Detective's words were:12 %DWords)) | kick %CivilianChannel %DetectivesVictim You died
if ($InGame(%DetectivesVictim) == yes) { dec %TotalCivilian }
}
if ($WhatIs(%DetectivesVictim) == detective) {
msg %GameChannel $c3(Detective) $c2(%DetectivesVictim) $c1(could no longer handle the pressure he was under, so he decided to kill himself... $iif(%DWords != $null,Detective's words were:12 %DWords)) | kick %CivilianChannel %DetectivesVictim You died
if ($InGame(%DetectivesVictim) == yes) { dec %TotalDetective }
}
if ($WhatIs(%DetectivesVictim) == mafia) {
msg %GameChannel $c1(The) $c3(detective) $c1(was going through a tough operation and in the end has managed to kill the) $c3(mafia) $c2(%DetectivesVictim) $+ $c1(... $iif(%DWords != $null,Detective's words were:12 %DWords)) | kick %MafiaChannel %DetectivesVictim You died
if ($InGame(%DetectivesVictim) == yes) { dec %TotalMafia }
}
if ($WhatIs(%DetectivesVictim) == doctor) {
msg %GameChannel $c1(The) $c3(detective) $c1(did not believe that the) $c3(doctor) $c2(%DetectivesVictim) $c1(had stiched up his sholder to his best efforts, so he deserved to die... $iif(%DWords != $null,Detective's words were:12 %DWords)) | kick %CivilianChannel %DetectivesVictim You died
if ($InGame(%DetectivesVictim) == yes) { dec %TotalDoctor }
}
if ($WhatIs(%DetectivesVictim) == killer) {
msg %GameChannel $c1(The) $c3(detective) $1(was sitting in the bar when he started fighting with the) $c3(killer) $c2(%DetectivesVictim) $+ $c1(and was nothing short of victory! $iif(%DWords != $null,Detective's words were:12 %DWords)) | kick %CivilianChannel %DetectivesVictim You died
if ($InGame(%DetectivesVictim) == yes) { dec %TotalKiller }
}
if ($WhatIs(%DetectivesVictim) == homeless) {
msg %GameChannel $c1(The) $c3(detective) $1(got into an arguement with his best friend, and killed the) $c3(homeless bum) $c2(%DetectivesVictim) $+ $c1(... $iif(%DWords != $null,Detective's words were:12 %DWords)) | kick %CivilianChannel %DetectivesVictim You died
if ($InGame(%DetectivesVictim) == yes) { dec %TotalHomeless }
}
if ($InGame(%DetectivesVictim) == yes) dec %NumberOfPlayers
Punt %DetectivesVictim
}
timerNextMove 1 15 MafiasMove
return
}
MafiasMove {
if (%MafiasVictim == $null) {
if ($read(m.txt,1) != $null) { BotAttacks $read(m.txt,1) | timerNextMove 1 15 KillersMove | /return }
KillersMove
return
}
if (%healed == 0) {
if (%DoctorsVictim == %MafiasVictim) {
set %healed 1
msg %GameChannel $c1(The) $c3(mafia) $c1(had a meeting last night, and came to the conclusion that) $c2(%MafiasVictim) $c1(deserves to die! $iif(%MWords != $null,Mafia's words were:12 %MWords))
msg %GameChannel $c1(Nobody could touch) $c2(%DoctorsVictim) $c1(for the) $c3(doctor) $c1(was there to save a life! $iif(%HWords != $null,Doctor's words were:12 %HWords))
}
}
if ($WhatIs(%MafiasVictim) == civilian) {
msg %GameChannel $c1(It wasn't long until the) $c3(mafia) $c1(decided to let) $c3(civilian) $c2(%MafiasVictim) $c1(rest in peace! $iif(%MWords != $null,Mafia's words were:12 %MWords)) | kick %CivilianChannel %MafiasVictim You died
if ($InGame(%MafiasVictim) == yes) { dec %TotalCivilian }
}
if ($WhatIs(%MafiasVictim) == detective) {
msg %GameChannel $c1(Well people, today was a sad day, for the) $c3(mafia) $c1(had finally found the) $c3(detective) $c2(%MafiasVictim) $c1(and put a bullet through the head! $iif(%MWords != $null,Mafia's words were:12 %MWords))
kick %CivilianChannel %MafiasVictim You died
if ($InGame(%MafiasVictim) == yes) { dec %TotalDetective }
}
if ($WhatIs(%MafiasVictim) == mafia) {
msg %GameChannel $c1(The) $c3(mafia) $c1(hand a great conflict last night, and it ended in a killing of the) $c3(mafia's) $c2(%MafiasVictim) $+ $c1(... $iif(%MWords != $null,Mafia's words were:12 %MWords))
kick %MafiaChannel %MafiasVictim You died
if ($InGame(%MafiasVictim) == yes) { dec %TotalMafia }
}
if ($WhatIs(%MafiasVictim) == doctor) {
msg %GameChannel $c1(The) $c3(mafia) $c1(did not like the fact that the majority of their victims live to see the next day after their visit, so they killed the) $c3(doctor) $c2(%MafiasVictim) $+ $c1(... $iif(%MWords != $null,Mafia's words were:12 %MWords))
kick %CivilianChannel %MafiasVictim You died
if ($InGame(%MafiasVictim) == yes) { dec %TotalDoctor }
}
if ($WhatIs(%MafiasVictim) == killer) {
msg %GameChannel $c1(The) $c3(mafia) $c1(are aware of their competition, so they burtally shot and killed the) $c3(killer) $c2(%MafiasVictim) $+ $c1(... $iif(%MWords != $null,Mafia's words were:12 %MWords))
kick %CivilianChannel %MafiasVictim You died
if ($InGame(%MafiasVictim) == yes) { dec %TotalKiller }
}
if ($WhatIs(%MafiasVictim) == homeless) {
msg %GameChannel $c1(The) $c3(mafia) $c1(were afraid of getting traced, so they threw a grenade they had on them in the dumpster and by chance killing the) $c3(homeless bum) $c2(%MafiasVictim) $+ $c1(... $iif(%MWords != $null,Mafia's words were:12 %MWords))
kick %CivilianChannel %MafiasVictim You died
if ($InGame(%MafiasVictim) == yes) { dec %TotalHomeless }
}
if ($InGame(%MafiasVictim) == yes) dec %NumberOfPlayers
Punt %MafiasVictim
timerNextMove 1 15 KillersMove
}
KillersMove {
if (%TotalKiller < 1) { DoctorsMove | return }
if (%KillersVictim == $null) { BotAttacks %Killer | timerNextMove 1 15 DoctorsMove | return }
if (%healed == 0) {
if (%DoctorsVictim == %KillersVictim) {
set %healed 1
msg %GameChannel $c1(The) $c3(killer) $c1(got a little to careless with) $c2(%victman) $+ $c1(, and couldn't get the job done! $iif(%KWords != $null,Killer's words were:12 %KWords))
msg %GameChannel $c2(%victdok) $c1(didn't die for the) $c3(doctor) $c1(was right at the scene of the crime! $iif(%HWords != $null,The doctor's words were:12 %HWords))
goto doc
}
}
if ($WhatIs(%KillersVictim) == civilian) {
msg %GameChannel $c1(At night the) $c3(killer) $c1(got the blood of the innocent as he wanted, and killed) $c3(civilian) $c2(%KillersVictim) $+ $c1(! $iif(%KWords != $null,Killer's words were:12 %KWords))
kick %CivilianChannel %KillersVictim You died
if ($InGame(%KillersVictim) == yes) dec %TotalCivilian
}
if ($WhatIs(%KillersVictim) == detective) {
msg %GameChannel $c1(The crazy) $c3(killer) $c1(decapitated) the $3(detective) $2(%KillersVictim) $c1(and carved his name into the skull! $iif(%KWords != $null,Killer's words were:12 %KWords))
kick %CivilianChannel %KillersVictim You died
if ($InGame(%KillersVictim) == yes) dec %TotalDetective
}
if ($WhatIs(%KillersVictim) == mafia) {
msg %GameChannel $c1(The) $c3(killer) $c1(saw a mob and wanted to join, but after getting rejected he killed the) $3(mafia) $2(%KillersVictim) $+ $c1(! $iif(%KWords != $null,Killer's words were:12 %KWords))
kick %MafiaChannel %KillersVictim You died
if ($InGame(%KillersVictim) == yes) dec %TotalMafia
}
if ($WhatIs(%KillersVictim) == doctor) {
msg %GameChannel $c1(The) $c3(doctor) $2(%KillersVictim) $c1(was out helping the people in town, then suddenly got stabbed in the back with a dagger by the visious) $3(killer) $+ $c1(! $iif(%KWords != $null,Killer's words were:12 %KWords))
kick %CivilianChannel %KillersVictim You died
if ($InGame(%KillersVictim) == yes) dec %TotalDoctor
}
if ($WhatIs(%KillersVictim) == killer) {
msg %GameChannel $c1(Going crazy from boredom, the) $c3(killer) $c2(%KillersVictim) $c1(decided to commit suicide, and jabbed a knife right into the throat! $iif(%KWords != $null,Killer's words were:12 %KWords))
kick %CivilianChannel %KillersVictim You died
kick %MafiaChannel %KillersVictim You died
if ($InGame(%KillersVictim) == yes) dec %TotalKiller
}
if ($WhatIs(%KillersVictim) == homeless) {
msg %GameChannel $c1(The) $c3(killer) $c1(noticed that the) $3(homeless bum) $2(%KillersVictim) $c1(was asking for money, so decided to have some fun by stabbing the bum in the eyes and snapping his neck! $iif(%KWords != $null,Killer's words were:12 %KWords))
kick %CivilianChannel %KillersVictim You died
if ($InGame(%KillersVictim) == yes) dec %TotalHomeless
}
if ($InGame(%KillersVictim) == yes) dec %NumberOfPlayers
Punt %KillersVictim
:doc
timerNextMove 1 15 DoctorsMove
}
DoctorsMove {
if (%TotalDoctor < 1) { BumsMove | return }
if (%DoctorsVictim == $null) {
if (%TotalDoctor > 0) { BotAttacks %Doctor | timerNextMove 1 15 BumsMove | return }
}
if (%healed == 0) {
msg %GameChannel $c1(The) $c3(doctor) $c1(thought that) $c2(%DoctorsVictim) $c1(looked too ill, so he decided to stay there over night... $iif(%HWords != $null,Doctor's words were:12 %HWords))
}
else { BumsMove | return }
timerNextMove 1 15 BumsMove
}
BumsMove {
if (%BumsVictim == $null) {
if (%TotalHomeless > 0) { BotAttacks %Homeless | timerNextMove 1 15 StartVoting | return }
StartVoting
return
}
msg %GameChannel $c1(The) $c3(homeless bum) $c1(at night started snooping around) $c2(%BumsVictim) $+ $c1('s stuff.. $iif(%BWords != $null,Homeless' words were:12 %BWords))
timerNextMove 1 15 StartVoting
}
BotAttacks {
if ($WhatIs($1) == Civilian) { msg %GameChannel $c(The bot had to take real action, so) $c2(civilian) $c3($1) $c1(was put face-first into a wall, and shot in the back!)
kick $1 %CivilianChannel You died.
if ($InGame($1) == yes) dec %TotalCivilian
}
if ($WhatIs($1) == Detective) {
msg %GameChannel $c1(The) $c3(detective) $c2($1) $c1(got too drunk and started a fight with the bot, and you could see how that ended...)
kick $1 %CivilianChannel $c1(You died.)
set %DetectiveMoved yes
if ($InGame($1) == yes) dec %TotalDetective
}
if ($WhatIs($1) == Mafia) {
msg %GameChannel $c1(The) $c3(mafia) $c2($1) $c1(got too drunk and started a fight with the bot, and you could see how that ended...)
kick $1 %MafiaChannel $c1(You died.)
set %MafiaMoved yes
if ($InGame($1) == yes) dec %TotalMafia
}
if ($WhatIs($1) == Doctor) {
msg %GameChannel $c1(The) $c3(doctor) $c2($1) $c1(got too drunk and started a fight with the bot, and you could see how that ended...)
kick $1 %CivilianChannel $c1(You died.)
set %DoctorMoved yes
if ($InGame($1) == yes) dec %TotalDoctor
}
if ($WhatIs($1) == Killer) {
msg %GameChannel $c1(The) $c3(killer) $c2($1) $c1(got too drunk and started a fight with the bot, and you could see how that ended...)
kick $1 %CivilianChannel $c1(You died.)
set %KillerMoved yes
if ($InGame($1) == yes) dec %TotalKiller
}
if ($WhatIs($1) == Homeless) {
msg %GameChannel $c1(The) $c3(homeless bum) $c2($1) $c1(got too drunk and started a fight with the bot, and you could see how that ended...)
kick $1 %CivilianChannel $c1(You died.)
set %HomelessMoved yes
if ($InGame($1) == yes) dec %TotalHomeless
}
if ($InGame($1) == yes) dec %NumerOfPlayers
punt $1
}
VotingStats {
unset %Voted*
set %x 1
set %y 0
set %z 0
var %VotingMessage = $c4(Voting Statistics:)
while ($hget(VotingResults,%x).data) {
set %User $hget(VotingResults,%x).data
inc %Voted $+ $hget(VotingResults,%x).data
if (%User !isin %VotingMessage) set %VotingMessage %VotingMessage $iif(%User != 1night,$c2(%User),$c5($right(%User,-1))) $c4(-) $c3($+(!,Voted,%User)) $+ $c4(.)
if (%z < $eval($+(%,Voted,$hget(VotingResults,%x).data),2)) { set %z $eval($+(%,Voted,$hget(VotingResults,%x).data),2) | set %CiviliansVictim $hget(VotingResults,%x).data }
inc %x
inc %y
}
set %VotingMessage %VotingMessage $c3($+([,%y,:,%NumberOfPlayers,]))
msg %GameChannel $regsubex(%VotingMessage,/!(Voted\w+)/ig,$(%\1,2))
if ($calc(%z / %NumberOfPlayers) >= .6) { timers off | timerYesNo 1 5 Voting | unset %D }
}
ThoseVoted {
if (%GameIsPlaying == false) return
if (%Voting == no) return
if ($InGame($1) == no) return
if ($left($2,1) != !) return
set %Vote $right($2,-1)
if ($PlayerNumber(%Vote) == yes) %Victim = $read(l.txt,%Vote)
else %Victim = %vote
%Vote = %Victim
if (%Vote == !night) { set %Vote 1night }
if (($InGame(%Vote) == no) && (%Vote != 1night)) {
msg %GameChannel $c1(There is no) $c2(%Vote) $c1(in the game...)
return
}
hadd VotingResults $1 %Vote
VotingStats
}
YesNoVoting {
if (%Against >= %For ) {
msg %GameChannel $c1(The defendant) $c2(%CiviliansVictim) $c1(is safe! Now's the time to celebrate!)
timerGoToNight 1 10 Night
return
}
if ($calc(%Against + %For) <= $calc((%NumberOfPlayers -1)/2)) {
msg %GameChannel $c1(The people haven't come to a conclusion!)
timerGoToNight 1 10 Night
return
}
if (%CiviliansVictim == $null) goto CheckForEnd
if ($WhatIs(%CiviliansVictim) == civilian) {
msg %GameChannel $c1(Today the people have decided to hang the) $c3(civilian) $c2(%CiviliansVictim)
if ($InGame(%CiviliansVictim) == yes) dec %TotalCivilian
}
if ($WhatIs(%CiviliansVictim) == detective) {
msg %GameChannel $c1(People what have you done? You just hang the) $c3(detective) $c2(%CiviliansVictim)
if ($InGame(%CiviliansVictim) == yes) dec %TotalDetective
}
if ($WhatIs(%CiviliansVictim) == mafia) {
msg %GameChannel $c1(Hooray! The town has finally gotten rid of the evil) $c3(mafia) $c2(%CiviliansVictim)
if ($InGame(%CiviliansVictim) == yes) dec %TotalMafia
}
if ($WhatIs(%CiviliansVictim) == doctor) {
msg %GameChannel $c1(The townspeople were fed up with the constant medicine mixup, so they hung the) $c3(doctor) $c2(%CiviliansVictim)
if ($InGame(%CiviliansVictim) == yes) dec %TotalDoctor
}
if ($WhatIs(%CiviliansVictim) == killer) {
msg %GameChannel $c1(The good people of the village have had enough of the innocent people dying, and killed off the) $c3(killer) $c2(%CiviliansVictim)
if ($InGame(%CiviliansVictim) == yes) dec %TotalKiller
}
if ($WhatIs(%CiviliansVictim) == homeless) {
msg %GameChannel $c1(The people could no longer stand the horrible stench of the) $c3(homeless bum) $c2(%CiviliansVictim)
if ($InGame(%CiviliansVictim) == yes) dec %TotalHomeless
}
if ($InGame(%CiviliansVictim) == yes) dec %NumberOfPlayers
Punt %CiviliansVictim
goto CheckForEnd
:CheckForEnd
if ($VictoryAchieved == true) {
EndGame
return
}
timerVotingOver 1 10 Night
}
VoteFor {
if ($InGame($1) == no) return
if (%GameIsStopped == true) return
if (%GameIsPlaying == false) return
if (%EndVoting == no) return
if ($1 == %CiviliansVictim) return
if ($hget(VotingResults,$1) == $null) { inc %For | inc %TotalVoted }
if ($hget(VotingResults,$1) == no) { inc %For | dec %Against }
hadd VotingResults $1 Yes
msg %GameChannel $c2($+($chr(91),%For,:,%Against,$chr(93))) $+ $c3($+($chr(91),%TotalVoted,:,$calc(%NumberOfPlayers -1),$chr(93))) $c1(The townperson) $c2($1) $c1(has voted) $c3(for) $c1(the hanging of) $c2(%CiviliansVictim)
if (%For > $calc((%NumberOfPlayers - 1)/2) ) { timer1 -o 1 7 YesNoVoting }
elseif (%Against > $calc((%NumberOfPlayers - 1)/2) ) { timer1 -o 1 7 YesNoVoting }
elseif ($calc(%Pro + %Against) == $calc(%NumberOfPlayers - 1) ) { timer1 -o 1 7 YesNoVoting }
}
VoteAgainst {
if ($InGame($1) == no) return
if (%GameIsStopped == true) return
if (%GameIsPlaying == false) return
if (%EndVoting == no) return
if ($1 == %CiviliansVictim) return
if ($hget(VotingResults,$1) == $null) { inc %Against | inc %TotalVoted }
if ($hget(VotingResults,$1) == yes) { inc %Against | dec %For }
hadd VotingResults $1 No
msg %GameChannel $c2($+($chr(91),%For,:,%Against,$chr(93))) $+ $c3($+($chr(91),%TotalVoted,:,$calc(%NumberOfPlayers -1),$chr(93))) $c1(The townperson) $c2($1) $c1(has voted) $c3(against) $c1(the hanging of) $c2(%CiviliansVictim)
if (%For > $calc((%NumberOfPlayers - 1)/2) ) { timer1 -o 1 7 YesNoVoting }
elseif (%Against > $calc((%NumberOfPlayers - 1)/2) ) { timer1 -o 1 7 YesNoVoting }
elseif ($calc(%Pro + %Against) == $calc(%NumberOfPlayers - 1) ) { timer1 -o 1 7 YesNoVoting }
}
VictoryAchieved {
if (%NumberOfPlayers == 1) {
if (%TotalMafia == 1) {
msg %GameChannel $c2(Game over! The wins goes to mafia!)
inc %MafiaWon
EndRoles
return true
}
}
if (%NumberOfPlayers == 1) {
if (%TotalKiller == 1) {
msg %GameChannel $c2(Game over! The wins goes to civilians!)
inc %CiviliansWon
EndRoles
return true
}
}
if (%NumberOfPlayers == 1) {
if (%TotalDoctor == 1) {
msg %GameChannel $c2(Game over! The wins goes to civilians!)
inc %CiviliansWon
EndRoles
return true
}
}
if (%NumberOfPlayers == 2) {
if (%TotalKiller == 1) {
if (%TotalMafia == 1)
msg %GameChannel $c2(Game over! It's a tie!)
inc %Ties
EndRoles
return true
}
}
if (%NumberOfPlayers == 1) {
if (%TotalHomeless == 1) {
msg %GameChannel $c2(Game over! The wins goes to civilians!)
inc %CiviliansWon
EndRoles
return true
}
}
if (%NumberOfPlayers == 1) {
if (%TotalCivilian == 1) {
msg %GameChannel $c2(Game over! The wins goes to mafia!)
inc %MafiaWon
EndRoles
return true
}
}
if ($read(m.txt,1) == $null) {
if (%Killer == $null ) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) >= 1 ) {
msg %GameChannel $c2(Game over! The wins goes to thecivilian!)
inc %CiviliansWon
EndRoles
return true
}
}
}
if ($read(m.txt,1) != $null) {
if (%Detective == $null) {
if (%Killer == $null ) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) <= 1 ) {
msg %GameChannel $c2(Game over! The wins goes to themafia!)
inc %MafiaWon
EndRoles
return true
}
}
}
}
if (%Killer != $null) {
if (%Detective == $null) {
if ($read(m.txt,1) == $null ) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) <= 1 ) {
msg %GameChannel $c2(Game over! The winner is the killer!)
inc %KillerWon
EndRoles
return true
}
}
}
}
if (%TotalDetective == 1) {
if (%TotalKiller == 1) {
if (%TotalPlayers == 2) {
msg %GameChannel $c2(Game over! It's a tie!)
inc %Ties
EndRoles
return true
}
}
}
if (%TotalMafia == 1) {
if (%TotalKiller == 1) {
if (%TotalPlayers == 2) {
msg %GameChannel $c2(Game over! It's a tie!)
inc %Ties
EndRoles
return true
}
}
}
if (%TotalKiller == 1) {
if (%TotalDetective == 0) {
if (%TotalMafia == 0) {
if (%TotalPlayers < 3) {
msg %GameChannel $c2(Game over! The winnder is the killer!)
inc %KillerWon
EndRoles
return true
}
}
}
}
if (%TotalMafia == 1) {
if (%TotalDetective == 1) {
if (%TotalKiller == 0) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) == 0) {
msg %GameChannel $c2(Game over! It's a tie!)
inc %Ties
EndRoles
return true
}
}
}
}
if (%TotalMafia == 1) {
if (%TotalDetective == 1) {
if (%TotalKiller == 0) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) == 0 ) {
msg %GameChannel $c2(Game over! It's a tie!)
inc %Ties
EndRoles
return true
}
}
}
}
if (%TotalKiller == 1) {
if (%TotalDetective == 1) {
if (%TotalMafia == 0) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) == 0 ) {
msg %GameChannel $c2(Game over! It's a tie!)
inc %Ties
EndRoles
return true
}
}
}
}
if (%TotalMafia == 1) {
if (%TotalKiller == 1) {
if (%TotalDetective == 0) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) == 0 ) {
msg %GameChannel $c2(Game over! It's a tie!)
inc %Ties
EndRoles
return true
}
}
}
}
if (%TotalMafia == 0) {
if (%TotalKiller == 0) {
if (%TotalDetective == 0 ) {
if ($calc(%TotalCivilian + %TotalDoctor + %TotalHomeless) == 0 ) {
msg %GameChannel $c2(Game over! Everybody lost!)
inc %Ties
EndRoles
return true
}
}
}
}
if (%NumberOfPlayers == 0) {
msg %GameChannel $c2(Game over! It's a tie and everybody lost!)
inc %Ties
EndRoles
EndGame
return true
}
return false
}
Leaving {
if (%GameIsPlaying == false) return
if ($GameIsStopped == true) return
if ($InGame($1) == yes) return
if (%Registration == on) {
punt $1
msg %GameChannel $c2($1) $c1(is no longer in the game...)
%numplayers = %numplayers - 1
return
}
if ($1 ison %GameChannel) mode %GameChannel -v $1
msg %GameChannel $c2($1) $c1(has until either the day or night to get back, or else the bot will have to do some dirty work...)
kick %CivilianChannel $1 You left
kick %MafiaChannel $1 You left
}
JoinGameChannel {
if ($1 == $me) { EndGame }
inc %Visitors
notice $1 $c2($1) $c1(welcome to the internet IRС-game channel) $c2("Mafia") $c1(you are visitor number) $c3(%Visitors)
if ((%GameIsPlaying == false) && (%GameIsStopped == false)) {
notice $1 $c1(To start the game, type in) $2(!start) $c1(in the channel, but keep in mind that you need at least $c3(3) $c1(players...))
return
}
if (%Registration == on) {
notice $1 $c1(There is currently a registeration for the game! Type in) $c2(!reg) $c1(to register for the game!)
return
}
if (%GameIsPlaying == 1) {
if ($GotKicked($1) > 0) {
mode %GameChannel +v $1
msg %GameChannel $c1($1 $+ , You're back in the game!)
if (%NightTime == yes) {
if ($EveryoneMoved == no) {
msg %GameChannel $c1(Just in case you have a role and you haven't made your move yet, do it now...)
timer1 off
timer1 1 180 Day
}
}
%t = $GotKicked($1)
write -dl %t q.txt
return
}
notice $1 $c1(Sadly, the game has already started. Please wait for the game to end...)
return
}
}
EveryoneMoved {
if (%DetectiveMoved > 0) {
if (%MafiaMoved > 0 ) {
if (%KillerMoved > 0 ) {
if (%DoctorMoved > 0 ) {
if (%BumMoved > 0 ) return yes
}
}
}
}
return no
}
GotKicked {
set %x 1
while ($read(q.txt,%x)) {
if ($read(q.txt,%x) == $1) return %x
if ($read(q.txt,%x) == $null) return 0
inc %k
}
return 0
}
Reg {
if (%GameIsPlaying == false) StartTheGame $1
if (%Registration == off) return
if ($InGame($1) == yes) return
inc %NumberofPlayers
write l.txt $1
if ($1 ison %GameChannel) mode %GameChannel +v-ho $1 $1 $1
notice $1 $c1(You have registered as player number) $c2(%NumberOfPlayers)
}
ReggedByOp {
if (($2 !isop %GameChannel) && ($2 !ishop %GameChannel)) return
if ($1 !ison %GameChannel) return
if (%GameIsPlaying == false) StartTheGame
if (%Registration == off) return
if ($InGame($1) == yes) return
inc %NumberofPlayers
write l.txt $1
mode %GameChannel +v-ho $1 $1 $1
msg %GameChannel $c3($1) $c1(has been registered registered as player number) $c2(%NumberOfPlayers) $c1(by staff member) $c3($2)
}
Kill {
set %VictimsName $null
if ((%GameIsPlaying == false) || (%GameIsStopped == true) || (%NightTime == no) || ($InGame($2) == no)) return
if ($PlayerNumber($1) == yes) set %VictimsName $read(l.txt,$1)
else set %VictimsName $1
if ($InGame(%VictimsName) == no) { msg $2 $c1(There is no such player! Please try again...) | return }
if ($WhatIs($2) == detective) {
if (%DetectiveMoved > 0) { msg $2 $c2(Sorry, but you've already made your move...) | return }
set %DetectivesVictim %VictimsName
set %DetectiveChecked no
set %DetectiveMoved 1
set %DWords $3-
msg %GameChannel $c1(The) $c3(detective) $c1(got bored out of his mind, so he decided to do something about it...)
msg $2 $c1(You have decided to kill) $c2(%VictimsName)
msg %CivilianChannel $c1(The) $c3(detective) $c1(decided to kill) $c2(%VictimsName)
}
if ($read(m.txt,1) == $2) {
if (%MafiaMoved > 0) { msg $2 $c2(Sorry, but you've already made your move...) | return }
set %MafiasVictim %VictimsName
set %MafiaMoved 1
set %MWords $3-
msg %GameChannel $c1(The) $c3(mafia) $c1(gathered up in a very dark ally, and decided to get some work done...)
msg $2 $c1(You have decided to kill) $c2(%VictimsName)
msg %MafiaChannel $c1(The) $c3(mafia) $c1(decided to kill) $c2(%VictimsName)
}
if ($WhatIs($2) == killer) {
if (%KillerMoved > 0) { msg $2 $c2(Sorry, but you've already made your move...) | return }
set %KillersVictim %VictimsName
set %KillerMoved 1
set %KWords $3-
msg $2 $c1(You have decided to kill) $c2(%VictimsName)
msg %GameChannel $c1(The) $c3(killer) $c1(got thirsty for some blood, so now is off to quench that thirst...)
}
if ($EveryoneMoved == yes) { timers off | timerGoToDay 1 10 Day }
}
Check {
set %VictimsName $null
if ((%GameIsPlaying == false) || (%GameIsStopped == true) || (%NightTime == no) || ($InGame($2) == no)) return
if ($PlayerNumber($1) == yes) set %VictimsName $read(l.txt,$1)
else set %VictimsName $1
if ($InGame(%VictimsName) == no) { msg $2 $c1(There is no such player! Please try again...) | return }
if ($WhatIs($2) == detective) {
if (%DetectiveMoved > 0) { msg $2 $c2(Sorry, but you've already made your move...) | return }
set %DetectivesVictim %VictimsName
set %DetectiveChecked yes
set %DetectiveMoved 1
set %DWords $3-
msg $2 $c1(You have decided to check) $c2(%VictimsName)
msg %GameChannel $c1(The) $c3(detective) $c1(got bored out of his mind, so he decided to do something about it...)
msg %CivilianChannel $c1(The) $c3(detective) $c1(decided to check) $c2(%VictimsName)
}
if ($WhatIs($2) == homeless) {
if (%bomdone > 0) { msg $2 $c2(Sorry, but you've already made your move...) | return }
set %BumsVictim %VictimsName
set %BumMoed 1
%BWords $3-
msg $2 $c1(You have decided to check) $c2(%VictimsName)
msg %GameChannel $c1(The) $c3(homeless bum) $c1(is out digging in trash...)
}
if ($EveryoneMoved == yes) { timer1 off | timerGoToDay 1 10 Day }
}
Heal {
set %VictimsName $null
if ((%GameIsPlaying == false) || (%GameIsStopped == true) || (%NightTime == no) || ($InGame($2) == no)) return
if ($PlayerNumber($1) == yes) set %VictimsName $read(l.txt,$1)
else set %VictimsName $1
if ($InGame(%VictimsName) == 0) { msg $2 $c1(There is no such player in the game! Please try again...) | return }
if (%DoctorMoved > 0) { msg $2 $c2(Sorry, but you've already made your move...) | return }
if (%LastPersonHealed == %VictimsName) msg $2 $c1(Sorry, as kind as you may be, but you can't heal the same person more than once in a row!)
set %LastPersonHealed %VictimsName
set %DoctorsVictim %VictimsName
set %DoctorMoved 1
msg %GameChannel $c1(The) $c3(doctor) $c1(got a call, so he collected his pills and syringes...)
msg $2 $c1(You have decided to heal) $c2(%VictimsName)
set %HWords $3-
if ($EveryoneMoved == yes) { timers off | timerGoToDay 1 10 Day }
}
PlayerNumber {
if (!$1) return no
if ($1 !isnum) return no
else {
if ($read(l.txt,$1)) return yes
}
return no
}
ShowTeams {
set %x 1
:next1
set %y 1
:next2
if (%y == %x) { inc %y | goto next2 }
if (%x > %TotalMafia) goto GoodTeam
if (%y > %TotalMafia) { inc %x | goto next1 }
msg $read(m.txt,%x) $c3(Mafia number: %j) $c2($read(m.txt,%y))
inc %x
goto next2
:GoodTeam
if (%TotalHomeless != 0) {
msg %Detective $c3(Homeless bum:) $c2(%Homeless)
msg %Homeless $c3(Detective:) $c(%Detective)
}
}
WhatIs {
if (%WasDetective == $1) return Detective
if (%WasKiller == $1) return Killer
if (%WasDoctor == $1) return Doctor
if (%WasHomeless == $1) return Homeless
set %x 1
while ($read(w.txt,%x) != $null) {
if ($read(w.txt,%x) == $1) return Mafia
inc %x
}
return civilian
}
ChangedNick {
if ((%GameIsPlaying == false) || ($GameIsStopped == true) || ($InGame($1) == no)) return
if (%Registration == on) {
Punt $1
write l.txt $2
mode %GameChannel +v $2
msg %GameChannel $c2($2) $c1(you've been re-registered with the new nick!)
return
}
if ($GotKicked($1) == > 0) return
msg %GameChannel $c1(Everybody, remember this once and for all, especially you) $c2($2) $+ $c1(! Changing your nick during the game results in death!)
if ($2 ison %GameChannel) mode %GameChannel -v $2
msg %GameChannel $c2($2) $c1(you will be excluded from the game...)
write q.txt $1
}
EndGame {
close -m
set %GameIsPlaying false
timerUnsetM 1 10 mode %GameChannel -m
{ set %prefix $+(-,$str(v,$modespl)) }
:start
set %massing $nick($chan,0)
while (%massing) {
if ($nick(%GameChannel,%massing) != $me) { set %mass1 %mass1 $nick($chan,%massing) }
if ($gettok(%mass1,0,32) = $modespl) { mode $chan %prefix %mass1 | unset %mass1 }
dec %massing
}
mode $chan %prefix %mass1 | unset %mass1
return
}
MafiaNumber {
set %x 1
while ($read($read(m.txt,x))) {
if ($1 == $read(m.txt,%x)) return %x
if ($read(m.txt,%x) == $null) return 0
inc %x
}
}
fif {
var %find = $read($1,tw,$2)
return $readn
}
FoundOutRole {
if ((%GameIsPlaying == false) || (%GameIsStopped == true)) return
if (($WhatIs($1) != Detective) && ($WhatIs($1) != homeless)) return
if (($WhatIs($1) == Detective) && (%DetectivesVictim != $null) && (%DetectiveChecked == yes)) {
if ($WhatIs(%DetectivesVictim) == civilian) { msg $1 $c2(%DetectivesVictim) $c1(- is the) $c3(civilian) | msg %CivilianChannel $c2(%DetectivesVictim) $c1(- is the) $c3(civilian) | return }
if ($WhatIs(%DetectivesVictim) == detective) { msg $1 $c2(%DetectivesVictim) $c1(- is the) $c3(detective) | msg %CivilianChannel $c2(%DetectivesVictim) $c1(- is the) $c3(detective) | return } if ( $role(%victname) == 3 ) { msg $1 4 $+ %victname 10- is the 12killer10! | /msg %CivilianChannel 4 $+ %victname 10- is the 12killer10! 10To invite the player here, type in 4!invite nick }
if ($WhatIs(%DetectivesVictim) == mafia) { msg $1 $c2(%DetectivesVictim) $c1(- is the) $c3(mafia) | msg %CivilianChannel $c2(%DetectivesVictim) $c1(- is the) $c3(mafia) | return }
if ($WhatIs(%DetectivesVictim) == doctor) { msg $1 $c2(%DetectivesVictim) $c1(- is the) $c3(doctor) | msg %CivilianChannel $c2(%DetectivesVictim) $c1(- is the) $c3(dotor) | return }
if ($WhatIs(%DetectivesVictim) == killer) { msg $1 $c2(%DetectivesVictim) $c1(- is the) $c3(killer) | msg %CivilianChannel $c2(%DetectivesVictim) $c1(- is the) $c3(killer) | return }
if ($WhatIs(%DetectivesVictim) == homeless) { msg $1 $c2(%DetectivesVictim) $c1(- is the) $c3(homeless bum) | /msg %CivilianChannel $c2(%DetectivesVictim) $c1(- is the) $c3(homeless bum) | return }
}
if (($WhatIs($1) == Homeless) && (%BumsVictim != $null)) {
if ($WhatIs(%BumsVictim) == civilian) { msg $1 $c2(%BumsVictim) $c1(- is the) $c3(civilian) | msg %CivilianChannel $c2(%BumsVictim) $c1(- is the) $c3(civilian) | return }
if ($WhatIs(%BumsVictim) == detective) { msg $1 $c2(%BumsVictim) $c1(- is the) $c3(detective) | msg %CivilianChannel $c2(%BumsVictim) $c1(- is the) $c3(detective) | return } if ( $role(%victname) == 3 ) { msg $1 4 $+ %victname 10- is the 12killer10! | /msg %CivilianChannel 4 $+ %victname 10- is the 12killer10! 10To invite the player here, type in 4!invite nick }
if ($WhatIs(%BumsVictim) == mafia) { msg $1 $c2(%BumsVictim) $c1(- is the) $c3(mafia) | msg %CivilianChannel $c2(%BumsVictim) $c1(- is the) $c3(mafia) | return }
if ($WhatIs(%BumsVictim) == doctor) { msg $1 $c2(%BumsVictim) $c1(- is the) $c3(doctor) | msg %CivilianChannel $c2(%BumsVictim) $c1(- is the) $c3(dotor) | return }
if ($WhatIs(%BumsVictim) == killer) { msg $1 $c2(%BumsVictim) $c1(- is the) $c3(killer) | msg %CivilianChannel $c2(%BumsVictim) $c1(- is the) $c3(killer) | return }
if ($WhatIs(%BumsVictim) == homeless) { msg $1 $c2(%BumsVictim) $c1(- is the) $c3(homeless bum) | msg %CivilianChannel $c2(%BumsVictim) $c1(- is the) $c3(homeless bum) | return }
}
}
AllAccepted {
if (%DetectiveAccepted == no) return no
if (%DoctorAccepted == no) return no
if (%KillerAccepted == no) return no
if (%HomelessAccepted == no) return no
set %x 1
while ($read(a.txt,t,$calc(%x)) != $null) {
if ($read(a.txt,t,%x) == no) return no
inc %x
}
if ($read(a.txt,t,%x) == $null) return yes
}
You can also just multi-connect and bring in a mass of "bots". I've noticed they've had this problem a few times. Also you have cases of people "Teaming up". Imo the game itself will always be flaw'd. But tis pretty good when you come right down to it, Most people have a sense of HONOR. Those that dont are banned etc.
You need more checks in the game to keep players from cheating. For one, you can change your nick, and it re-registers, but it registers you as a new player, thus allowing you to vote over and over for every new nick you put in. You can also change your nick when you've been voted out to stay in the game. You can set up a ban so people cannot change their nick while in the channel to keep this from happening. Add more checks so the game runs smoother.
Also, there's no way to tell what part you play, how to use a help system, or what to do with the part. Looks more like a popularity contest than anything else.
Needs work. 4/10
Totally doesn't work. People can register once !start is typed, and then it all goes to hell.
(22:05:26) (~Spoink) [DA]Howard has until either the day or night to get back or else the bot will have to do some dirty work...
[DA]Howard isn't even on the %GameChannel.
(22:02:27) (~Spoink) [DA]RandomBattlerXD is no longer in the game...
(22:02:30) (~Neptune) wtf
(22:03:01) (~Spoink) {SV}FireMatt is no longer in the game...
(22:04:42) (~Spoink) Well the registrtaion is now over and the roles are about to be given out!
(22:04:45) (+Butch) k
(22:04:47) —› mode: (Spoink) sets (+m)
(22:04:51) (+Butch) !Yes
(22:04:55) (+Butch) !yes
(22:04:57) (+Butch) !Yes
(22:04:59) (+Butch) !yes
(22:05:20) —› nick: (C4) is now known as (Phoenix_Wright)
(22:05:23) (+Butch) !yes
(22:05:24) (+Butch) !Yes
(22:05:26) (+Butch) ACCEPTR
(22:05:26) (~Spoink) [DA]Howard has until either the day or night to get back or else the bot will have to do some dirty work...
(22:05:52) (~Spoink) The roles have been given out and the game is about to start...
(22:05:52) (~Spoink) In total there are: civilians - 1, detective, mafia - 1
(22:05:52) (~Spoink) Game over! The wins goes to thecivilian!
(22:05:52) (~Spoink) The game has been played for 3mins 30secs.
(22:05:53) (~Spoink) The roles were:
(22:05:53) (~Spoink) Detective: Butch
(22:05:53) (~Spoink) It is now the night time the people are sleeping tight after a hard day of work. The only ones who are up are those you are looking for trouble. The night will last 3 minutes 10!!
(22:05:55) -Spoink@#Arcade- Players, time to make your move!
(22:06:01) (+Butch) Wat
Well it's easier to edit if the remotes and the alaises were in separate places. Plus the prefixing would be incredibly tedious and rather useless. It also allows more customization because it allows people to add their own modules in the proper section, and it'd provide a backbone in case one is needed.
As for WereWolf being spelled improperly, where I'm from the spelling is with a, as opposed to the e. Much like color versus colour, though seemingly WareWolf isn't quite as common as WereWolf, but I think my point has gotten through regardless.
Well seeing how Priest has been helped, I figured I'd post something related to the general bot.
I've updated both the aliases and remotes for the bot to make it slightly more efficient. It also includes several bugs fixes and a couple glitches removed, as well as new commands such as the !sideswon (which shows the number of times each sides won) and !dur (shows the duration of the game).
Hey i've been a huge fan of the werewolf - mafia game since i've first played it a few months ago... And since its dissapeard from the site I played it on i've been looking for a place I could get it... Do you have the werewolf version? Also i've tried loading that one and playing it but it woulnt really work all the way... I changed the var's and loaded it into the right spots but the turns took forever-or just didnt fire. You can contact me at IckBotCrane@hotmail.com Any help would be appreciated thanks. :)
Hmmm, winni2 two questions for you there: when does it display that error message, and did you load the remotes? Because there's an on load event, which would set all the variables so the bot would join all of the proper channels. If you provide a bit more detail, then I'll gladly help you out and fix the code if need be.