Timing ====== The Timing include contains a lot of timing related functions. MsToTime ~~~~~~~~ .. code-block:: pascal 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 .. note:: by Zephyrsfury, Nava2 and Rasta Magician. Example: .. code-block:: pascal TimeRunning ~~~~~~~~~~~ .. code-block:: pascal function TimeRunning: String; Returns Time since the script was started (GetTimeRunning). .. note:: by Rasta Magician. Example: .. code-block:: pascal MarkTime ~~~~~~~~~~~ .. code-block:: pascal procedure MarkTime(var TimeMarker: Integer); Sets TimeMarker to current system time .. note:: by Stupid3ooo Example: .. code-block:: pascal TimeFromMark ~~~~~~~~~~~~ .. code-block:: pascal function TimeFromMark(TimeMarker: Integer): Integer; Returns Milliseconds since MarkTime was set .. note:: by Stupid3ooo Example: .. code-block:: pascal TheTime ~~~~~~~~ .. code-block:: pascal function TheTime : string; Returns current time as a string .. note:: by RsN (fixed by Ron) Example: .. code-block:: pascal TheDate ~~~~~~~ .. code-block:: pascal function TheDate(DateFormat : Integer) : String; TheDate will return 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: .. code-block:: pascal WaitOptionMultiEx ~~~~~~~~~~~~~~~~~ .. code-block:: pascal function WaitOptionMultiEx(S: TStringArray; TextType: string; Action: fnct_ActionOptions; Time: Integer): Boolean; Waits for a TStringArray of options and selects one of them. Searches for TextType you input. 'action', 'player': The white text 'item': The orange text 'npc': The yellow text 'object': The cyan text 'all': Searches for all colors of text. Will default to 'all'. .. note:: by Infantry001 Example: .. code-block:: pascal WaitOptionMulti ~~~~~~~~~~~~~~~ .. code-block:: pascal function WaitOptionMulti(S: TStringArray; Time: Integer): Boolean; Waits for a TStringArray of options and selects one of them .. note:: by Marpis, N1ke! & Rasta Magician Example: .. code-block:: pascal WaitOptionEx ~~~~~~~~~~~~ .. code-block:: pascal function WaitOptionEx(S, TextType: String; Time: Integer): Boolean; Waits for an Option and selects it. Searches for TextType. .. note:: by Infantry001 Example: .. code-block:: pascal WaitOption ~~~~~~~~~~ .. code-block:: pascal function WaitOption(S: String; Time: Integer): Boolean; Waits for an Option and selects it .. note:: by N1ke! Example: .. code-block:: pascal WaitUpTextMulti ~~~~~~~~~~~~~~~ .. code-block:: pascal function WaitUpTextMulti(S: TStringArray; Time: integer): Boolean; Waits for a TStringArray of UpText, returns true if found .. note:: by Marpis & N1ke! Example: .. code-block:: pascal WaitUptext ~~~~~~~~~~ .. code-block:: pascal function WaitUptext(S: String; Time: Integer): Boolean; Waits for an UpText, returns true if found .. note:: by Marpis edited by N1ke! Example: .. code-block:: pascal WaitInvCount ~~~~~~~~~~~~ .. code-block:: pascal function WaitInvCount(Count, MaxTime: Integer; CountType: (MaxCT, MinCT, ExactCT)): boolean; Waits for a maximum inv count. Returns true if InvCount <= Count .. note:: by Rasta Magician Example: .. code-block:: pascal WaitInvMaxCount ~~~~~~~~~~~~~~~ .. code-block:: pascal function WaitInvMaxCount(Count, MaxTime: integer): boolean; Waits for a maximum inv count. Returns true if InvCount <= Count .. note:: by Rasta Magician. Example: .. code-block:: pascal WaitInvMinCount ~~~~~~~~~~~~~~~ .. code-block:: pascal function WaitInvMinCount(Count, MaxTime: integer): boolean; Waits for a minimum inv count. Returns true if InvCount >= Count .. note:: by Rasta Magician Example: .. code-block:: pascal WaitColor ~~~~~~~~~ .. code-block:: pascal function WaitColor(x, y, Color, Tol, MaxTime: integer): Boolean; Waits for a color at (x, y) with tolerance Tol, returns true if found .. note:: by Rasta Magician, fixed by TRiLeZ Example: .. code-block:: pascal WaitFindColor ~~~~~~~~~~~~~ .. code-block:: pascal function WaitFindColor(var x, y: integer; Color, Tol, x1, y1, x2, y2, MaxTime: integer): Boolean; Waits for a color at (x, y) with tolerance Tol, returns true if found .. note:: by Rasta Magician, fixed by TRiLeZ Example: .. code-block:: pascal WaitFindColors ~~~~~~~~~~~~~~ .. code-block:: pascal function WaitFindColors(var x, y: integer; Color, Tol, x1, y1, x2, y2, MaxTime: integer): Boolean; Waits for a color at (x, y) with tolerance Tol, returns true if found .. note:: by IceFire908 based completely off WaitFindColor Example: .. code-block:: pascal WaitColorCount ~~~~~~~~~~~~~~ .. code-block:: pascal function WaitColorCount(Color, x1, y1, x2, y2, Tol, MinCount, MaxCount, MaxTime: integer):boolean; Waits Color count in box (x1, y1, x2, y2) with Tol .. note:: by Rasta Magician Example: .. code-block:: pascal WaitColorGone ~~~~~~~~~~~~~ .. code-block:: pascal function WaitColorGone(Color, x, y, Tol, MaxTime: integer): Boolean; Waits until a colour is gone at (x, y) with tolerance and a timeout. Results true if the colour disappeared at (x, y) within the time cap. .. note:: by TRiLeZ Example: .. code-block:: pascal WaitColorGoneIn ~~~~~~~~~~~~~~~ .. code-block:: pascal function WaitColorGoneIn(Colour, x1, y1, x2, y2, Tol, MaxTime: integer): Boolean; Waits until a colour is gone in an area with tolerance and a timeout. Results true if the colour disappeared in the area within the time cap. .. note:: by TRiLeZ Example: .. code-block:: pascal WaitFunc ~~~~~~~~ .. code-block:: pascal function WaitFunc(Func: Function: Boolean; WaitPerLoop, MaxTime: Integer): Boolean; Waits for function Func to be 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! Example: .. code-block:: pascal WaitNone ~~~~~~~~ .. code-block:: pascal procedure WaitNone; For use with while (this) do WaitNone .. note:: by IceFire908 Example: .. code-block:: pascal