| View previous topic :: View next topic |
| Author |
Message |
BIF Voice
Joined: 31 Jul 2006 Posts: 12
|
Posted: Fri Jun 29, 2007 2:57 pm Post subject: Auto Voice Top 3 trivia players |
|
|
I want my trivia bot to auto voice users that are in the score file. the score file lists users in 1st place to last. So on join it would need to check to see if user is in the scores file. and then if the user is amoung the top 3 players he/she is auto voiced. This below Is a section on a public command used to display the top 10 players in the channel.
| Code: |
#triggered when someone uses !top10 command
proc tgshowtop10 {nick host hand chan text} {
global tgscores tgchan tgscorestotal
if {[strlwr $chan]==[strlwr $tgchan]} {
tggetscores
if {$tgscorestotal>0} {
if {$tgscorestotal>9} {
set _max 9
} else {
set _max [expr $tgscorestotal-1]
}
set i 0
while {$i<=$_max} {
set _item [lindex $tgscores $i]
set _nick [join [lindex [split $_item ,] 2]]
set _score [join [lindex [split $_item ,] 0]]
if {$i==0} {
append _scores "[tgcolscr1]$_nick $_score"
} elseif {$i==1} {
append _scores ", [tgcolscr2]$_nick $_score"
} elseif {$i==2} {
append _scores ", [tgcolscr3]$_nick $_score"
} else {
append _scores ", [tgcolmisc1]$_nick $_score"
}
incr i
}
tggamemsg "[tgcolmisc1]Top 10: $_scores"
} else {
tggamemsg "[tgcolmisc1]Score table is empty."
}
}
}
|
|
|
| Back to top |
|
 |
oxygen Voice
Joined: 05 Sep 2005 Posts: 22 Location: Germany
|
Posted: Mon Jul 23, 2007 11:25 am Post subject: |
|
|
Hello
Try to add this to your joining proc. If you don't know how.. just post your joining proc here.
| Code: |
# Set this to how many players you like to voice.
set topplayer 3
# Joining trivia chan.
proc tgjoinmsg {nick host hand chan} {
global tgranksbyname topplayer tgscoresbyname tgchan
tggetscores
if {![info exists tgscoresbyname([strlwr $nick])]} {
tggamemsg ">>>> Hellooo $nick , you're not in the scores list!!! ;\)"
} else {
if {$tgranksbyname([strlwr $nick])<=$topplayer&&[botisop $tgchan]} {
putserv "MODE $tgchan +v $nick"
putserv "PRIVMSG $tgchan :>>>> You're a Top$topplayer $nick and deserve voice. :\)"
}
}
}
|
Greets,
~werner |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|