egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trouble with args, *PROB SOLVED*

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Vexor
Voice


Joined: 21 Jul 2006
Posts: 18
Location: Washington Court House

PostPosted: Tue Jul 25, 2006 12:19 am    Post subject: Trouble with args, *PROB SOLVED* Reply with quote

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. Confused

Any suggestions?


Last edited by Vexor on Tue Jul 25, 2006 5:40 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
Zero
Voice


Joined: 25 Jul 2006
Posts: 4

PostPosted: Tue Jul 25, 2006 4:19 am    Post subject: Reply with quote

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
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Tue Jul 25, 2006 4:32 am    Post subject: Reply with quote

you should use
Code:
proc send:help {nick uhost hand chan {args ""}}
Back to top
View user's profile Send private message Send e-mail
Vexor
Voice


Joined: 21 Jul 2006
Posts: 18
Location: Washington Court House

PostPosted: Tue Jul 25, 2006 4:58 am    Post subject: Reply with quote

Code:

proc send:help {nick uhost hand chan {args ""}}


Just isn't working Confused

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
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue Jul 25, 2006 3:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber