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 

MASK

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Fri Dec 08, 2006 7:35 am    Post subject: MASK Reply with quote

Hi all,

It my first time writing a TCL script.

I wanna ask, is the MASK inside the bind accept the same thing Normal IRC does?

Will this work?
Code:

bind PUBM - /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/g CallMain


If it don't can anyone point me to a site that contain all the matching command?

The above "/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/g" is actually meant to react if someone spammed a ip address like 21.203.203.11
Well, I did that for my IRC script, but I trying to convert the coding to TCL ones.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Dec 08, 2006 7:49 am    Post subject: Reply with quote

bind masks do not support regular expressions, but only simple wildcards supported by "string match", ie ?, *, [chars], \x

? would match any single character
* would match any number of characters
[chars] would match any single character of the ones in chars, also supports intervals such as a-z
\x would match the single character x (used for escaping special characters such as ?*[]\)

The closest thing you could use would be something like this: "*.*.*.*", but that would match anything said that has three or more dots in it...
If you really wish to use regular expressions, considder doing the matching within the CallMain proc, rather than doing it in the binding.. regexp is your friend here
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Dec 08, 2006 8:55 am    Post subject: Reply with quote

Also % matches a single word (no white spaces).
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Sat Dec 09, 2006 5:15 pm    Post subject: Reply with quote

Thanks Very Happy

Ermm...

Sorry but...

What is the variable for the channel message in variable?

I know nick is $nick, channel name is $channel, wat about the channel message? Is it $pubm ?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sat Dec 09, 2006 5:35 pm    Post subject: Reply with quote

(6) PUBM (stackable)
bind pubm <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <text>

Description: just like MSGM, except it's triggered by things said
on a channel instead of things /msg'd to the bot. The mask is
matched against the channel name followed by the text and can
| contain wildcards. If the proc returns 1, Eggdrop will not log
| the message that triggered this bind. PUBM binds are processed
| before PUB binds. If the exclusive-binds setting is enabled,
| PUB binds will not be trigged by text that a PUBM bind has
| already handled.
Module: irc


Assuming your proc used the above example format, your msg would be inside of $text
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Dec 09, 2006 5:41 pm    Post subject: Reply with quote

Tcl-commands.doc:
Quote:
PUBM (stackable)
bind pubm <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <text>

Description: just like MSGM, except it's triggered by things said
on a channel instead of things /msg'd to the bot. The mask is
matched against the channel name followed by the text and can
contain wildcards. Also, if a line triggers a PUB bind, it will not
trigger a PUBM bind.
Module: irc

You can name them whatever you want as long as the number of attributes is correct.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Sun Dec 10, 2006 6:28 am    Post subject: Reply with quote

Yah, i mean inside the proc

how can I get the message string?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 10, 2006 8:54 am    Post subject: Reply with quote

Didn't you read what me and rosc2112 showed you? look close and notice the <text> parameter. There are loads and loads of examples in this forum, search.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Dec 10, 2006 8:56 am    Post subject: Reply with quote

Then considder this example:

Code:
bind pubm - * myproc

proc myproc {arg1 arg2 arg3 arg4 arg5} {
 putlog "myproc was called by $arg1 from host $arg2 identified as $arg3 on channel $arg4 saying $arg5"
}


Just as Sir_Fz said, it really does'nt matter what you call those parameters..
You just specify which arguments your proc should take. Once you call your proc with:
Code:
myproc "the nick" "the host" "the handle" "the channel" "the text"
these values will be assigned to local variables within the proc, named as you specify in the header (in this example arg1, arg2, arg3, arg4, arg5).

All "bind" does is calling whatever command-line you specified (in this example "myproc"), with a number of arguments (5 arguments for the pubm binding) holding various information on the event that triggered the binding
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Sun Dec 10, 2006 9:03 am    Post subject: Reply with quote

THANKYOU nml375

For the clear explaination on these argument

I don't really understand the documentation
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 -> Scripting Help 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