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 

public command !add !fun text

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


Joined: 30 Apr 2009
Posts: 33
Location: Viet Nam

PostPosted: Thu Jun 11, 2009 7:57 am    Post subject: public command !add !fun text Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Thu Jun 11, 2009 5:38 pm    Post subject: Reply with quote

Use the Putserv-O-Matic script, and change your list to look like below:
Code:
  "!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.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Repdientu
Voice


Joined: 30 Apr 2009
Posts: 33
Location: Viet Nam

PostPosted: Fri Jun 12, 2009 7:31 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message Visit poster's website
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Sat Jun 13, 2009 8:53 am    Post subject: Reply with quote

speechles wrote:
Use the Putserv-O-Matic script, and change your list to look like below:
Code:
  "!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
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Jun 13, 2009 9:45 am    Post subject: Reply with quote

holycrap wrote:
speechles wrote:
Use the Putserv-O-Matic script, and change your list to look like below:
Code:
  "!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:
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
}

Yeah, that would be rather simple and trivial to accomplish. Wink
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Sat Jun 13, 2009 7:41 pm    Post subject: Reply with quote

Kewl! Very Happy

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!

Very Happy
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jun 13, 2009 10:31 pm    Post subject: Reply with quote

/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:
puthelp "PRIVMSG #channel :\001ACTION does something\001"


For use with the script suggested by speechles, you'd add an entry such as below:
Code:
"!act*|#yourchan| privmsg %c :\001ACTION does something\001"

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Mon Jun 15, 2009 9:06 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Jun 15, 2009 1:30 pm    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Repdientu
Voice


Joined: 30 Apr 2009
Posts: 33
Location: Viet Nam

PostPosted: Wed Jul 29, 2009 1:53 am    Post subject: Reply with quote

Hi Speechles
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 {
  "*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 ?
Back to top
View user's profile Send private message Visit poster's website
holycrap
Op


Joined: 21 Jan 2008
Posts: 152

PostPosted: Sat Aug 01, 2009 2:33 pm    Post subject: Reply with quote

Code:
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.

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