
-----------------------------------
D_homes
Mon Nov 16, 2009 9:05 pm

Time
-----------------------------------
What is it you are trying to achieve?
Create a downward counting timer according to what the user has entered. The int needs to be changed into a string aswell for Font.Draw 

What is the problem you are having?
Can't seem to get it to work. If its in the main loop, the program waits for it to count down to zero then starts. If its in a separate process, the program waits for it to get to zero, starts and the timer goes into negative numbers


What I have tried to solve this problem


get time_remaining

for i:1..time_remaining
delay (1000)                                                                % Delays 1 second
time_remaining -= 1                                                     % Subtracts 1 from the time
time_remaining_display := intstr (time_remaining)          % Converts it to a string for Font.Draw
end for


I've also tried the for loop in a process and forked it, but it still doesn't work.


Please specify what version of Turing you are using
4.1

-----------------------------------
Tony
Mon Nov 16, 2009 9:16 pm

Re: Time
-----------------------------------
I've also tried the for loop in a process and forked it, but it still doesn't work.
Did you just try to throw some random code at the problem, without understanding what it does, in hopes that it might somehow solve the problem?

Also, your loop doesn't appear to have any sort of output (any sort of put, draw, etc.)

-----------------------------------
D_homes
Mon Nov 16, 2009 9:22 pm

Re: Time
-----------------------------------
So you're saying that the font.draw needs to be in the loop?
Makes sense don't know why i didn't f**king think of that.

-----------------------------------
B-Man 31
Mon Nov 16, 2009 9:36 pm

Re: Time
-----------------------------------
also instead of:


time_remaining_display := intstr (time_remaining)


to covert it into string, you can just do this in your font.draw:


Font.Draw (intstr (time_remaining),100,100, font,black) 
%Just added some random stuff to complete the Font.Draw


This saves you a line of coding.
