vilon
2009-07-22 15:03:51
GameTab.scar
R_GetMMLevels('hp') got broken with the latest runescape changes. Fixed:
Timing.scar
Renamed:
WaitAnimation -> WaitForAnim
WaitAnimationBool -> WaitForAnimBool
Also fixed some errors and credits/function-list. Full Timing.scar:
Characters.scar
WaitForAnim -> Is now in Timing.scar
CharAnimBool -> Is now WaitForAnimBool in Timing.scar
R_GetMMLevels('hp') got broken with the latest runescape changes. Fixed:
{*******************************************************************************
function R_GetMMLevels(Which: string): Integer;
By: lordsaturn, fixed by vilon
Description: Returns the current value at the designated MM spot.
*******************************************************************************}
function R_GetMMLevels(Which: string): Integer;
begin
Result := -1;
case LowerCase(Which) of
'hitpoints', 'hp': Result := 748;
'prayer', 'pp' : Result := 749;
'run', 'energy' : Result := 750;
else SRL_Warn('R_GetMMLevels', 'Invaild string.', -3);
end;
Result := StrToIntDef(GetInterfaceText(Result, 4 + 1 * Integer(Result <> 749)), -1);
end;Timing.scar
Renamed:
WaitAnimation -> WaitForAnim
WaitAnimationBool -> WaitForAnimBool
Also fixed some errors and credits/function-list. Full Timing.scar:
//------------------------------------------------------------------\\
//-- Scar Non-Standard Resource Library --||
//-- ยป Reflection Routines - Timing --||
//------------------------------------------------------------------//
// * function R_WaitOptionMulti(S: TStringArray; Time: Integer): Boolean; // * by Marpis, N1ke! & vilon
// * function R_WaitOption(S: string; Time: Integer): Boolean; // * by Marpis, N1ke! & vilon
// * function R_WaitActionMulti(S: TStringArray; Time: Integer): Boolean; // * by vilon
// * function R_WaitAction(S: string; Time: Integer): Boolean; // * by vilon
// * function R_WaitUpTextMulti(S: TStringArray; Time: Integer): Boolean; // * by Marpis, N1ke! & vilon
// * function R_WaitUpText(S: string; Time: Integer): Boolean; // * by Marpis, N1ke! & vilon
// * function WaitForAnim(Time: Integer): Integer; // * by lordsaturn & vilon
// * function WaitForAnimBool(Time: Integer): Boolean; // * by vilon
// * function WaitForOption(Option: string; Timeout: Integer): Boolean; // * by Drags111
// * function WaitForMenu(Time: Integer): Boolean; // * by Drags111 & vilon
{*******************************************************************************
function R_WaitOptionMulti(S: TStringArray; Time: Integer): Boolean;
By: Marpis, N1ke! & vilon
Description: Waits for a TStringArray of Options and selects one of them.
*******************************************************************************}
function R_WaitOptionMulti(S: TStringArray; Time: Integer): Boolean;
var
T: Integer;
begin
Result := False;
T := GetSystemTime + Time;
repeat
Result := R_ChooseOptionMulti(S);
Wait(20 + Random(10));
until(Result or (GetSystemTime > T));
end;
{*******************************************************************************
function R_WaitOption(S: string; Time: Integer): Boolean;
By: Marpis, N1ke! & vilon
Description: Waits for an Option and selects it.
*******************************************************************************}
function R_WaitOption(S: string; Time: Integer): Boolean;
begin
Result := R_WaitOptionMulti([S], Time);
end;
{*******************************************************************************
function R_WaitActionMulti(S: TStringArray; Time: Integer): Boolean;
By: vilon
Description: Waits for a TStringArray of Actions and selects one of them.
*******************************************************************************}
function R_WaitActionMulti(S: TStringArray; Time: Integer): Boolean;
var
T: Integer;
begin
Result := False;
T := GetSystemTime + Time;
repeat
Result := R_ChooseActionMulti(S);
Wait(10 + Random(20));
until(Result or (GetSystemTime > T));
end;
{*******************************************************************************
function R_WaitAction(S: string; Time: Integer): Boolean;
By: vilon
Description: Waits for an Action and selects it.
*******************************************************************************}
function R_WaitAction(S: string; Time: Integer): Boolean;
begin
Result := R_WaitActionMulti([S], Time);
end;
{*******************************************************************************
function R_WaitUpTextMulti(S: TStringArray; Time: Integer): Boolean;
By: Marpis, N1ke! & vilon
Description: Waits for a TStringArray of UpText, returns true if found.
*******************************************************************************}
function R_WaitUpTextMulti(S: TStringArray; Time: Integer): Boolean;
var
T: Integer;
begin
Result := False;
T := GetSystemTime + Time;
repeat
Result := R_IsUpTextMulti(S);
Wait(20 + Random(20));
until(Result or (GetSystemTime > T));
end;
{*******************************************************************************
function R_WaitUpText(S: string; Time: Integer): Boolean;
By: Marpis, N1ke! & vilon
Description: Waits for an UpText, returns true if found.
*******************************************************************************}
function R_WaitUpText(S: string; Time: Integer): Boolean;
var
T: Integer;
begin
Result := False;
T := GetSystemTime + Time;
repeat
Result := R_IsUpText(S);
Wait(20 + Random(20));
until(Result or (GetSystemTime > T));
end;
{*******************************************************************************
function WaitForAnim(Time: Integer): Integer;
By: lordsaturn & vilon
Description: Waits for an animation with a timeout. If an animation occurs, the
value will be returned, else returns -1.
*******************************************************************************}
function WaitForAnim(Time: Integer): Integer;
var
T: Integer;
begin
Result := -1;
T := GetSystemTime + Time;
repeat
Result := GetAnimation;
Wait(100);
until((Result <> -1) or (GetSystemTime > T));
end;
{*******************************************************************************
function WaitForAnimBool(Time: Integer): Boolean;
By: vilon
Description: Waits for an animation with a timeout. Returns true on animation.
*******************************************************************************}
function WaitForAnimBool(Time: Integer): Boolean;
begin
Result := (WaitForAnim(Time) <> -1);
end;
{*******************************************************************************
function WaitForOption(Option: string; Timeout: Integer): Boolean;
By: Drags111
Description: Waits till the option exists or times out.
*******************************************************************************}
function WaitForOption(Option: string; Timeout: Integer): Boolean;
var
a: Integer;
begin
while not OptionExists(Option) do
begin
if GetSystemTime - a > Timeout then Exit;
Wait(100+Random(50));
end;
Result := True;
end;
{*******************************************************************************
function WaitForMenu(Time: Integer): Boolean;
By: Drags111 & vilon
Description: Waits until the menu is open or times out.
*******************************************************************************}
function WaitForMenu(Time: Integer): Boolean;
var
T: Integer;
begin
Result := False;
T := GetSystemTime + Time;
repeat
Result := IsOptionMenuOpen;
Wait(10 + Random(20));
until(Result or (GetSystemTime > T));
end;Characters.scar
WaitForAnim -> Is now in Timing.scar
CharAnimBool -> Is now WaitForAnimBool in Timing.scar