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.

newbie help with tcl scripting

Old posts that have not been replied to for several years.
Locked
C
CC

newbie help with tcl scripting

Post by CC »

I have a procedure that is triggered on bind join - * <proc name>.

Inside this procudure I want to have certain if statements for different hosts.

An example of what I want to do which doesn't work:

Code: Select all

if {$host == "*@*.staff.*"} {
<body>
}
else {
<body>
}
How can I do the above?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Read the tcl manual for the "string" command... hint: you want wildcard matching...
C
CC

Post by CC »

I've had a look through the tcl-commands.doc file and found:

Code: Select all

  maskhost <nick!user@host>
    Returns: masked hostmask for the string given ("n!u@1.2.3.4" -> "*!u@1.2.3.*",
      "n!u@lame.com" -> "*!u@lame.com", "n!u@a.b.edu" -> "*!u@*.b.edu")
    Module: core
?
c
cofferscuffs

Post by cofferscuffs »

if { [string match "*@*.staff.*" $host] } {
#match
} {
#no match
}

(8) JOIN (stackable)
bind join <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel>

Description: triggered by someone joining the channel. The mask in
the bind is matched against "#channel nick!user@host" and can
contain wildcards.
Module: irc

is what you need to read though in tcl-commands.doc so something like

bind join - "*@*.staff.*" procname

i *think*
C
CC

Post by CC »

The thing is, I already have a bind join - * procname which sends a message to all users joining the channel. What I want is that if someone matches the host *@*.staff.* then a different message will be dispplayed.
User avatar
Souperman
Halfop
Posts: 69
Joined: Sat Feb 02, 2002 8:00 pm
Location: Cape Town, South Africa
Contact:

Post by Souperman »

Code: Select all

bind join - * procname

proc procname {nick uhost hand chan} {
 if {[string match "*@*.staff.*" $uhost]} {
  puthelp "PRIVMSG $nick :message for people with the staff host"
 } else {
  puthelp "PRIVMSG $nick :message for everyone else"
 }
}
Read the Tcl "string" manual page (not tcl-commands.doc, those are simply Tcl commands added by Eggdrop). Either look at http://www.tcl.tk/man/ or "man n string" on your shell.
Quick! Somebody get me a new ink cartridge
O
Olo

Post by Olo »

where exactly can i get a copy of this TCL SCRIPTS Manual???[/quote][/code]
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

XplaiN but think of me as stupid
Locked