04-27-2017, 22:41 +0200
AuthorPost
CyBex  03-29-2004, 22:14   | [EGG] bind Jabber  ICQ  AOL IM  Yahoo IM  MSN  Homepage
nie da
(Administrator)

Avatar

Member since 01/2004
260 Posts
Location: Berlin
Quote by "Eggdrop Manual":
bind <type> <flags> <keyword/mask>  [proc-name]
   
    Description: You can use the 'bind' command to attach Tcl procedures to certain events. flags are the flags the user must have to trigger the event (if applicable). proc-name is the name of the Tcl procedure to call for this command (see below for the format of the procedure call). If the proc-name is omitted, no binding is added. Instead, the current binding is returned (if it's stackable, a list of the current bindings is returned).

    Returns: name of the command that was added, or (if proc-name was omitted), a list of the current bindings for this command

    Module: core
Manual: TCL-Commands

See also: unbind, binds

mfG CyBex @ QuakeNet, UnderNet, EFNet, Freenode, euIRC, GameSurge & ShadowWorld - Files
This post was edited 1 times, last on 04-01-2004, 12:04 by unknown
Mirage  03-31-2004, 17:30   | Public binds
Staff
(Moderator)
Member since 01/2004
54 Posts
Location: Zwickau, Germany
Public binds

1. possibility
                                                                                                                              
1
bind pub <flags> <command> <proc>


Flags: What flags must a user have on the Bot to trigger that bind?
- or -|- = no flags needed
n = global owner
-|n = channel owner
n|n = global owner OR channel owner
n&n = global owner AND channel owner
m|n = global master OR channel owner
You can replace the "n" and  "m" with what ever flag you want.
Command: The first word the user writes in his line is the command. So if someone says "Hey guys" in the channel and the command is "Hey" the bind is triggered and the specific procedure called.
Proc: The procedure that should be called when the bind is triggered

Call the procedure "greet" when someone says "Hello" on any channel the bot is on:
                                                                                                                              
1
bind pub - "hello" greet

    We can write "hello" as the command because l
    etter case doesn't matter in binds

Example trigger: Someuser (Someuser!user@coolhost.us) writes "hello world!" on channel "#we.learn.tcl" and is known as "Beginner" by the Bot.


Example procedure header for the greet:
                                                                                                                              
1
proc greet { nick uhost handle channel text } {


So regarding the example trigger the following content would be in the following variables ($variable - content):
$nick - Someuser
$uhost - user@coolhost.us
$handle - Beginner
$channel - #we.learn.tcl
$text - world! (everything after the command)

2. possibility

Whenever you want to check more than the first word of a line or if you want to use wildcards you have to use the bind type PUBM
                                                                                                                              
1
bind pubm <flags> <mask> <proc>


Flags: as aforementioned
Mask: The mask is a bit different to command parameter in the bind type pub. It is matched against the channel the user said something on and the text he had written. Means: "#channel text". Examples beneath.
Proc: as aforementioned

Ok. Let's make the procedure "greet" being called when users write something with an @ in the channel #we.learn.tcl.
                                                                                                                              
1
bind pubm - "#we.learn.tcl *@*" greet

Or making the channel name regardless:
                                                                                                                              
1
bind pubm - "% *@*" greet


% = wildcard for "one word"

Example trigger (matches for both binds): Someuser (Someuser!user@coolhost.us) writes "write to me: cooluser@someisp.org" on channel "#we.learn.tcl" and is known as "Beginner" by the Bot.

Example procedure header:
                                                                                                                              
1
proc greet { nick uhost hand chan arg } {


Regarding the example trigger the variables will get the following content:
$nick - Someuser
$uhost - user@coolhost.us
$hand - Beginner
$chan - #we.learn.tcl
$arg - write to me: cooluser@someisp.org (the first word is not stripped like when it is called by a pub bind, the 5th argument contents the whole line here)

As you can see you can name the variables as you want (but be careful with using the name "args" for 5th argument - this has a special meaning). Only the order of the content is always the same and you always have to provide 5 variable names for those two bind types.

I hope this will help you making your first public binds.
CyBex  04-01-2004, 12:37   | [EGG] proc header Jabber  ICQ  AOL IM  Yahoo IM  MSN  Homepage
nie da
(Administrator)

Avatar

Member since 01/2004
260 Posts
Location: Berlin
[Not loaded: http://tcl.b0rk.de/pic/ukw.gif]Every BIND has an specific I list here now every since Eggdrop 1.6.15 sortet by the same header.
[Not loaded: http://tcl.b0rk.de/pic/gerw.gif] Jeder BIND hat seine Speziellen Eigenschaften an Parametern die er an die Procedure <procname> übergibt. Ich liste hier jeden Bind auf der in der Eggdrop 1.6.15 Dokumentation ist (sortiert nach den gleichen Parametern / Übergabewerte im Header).
  • proc <procname> { <nickname <userhost> <handle> <text> } {
    • 1. bind MSG <flags> <command> <procname>
    • 5. bind MSGM <flags> <mask> <procname>
      • [Not loaded: http://tcl.b0rk.de/pic/gerw.gif] Werden beide bei Query's angetriggert, der eine bei Commandos und der anderen bei Textphrasen bzw Masken
        • Commands sind immer einzellne Worte, die am Anfang stehen und der Teil dahinter wird als <text> übergeben.
        • Masken sind für Textstellen IRGENDWO in dem Text gedacht. zB *hello*world* reagiert auch auf "hello to another new world"
  • proc <procname> { <handle> <idx> <text> } {
    • 2. DCC
    • 3. FIL
  • proc <procname> { <nickname> userhost> <handle> <channel> <text> } {
    • 4. PUB
    • 6. PUBM
    • 9. PART
    • 10. SIGN
    • 11. TOPC
    • 13. NICK
    • 7. NOTC
    • 8. JOIN
    • 12. KICK
    • 14. MODE
    • 15. CTCP
  • [Not loaded: http://tcl.b0rk.de/pic/gerw.gif] wird fortgesetzt :-)

mfG CyBex @ QuakeNet, UnderNet, EFNet, Freenode, euIRC, GameSurge & ShadowWorld - Files
Advanced options for this topic:

Ignore this topic (Do not list this topic in the "unread topics" search. You are currently not ignoring this topic.)
Hide this topic (Hidden topics are not displayed in the topics list. This topic is currently not hidden.)
Go to forum

Unclassified NewsBoard 1.5.3-d | © 2003-4 by Yves Goergen