Log in

View Full Version : Checking Markt



Element17
07-16-2012, 04:15 PM
Is there anyway to check the time that has passed from when you call MarkTime?

Runaway
07-16-2012, 04:16 PM
MarkTime(t);
TimeFromMark(t);

:)

Element17
07-16-2012, 04:40 PM
Silly! I know that haha, but I'm looking for a timer....hope I can explains this so it makes sense.


Okay.

MarkTime(Timer);
//Blah blah blah
//more stuff etc
//Want to check the time that has passed up until this point and post it in the debug box

Does that make sense? I just want to mark the time and after it does whatever procedures/functions I want to see how much time has passed since I marked the time.

Home
07-16-2012, 04:46 PM
Like he said..

MarkTime(C);
Do...
This..
Stuff..
WriteLn(TimeFromMark(C));

~Home

Abu
07-16-2012, 04:49 PM
^^^ Wouldn't you have to do IntToStr() ?

Runaway
07-16-2012, 04:50 PM
^^^ Wouldn't you have to do IntToStr() ?

Nope ;) Only when you're mixing strings with integers(/variants).

Abu
07-16-2012, 05:00 PM
Nope ;) Only when you're mixing strings with integers(/variants).

But isn't TimeFromMark(C) an integer and doesn't Writeln() require a string?

Is that not mixing? :confused:

Runaway
07-16-2012, 05:05 PM
But isn't TimeFromMark(C) an integer and doesn't Writeln() require a string?

Is that not mixing? :confused:

Mixing:
Writeln('Time: '+TimeFromMark(t));

Writeln actually doesn't require a string, only when more than 1 type of variable is being used. As long as you ask it to write a single variable, it will accept any variant.

Abu
07-16-2012, 05:06 PM
Mixing:
Writeln('Time: '+TimeFromMark(t));

Writeln actually doesn't require a string, only when more than 1 type of variable is being used. As long as you ask it to write a single variable, it will accept any variant.

Ah, alright. I get it now ;)

See I usually do Writeln('Time: '+TimeFromMark(t));, which explains a lot.

Element17
07-16-2012, 08:24 PM
Ahh thank you Runaway..you seem to always be helping me haha. Also thanks Home. For some reason I thought it would of been more difficult.

P1ng
07-16-2012, 10:49 PM
I use this function which I slightly modified from a code that runaway posted when I asked a similar question a little while back -
procedure TimeStamp(WaitTime: Integer);
var
T: Integer;
Ticker: String;
begin
MarkTime(T);
while (WaitTime > TimeFromMark(T)) do
begin
Wait(500);
Ticker := MsToTime(WaitTime - TimeFromMark(T), Time_Short);
Status('Break remaining: ' + Ticker);
end;
end;

used like this in my script
BreakLength := RandomRange(30000,1200000);//how long the break is
WriteLn('Taking a break for ' + (MsToTime(BreakLength, Time_Short)));
MarkTime(BreakT);//my time mark for the break so to speak
TimeStamp(BreakLength);//Write TimeStamp with the time to countdown in the brackets
repeat
Wait(100);
until (BreakLength < TimeFromMark(BreakT));

Feel free to edit this as you wish to suit your purposes if you'd like, it just writes the time remaining in your status bar

Element17
07-17-2012, 12:05 AM
Thanks mate!