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 for those learning Tcl or writing their own scripts.
ghostscript
Voice
Posts: 13 Joined: Wed Feb 08, 2006 4:08 pm
Location: unknown
Contact:
Post
by ghostscript » Mon Feb 13, 2006 7:29 pm
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: Select all
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.
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Tue Feb 14, 2006 1:12 am
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
ghostscript
Voice
Posts: 13 Joined: Wed Feb 08, 2006 4:08 pm
Location: unknown
Contact:
Post
by ghostscript » Tue Feb 14, 2006 3:42 pm
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: Select all
set tfirst [lindex $args 0]
set tsecond [lindex $args 1]
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Tue Feb 14, 2006 11:11 pm
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
ghostscript
Voice
Posts: 13 Joined: Wed Feb 08, 2006 4:08 pm
Location: unknown
Contact:
Post
by ghostscript » Wed Feb 15, 2006 2:27 pm
That worked wonders. Thank you very much. ~bows~