proc command:global {nick uhost hand chan arg} {
global botnick
if {[isop $nick #nrbots]} {
set command [lindex [split $arg] 1]
switch -- $command {
"rehash" {
rehash
if {$botnick == "nrbot-01"} {
putnotc $nick "Rehashing Complete"
}
}
"cycle" {
putserv "PART $chan :cycle"
putserv "JOIN $chan"
}
default {
putnotc $nick "Error(1): You didnt specify a global command."
}
}
} else {
putnotc $nick "Error(1): You lack access to the bot network"
putnotc $nick "Error(2): Unable to 'global'"
}
}
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
$arg 1 would be the second element in the list after you called the proc so the first one which is what your matching it to should be 0
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
daltonc wrote:Hey, thanks! It works now, got another question, how can I find out if there is a certin element in an array?
1st: this isnt an array, it's a list. arrays are used like: $array(element)
2nd: count the spaces or the {} expressions if present
example:
ex: 1 2 3 4 5
this has 5 elements
ex: {1 2} {3 4} 5
this has 3 elements
also remember, the first element has the index 0 ^-^.