Time

The time file includes any functions that have anything to do with time: timers, the time of day, conversions, etc.

The source for this file can be found here.

const Date/Time

Integer constants that represent the different time formats that can be used to display the time and dates in a string.

Example:

writeln(500000, TIME_SHORT);

msToTime

function msToTime(MS, StrType: Integer): string;

Takes MS in milliseconds and outputs a string with hours, mins and seconds. Different styles can be created with different StrType values: Str Type:

  • TIME_FORMAL: 2 Hours, 47 Minutes and 28 Seconds
  • TIME_SHORT: 02h, 47m, 28s
  • TIME_ABBREV: 2 hr, 47 min, 28 sec
  • TIME_BARE: 02:47:28
  • TIME_FSTOP: 12.04.40
  • TIME_FORMAL_LONG: 1 Years, 3 Months, 2 Weeks, 4 Days, 13 Hours, 3 Minutes, and 20 Seconds

Note

  • by Zephyrsfury, Nava2 and Rasta Magician.
  • Last updated: 4/12/2013 by Ashaman88

Example:

writeln(500000, TIME_SHORT);

timeRunning

function timeRunning: String;

Returns Time since the script was started (GetTimeRunning).

Note

  • by Rasta Magician.
  • Last updated: 4/12/2013 by Ashaman88

Example:

writeln('Script time: '+timeRunning);

theTime

function theTime: string;

Returns current time as a string.

Note

  • by RsN (fixed by Ron and Markus)

Example:

writeln(theTime);

theDate

function theDate(DateFormat: Integer): String;

Returns the current date. DateFormats can be:

  • DATE_FORMAL = April 2nd, 2007 Month Day, Year
  • DATE_MONTH = 04/02/07 Month/Day/Year
  • DATE_DAY = 02-04-07 Day-Month-Year

Note

  • by Ron, Nava2 & Narcle

Example:

writeln(theDate);

waitFunc

function waitFunc(Func: Function: Boolean; WaitPerLoop, MaxTime: Integer; Value: Boolean = true): Boolean;

Waits for function Func to be true or false (default true). WaitPerLoop is how often you want to call “Func” function. Example: “waitFunc(@BankScreen, 10 + Random(15), 750);” will check if BankScreen is open every 10-25th millisecond, for a maximum of 750 milliseconds. Notice the ‘@’.

Note

  • by Rasta Magician, small edit by EvilChicken!
  • Last Updated: 17 July 2016 by BMWxi

Example:

waitFunc(@funcName, 50, 5000);

waitTypeFunc

function waitTypeFunc(Func: function: boolean of object; WaitPerLoop, MaxTime: Integer; Value: Boolean = True): Boolean;

Waits for a type function Func to be true or false (default true). WaitPerLoop is how often you want to call “Func” function. Example: “waitTypeFunc(@bankScreen.isOpen, 10 + Random(15), 750);” will check if bankScreen is open every 10-25th millisecond, for a maximum of 750 milliseconds. Notice the ‘@’.

Note

  • by Olly
  • Last Updated: 17 July 2016 by BMWxi

Example:

waitTypeFunc(@minimap.isResting, 50, 5000);

TTimeMarker

type TTimeMarker = record
    time, startTime: LongWord;
    paused: Boolean;
end;

Timer type which is useful for loops, timing and writing progress reports.

Note

  • by Bart de Boer

TTimeMarker.start

Starts the timer. Can also be used when paused to continue where it left.

Note

  • by Bart de Boer

Example:

MyScriptTimer.start();

TTimeMarker.reset

Stops the timer and resets it to zero.

Note

  • by Bart de Boer

Example:

MyScriptTimer.reset();

TTimeMarker.pause

Pauses the timer. It can be continued with start().

Note

  • by Bart de Boer

Example:

MyScriptTimer.pause();
TakeABreak(90000);
MyScriptTimer.start();

TTimeMarker.getTime

Gets the time from the timer. Returns zero if the timer was not set.

Note

  • by Bart de Boer

Example:

MyScriptTimer.start();
repeat
    DoStuff;
until(MyScriptTimer.getTime() > 60000);

TTimeMarker.getTotalTime

Gets the time from the timer including the time it was paused. Returns zero if the timer was not set.

Note

  • by Bart de Boer

Example:

BreakTime := MyTimer.getTotalTime() - MyTimer.getTime();

TCountDown

type
  TCountDown = type UInt64;

Timer type which is useful for loops, timing and writing progress reports.

Note

  • by Obscurity