| View previous topic :: View next topic |
| Author |
Message |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Fri Dec 08, 2006 7:35 am Post subject: MASK |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Dec 08, 2006 7:49 am Post subject: |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Dec 08, 2006 8:55 am Post subject: |
|
|
Also % matches a single word (no white spaces). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Sat Dec 09, 2006 5:15 pm Post subject: |
|
|
Thanks
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 |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Sat Dec 09, 2006 5:35 pm Post subject: |
|
|
(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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Dec 09, 2006 5:41 pm Post subject: |
|
|
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 |
|
 |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Sun Dec 10, 2006 6:28 am Post subject: |
|
|
Yah, i mean inside the proc
how can I get the message string? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Dec 10, 2006 8:54 am Post subject: |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Dec 10, 2006 8:56 am Post subject: |
|
|
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 |
|
 |
Lu5ck Halfop
Joined: 07 Dec 2006 Posts: 43
|
Posted: Sun Dec 10, 2006 9:03 am Post subject: |
|
|
THANKYOU nml375
For the clear explaination on these argument
I don't really understand the documentation |
|
| Back to top |
|
 |
|