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.

Bot should response to spoken word from user

Old posts that have not been replied to for several years.
Locked
J
Jagg
Halfop
Posts: 53
Joined: Sat Jan 24, 2004 11:32 am

Bot should response to spoken word from user

Post by Jagg »

Hi,

how to do a little script that response a simple text if a user says a word which has a [ in front of the word and a ] after (like [help])

For example:

<user>please look for [help]
<eggdrop>www.testurl.com/[i]<the_word_from_the_user>[/i]

Thanks
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pubm - * response

proc response {nick uhost hand chan arg} {
 set i 0
 foreach w [split $arg] {
  if {[string match \[*\] $w]} { set in $i ; break}
  incr i
 }
 if {[info exists in]} {
  puthelp "privmsg $chan :www.testurl.com/[string map {[ "" ] ""} [lindex [split $arg] $in]]"
 }
}
J
Jagg
Halfop
Posts: 53
Joined: Sat Jan 24, 2004 11:32 am

Post by Jagg »

Sir_Fz wrote:

Code: Select all

bind pubm - * response

proc response {nick uhost hand chan arg} {
 set i 0
 foreach w [split $arg] {
  if {[string match \[*\] $w]} { set in $i ; break}
  incr i
 }
 if {[info exists in]} {
  puthelp "privmsg $chan :www.testurl.com/[string map {[ "" ] ""} [lindex [split $arg] $in]]"
 }
}
Thanks

First one didn't work then I done a refresh of this site and the code changed but also didn't work.

I have now edit

Code: Select all

[string match \[*\] $w]
to

Code: Select all

[string match {\[*\]} $w]
Then it works :)

THANKS YOU!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Yeah my bad, that's because \[*\] will only match the character "*".
Locked