| View previous topic :: View next topic |
| Author |
Message |
ghostscript Voice
Joined: 08 Feb 2006 Posts: 13 Location: unknown
|
Posted: Mon Feb 13, 2006 7:29 pm Post subject: Argument Separation |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Feb 14, 2006 1:12 am Post subject: |
|
|
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 |
|
 |
ghostscript Voice
Joined: 08 Feb 2006 Posts: 13 Location: unknown
|
Posted: Tue Feb 14, 2006 3:42 pm Post subject: |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Feb 14, 2006 11:11 pm Post subject: |
|
|
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 |
|
 |
ghostscript Voice
Joined: 08 Feb 2006 Posts: 13 Location: unknown
|
Posted: Wed Feb 15, 2006 2:27 pm Post subject: Really, Thanks! |
|
|
| That worked wonders. Thank you very much. ~bows~ |
|
| Back to top |
|
 |
|