| View previous topic :: View next topic |
| Author |
Message |
skenmy Voice
Joined: 27 May 2006 Posts: 2
|
Posted: Sat May 27, 2006 10:14 am Post subject: Splitting into lines |
|
|
Hi all,
I'm busy modifying a quotescript for eggdrop - and I need a way of being able to record multiple-line quotes.
I figured that splitting it with a "|" character will suffice - but now I need a way of getting my Tcl script to split the line by the | and print out a new line for each "line" in the quote. An example of a code that could do this would be much appreciated.
Thanks! |
|
| Back to top |
|
 |
avilon Halfop

Joined: 13 Jul 2004 Posts: 64 Location: Germany
|
Posted: Sat May 27, 2006 10:22 am Post subject: |
|
|
| Code: | set fs [open QUOTES.txt]
set data [read $fs]
close $fs
foreach Quote [split $data \n] {
foreach Line [split $Quote "|"] {
puthelp "PRIVMSG #CHANNEL :$Line"
}
} |
|
|
| Back to top |
|
 |
skenmy Voice
Joined: 27 May 2006 Posts: 2
|
Posted: Sat May 27, 2006 10:25 am Post subject: |
|
|
Looks pretty good - I'm running out of a database but I'm pretty sure I could adapt that quite easily.
Many Thanks! |
|
| Back to top |
|
 |
|