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.

Reacting to all commands *?

Help for those learning Tcl or writing their own scripts.
Post Reply
P
Pauschi
Voice
Posts: 11
Joined: Tue Sep 03, 2019 11:09 am

Reacting to all commands *?

Post by Pauschi »

Hello!

my simple script is working so far, unfortunally it only reacts when someone writes !raffle into the chat.

Code: Select all

bind PUB -|- !raffle raffle
proc raffle { nick host hand chan arg } {
putserv "PRIVMSG $chan :!raffle"
}
Can it be triggered with every text what starts with "!" ?

I tried

Code: Select all

bind PUB -|- !* all
but it doesnt work :(

And it should PRIVMSG to the chan with excatly THAT what was inputted.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Hello,
The PUB binding does not support wildcard characters such as *. For this, you'll have to use the PUBM binding instead.

Keep in mind though, that the syntax for PUBM is slightly different to PUB;
The mask is matched against "#channel text", so you'll probably want to use something like this:

Code: Select all

bind pubm -|- "% !*" raffle
Also, if the command (raffle, in this case) returns 1, the message will not be logged.
Finally, if you've enabled exclusive bindings, this will prevent any PUB binds matching the text-line from actually triggering.

As for responding with the input-text, this is available in the last parameter passed to the function;

Code: Select all

proc raffle {nick host handle channel text} {
  puthelp "PRIVMSG $channel :$text"
}
NML_375
P
Pauschi
Voice
Posts: 11
Joined: Tue Sep 03, 2019 11:09 am

Post by Pauschi »

Thank you sir! Im gonna try it:)
Post Reply