This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help for delayed onjoinmessage excluding certain hosts

Help for those learning Tcl or writing their own scripts.
Post Reply
S
Snoopotic
Voice
Posts: 4
Joined: Sat Feb 10, 2007 10:10 am

Help for delayed onjoinmessage excluding certain hosts

Post by Snoopotic »

Hi.
I need your help. FIrst the Code:

Code: Select all

## set a var for your hosts
set matchHosts [list \
*@crew* \
*@root* \
*@bastard* \
*@services* \
*@*users*]

## then use that down here

proc join:message {nick uhost hand chan} {
  foreach mask $::matchHosts {
     if {![string match -nocase $mask $uhost]} {utimer 15 [list timed_message $nick]; return 0}
   }
}
## put your binds after the proc
bind join - * join:message

proc timed_message {nick} { 
  puthelp "NOTICE $nick :Hi $nick, welcome to #channel... blabla :D"
 } 
THe problem is: with this current code, the bot sends the delayed notice to ALL users joining that channel ALSO these one having this (v)host is specified above :/
Any ideas it might be inside the foreach - if thingy... but I'm out of my sources. Im not that tcl-freak and snipped the code together :D
Thanks for your help.
I use eggdrop *.18 under suse10 on an unrealircd
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

your foreach is all wrong :)

try

Code: Select all

## set a var for your hosts
set matchHosts [list \
*@crew* \
*@root* \
*@bastard* \
*@services* \
*@*users*]

## then use that down here

proc join:message {nick uhost hand chan} {
  foreach mask $::matchHosts {
    if {[string match -nocase $mask $uhost]} {return 0}
  }
  utimer 15 [list timed_message $nick]
}
## put your binds after the proc
bind join - * join:message

proc timed_message {nick} {
  puthelp "NOTICE $nick :Hi $nick, welcome to #channel... blabla :D"
 }


S
Snoopotic
Voice
Posts: 4
Joined: Sat Feb 10, 2007 10:10 am

Post by Snoopotic »

Ha very fine, its qiet a more easy solution :D I thought it might be done by negotiating...
Nah. Thanks so much, works as I wanted it :D
Post Reply