| View previous topic :: View next topic |
| Author |
Message |
yoda989 Voice
Joined: 21 Feb 2005 Posts: 2
|
Posted: Mon Feb 21, 2005 2:45 am Post subject: script that will reply custom text when command is unknown |
|
|
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. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Feb 21, 2005 6:39 am Post subject: |
|
|
Eggdrop already replies with | Quote: | | What? You need '.help' | when someone types an invalid command. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
^DooM^ Owner

Joined: 26 Aug 2003 Posts: 772 Location: IronForge
|
Posted: Mon Feb 21, 2005 6:53 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Mon Feb 21, 2005 7:30 am Post subject: |
|
|
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 "*".
| Quote: |
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.
================================== |
|
| Back to top |
|
 |
^DooM^ Owner

Joined: 26 Aug 2003 Posts: 772 Location: IronForge
|
Posted: Mon Feb 21, 2005 8:05 am Post subject: |
|
|
| 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 "*".
| Quote: |
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 |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 21, 2005 8:22 am Post subject: |
|
|
Or switch if you don't care for speed.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
yoda989 Voice
Joined: 21 Feb 2005 Posts: 2
|
Posted: Mon Feb 21, 2005 9:04 pm Post subject: |
|
|
Thanks for the tips everone.
however, being total noob i am afraid it doesnt help me much.
Can someone help with a complete script? |
|
| Back to top |
|
 |
spock Master
Joined: 12 Dec 2002 Posts: 319
|
Posted: Tue Feb 22, 2005 12:13 pm Post subject: |
|
|
| Code: |
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? |
|
| Back to top |
|
 |
^DooM^ Owner

Joined: 26 Aug 2003 Posts: 772 Location: IronForge
|
Posted: Tue Feb 22, 2005 1:15 pm Post subject: |
|
|
| 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  _________________ 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 |
|
| Back to top |
|
 |
|