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.

bind "-$comm" for command

Help for those learning Tcl or writing their own scripts.
Post Reply
F
FallFromGrace
Voice
Posts: 17
Joined: Mon Jul 28, 2008 8:52 am

bind "-$comm" for command

Post by FallFromGrace »

I want to bind "-" symbol, to use it like:

-123
-test

where "-" is a command, and 123/test is $text

I have already did "+" with: bind pubm - "*+*" command (but "+*" doesnt works =\)

how can i bind "-" symbol? bind pubm - "*-*" command or b]bind pubm - "*\-*" command[/b] doest works properly, it just binds ALL actions in chat to command..
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Quick, basic example:

Code: Select all

bind pubm - {*} myproc

proc myproc {nick host hand chan text} {
    if {[string index [lindex [split $text] 0] 0] != "-"} { return }
    set text [join [string trimleft $text -]]
    # do stuff here...
}
r0t3n @ #r0t3n @ Quakenet
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Why not

Code: Select all

bind pubm - "% -*" whatever
proc whatever {n u h c text} {
	set text [string range $text 1 end]
	# ...
}
?
Have you ever read "The Manual"?
Post Reply