Hi,
Sorry if this sounds newbish, but I am new. I spent some time searching here and deja but cannot seem to find an answer. I want to be able to run a command like "@hi jimmy" and have it display something out of list. The problem is that I have variables in list that I want substituted, and it does not seem that lindex can do this. Is there another way to accomplish this?
Thanks!
bind pub o @hi pub_hi
set list {
"hi $args"
"hello $args"
}
proc pub_hi {nick mask hand channel args} {
global list
puthelp "PRIVMSG $channel :[lindex $list [rand [llength $list]]]"
}
Use subst to substitute variables into text the way you're doing it.
But a better idea is to use your own variable names (like %nick instead of $nick) and then use regsub to substitute in fixed values. That's a lot more secure.
well spoke to soon It works the first time after a rehash or a restart, but then it just substitues the same things everytime after that. Pointers on what I am doing wrong?