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.

script that will reply custom text when command is unknown

Old posts that have not been replied to for several years.
Locked
y
yoda989
Voice
Posts: 2
Joined: Mon Feb 21, 2005 2:36 am

script that will reply custom text when command is unknown

Post by yoda989 »

Hi,

Maybe someone can help me with this?
When users type in wrong or command which does not exist I would like eggdrop to respond with custom text - something like "please type in !help for available commands"

I hope you guys can help me with this.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Eggdrop already replies with
What? You need '.help'
when someone types an invalid command.
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

I think he means external commands rather than dcc commands.

When text is sent to a channel the eggdrop evaluates it and checks what it see's on channel to what it has listed in its bind list. If it doesn't exist in the bind list it ignores the text untill the next set of text it see's so any potential text in a channel could be considered as a trigger it doesn't have to start with a !.

The way it could be done is to write a script that executes when it sees a '!' at the start of a line. Have a list that contains all of the binds that exist already. If a trigger is seen that already exists return the procedure else if its not in the list then print use !help.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

A more efficient solution would be a structure like this, for your proc:

You can use bind pubm with this and match [lindex $text 0] for the trigger you want in this case, so it will be binded to "*".
if { ..... } {
#do help1
}
elseif { .... } {
#do help2
}
elseif { .... } {
#do help3
}
elseif { .... } {
#do help4
}
else {
PUT INVALID COMMAND IN HERE
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

awyeah wrote:A more efficient solution would be a structure like this, for your proc:

You can use bind pubm with this and match [lindex $text 0] for the trigger you want in this case, so it will be binded to "*".
if { ..... } {
#do help1
}
elseif { .... } {
#do help2
}
elseif { .... } {
#do help3
}
elseif { .... } {
#do help4
}
else {
PUT INVALID COMMAND IN HERE
}
If i understand what you are saying you want him to add an if statement for every bind he has?
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Or switch if you don't care for speed. :P
Once the game is over, the king and the pawn go back in the same box.
y
yoda989
Voice
Posts: 2
Joined: Mon Feb 21, 2005 2:36 am

Post by yoda989 »

Thanks for the tips everone.
however, being total noob i am afraid it doesnt help me much.
Can someone help with a complete script?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

Code: Select all

bind pubm - "% !*" pubm:check
proc pubm:check { n u h c t } {
  if {[lsearch -exact $::bl [lindex [split $t] 0]]!=-1} { return }
  putserv "PRIVMSG $c :please type in !help for available commands"
}

proc mbl {} {
  set ::bl {}
  foreach b [binds pub*] {lappend ::bl [lindex [lindex $b 2] end]}
}
mbl
here is code for doom's suggestion. didn't test, but it should work. make sure mbl is executed after all your binds.
photon?
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

spock wrote: make sure mbl is executed after all your binds.
Just to clarify what spock means by that is make sure that script is the very last one on your source scripts/script.tcl list at the bottom of your config file :wink:
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Locked