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.

Splitting a text file into lines

Old posts that have not been replied to for several years.
Locked
R
Real
Voice
Posts: 24
Joined: Mon Mar 08, 2004 11:27 am

Splitting a text file into lines

Post by Real »

Hello.

Code: Select all

proc proc_join {nick uhost hand chan} {
 global myhostmask pmfile
  if {$uhost == $myhostmask} {
     set pmfileread [open $pmfile r]
     set pmdata [read -nonewline $pmfileread]
     close $pmfileread
     putserv "PRIVMSG $nick :$pmdata" 
   }
 }
This is my code.

If for example in the text is:

Code: Select all

This is sentence 1
This is sentence 2
This is sentence 3
How can I make it so that the eggdrop pm's me saying each sentence in a new line? I tried using split, but it splits up the data as seperate words, and I need full sentences


Big thanks
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set f [open "the_file.txt" r] 
while {[gets $f l]>-1} {
  putserv "PRIVMSG $nick :$l"
}
Once the game is over, the king and the pawn go back in the same box.
Locked