Formatting of code : You can (and must) use [ tcl ] an [ /tcl ] tags (without spaces in tags) to format your TCL codes and have syntax coloration x


Top 5 idlers script
#1
need help a little on this script, please

tcl
#############################################################################################
#                                                                                          #
# Idle Top 5!                                                                              #
# Based on Idle King script by Ozh.                                                        #
# That script was originally named "Idle des jeunes" in French, which is funny as hell.    #
#                                                                                          #
# Contact stuff :                                                                          #
# TrashF, TrashF@iki.fi, QuakeNet.                                                          #
#                                                                                          #
#############################################################################################
 
#just type !idle on channel to get the top 5 idlers
 
bind pub - !idle idle_getnick
 
proc idle_getnick {nick mask hand chan args} {
global botnick
set idlaajia 0 
set idle_1 "0"
set idle_2 "0"
set idle_3 "0"
set idle_4 "0"
set idle_5 "0"
set idle_1_nick "N/A"
set idle_2_nick "N/A"
set idle_3_nick "N/A"
set idle_4_nick "N/A"
set idle_5_nick "N/A"
foreach mec [chanlist $chan] {
set idle_idle [getchanidle $mec $chan]
if {$idle_idle > $idle_1 && $mec != $botnick && $mec != "L"} {set idle_1 $idle_idle ; set idle_1_nick $mec ; incr idlaajia }
}
foreach mec [chanlist $chan] {
set idle_idle [getchanidle $mec $chan]
if {$idle_idle > $idle_2 && $mec != $idle_1_nick && $mec != $botnick && $mec != "L"} {set idle_2 $idle_idle ; set idle_2_nick $mec ; incr idlaajia}
}
foreach mec [chanlist $chan] {
set idle_idle [getchanidle $mec $chan]
if {$idle_idle > $idle_3 && $mec != $idle_1_nick && $mec != $idle_2_nick && $mec != $botnick && $mec != "L"} {set idle_3 $idle_idle ; set idle_3_nick $mec ; incr idlaajia}
}
foreach mec [chanlist $chan] {
set idle_idle [getchanidle $mec $chan]
if {$idle_idle > $idle_4 && $mec != $idle_1_nick && $mec != $idle_2_nick && $mec != $idle_3_nick && $mec != $botnick && $mec != "L"} {set idle_4 $idle_idle ; set idle_4_nick $mec ; incr idlaajia}
}
foreach mec [chanlist $chan] {
set idle_idle [getchanidle $mec $chan]
if {$idle_idle > $idle_5 && $mec != $idle_1_nick && $mec != $idle_2_nick && $mec != $idle_3_nick && $mec != $idle_4_nick && $mec != $botnick && $mec != "L"} {set idle_5 $idle_idle ; set idle_5_nick $mec ; incr idlaajia}
}
 
#here you can change the output method if you want.
if {$idlaajia > "5"} {set idlaajia 5}
putchan $chan "# Top $idlaajia Idlers #" 
if {$idle_1_nick != "N/A"} { putchan $chan "\00304#1.\003 \00302$idle_1_nick\003 ($idle_1 minutes); \00304#2.\003 \00302$idle_2_nick\003 ($idle_2 minutes); \00304#3.\003 \00302$idle_3_nick\003 ($idle_3 minutes); \00304#4.\003 \00302$idle_4_nick\003 ($idle_4 minutes); \00304#5.\003 \00302$idle_5_nick\003 ($idle_5 minutes)" }
}
 
putlog "Idle Top 5 by TrashF @ QNet loaded."




output is 

tcl
<user>!idle
<bot> # Top 5 Idlers #
<bot> #1. user1 (455 minutes); #2. user2 (455 minutes); #3. user3 (455 minutes); #4. user4 (455 minutes); #5. user5 (455 minutes);




now i want the output like this:

tcl
<user>!idle
<bot> # Top 5 Idlers #
<bot> #1. user1 (1d:4h:22m:22s); #2. user2 (2d:4h:22m:22s); #3. user3 (3d:4h:22m:22s); #4. user4 (4d:4h:22m:22s); #5. user5 (5d:4h:22m:22s)




thank you all..
  Reply


Messages In This Thread
Top 5 idlers script - by mabrook - 14/10/2021, 15:34
RE: Top 5 idlers script - by BLaCkShaDoW - 14/10/2021, 16:54
RE: Top 5 idlers script - by mabrook - 14/10/2021, 17:09
RE: Top 5 idlers script - by BLaCkShaDoW - 14/10/2021, 17:23
RE: Top 5 idlers script - by mabrook - 14/10/2021, 17:26
RE: Top 5 idlers script - by BLaCkShaDoW - 14/10/2021, 23:24
RE: Top 5 idlers script - by mabrook - 15/10/2021, 10:46
RE: Top 5 idlers script - by CrazyCat - 15/10/2021, 10:53
RE: Top 5 idlers script - by mabrook - 15/10/2021, 10:59

Forum Jump:


Users browsing this thread: 1 Guest(s)