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 

Splitting into lines

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


Joined: 27 May 2006
Posts: 2

PostPosted: Sat May 27, 2006 10:14 am    Post subject: Splitting into lines Reply with quote

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


Joined: 13 Jul 2004
Posts: 64
Location: Germany

PostPosted: Sat May 27, 2006 10:22 am    Post subject: Reply with quote

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


Joined: 27 May 2006
Posts: 2

PostPosted: Sat May 27, 2006 10:25 am    Post subject: Reply with quote

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