| View previous topic :: View next topic |
| Author |
Message |
Vexor Voice

Joined: 21 Jul 2006 Posts: 18 Location: Washington Court House
|
Posted: Tue Jul 25, 2006 12:19 am Post subject: Trouble with args, *PROB SOLVED* |
|
|
Greetings all,
I'm creating a small user's help guide for my bot so people can know all channel commands for the bot. This works to some degree. If I type in "!help google" I get the small help text that explains how to use it. But if I just use "!help" I get no response at all. It's probably just a total brain fart but I can't put my finger on it.
| Code: |
proc send:help {nick uhost hand chan args} {
#Bring in the default list
global helplist
if { $args != "" } {
put:help $args $nick
} else {
putserv "privmsg $nick :Current general commands include: $helplist"
putserv "privmsg $nick :For more information on a topic use \"!help topic\" (such as !help google)"
}
}
|
put:help is what calls if args is not blank, (ie, the "!help google", which works) What's not working is the else statement block.
Any suggestions?
Last edited by Vexor on Tue Jul 25, 2006 5:40 am; edited 2 times in total |
|
| Back to top |
|
 |
Zero Voice
Joined: 25 Jul 2006 Posts: 4
|
Posted: Tue Jul 25, 2006 4:19 am Post subject: |
|
|
Try this:
| Code: |
proc send:help {nick uhost hand chan args} {
#Bring in the default list
global helplist
if { [llength $args] > 0 } {
put:help $args $nick
} else {
putserv "privmsg $nick :Current general commands include: $helplist"
putserv "privmsg $nick :For more information on a topic use \"!help topic\" (such as !help google)"
}
}
|
Maybe llength $args works... |
|
| Back to top |
|
 |
krimson Halfop

Joined: 19 Apr 2006 Posts: 86
|
Posted: Tue Jul 25, 2006 4:32 am Post subject: |
|
|
you should use
| Code: | | proc send:help {nick uhost hand chan {args ""}} |
|
|
| Back to top |
|
 |
Vexor Voice

Joined: 21 Jul 2006 Posts: 18 Location: Washington Court House
|
Posted: Tue Jul 25, 2006 4:58 am Post subject: |
|
|
| Code: |
proc send:help {nick uhost hand chan {args ""}}
|
Just isn't working
I'm at a total loss. [llength $args] didn't work either.
*UPDATE* I said the hell with it and just rewrote the code. Thanks for your suggestions, and sorry for the trouble. *mutters to himself* |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Tue Jul 25, 2006 3:59 pm Post subject: |
|
|
| Code: |
bind - pub !help myproc
proc myproc {nick uhost hand chan text} {
set cmd [lindex [split $text] 0]
if {$cmd == "google"} {
puthelp "PRIVMSG $nick :Google help line 1"
puthelp "PRIVMSG $nick :Google help line 2 etc."
return
}
if {$cmd == "something"} {
# more stuff here
return
}
if {$cmd == ""} {
# Whatever you want..
# could also just use the next "else" part after any "if", for default help..
return
} else {
# default help stuff here...
return
}
}
|
|
|
| Back to top |
|
 |
|