## Null AcroBot, started Tuesday, May 16th 2000!
## Script Version: 1.0 Beta
## Release Date: Saturday, December 16th, 2000!
## This Eggdrop script is (c) 2000 by Shawn Roles (Null)
##
## I WILL NOT BE HELD RESPONSIBLE FOR ANYTHING THAT HAPPENS NEGATIVELY THROUGH USAGE
## OF THIS SCRIPT...THIS SCRIPT IS USED 'AS-IS'...
##
## E-Mail: Null@hotmail.com any questions, ideas, concerns, comments, etc...
## (You can also find me in #Chat_Central on Undernet!)
##
## THIS SCRIPT IS CONSIDERED SHAREWARE...
## If you find this script adds nicely to your channel or you highly enjoy it,
## my only request is $5 US sent to my address below for each gamescript you find
## useful (The Full Triviabot version notwithstanding however...see it's archive for
## details...sorry!)...the fee covers any new updates/versions fer th'script that you
## for th'time spent on creatin' these scripts tha's really no return a'tall,
## however I enjoy creatin' various games in my spare time...if people end up usin' my
## scripts an' no incentive is returned then I'll simply continue creatin' games,
## but sadly fer personal useage rather than public release...which I'd much rather do...
##
## Everyone that registers any/all scripts will be placed upon a private mailing list
## any will receive special offers and package deals on other projects or expansion packs!
## (2 trivia banks free with purchase of the full version triviabot, free bank of 500 Madlibs
## with purchase of the Madlib Bot, for examples...) 8)
## Another bonus of registering is that if most people decide to use without registering,
## I'll simply stop updatin' the free downloads on the website an' do private releases!
##
## When you register, please include your e-mail address so that I can include you onto
## the above mailing list, plus if anything that needs to be mailed to you can be sent
## immediately upon reception of payment! (Trivia banks, for example!)
##
## Please send Cheque or INTERNATIONAL Money Order (Money Order is preferred, btw)
## to the address below:
##
## Shawn Roles
## RR4 (12173 Loyalist Parkway)
## Picton, Ontario
## K0K 2T0
## Canada
##
## Thank you and enjoy! 8)
## Sincerely,
## Null
## This script is dedicated to Harley, who was taken away from us on
## March 31st, 1999 when he was hit by a car, and to Rusty who was taken
## away from us on December 25th, 1999 by a heart attack...we love and miss
## you both very much...Nerf and Scrappy!
##
## This script is also dedicated to all the great people in #Chat_Central on Undernet that
## have given me tons of support and willingness fer hours an' hours of playtestin'
## an' bug reports, ideas an' compliments that've helped keep me codin' an' workin' on
## bringin' more channelgames to th'happy world of Reality!!! Thanks everyone!!! 8) 8) 8)
##
########################## ACROBOT CONFIG SECTION ######################
## Do a search/replace for '#Tester3' (No quotes) and replace it
## with your own channel! ('#Chat_Central', for example!)
##
## Do a search/replace for 'ScrappyDo' (No quotes) and replace it with
## your own nick!
########################################################################
bind pub - !help AcroHelp
bind join - * AcroWelcome
bind pub - !server Server
bind pub - !monthtop10 monthtopten
bind pub - !monthtopten monthtopten
bind msg - xxnewmonth cleartop10
bind msg - comment UserComments
bind pub - !won SpecificPlayerScore
bind pub - !top10 Top10
set scorefile "acroscore.txt"
set webscore "Acrowebscore.html"
set round 0
set Acrochannel "#Tester3"
set server $server
set botnick $botnick
utimer 10 "Advertiser #Tester3"
proc init_acro { } {
global acro
if [info exists acro] { unset acro }
if [info exists vote] { unset vote }
if [info exists bonus] { unset bonus }
set acro(progress) 0
set acro(min) 3
set acro(max) 5
set acro(rounds) 10
set acro(nym) ""
set acro(players) 0
set acro(maxpl) 10
set acro(minpl) 3
set acro(nicks) ""
set acro(extend) 0
set acro(extended) 0
set nextacro 0
set f [open "AcroValidVoters.txt" w]
puts $f ""
close $f
set f [open "AcroWhoVotedForWhat.txt" w]
puts $f ""
close $f
}
set AdsToUse {
"Got Milk? Who Cares!!! Type '!Acro' to play some great Acro!!!"
"Type '!Acro' for hours of fun with Null's Acrobot..."
"Come on!!! Type '!Acro' and play with me!!! I *DARE* YOU!!!"
"I bet you can't even make it to 10th place this month!!! Type '!Acro' and show me how right I am!!! Bahahaha!!!"
"I'd tell you to type '!Acro', but I wouldn't want to embarrass you in front of everyone with all those wrong answers you give! Bahahaha!!!"
"Type '!Acro' only if you're a *REAL* man!!!"
"Type '!Acro' only if you're a *REAL* woman!!!"
"Do you have no life? If so, type '!Acro' and let me make you forget all about that!"
"Type '!Acro'!!! The minutes disappear so fast you'd swear I'm a time machine!"
"Wanna have some fun??? Yes? Type '!Acro'! No? Type '!Acro' anyways!!!"
"4 Out of 5 mIRC'ers type '!Acro'!!!"
"I'd type '!Acro' if *I* were you...really...I mean it...please???"
"Type '!Acro' and use me like the bitch that I am!"
"Type '!Acro' and show me that you love me!"
"Please type '!Acro' for me? I'd do it for you!"
"I hear that typing '!Acro' is a healthy source of 7 essentials vitamins and minerals!"
"Type '!Acro'! It's a *GREAT* way to start your day!"
"I'll donate a third of every Acro I say today to 'Acros-For-Tots'! So please...won't you make a contribution and type '!Acro'! for all those Acroless toddlers out there?"
}
set InfoItemsToSayBeforeAQuestion {
"Type '!help' To See All The Acrobot's Commands!"
"Type '!server' To See What Server The Acrobot Is Playing On!"
"Type '/msg BOTNAME comment YOUR COMMENT' To Send Your Comments/Error Reports To The Acrobot!"
"Type '!top10' To See This Month's Current Top Ten Acroholics!"
"Type '!monthtop10' To See Last Month's Top Ten Acroholics!"
"Type '!won NICK' To See A Specific User's Current Acro Score! (The !won command has a glitch in it still...I'm working on it tho'...) 8)"
"You can use the following characters in your acro: .!,' (But you can't use actual numbers!)"
}
set SuggestedAcroTopic {
"Music"
"Movies"
"Sports"
"Miscellaneous"
"Current Events"
"Celebrities"
"Cartoons"
"Miscellaneous"
"Talk Show Topics"
"Superheroes"
"Food"
"Miscellaneous"
}
proc get_SuggestedAcroTopic { } {
global SuggestedAcroTopic
set outputiz2 [lindex $SuggestedAcroTopic [rand [llength $SuggestedAcroTopic]]]
return $outputiz2
}
proc get_InfoItem { } {
global InfoItemsToSayBeforeAQuestion
set outputiz2 [lindex $InfoItemsToSayBeforeAQuestion [rand [llength $InfoItemsToSayBeforeAQuestion]]]
return $outputiz2
}
proc get_Ad { } {
global AdsToUse
set outputiz2 [lindex $AdsToUse [rand [llength $AdsToUse]]]
return $outputiz2
}
proc Advertiser {chan} {
global acro
if { $acro(progress) == 0 } {
putserv "PRIVMSG #Tester3 :15,1 [get_Ad]"
}
utimer 1200 "Advertiser #Tester3"
return
}
proc cleartop10 {nick uhost hand chan args} {
global Acrochannel score topscore
if {$nick != "ScrappyDo"} {
putserv "privmsg $nick :Sorry $nick...you aren't allowed to use this command...your attempt to do so has been logged..."
putserv "privmsg ScrappyDo :$nick just attempted to reset the Acro Scores...thought you might like to know...;)"
return 1
}
set f [open "MonthlyAcroScores.txt" w]
set webscore "MonthlyAcroScores.html"
foreach z [lsort -decreasing -command sort_topscore [array names topscore]] {
puts $f "$z $topscore($z)"
set topscore(z) 0
}
close $f
if {$webscore != ""} {
set f [open "MonthlyAcroScores.html" w]
puts $f "
Current Online Acro standings as of [clock format [clock seconds] -format {%c %Z}]"
puts $f ""
puts $f "| Nick | Score |
"
foreach z [lsort -decreasing -command sort_topscore [array names topscore]] {
puts $f "| $z | $topscore($z) |
"
}
puts $f "
"
close $f
}
set f [open "AcroBotScores.txt" w]
puts $f "ScrappyDo 0"
close $f
if [info exists topscore] { unset topscore }
putserv "privmsg $Acrochannel :All Acro scores have been cleared for the beginning of a new month! Type !monthtop10 to see the previous month's top ten scores and good luck to everyone in the new month!!! 8)"
return 1
}
##
proc Server {nick uhost hand chan args} {
global server
putserv "privmsg $chan :I am on $server! Type /server $server for the extra edge!"
}
proc AcroWelcome {nick uhost hand chan} {
global acro server
if { $acro(progress) != 0 } {
putserv "privmsg $nick :Welcome to $chan $nick! Acro is running! Type !help for all the new Acro commands! I am currently connected to $server! Type /server $server for the extra edge! Have fun!"
} else {
putserv "privmsg $nick :Welcome to $chan $nick! Acro is off right now...type !Acro to start Online Acro or !help for all the new Acro commands! I am currently connected to $server! Type /server $server for the extra edge! Have fun!"
}
return 1
}
proc AcroHelp {nick uhost hand chan args} {
putserv "privmsg $nick :Welcome To Null's Acrobot v1.0...lovingly dedicated to Harley and Rusty..."
putserv "privmsg $nick :v1.0 Commands: !Acro - starts Acro, !stopacro - stops Acro (Ops Only!), !top10 - shows this month's top 10 players, !monthtop10 - shows last month's top 10 players, !won NICK - shows score of NICK, !server - Shows server Acrobot is on, /msg BOTNAME comment - Send a Comment/Error Report, !help - this menu"
return 1
}
proc UserComments {nick uhost hand args} {
global botnick
set totrim [string length $args]
set argslength [string length $args]
set totrim [expr $argslength -2]
set anythingsubmitted [string range $args 1 $totrim]
if {[string length $anythingsubmitted] == 0} {
putserv "privmsg $nick :Usage: /msg BOTNICK comment YOUR COMMENT"
return
} {
set f [open "AcrobotUserComments.txt" a]
puts $f "$nick: $args"
putserv "privmsg $nick :Thanks for your insights $nick! We'll check it out asap! 8)"
close $f
return
}
}
## Display Top 10 Scores Of the Previous Month For Webpage Info!
proc monthtopten {nick uhost hand chan args} {
putserv "PRIVMSG $nick :Official Top 10 Acro Scores For Last Month:"
set winners ""
set f [open "MonthlyAcroScores.txt" r]
for { set s 0 } { $s < 10 } { incr s } {
gets $f tally
set placement [expr $s +1]
if {$placement == 1} {set placement " 1st Place: "
set headhoncho [lindex $tally 0]
}
if {$placement == 2} {set placement " 2nd Place: "}
if {$placement == 3} {set placement " 3rd Place: "}
if {$placement == 4} {set placement " 4th Place: "}
if {$placement == 5} {set placement " 5th Place: "}
if {$placement == 6} {set placement " 6th Place: "}
if {$placement == 7} {set placement " 7th Place: "}
if {$placement == 8} {set placement " 8th Place: "}
if {$placement == 9} {set placement " 9th Place: "}
if {$placement == 10} {set placement " 10th Place: "}
append winners $placement
append winners [lindex $tally 0]
append winners " with "
append winners [lindex $tally 1]
if {[lindex $tally 1] > 1} {
append winners " wins! "
} else {
append winners " win! "
}
}
putserv "PRIVMSG $nick :$winners"
putserv "PRIVMSG $nick :Congratulations To $headhoncho For Kicking The Most Ass Last Month! 8)"
close $f
return
}
proc read_score { } {
global score scorefile
if [info exists score] { unset score }
if ![file exists $scorefile] {
set f [open $scorefile w]
close $f
}
set f [open $scorefile r]
while {[gets $f s] != -1} {
set score([lindex $s 0]) [lindex $s 1]
}
close $f
}
proc write_score { } {
global score scorefile webscore
set f [open $scorefile w]
foreach s [lsort -decreasing -command sort_score [array names score]] {
puts $f "$s $score($s)"
}
close $f
if {$webscore != ""} {
set f [open $webscore w]
puts $f "Current Acro standings as of [clock format [clock seconds] -format {%c %Z}]"
puts $f ""
puts $f "| Nick | Score |
"
foreach s [lsort -decreasing -command sort_score [array names score]] {
puts $f "| $s | $score($s) |
"
}
puts $f "
"
close $f
}
}
proc sort_score {s1 s2} {
global score
if {$score($s1) > $score($s2)} { return 1 }
if {$score($s1) < $score($s2)} { return -1 }
if {$score($s1) == $score($s2)} { return 0 }
}
proc sort_votes {s1 s2} {
global vote
if {$vote($s1) > $vote($s2)} { return 1 }
if {$vote($s1) < $vote($s2)} { return -1 }
if {$vote($s1) == $vote($s2)} { return 0 }
}
proc sort_games {s1 s2} {
global gamescore
if {$gamescore($s1) > $gamescore($s2)} { return 1 }
if {$gamescore($s1) < $gamescore($s2)} { return -1 }
if {$gamescore($s1) == $gamescore($s2)} { return 0 }
}
foreach t [utimers] { if [string match *acro* [lindex $t 1]] { killutimer [lindex $t end] } }
init_acro
if [file exists $scorefile] { read_score }
set letters "ABCDEFGHIJKLMNOPRSTUVWY"
if [string match *BitchX* $version] {
bind pub -1 !Acro start_acro
} { bind pub - !Acro start_acro }
proc start_acro { n u h c a } {
global acro botnick round vote timervar bonus acroorder acrocount numberofvotes
set numberofvotes 0
set timervar 0
if [info exists vote] { unset vote }
if [info exists bonus] {unset bonus}
if [info exists acroorder] {unset acroorder}
if { $acro(progress) != 0 } { putserv "privmsg $n :\0034 Game already in progress, sorry..." ; return 0 }
if {[llength [chanlist $c]] < [expr $acro(minpl) +1]} { putserv "privmsg $c :\0034 Not enough players present! We need at least $acro(minpl) users to play! (Pretend you have friends and invite them all in...*NOW*!!!)" ; return 0 }
init_acro
set acrocount 1
set acro(progress) 1
incr round
putserv "privmsg $c :7 [get_InfoItem]"
putserv "privmsg $c :3A new round is beginning! Everyone must /MSG me your answer.Use the form /MSG $botnick . Good Luck Everybody!"
putserv "privmsg $c :Round #4 $round"
putserv "privmsg $c :Suggested Topic:4 [get_SuggestedAcroTopic]"
putserv "privmsg $c :\0037,0 The acronym for this round is \0038,1[make_acro]\0037,0. You have 60 seconds."
## Reset Valid Voters File And Who Voted For What Acro File!
set f [open "AcroGivenAcroOrder.txt" w]
close $f
set f [open "AcroValidVoters.txt" w]
close $f
set f [open "AcroWhoVotedForWhat.txt" w]
close $f
set f [open "AcroOrder.txt" w]
close $f
## set timebeforewarning [expr $timervar -10]
utimer 60 "warn_acro $c"
}
if [string match *BitchX* $version] {
bind pub o !stoparco stop_acro
} { bind pub o !stopacro stop_acro }
proc stop_acro { n u h c a } {
init_acro
putserv "privmsg $c :Acro has been stopped by $n! Type !Acro to play again..."
foreach t [utimers] { if [string match *acro* [lindex $t 1]] { killutimer [lindex $t end] } }
utimer 10 "Advertiser #Tester3"
}
if [string match *BitchX* $version] {
bind msgm -1 * msg_acro
} { bind msgm - * msg_acro }
proc msg_acro { n u h a } {
global botnick acro bonus acroorder acrocount score gamescore numberofvotes
set u [string tolower $n]
regsub -nocase -all \[{}] $a "" a
if {$acro(progress) == 1} {
if {([llength $a] != [string length $acro(nym)]) || ([string length [join $a ""]] == [string length $acro(nym)]) } { putserv "notice $n :Invalid Acronym" ; return 0 }
if [regexp -nocase {[^a-z.!,'?]} [join $a ""]] { putserv "privmsg $n :\0034 Invalid Acronym" ; return 0 }
if {[info exists acro($u)]} {
if {$a == [lrange $acro($u) 3 end]} {
putserv "privmsg $n :\0034 Your answer is already \"$a\""
return 0
}
if {[lindex $acro($u) 1] == 0} {
putserv "privmsg $n :\0034 You have already submitted an answer!"
## set acro($u) "$n {$a} [lrange $acro($u) 3 end]"
return 0
}
## if {[lindex $acro($u) 1] == $a} {
## putserv "privmsg $n :Your answer has been changed to \"$a\""
## set acro($u) "$n 0 $a"
## return 0
## }
putserv "privmsg $n :\0034 You have already submitted an answer!"
## set acro($u) "$n {$a} [lrange $acro($u) 3 end]"
return 0
}
if {$acro(players) >= $acro(maxpl)} {
putserv "privmsg $n :\0034 Maximum players reached, please try again later."
return 0
}
for { set r 0 } { $r <= [string length $acro(nym)] } { incr r } {
if ![string match [string index $acro(nym) $r] [string toupper [string index [lindex $a $r] 0]]] {
putserv "privmsg $n :\0034 Invalid Acronym"
return 0
}
}
putserv "privmsg $n :Answer set to \"$a\""
incr acro(players)
set acro($u) "$n 0 $acro(players) $a"
putserv "privmsg $n :You are player #$acro(players)"
if {$acro(players) == 1} {
putserv "privmsg #Tester3 :$acro(players) answer received!"
} {
putserv "privmsg #Tester3 :$acro(players) answers received!"
}
set bonus($n) 0
set acroorder($acrocount) $n
incr acrocount
## Add Nick ($n) And Their Acro ($a) To AcroValid Voters.txt File !
set f [open "AcroValidVoters.txt" a]
puts $f "$n"
close $f
}
set f [open "AcroGivenAcroOrder.txt" a]
puts $f "$acro($u)"
close $f
##
if {$acro(progress) == 2} {
global vote
## Check To See If Nick ($n) Made An Acro This Round And Can Vote!
set validvoterflag 0
set f [open "AcroValidVoters.txt" r]
while {[gets $f line] != -1} {
set validvotercheck [lindex $line 0]
if {$validvotercheck == $n} {
set validvoterflag 1
}
}
close $f
if {$validvoterflag == 0} {
putserv "privmsg $n :\0034 Sorry $n, but you can't vote because you didn't make an Acro this round!"
return 1
}
##
if {[lsearch $vote(voters) $u] != -1} {
putserv "privmsg $n :\0034 You already voted"
return 0
}
set a [lindex $a 0]
if ![info exists vote($a)] {
putserv "privmsg $n :\0034 No such answer."
return 0
}
if {$n == [lindex $vote($a) 0]} {
putserv "privmsg $n :\0034 You can't vote for yourself...try again!"
return 0
}
set vote($a) "[lindex $vote($a) 0] [expr {[lindex $vote($a) 1] + 1}]"
putserv "privmsg $n :Your vote has been recorded..."
lappend vote(voters) $u
incr numberofvotes
if {$numberofvotes == 1} {
putserv "privmsg #Tester3 :$numberofvotes vote received!"
} {
putserv "privmsg #Tester3 :$numberofvotes votes received!"
}
## Add Nick ($n) and What Acro They Voted For ($a) To AcroWhoVotedForWhat.txt File
set f [open "AcroWhoVotedForWhat.txt" a]
puts $f "$n $a"
close $f
##
}
return 1
}
proc make_acro { } {
global acro letters timervar
set r [expr [rand [expr {$acro(max) - $acro(min) + 1}]] + $acro(min)]
while { [string length $acro(nym)] < $r } {
append acro(nym) [string index $letters [rand [string length $letters]]]
}
if {$r == 3} {set timervar 45}
if {$r == 4} {set timervar 60}
if {$r == 5} {set timervar 75}
if {$r == 6} {set timervar 90}
if {$r == 7} {set timervar 90}
return $acro(nym)
}
proc warn_acro { c } {
global acro bonus
utimer 10 "end_acro $c"
putserv "privmsg $c :\0034 ***Ten Seconds Left - Get Those Acros In!***"
}
proc end_acro { c } {
global acro botnick vote score bonus nextacro
set nextacro 0
if {$acro(players) < $acro(minpl)} {
if {$acro(extended) >= $acro(extend)} { putserv "privmsg $c :6Not enough players in this round...minimum of 3 players required...moving on to next Acro..." ; set nextacro 1 }
}
set acro(progress) 2
if [info exists vote] { unset vote }
set vote(voters) ""
if { $nextacro == 0 } {
putserv "privmsg $c :Time expired, lets vote!"
set n 1
set ff [open "AcroGivenAcroOrder.txt" r]
while {[gets $ff playersacroingivenorder] != -1} {
putserv "privmsg $c :\0038,1 $n: [lrange $playersacroingivenorder 3 end]"
set vote($n) "[lindex $playersacroingivenorder 0] 0"
set f [open "AcroOrder.txt" a]
puts $f "[lindex $vote($n) 0]'s acro of [lrange $playersacroingivenorder 3 end]"
close $f
incr n
}
putserv "privmsg $c :Type /msg $botnick NUMBER to vote!"
## set n [expr $n +30]
utimer 35 "warn_vote $c"
}
if {$nextacro == 1 } { utimer 1 "end_vote $c" }
}
proc warn_vote { c } {
putserv "privmsg $c :\0034 ***Ten Seconds Left - Get Those Votes In!***"
utimer 10 "end_vote $c"
}
proc end_vote { c } {
global acro score vote bonus acroorder acrocount gamescore topscore round scorefile nextacro pointstowin
if {$nextacro == 0} {
putserv "privmsg #Tester3 :Time's Up...Here's The Results..."
}
set acro(progress) 0
foreach e [array names vote] {
if ![regexp {[0-9]} $e] { continue }
## if ![info exists bonus([lindex $vote($e) 0])] {
## set bonus([lindex $vote($e) 0]) [lindex $vote($e) 1]
## } { set bonus([lindex $vote($e) 0]) [expr {[lindex $vote($e) 1] + $score([lindex $vote($e) 0])}] }
if ![info exists score([lindex $vote($e) 0])] {
set score([lindex $vote($e) 0]) [lindex $vote($e) 1]
} { set score([lindex $vote($e) 0]) [expr {[lindex $vote($e) 1] + $score([lindex $vote($e) 0])}] }
if ![info exists gamescore([lindex $vote($e) 0])] {
set gamescore([lindex $vote($e) 0]) [lindex $vote($e) 1]
} { set gamescore([lindex $vote($e) 0]) [expr {[lindex $vote($e) 1] + $gamescore([lindex $vote($e) 0])}] }
}
##if {$nextacro == 0} {
## New Code - Show What Acros Got Votes And From Who
## Find Out What the Max Votes On An Acro Is!
set firstplayerwithavotechecker ""
set playernameend 0
set maxvotenumber 0
set AcroNumwithMostVotes 0
set fastestacronumwithmostvotescounter 1
set firstacronumberwithavote 0
set firstplayerwithavote ""
set firstacrochecker 0
set counter 1
set mostvotesflag 0
set f [open "AcroOrder.txt" r]
while {[gets $f WhoandtheirAcro] != -1} {
set votes 0
set bonusscorename [lindex $WhoandtheirAcro 0]
set bsnameend [expr [string length $bonusscorename] -3]
set bonusscorename [string range $bonusscorename 0 $bsnameend]
set g [open "AcroWhoVotedForWhat.txt" r]
while {[gets $g voterandvote] != -1} {
set votecheck [lindex $voterandvote 1]
if {$votecheck == $counter} {
incr votes
}
if {$votes > $maxvotenumber} {
set maxvotenumber $votes
set AcroNumberwithMostVotes $fastestacronumwithmostvotescounter
}
}
close $g
incr counter
}
close $f
set counter 1
set mostvotesflag 0
set mostvotes ""
set foundfastestacrowithvote 0
set fastestacronumwithmostvotescounter 1
set f [open "AcroOrder.txt" r]
while {[gets $f WhoandtheirAcro] != -1} {
## set AcroGivenOrderNum [lindex $WhoandtheirAcro 2]
set voters ""
set votes 0
## set bonusscorename [lindex $WhoandtheirAcro 0]
## set bsnameend [expr [string length $bonusscorename] -3]
## set bonusscorename [string range $bonusscorename 0 $bsnameend]
set g [open "AcroWhoVotedForWhat.txt" r]
while {[gets $g voterandvote] != -1} {
set votecheck [lindex $voterandvote 1]
if {$votecheck == $counter} {
incr votes 1
append voters [lindex $voterandvote 0]
append voters " "
}
}
close $g
if {$votes >= $maxvotenumber} {
set personwithmostvotes [lindex $WhoandtheirAcro 0]
set mostvoteend [expr [string length $personwithmostvotes] -3]
set personwithmostvotes [string range $personwithmostvotes 0 $mostvoteend]
append mostvotes " "
append mostvotes $personwithmostvotes
if {$firstacrochecker == 0} {
set firstacronumberwithavote $fastestacronumwithmostvotescounter
set firstplayerwithavote $personwithmostvotes
set firstacrochecker 1
}
if {$foundfastestacrowithvote == 0} {
set AcroNumwithMostVotes $fastestacronumwithmostvotescounter
incr foundfastestacrowithvote
}
incr mostvotesflag
set bonus($personwithmostvotes) [expr $bonus($personwithmostvotes) + 3]
set score($personwithmostvotes) [expr $score($personwithmostvotes) + 3]
set gamescore($personwithmostvotes) [expr $gamescore($personwithmostvotes) + 3]
}
if {$votes == 0} {
putserv "privmsg #Tester3 :4 $WhoandtheirAcro received no votes"
} {
putserv "privmsg #Tester3 :3 $WhoandtheirAcro got $votes votes from $voters"
incr bonus($bonusscorename) $votes
## incr score($bonusscorename) $votes
## incr gamescore($bonusscorename) $votes
}
incr counter
incr fastestacronumwithmostvotescounter
}
close $f
## Person(s) With Most Votes This Round Receives +3 Bonus Points
if {$mostvotesflag == 0} {
## putserv "privmsg #Tester3 :No bonus points given for the Acro with the most votes this round!"
}
if {$mostvotesflag == 1} {
putserv "privmsg #Tester3 :$mostvotes got the most votes this round and receives3 +3 bonus points!"
}
if {$mostvotesflag > 1} {
putserv "privmsg #Tester3 :$mostvotes tied for the most votes and each receive3 +3 bonus points!"
}
## Fastest Acro That Received A Vote Gets +2 Bonus Points
if {$firstplayerwithavote != ""} {
incr bonus($firstplayerwithavote) 2
incr score($firstplayerwithavote) 2
incr gamescore($firstplayerwithavote) 2
}
if {$firstacronumberwithavote == 0} {
## putserv "privmsg #Tester3 :No bonus points given for the fastest Acro that received a vote this round!"
} {
putserv "privmsg #Tester3 :$firstplayerwithavote had the fastest Acro that received a vote and scores3 +2 bonus points!"
}
## Everyone that Voted For Winning Acro Gets +1 Bonus Point
set winningacro $AcroNumwithMostVotes
set votedforwinningacro ""
set votedforwinningacroflag 0
set h [open "AcroWhoVotedForWhat.txt" r]
while {[gets $h voterandvote] != -1} {
set votercheck [lindex $voterandvote 1]
if {$votercheck == $winningacro} {
append votedforwinningacro " "
append votedforwinningacro [lindex $voterandvote 0]
incr votedforwinningacroflag
set votername [lindex $voterandvote 0]
## putserv "privmsg #Tester3 :bonus for [lindex $voterandvote 0]:$bonus($didtheyvote)!"
incr bonus($votername)
incr score($votername)
incr gamescore($votername)
}
}
if {$votedforwinningacroflag == 0} {
## putserv "privmsg #Tester3 :No bonus points given for players that voted for the winning Acro this round!"
}
if {$votedforwinningacroflag == 1} {
putserv "privmsg #Tester3 :$votedforwinningacro voted for the fastest winning Acro this round and receives3 +1 bonus point!"
}
if {$votedforwinningacroflag > 1} {
putserv "privmsg #Tester3 :$votedforwinningacro voted for the fastest winning Acro this round and each receives3 +1 bonus point!"
}
## If People That Got Votes Didn't Vote Themselves, Remove Their Points From This Round!
set f [open "AcroOrder.txt" r]
set votedflag 0
set nonvoters ""
set didtheyvote ""
while {[gets $f WhoandtheirAcro] != -1} {
set didtheyvote [lindex $WhoandtheirAcro 0]
set didtheyvoteend [expr [string length $didtheyvote] -3]
set didtheyvote [string range $didtheyvote 0 $didtheyvoteend]
set votedflag 0
set h [open "AcroWhoVotedForWhat.txt" r]
while {[gets $h voterandvote] != -1} {
set votercheck [lindex $voterandvote 0]
if {$votercheck == $didtheyvote} {
incr votedflag
}
}
close $h
if {$votedflag == 0} {
append nonvoters " "
append nonvoters $didtheyvote
set score($didtheyvote) [expr $score($didtheyvote) - $bonus($didtheyvote)]
if {$score($didtheyvote) < 0} {set score($didtheyvote) 0}
set gamescore($didtheyvote) [expr $gamescore($didtheyvote) - $bonus($didtheyvote)]
if {$gamescore($didtheyvote) < 0} {set gamescore($didtheyvote) 0}
}
}
if {$nextacro == 0} {
if {[string length $nonvoters] != 0} {
putserv "privmsg #Tester3 :4Too bad $nonvoters didn't vote...away goes all their points from this round!"
}
}
## End of Point Removal Code!
## Display Current Game's Acro Scores
set scorelist [lsort -decreasing -command sort_games [array names gamescore]]
set CurrentAcroScores ""
for { set s 0 } { $s < [llength $scorelist] } { incr s } {
set player [lindex $scorelist $s]
set playerscore $gamescore([lindex $scorelist $s])
append CurrentAcroScores $player
append CurrentAcroScores ": "
append CurrentAcroScores $playerscore
append CurrentAcroScores " "
}
if {[llength $scorelist] < 1} {set CurrentAcroScores "There are no scores yet this game!"}
putserv "privmsg #Tester3 :Current Scores:\0038,1 $CurrentAcroScores"
## Check if there's a winner (30+ points), If ties all who have top score win,
## Increase Winner(s) scores in TopAcroScores.txt by one, start new game...otherwise continue...
set winnerflag 0
set pointstowin 30
set gamewinners ""
read_topscores
for { set u 0 } { $u < [llength $scorelist] } { incr u } {
set scorelist [lsort -decreasing -command sort_games [array names gamescore]]
set z [lindex $scorelist $u]
set playerscore $gamescore([lindex $scorelist $u])
if { $playerscore >= $pointstowin } {
incr winnerflag
set pointstowin $playerscore
append gamewinners $z
append gamewinners " "
## Write Winning Scores To The AcroTopScores.txt File Here!
if {[info exists topscore($z)]} {
incr topscore($z)
} {
set topscore($z) 1
}
}
}
write_topscore
if { $winnerflag == 1 } {
putserv "privmsg #Tester3 :We have a winner!!! Congratulations to $gamewinners for a game well played!!!"
foreach t [utimers] { if [string match *acro* [lindex $t 1]] { killutimer [lindex $t end] } }
init_acro
unset gamescore
set round 0
set nextacro 0
putserv "privmsg #Tester3 :Great game to everyone...new game starting in 60 seconds..."
foreach t [utimers] { if [string match *acro* [lindex $t 1]] { killutimer [lindex $t end] } }
utimer 60 "start_acro #Tester3 #Tester3 #Tester3 #Tester3 #Tester3"
return 1
}
if { $winnerflag >= 2 } {
putserv "privmsg #Tester3 :We have a tie!!! Congratulations to $gamewinners for a job well done!!!"
foreach t [utimers] { if [string match *acro* [lindex $t 1]] { killutimer [lindex $t end] } }
init_acro
unset gamescore
set round 0
set nextacro 0
putserv "privmsg #Tester3 :Great game to everyone...new game starting in 60 seconds..."
foreach t [utimers] { if [string match *acro* [lindex $t 1]] { killutimer [lindex $t end] } }
utimer 60 "start_acro #Tester3 #Tester3 #Tester3 #Tester3 #Tester3"
return 1
} {
set nextacro 0
putserv "privmsg #Tester3 :Next round starting in 20 seconds..."
foreach t [utimers] { if [string match *acro* [lindex $t 1]] { killutimer [lindex $t end] } }
utimer 20 "start_acro #Tester3 #Tester3 #Tester3 #Tester3 #Tester3"
return 1
}
}
##
proc delay_acro { c } {
start_acro blah blah blah #Tester3 ""
}
proc c { c t } {
set h [expr $c/2 - [string length $t]/2]
for { set r 0 ; set s "" } {$r < $h} { incr r } { append s " " }
set l [expr $c - [string length $t] - [string length $s]]
for { set r 0 ; set v "" } {$r < $l} { incr r } { append v " " }
return [append s $t $v]
}
bind pub - !Acrohelp acro_help
## Display Specific User's Current Score
proc SpecificPlayerScore {nick uhost hand chan args} {
set scoreplayer $args
set foundflag 0
set f [open "AcroTopScores.txt" r]
while {[gets $f tally] != -1} {
set checker [lindex $tally 0]
if {$checker == $scoreplayer} {
putserv "PRIVMSG $chan :\0037 [lindex $tally 0] has won [lindex $tally 1] times!"
set foundflag 1
}
}
if {$foundflag == 0} {
putserv "PRIVMSG $chan :$scoreplayer has never won!"
}
close $f
return 1
}
}
## Display Top 10 Scores To A Player
proc Top10 {n u h c a} {
putserv "PRIVMSG $n :Top 10 Acro Scores For This Month:"
set winners ""
set f [open "AcroTopScores.txt" r]
for { set s 0 } { $s < 10 } { incr s } {
gets $f tally
set placement [expr $s +1]
if {$placement == 1} {set placement " 1st Place: "
set headhoncho [lindex $tally 0]
}
if {$placement == 2} {set placement " 2nd Place: "}
if {$placement == 3} {set placement " 3rd Place: "}
if {$placement == 4} {set placement " 4th Place: "}
if {$placement == 5} {set placement " 5th Place: "}
if {$placement == 6} {set placement " 6th Place: "}
if {$placement == 7} {set placement " 7th Place: "}
if {$placement == 8} {set placement " 8th Place: "}
if {$placement == 9} {set placement " 9th Place: "}
if {$placement == 10} {set placement " 10th Place: "}
append winners $placement
append winners [lindex $tally 0]
append winners " with "
append winners [lindex $tally 1]
if {[lindex $tally 1] > 1} {
append winners " wins! "
} else {
append winners " win! "
}
}
putserv "PRIVMSG $n :$winners"
putserv "PRIVMSG $n :Congratulations To $headhoncho For Kicking The Most Ass So Far! 8)"
close $f
return
}
proc read_topscores { } {
global topscore
if [info exists topscore] { unset topscore }
set f [open "AcroTopScores.txt" r]
while {[gets $f line] != -1} {
set z [lindex $line 0]
set topscore($z) [lindex $line 1]
}
close $f
}
proc write_topscore { } {
global topscore
set q [open "AcroTopScores.txt" w]
foreach z [lsort -decreasing -command sort_topscore [array names topscore]] {
puts $q "$z $topscore($z)"
}
close $q
set webscore "AcroTopScores.html"
if {$webscore != ""} {
set q [open $webscore w]
puts $q "Current Acro standings as of [clock format [clock seconds] -format {%c %Z}]"
puts $q ""
puts $q "| Nick | Score |
"
foreach z [lsort -decreasing -command sort_topscore [array names topscore]] {
puts $q "| $z | $topscore($z) |
"
}
puts $q "
"
close $q
}
}
proc sort_topscore {z1 z2} {
global topscore
if {$topscore($z1) > $topscore($z2)} { return 1 }
if {$topscore($z1) < $topscore($z2)} { return -1 }
if {$topscore($z1) == $topscore($z2)} { return 0 }
}