| View previous topic :: View next topic |
| Author |
Message |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Jul 07, 2007 3:50 pm Post subject: help with my tea script [SOLVED] |
|
|
| Code: | #################
proc pub_!tea {nick uhost hand chan rest} {
global botnick
set cmd [string tolower [lindex $rest 0]]
if {$cmd == "help"} {
putnot $nick "!tea will give you a hot tea."
putnot $nick "!tea <nick> will give <nick> a hot tea." ; return 0}
if {$cmd == ""} {
putchan $chan "\001ACTION sets a fresh cup of hot tea in front of $nick\001" ;return 0}
putchan $chan "\001ACTION sets a fresh cup of hot tea in front of $cmd\001"
}
bind pub - !tea pub_!tea
################# |
when using "!tea help" it don't work unless 'help' is typed in lowercase letters.. im sure it is "[string tolower [lindex $rest 0]]" causing it but I can't figure out anything else to use to allow caps and lowercase...
Can someone please point me in right direction or show me another example script? Thanks
Last edited by cache on Sat Jul 07, 2007 6:23 pm; edited 1 time in total |
|
| Back to top |
|
 |
w00f Halfop
Joined: 04 Oct 2006 Posts: 49
|
Posted: Sat Jul 07, 2007 5:08 pm Post subject: |
|
|
use -nocase option with string match
i.e.
| Code: |
set cmd [lindex $rest 0]
if {[string match -nocase $cmd "help"]} { .... }
|
~w00f |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Jul 07, 2007 6:23 pm Post subject: |
|
|
Thanks w00f got it working  |
|
| Back to top |
|
 |
|