bind join - * rockband:greeting
proc rockband:greeting {n u h c } {
global channel
if {$c == "$channel"} {
if {[matchattr $h |f $channel]} {
puthelp "PRIVMSG $c :\002$n:\002 \037\002Console\037\002: [getuser $n XTRA console] \002\037Username\037\002: [getuser $n XTRA username] \002\037Instruments\037\002: [getuser $n XTRA instruments]"
} else {
putserv "NOTICE $n :\002Hello $n\002 you aren't registered with RockBand, to register msg |ICE| , Apples"
}
}
}
I am trying to make it so, if I add a user with the nick Test , if they later change their nick to Test2 it will still greet them by checking their host matches any of the handles, or something like that..
my script works great if no one changes their nick, but what perfect world does that happen?
If they are seeing the notice from the bot that they are not registered, then their hostmask has changed from what they were added with.
To comment on anything other than that would be purely speculative as you have not provided the code you use for registration. (Unless you are manually adding them, we need to see an example of how you are setting their hostmask and XTRA settings).
if {[lindex $t 2] doestnotequal "this" or "this2"} {
putserv "NOTICE $n :\002Syntax error:\002 please use (.search console XBox/PS3 )"
return 0
}
ONE MORE THING: if someone does .whois handle that won't work anymore since we did the nick2han how can I make so if [lindex $t 1 == handle and not a nick] do this
if {([lindex [split $t] 0] == "moo") || ([lindex [split $t] 0] == "foobar")} {
# do what you want
# Notes: || is OR, while && is AND
# Notes: This example is not case insensitive
}
if {[regexp ^(moo|foobar)$ [lindex [split $t] 0]]} {
# do what you want
# Notes: For regular expressions | is equivelent to OR
# Notes: ^ must match at beginning of string
# Notes: $ must match at ending of string
# Notes: See Tcl manpages for regex syntax
}
You can also use a -nocase switch with regexp to make it case insensitive.
DragnLord wrote:I've never recommended using lindex on any string.
Funny though that you said nick2hand and finduser weren't much help, then you give an example using nick2hand. I needed a good smile.
nick2hand was for a follow up question, a question he asked AFTER you replied to the initial question. the nick2hand was for a different trigger altogether.
theice wrote:
ONE MORE THING: if someone does .whois handle that won't work anymore since we did the nick2han how can I make so if [lindex $t 1 == handle and not a nick] do this
You shouldn't edit your posts after people have already replied.. Instead make a reply post...
DragnLord wrote:Might want to read the postings better.
/me gets to laugh louder
Think you might want to...
First post by the user was a join binding (the one which you replied to).. which did NOT require nick2hand....
The post after your reply was a pub binding... which COULD have used nick2hand under given assumptions...
I'm pretty sure you don't posses the gift of seeing into the future..