egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Relay Script - On certain text matches

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
BigToe
Halfop


Joined: 30 Dec 2010
Posts: 99

PostPosted: Wed Feb 02, 2011 3:12 pm    Post subject: Relay Script - On certain text matches Reply with quote

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?
Back to top
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Wed Feb 02, 2011 3:39 pm    Post subject: Reply with quote

Code:

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
Back to top
View user's profile Send private message
BigToe
Halfop


Joined: 30 Dec 2010
Posts: 99

PostPosted: Thu Feb 03, 2011 3:47 am    Post subject: Reply with quote

hey cache, thanks for the reply
Three questions:

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

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:
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.
Back to top
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Thu Feb 03, 2011 6:29 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
BigToe
Halfop


Joined: 30 Dec 2010
Posts: 99

PostPosted: Thu Feb 03, 2011 11:25 am    Post subject: Reply with quote

How is that done?
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Thu Feb 03, 2011 7:43 pm    Post subject: Reply with quote

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:
# 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."

_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
BigToe
Halfop


Joined: 30 Dec 2010
Posts: 99

PostPosted: Fri Feb 04, 2011 5:56 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Fri Feb 04, 2011 6:36 am    Post subject: Reply with quote

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:
"*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:
# 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.

_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber