Code: Select all
"!wc*|#yourchan|privmsg %c :welcome to my room %i1. good luck and have fun"
"!bye*|#yourchan|privmsg %c :good bye %i1. See you again"
What were to happen if %i1 was not given?speechles wrote:Use the Putserv-O-Matic script, and change your list to look like below:Replace the "#yourchan" found above (just it not pipes on either side) with either "*" for all channels or the "#name" of your channel. Change the flags in the bind from -|- to your flavor of control. This should accomplish your goal.Code: Select all
"!wc*|#yourchan|privmsg %c :welcome to my room %i1. good luck and have fun" "!bye*|#yourchan|privmsg %c :good bye %i1. See you again"
Change:holycrap wrote:What were to happen if %i1 was not given?speechles wrote:Use the Putserv-O-Matic script, and change your list to look like below:Replace the "#yourchan" found above (just it not pipes on either side) with either "*" for all channels or the "#name" of your channel. Change the flags in the bind from -|- to your flavor of control. This should accomplish your goal.Code: Select all
"!wc*|#yourchan|privmsg %c :welcome to my room %i1. good luck and have fun" "!bye*|#yourchan|privmsg %c :good bye %i1. See you again"
For exe: <user> !wc
and no text after the command was given? Would it be possible to default the null text after the command and return the person triggering the command?
<holycrap> !wc
<bot> welcome to channel holycrap
Code: Select all
regsub -all -nocase {%i1} $message [lindex [split $input] 1] message
Code: Select all
if {[llength [split $input]] > 1 } {
regsub -all -nocase {%i1} $message [lindex [split $input] 1] message
} else {
regsub -all -nocase {%i1} $message $nick message
}
Code: Select all
puthelp "PRIVMSG #channel :\001ACTION does something\001"
Code: Select all
"!act*|#yourchan| privmsg %c :\001ACTION does something\001"
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 {
"*slaps %b*|#test|privmsg %c :\001action blocks the slap and kicks %n in the face.\001"
"!notice*|#test|notice %n :notice message"
"!query*|#test|privmsg %n :query/private message"
"!kickme*|#test|kick %c %n :kick fulfilled.. hehe \037:P\037"
"!voiceme*|*|mode %c +v %n"
"!voiceme*|*|privmsg %c :\002%n\002, feel the \002Power\002 of voice!"
"!repeat*|*|privmsg %c :%n just said \002%i\002 :P"
"!voicenick*|*|mode %c +v %i1"
"!kickbannick*|*|mode %c +b %i1!*@*"
"!kickbannick*|*|kick %c %i1 :%i2 (Requested by %n)"
"!kicknick*|*|kick %c %i1 :%i2 (Requested by %n)"
}
# 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
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."
Code: Select all
Change:
Code:
regsub -all -nocase {%i1} $message [lindex [split $input] 1] message
To:
Code:
if {[llength [split $input]] > 1 } {
regsub -all -nocase {%i1} $message [lindex [split $input] 1] message
} else {
regsub -all -nocase {%i1} $message $nick message
}