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.

Relay Script - On certain text matches

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

Relay Script - On certain text matches

Post by BigToe »

Hi I looked through the TCL archieve, found a few relay scripts, however couldn't find a relay script that only relays specific text match messages what you can set a list of text matches like "Hello" or "*school*" and it will only relay the match text lines.

Anyone up to it please?
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Code: Select all

proc pub_hello {nick uhost hand channel arg} {
  global botnick
  putquick "PRIVMSG $channel :\001ACTION waves hello to $nick.\001"
  return 0
}
bind pubm - "*hello*" pub_hello
B
BigToe
Halfop
Posts: 99
Joined: Thu Dec 30, 2010 4:49 pm

Post by BigToe »

hey cache, thanks for the reply
Three questions:

A. If I want to add other words, do I just add the following lines?

Code: Select all

bind pubm - "word1" pub_word1 
bind pubm - "word*" pub_word2 
B. The second question is, I want it to relay the whole sentence that matches the certain text.

like <User> oh hello there!
PRIVMSG $channel : "oh hello there"

how is that done?

Code: Select all

putquick "PRIVMSG $channel :\001ACTION waves hello to $nick.\001"
C. Third question, I want it to match text that are written only in a specific channel called #BigToe, otherwise it won't relay it.
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

No you need to copy the entire code then change 'hello' in every spot then edit the waves hello to $nick. to what you want the word to say.
B
BigToe
Halfop
Posts: 99
Joined: Thu Dec 30, 2010 4:49 pm

Post by BigToe »

How is that done?
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Ther is a script that will do this it was written by speechless action missile script relays set words to a channel containing the whole sentence

Code: Select all

# Multi-Bind Messaging (the easy way to do this) 
# AKA, PutServ-O-Matic v1.0 
# by speechles (w/help from egghelp! yay!) 

# Construct your triggers|channel|message 
# here using the format below: 
# "TRIGGER|#CHANNEL|METHOD AND MESSAGE" 
# add as little, or as many as you want but you 
# MUST use the format described above! 
# You also have a few variables to use 
# %b - will be replaced with $::botnick (bots current nickname) 
# %n - will be replaced with $nick (person triggering) 
# %c - will be replaced with $chan (channel triggered in) 
# %u - will be replaced with $uhost (person triggering unique host) 
# %h - will be replaced with $hand (person triggering handle) 
# %i - will be replaced with user $input (entire thing) 
# %i1 - will be replaced with user $input (just the first word) 
# %i2 - will be replaced with user $input (second to last words) 
# below are merely some examples. 
variable mycommands { 
  "*add word here*|*|notice #channelnamehere :Relay: <%n %c>%i" 
  "*add word here*|*|notice #channelnamehere :Relay: <%n %c>%i" 
  
} 

# Script begins - change nothing below here 
bind pubm -|- "*" mycommands_proc 

proc mycommands_proc {nick uhand hand chan input} { 
   foreach item $::mycommands { 
      set trig [lindex [split $item \|] 0] 
      regsub -all -nocase {%b} $trig $::botnick trig 
      regsub -all -nocase {%n} $trig $nick trig 
      regsub -all -nocase {%c} $trig $chan trig 
      regsub -all -nocase {%u} $trig $uhand trig 
      regsub -all -nocase {%h} $trig $hand trig 
      regsub -all -nocase {%i1} $trig [lindex [split $input] 1] trig 
      regsub -all -nocase {%i2} $trig [join [lrange [split $input] 2 end]]] trig 
      regsub -all -nocase {%i} $trig [join [lrange [split $input] 1 end]]] trig 
      if {[string match -nocase $trig $input]} { 
         if {[string match -nocase [lindex [split $item \|] 1] $chan]} { 
            set message [join [lrange [split $item \|] 2 end]] 
            regsub -all -nocase {%b} $message $::botnick message 
            regsub -all -nocase {%n} $message $nick message 
            regsub -all -nocase {%c} $message $chan message 
            regsub -all -nocase {%u} $message $uhand message 
            regsub -all -nocase {%h} $message $hand message 
            regsub -all -nocase {%i1} $message [lindex [split $input] 1] message 
            regsub -all -nocase {%i2} $message [join [lrange [split $input] 2 end]]] message 
            regsub -all -nocase {%i} $message [join [lrange [split $input] 1 end]]] message 
            putserv "$message" 
         } 
      } 
   } 
} 

putlog "Multi-bind messaging with action missles script loaded." 
B
BigToe
Halfop
Posts: 99
Joined: Thu Dec 30, 2010 4:49 pm

Post by BigToe »

How do I set it to relay the whole line in case my trigger is "*Hello*"?
I only got it to relay from that word and on, and not the whole sentence
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

BigToe wrote:How do I set it to relay the whole line in case my trigger is "*Hello*"?
I only got it to relay from that word and on, and not the whole sentence

Code: Select all

"*add word here*|*|notice #channelnamehere :Relay: <%n %c>%i %2"
All you need to do is add %2 shows in code above

Look at this part of the script

Code: Select all

# add as little, or as many as you want but you 
# MUST use the format described above! 
# You also have a few variables to use 
# %b - will be replaced with $::botnick (bots current nickname) 
# %n - will be replaced with $nick (person triggering) 
# %c - will be replaced with $chan (channel triggered in) 
# %u - will be replaced with $uhost (person triggering unique host) 
# %h - will be replaced with $hand (person triggering handle) 
# %i - will be replaced with user $input (entire thing) 
# %i1 - will be replaced with user $input (just the first word) 
# %i2 - will be replaced with user $input (second to last words) 
# below are merely some examples. 
Post Reply