
-----------------------------------
buzzkik
Sun Dec 09, 2007 9:50 pm

Restart Program
-----------------------------------
Is there a way that I can restart the program in turing through a command???

If not then how can I reset the Time.Elapsed counter?

-----------------------------------
rdrake
Sun Dec 09, 2007 11:35 pm

RE:Restart Program
-----------------------------------
Why don't you just store the value of Time.Elapsed in a variable when you want to reset it, then subtract the next Time.Elapsed time from the offset?

-----------------------------------
Sean
Mon Dec 10, 2007 12:31 pm

Re: Restart Program
-----------------------------------
How about you show a quick example?

-----------------------------------
rdrake
Mon Dec 10, 2007 12:52 pm

Re: Restart Program
-----------------------------------
% Do something long and complicated here.
put "It's been " + Time.Elapsed + " since you started this."

var offset : real := Time.Elapsed

% Do something else equally as long and complicated here.
put "It's been " + (Time.Elapsed - offset) + " since I was \"reset\""May or may not compile, I don't know Turing.

-----------------------------------
Clayton
Mon Dec 10, 2007 1:05 pm

RE:Restart Program
-----------------------------------
Fixed code:
%Do something long and complicated here
put "It's been ", Time.Elapsed, " since you started this."

var offset : int := Time.Elapsed

%Do something equally as long and complicated here
put "It's been ", Time.Elapsed - offset, " since I was \"reset\""

-----------------------------------
Sean
Mon Dec 10, 2007 1:28 pm

Re: Restart Program
-----------------------------------
Is there a way that I can restart the program in turing through a command???

If not then how can I reset the Time.Elapsed counter?


With all the examples, none have reset the program.  :shock:  :burn:

-----------------------------------
Nick
Mon Dec 10, 2007 3:17 pm

RE:Restart Program
-----------------------------------
if you want to restarrt te program then sererate your program into a procedure and call it in a loop that does only that

procedure game
    %game code here
end game

loop
    game
end loop

-----------------------------------
buzzkik
Mon Dec 10, 2007 10:00 pm

Re: Restart Program
-----------------------------------
So is there no command in turing that simply exits the program and then starts it again?  :?  
 
Using Procedures through loops simply gets the code in the procedure and keeps on looping it in the loop until you exit the loop somehow. It doesn't technically "exit" the actual program and then execute it again. 
 
I tried Window.Open and Window.Close but that simply opens or closes the windows. 
 
I'm such a noob at Turing..............  :vi:

-----------------------------------
Nick
Mon Dec 10, 2007 10:03 pm

RE:Restart Program
-----------------------------------
hmm try Sys.Exec at the end to reopen the same file (however it may need to be compiled)

sample:
if not Sys.Exec(fileName) then
    put "The file code not be opened"
end if

-----------------------------------
Tony
Mon Dec 10, 2007 10:04 pm

Re: Restart Program
-----------------------------------
So is there no command in turing that simply exits the program and then starts it again?  :?
You can try to have it execute itself with Sys.Exec and then exit upon success.

Edit: momop has beat me to it, with the same solution. Good job.

-----------------------------------
Clayton
Mon Dec 10, 2007 10:04 pm

RE:Restart Program
-----------------------------------
Why do you want to restart your program to begin with? If it comes to it, just have a "reset" procedure which sets all values of your variables back to default, as well as sets your Time.Elapsed offset to the current time.
