egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

script that will reply custom text when command is unknown

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
yoda989
Voice


Joined: 21 Feb 2005
Posts: 2

PostPosted: Mon Feb 21, 2005 2:45 am    Post subject: script that will reply custom text when command is unknown Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Feb 21, 2005 6:39 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Mon Feb 21, 2005 6:53 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Mon Feb 21, 2005 7:30 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Mon Feb 21, 2005 8:05 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Feb 21, 2005 8:22 am    Post subject: Reply with quote

Or switch if you don't care for speed. Razz
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
yoda989
Voice


Joined: 21 Feb 2005
Posts: 2

PostPosted: Mon Feb 21, 2005 9:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
spock
Master


Joined: 12 Dec 2002
Posts: 319

PostPosted: Tue Feb 22, 2005 12:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Tue Feb 22, 2005 1:15 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber