the reason it does not work is that the firstchannel and channelmsg variables are set outside the proc, meaning they are in global space. The firstchannel and channelmsg variables are within the proc, which is not in global space. You need to import the firstchannel and channelmsg variables from global space into the proc. For this you use:
This will import the global space variables firstchannel and channelmsg into proc space variables firstchannel and channelmsg.
For the if statement, it would be better to use a string equal -nocase, otherwise if the channels dont match case, it wont continue.
Code: Select all
if {[string equal -nocase $channel $firstchannel]} {
You also need another " if your putquick statement at the end.
Code: Select all
putquick "notice $nickname :$channelmsg"
The return 0 is not needed.
So the end code should look like:
Code: Select all
set trigger "!help"
set firstchannel "#test"
set channelmsg "need some help?"
bind pub - $trigger trigger1
proc trigger1 {nickname hostname handle channel text} {
global firstchannel channelmsg
if {[string equal -nocase $channel $firstchannel]} {
putquick "notice $nickname :$channelmsg"
}
}
Hope this helps