hey im trying to write a script for my team thats pretty simple. it just has to add you to a list if you say !on remove you if you say !off and list all active if you say !liston. this should be for channel operators only. here is what i have so far:
bind pubm O|F * triggers
global whoson
set whoson [list "no one"]
proc triggers {nick uhost hand chan arg} {
set trigger [lindex [split $arg] 0]
switch -exact -- [string tolower $trigger] {
"!on" {
if {lindex [$whoson 0] == "no one"} {
set whoson [list $nick]
putquick "NOTICE $nick :You've been added to the 'on-line' list, noone else is on at the moment though."
} else {
set whoson [linsert $whoson end $nick]
putquick "NOTICE $nick :You've been added to the 'on-line' list."
}
}
"!off" {
if { [lsearch -exact $whoson $nick ] >-1 } {
set playerindex [lsearch -exact $whoson $nick]
set whoson [lreplace $whoson $playerindex ""]
putquick "NOTICE $nick :You've been removed to the 'on-line' list. later!"
}
}
"!liston" {
set x 0
set listlong [llength $whoson]
putquick "NOTICE $nick :/0030,1d/0037,1D/0030,1ect members online:"
while {$x<$listlong} {
putquick "NOTICE $nick :[lindex $x]"
incr x
}
}
}
}
so now if i were to write binds to remove on quit and part how could i make the list global so that i can use it in other processes. i tried naming it ::whoson and global ::whoson but its still not grabbing the list.
now im not sure if this is going to slow the bot down a lot by checking on every part and quit so any advice is more than welcomed, thanks again in advance here is what i had written
to the proc then you can use $whoson in the proc since it became a global variable. while if you don't add the global line, you can use $::whoson or ::whoson for set...etc