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.

Ignore certain wildcards, but relay everything else

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
B
BigToe
Halfop
Posts: 99
Joined: Thu Dec 30, 2010 4:49 pm

Ignore certain wildcards, but relay everything else

Post by BigToe »

Hi,

I'm using the following script to relay messages from one channel to another:

Code: Select all

# Channel flag.
setudef flag monitorText2

# Subchannel.
set subchannel2 #channeltolisten

# Bind all text in all channels.
bind pubm - * monitorProc2
proc monitorProc2 {nick uhost hand chan text} {
global subchannel2

    # Check channel flag.
    if {![channel get $chan monitorText2]} {
        return 0
    }

    # Check text for matching values.
       if {[string match "*(Source:*" $text] } {

        # Send matching text to subchannel.
        putserv "PRIVMSG GianniInfantino :msg #channeltorelayto $text"
    }
}


But in practice what I'm looking for is a script that will ignore certain wildcards/texts - and relay every message that does not match that wildcard/text.

Thanks
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try this...

Code: Select all

### Set the channel to relay all qualifying text to! ###
set relayto #channeltorelayto

### Set any exempt masks for text that will not be relayed ###
### One exempt word, phrase, or mask per line! ###
set relayxmpt {

} ;## End of exempt masks setting ##


# Channel flag for all monitored channels.
# To flag a channel to be monitored, do: .chanset #yourchannel +relayText
setudef flag relayText

# Bind all text in all channels.
bind pubm - * relayMonitor

# Clean and split any exempt masks.
set relayxmpt [split [string trim $relayxmpt] "\n"]

proc relayMonitor {nk uh hn ch tx} {

    # Check channel flag.
    if {![channel get $ch relayText]} {  return 0  }

    # Check text for matching exempt.
    foreach xmpt $::relayxmpt {
        if {[string match -nocase $xmpt $tx]} {  return 0  }
    }

    # Send any qualifying text to $relayto channel.
    puthelp "PRIVMSG $::relayto :<$nk@$ch> $tx" 
    return 0
}

### Set any exempt masks for text that will not be relayed ###
### One exempt word, phrase, or mask per line! ###
Example:

Code: Select all

set relayxmpt {
hey
be back later
*(Source:*
} ;## End of exempt masks setting ##
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Post Reply