Don't worry Forest I'm here!
Start with how you want to put things in the text file, and work from there.
You say after 5 secs, you want to show ObjectA at 0,0,0
This suggests that we cheat and code the five second delay in then we can have a first line like:
10,ObjectA,0,0,0
which then contains the pause before the second line
99,ObjectB,5,5,0
for the second object. 99 as an arbitrary pause
Then and end of file indicator
9999
Our code would look somewhat like this:
sync on
open to read 1,"Data.txt"
dim NextRead as integer
dim CurrentObject as string
dim CurrentX as float
dim CurrentY as float
dim CurrentZ as float
dim DataRead as string
color backdrop rgb(0,0,0)
NextRead=timer()+5000 `This is our first delay, we will cheat and hard code it
do
DataRead=ReadOnTimer() `Call the read from file function
if DataRead<>"" `If it returns some data, act on it
If DataRead="9999" then end `We've come to the end of the file
NextRead=Timer()+val(left$(DataRead,Instr(DataRead,",",1)-1))*1000 `Find the stuff to the left of the first comma and use it as the new delay
DataRead=right$(DataRead,len(DataRead)-Instr(DataRead,",",1)) `Get rid of the first comma and the stuff to the left of it
CurrentObj=left$(DataRead,Instr(DataRead,",",1)-1 `Get the filename of the object and load it as object 1 (you can re-write to change this of cause!
Load Object CurrentObj,1
DataRead=right$(DataRead,len(DataRead)-Instr(DataRead,",",1)) `Get rid of the next comma and the stuff to the left of it
CurrentX=val(left$(DataRead,Instr(DataRead,",",1)-1)) `Find the stuff to the left of the first comma and use it as the new x coordinate
DataRead=right$(DataRead,len(DataRead)-Instr(DataRead,",",1)) `Get rid of the next comma and the stuff to the left of it
CurrentY=val(left$(DataRead,Instr(DataRead,",",1)-1)) `Find the stuff to the left of the first comma and use it as the new y coordinate
DataRead=right$(DataRead,len(DataRead)-Instr(DataRead,",",1)) `Get rid of the next comma and the stuff to the left of it
CurrentZ=val(left$(DataRead,Instr(DataRead,",",1)-1)) `Find the stuff to the left of the first comma and use it as the new z coordinate
Position Object 1,CurrentX,CurrentY,CurrentZ
endif
sync
loop
function ReadOnTimer(TimeToRead)
Dim Dataline as string
if Timer() < TimeToRead then exitfunction ""
read string 1, DataLine
endfunction DataLine
function Instr(StringToSearch$ as string,StringToFind$ as string,Start as Integer) `This is a slightly better Instr function
if Start+len(StringToFind$)>len(StringToSearch$) then exitfunction
tmp_matched = 1 `Start a temporary variable that shows how many characters have been matched
for tmp_loop = Start to len(StringToSearch$) `start looping through StringtoSearch
if mid$(StringToFind$,tmp_matched) = mid$(StringToSearch$,tmp_loop) `if the current character of StringtoSearch matches the current character of StringToFind
inc tmp_matched, 1 `move check onto next character
if tmp_matched = len(StringToFind$)+1 then exitfunction tmp_loop-(len(StringToFind$)-1) `exit with result if the whole string has been found
else
tmp_matched = 1 `if not, reset StringToFind to the first character
endif
next t
endfunction 0
Note - this is untested, and may require debugging, but I think it should work!
"You get what everyone gets, you get a lifetime!" - Death, The Sandman Library
First you Dream, then you ... - Neil Gaiman, 2001