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.

only echo stuff starting with a [

Help for those learning Tcl or writing their own scripts.
Post Reply
b
brood
Voice
Posts: 30
Joined: Thu Sep 01, 2005 4:12 am

only echo stuff starting with a [

Post by brood »

We have a sitebot on a channel where the SiTEOPS are in. Now we made a channel for users who got axx to the ftp will be in. The problem is the sitebot tels stuff (like pre of a release) we dont want the users to see. So we want to echo stuff the bot says in the users channel, but not that kind of stuff.

We are using this very easy script atm:
bind pubm * "*" pre
proc pre {nick uhost handle channel text} {
if {($nick == "nick") && ($channel == "#channel")} {
putserv "privmsg #userchannel :$text"
}
}
I was wondering if it could be change, it will only echo stuff we like it to be show in the user channel.

Like the sitebot announce:
<sitebot> PRE : blablabla
<sitebot> [TV] - blabla

So it have to echo only the text that starts with a "["

Hope this is clear :)

thanks
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pubm - "\[*" pre
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

Sir_Fz wrote:

Code: Select all

bind pubm - "\[*" pre
psst!
TCL-Commands.doc wrote:The mask is matched against the channel name followed by the text and can contain wildcards.
your are better off with:

Code: Select all

bind pubm - {#channel [*} pre
you can skip the $chan == #channel part then ;)
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Ah yeah, my bad :oops:
b
brood
Voice
Posts: 30
Joined: Thu Sep 01, 2005 4:12 am

Post by brood »

thanks that works :)

is it also to filter some lines out?

like we dont when to let the users see for example
[SYSOP] - blabbla
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

if {"[lindex [split $text] 0]" == "\[SYSOP\]"} { return 0 }
b
brood
Voice
Posts: 30
Joined: Thu Sep 01, 2005 4:12 am

Post by brood »

it doesnt seems to work.
bind pubm - {#channel1 [*} pre
proc pre {nick uhost handle channel text} {
if {($nick == "nick")} {
if {"[lindex [split $text] 0]" == "\[SYSOP\]"} { return 0 }
putserv "privmsg #channel2 :$text"
}
}
It still echo the [SYSOP] announcement
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pubm - {#channel1 [*} pre
proc pre {nick uhost handle channel text} {
 if {($nick == "nick")} {
  if {[string equal \[SYSOP\] [lindex [split $text] 0]]} { return 0 }
  putserv "privmsg #channel2 :$text"
 }
}
b
brood
Voice
Posts: 30
Joined: Thu Sep 01, 2005 4:12 am

Post by brood »

thanks :D
k
kaotech
Voice
Posts: 2
Joined: Tue Dec 20, 2005 8:24 pm

Post by kaotech »

if the [ is red what is necessary to change on the code ?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Sir_Fz wrote: if {($nick == "nick")} {
Huh?! :shock: Elementary! My Dear Watson!
kaotech check this page.
Once the game is over, the king and the pawn go back in the same box.
Post Reply