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.

public command !add !fun text

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
R
Repdientu
Voice
Posts: 37
Joined: Thu Apr 30, 2009 3:45 am
Location: Viet Nam
Contact:

public command !add !fun text

Post by Repdientu »

i want to add some cmd funy to my bot as:

on master:text:!add !wc welcome to my room $1 .good luck and have fun.
on master:text:!add !bye good bye $1. See you again

when i used that cmd in Room

!wc abc
bot will say: welcome to my room abc .good luck and have fun.
!bye abc
bot will say: good bye abc . See you again

can you help me? thank alot
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Use the Putserv-O-Matic script, and change your list to look like below:

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"
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.
R
Repdientu
Voice
Posts: 37
Joined: Thu Apr 30, 2009 3:45 am
Location: Viet Nam
Contact:

Post by Repdientu »

i want to some one in list master of bot can public add command to bot in room as:

!add !bye Bye $1. good night and see you again

bot will save this cmd and when some master type

!bye Nick

bot will say: Bye Nick. good night and see you again.

what am i doing?
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

speechles wrote:Use the Putserv-O-Matic script, and change your list to look like below:

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"
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.
What were to happen if %i1 was not given?
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
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

holycrap wrote:
speechles wrote:Use the Putserv-O-Matic script, and change your list to look like below:

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"
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.
What were to happen if %i1 was not given?
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
Change:

Code: Select all

regsub -all -nocase {%i1} $message [lindex [split $input] 1] message
To:

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
}
Yeah, that would be rather simple and trivial to accomplish. ;)
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Kewl! :D

In mIRC there's a "describe" "METHOD." Which is equivalent to the bot doing "/me <messag>" Is there a METHOD in TCL that does that? I only see "notice and privmsg."

Thanks!

:D
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

/me is merely an alias for the ACTION ctcp request. As such, it is a privmsg. The simplest way of sending such a request would be something like this:

Code: Select all

puthelp "PRIVMSG #channel :\001ACTION does something\001"
For use with the script suggested by speechles, you'd add an entry such as below:

Code: Select all

"!act*|#yourchan| privmsg %c :\001ACTION does something\001"
NML_375
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Hi again,

So, it's not possible for the bot to do this?

<holycrap> !hi dude
*bot says hi to dude

The "describe" method in mIRC can do this which is like /me
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Sure it is... As I said, /me, /act, describe, etc are just aliases for the ACTION ctcp request... Which, in turn is a simple PRIVMSG.. (ctcp's are not part of the irc specifications, but a client extension).
As such, irc servers don't know of any ME, ACT, DESC, DESCRIBE commands or similar... they know of PRIVMSG (used for ctcp requests) and NOTICE (used for ctcp replies).

My previous post explained how to do this using the putserv-o-matic script suggested by speechles...
NML_375
R
Repdientu
Voice
Posts: 37
Joined: Thu Apr 30, 2009 3:45 am
Location: Viet Nam
Contact:

Post by Repdientu »

Hi Speechles

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

can i used file /data/command.txt for variable mycommands ?
and can add some command via: !addcmd !mode*|#myroom|mode %c %i1 to command.txt ?
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

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 
} 

Hi,

It didn't work, bot just say blank still.

:D
Post Reply