This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Auto Voice Top 3 trivia players

Help for those learning Tcl or writing their own scripts.
Post Reply
B
BIF
Voice
Posts: 12
Joined: Mon Jul 31, 2006 4:53 pm

Auto Voice Top 3 trivia players

Post by BIF »

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: Select all

  #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."
                }
        }
}

 
o
oxygen
Voice
Posts: 22
Joined: Mon Sep 05, 2005 2:22 pm
Location: Germany

Post by oxygen »

Hello

Try to add this to your joining proc. If you don't know how.. just post your joining proc here.

Code: Select all

# 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
Post Reply