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.

command prefix

Old posts that have not been replied to for several years.
Locked
s
simonbell
Halfop
Posts: 68
Joined: Mon Aug 05, 2002 8:07 pm
Location: Washington, England
Contact:

command prefix

Post by simonbell »

I want to give the option to choose there own prefix in a separate settings file, using
set cmdprefix "!"


for example

then matching it to pub binds as such
bind pub - $cmdprefixauthaddop pub_authaddop
the problem is that the bot appears to think that "$cmdprefixauthaddop is one single global variable instead of just $cmdprefix

How do i get eggdrop to recognise the separation?

Simon
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

bind pub - [string trim $cmdprefix]authaddop pub_authaddop
that should do it ;)
Elen sila lúmenn' omentielvo
s
simonbell
Halfop
Posts: 68
Joined: Mon Aug 05, 2002 8:07 pm
Location: Washington, England
Contact:

Post by simonbell »

hm, actually that means that people can use ANY command prefix they like in the channel, ie, @authaddop and !authaddop both work no-matter what the setting in the file is.
s
simonbell
Halfop
Posts: 68
Joined: Mon Aug 05, 2002 8:07 pm
Location: Washington, England
Contact:

Post by simonbell »

i have fixed it by using [string index $cmdprefix 0]

thanks for your help
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

yeah... sorry.. I was not thinking :)... good thing you figured it out ;)
Elen sila lúmenn' omentielvo
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

You are having TCL do more work than it should have to. That being, a substitution and then processing of a command (O(2)), when all that is needed is a substitution (O(1)). It isn't much of a difference in all actuality, but for the sake of efficiency:

Code: Select all

bind pub - ${cmdprefix}authaddop pub_authaddop
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

simonbell wrote:hm, actually that means that people can use ANY command prefix they like in the channel, ie, @authaddop and !authaddop both work no-matter what the setting in the file is.
There is no way this is happening. Have you tried it?

As noted, you should use the ${cmdprefix} method.

However, to correct some facts, there is simply no way possible for what you say above to occur.

Take a look at the following code

Code: Select all

set p "!"
bind pub - [string trim $p]test test:test
First, the pub bind does not accept masks or wildcards (pubm does). So what ever is placed in the mask field, has to be fully matched, without any wildcard processing. This leaves the single option of only one command possible.

While the $p and the "string trim" command are processed dynamicly, they are only called once, and thus produce static content. This means that after Tcl has run "[string trim $p]" once, it doesn't call it each time it tries to match somthing.
Locked