ID:263916
 
Code:
mob/proc/processline(var/file)
world<<"Original Total Length: [src.linelength]"
world<<"<b>File: <br>[file]"
var/command=copytext(file,src.linelength,findtext(file,"("))
world<<"Command: [command]"
if(lowertext(command)=="echo")
if(!findtext(file,");"))
src<<"You are missing either a ) or a ; in your echo(s)."
return
else
var/text=copytext(file,src.linelength+5,findtext(file,");"))//Text that shows on screen
var/linecount=copytext(file,src.linelength,findtext(file,");")+2)
var/a=linecount
world<<"\blue [a]"
src.linelength+=length(linecount)
world<<"Total Length: [src.linelength]"
world<<"<b>\red Computer Text: [text]"
src.processline(file)
else
src<<"<b>No commands could be found.</b>"


Problem description:
(Warning: This is a messy snippet)

What's in a file:
echo(Hello);
echo(World);

Here is my problem, the proc processes the first line and says Hello, but when it repeats to view the next line it stops at the ‘var/command=copytext(file,src.linelength,findtext(file,"("))’ code line.

What does the vars stand for:
linecount and linelength - This counts how many characters I've gone through in order to see what line I should be on next.
text - The text in between the echo brackets.

What it shows when I process the line:
Original Total Length: 1
File:
echo(Hello);
echo(World);
Command: echo
echo(Hello);
Total Length: 13
Computer Text: Hello
Original Total Length: 13
File:
echo(Hello);
echo(World);
I like looking at recusive code even if it is buggy.

In copytext(file,src.linelength,findtext(file,"("))
You didn't tell findtext to skip past the stuff already processed. So findtext returned the position of ( from the previous echo which is less than src.linelength the 2nd time around.

Try findtext(file,"(",src.linelength))

You'll need to do that all over the place.

Also, linecount is not giving you a count, but a text string.