| View previous topic :: View next topic |
| Author |
Message |
Jagg Halfop
Joined: 24 Jan 2004 Posts: 53
|
Posted: Tue Sep 06, 2005 7:35 am Post subject: Bot should response to spoken word from user |
|
|
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/<the_word_from_the_user>
Thanks |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Sep 06, 2005 8:18 am Post subject: |
|
|
| Code: | 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]]"
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Jagg Halfop
Joined: 24 Jan 2004 Posts: 53
|
Posted: Tue Sep 06, 2005 9:23 am Post subject: |
|
|
| Sir_Fz wrote: | | Code: | 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: | | [string match \[*\] $w] |
to
| Code: | | [string match {\[*\]} $w] |
Then it works
THANKS YOU! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Sep 06, 2005 9:29 am Post subject: |
|
|
Yeah my bad, that's because \[*\] will only match the character "*". _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|