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.

help with my tea script [SOLVED]

Help for those learning Tcl or writing their own scripts.
Post Reply
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

help with my tea script [SOLVED]

Post by cache »

Code: Select all

#################
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.
w
w00f
Halfop
Posts: 49
Joined: Wed Oct 04, 2006 6:50 pm

Post by w00f »

use -nocase option with string match
i.e.

Code: Select all

set cmd [lindex $rest 0]
if {[string match -nocase $cmd "help"]} { .... }
~w00f
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Thanks w00f got it working :)
Post Reply