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 

Argument Separation

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


Joined: 08 Feb 2006
Posts: 13
Location: unknown

PostPosted: Mon Feb 13, 2006 7:29 pm    Post subject: Argument Separation Reply with quote

I am running Eggdrop 1.4 and am trying to design a simple script that takes the input "!taken abcde edcba" and serparates it into varibles equal abcde and edcba respectively.

Code:


        set $i [string first " " $args 0]
        set $j [string length $args]
        set $tfirst [string range $args 0 [$i-1]]
        set $tsecond [string range $args [$i+1] $j]



Any help would be most appicated.
Back to top
View user's profile Send private message Visit poster's website AIM Address
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Tue Feb 14, 2006 1:12 am    Post subject: Reply with quote

you need to learn about using Tcl lists (what you want is usually done using [lindex])
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
ghostscript
Voice


Joined: 08 Feb 2006
Posts: 13
Location: unknown

PostPosted: Tue Feb 14, 2006 3:42 pm    Post subject: Reply with quote

Tried changing to using lindex. Looks like it should work but i get empty returns now. Is there something I'm doing wrong here?

Code:

        set tfirst [lindex $args 0]
        set tsecond [lindex $args 1]
Back to top
View user's profile Send private message Visit poster's website AIM Address
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Tue Feb 14, 2006 11:11 pm    Post subject: Reply with quote

make sure you are getting in $args what you expect to get and use [split] on it
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
ghostscript
Voice


Joined: 08 Feb 2006
Posts: 13
Location: unknown

PostPosted: Wed Feb 15, 2006 2:27 pm    Post subject: Really, Thanks! Reply with quote

That worked wonders. Thank you very much. ~bows~
Back to top
View user's profile Send private message Visit poster's website AIM Address
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