jeremyhardin
08-26-2003, 01:58 PM
If anybody has any ideas, here's my situation. I want to edit a scene file like a text file.
specifically:
go to a blank line
write in my data
seems simple enough, but i cant seem to get lscript to move through the file.
i have a simple search and replace script going, but it doesn't "move" through the file. It searches the whole thing and replaces all instances. also, i'm having trouble writing multiple lines into the middle of a file.
scenes = getdir("Scenes");
chdir(scenes);
savescene("temp.lws");
if((input = File("temp.lws","r"))==nil)
return;
if((output = File("temp2.lws","w"))==nil)
return;
while(!input.eof())
{
line = input.read();
line ~= r~^to be replaced~replacement text~;
output.writeln(line);
}
input.close();
output.close();
any ideas or input are appreciated
specifically:
go to a blank line
write in my data
seems simple enough, but i cant seem to get lscript to move through the file.
i have a simple search and replace script going, but it doesn't "move" through the file. It searches the whole thing and replaces all instances. also, i'm having trouble writing multiple lines into the middle of a file.
scenes = getdir("Scenes");
chdir(scenes);
savescene("temp.lws");
if((input = File("temp.lws","r"))==nil)
return;
if((output = File("temp2.lws","w"))==nil)
return;
while(!input.eof())
{
line = input.read();
line ~= r~^to be replaced~replacement text~;
output.writeln(line);
}
input.close();
output.close();
any ideas or input are appreciated