SCAR Code:
program New;
{.Include SRL/SRL.Scar}
Var x, y : Integer;
tp : tpoint;
Function SkillCoords(Row, Column : ShortInt): TPoint;
Begin
Result := Point(577 + (55 * (Column-1)), 228 + (32 * (Row-1)));
If Row = 8 Then Result.y := 419;
End;
function SkillToCoords1(ScrollDownIfNeeded : Boolean; skill: Variant): TPoint;
var
Scroll: Boolean;
CX, CY, Col, skNo: Integer;
ScrollP : TPoint;
SkillS: string;
SkillArr: TStringArray;
begin
if (not(LoggedIn)) then Exit;
if (VarType(Skill) = 11) then
SkillS := IntToStr(Skill)
else
SkillS := Lowercase(Skill);
case Lowercase(SkillS) of
'hp': SkillS := 'hitpoints';
'ranged': SkillS := 'range';
'hunter': SkillS := 'hunting';
end;
SkillArr := ['attack', 'strength', 'defence', 'range', 'prayer', 'magic', 'runecrafting',
'hitpoints', 'agility', 'herblore', 'thieving', 'crafting', 'fletching',
'slayer', 'mining', 'smithing', 'fishing', 'cooking', 'firemaking',
'woodcutting', 'farming', 'construction', 'hunting', 'summoning'];
if (GetNumbers(SkillS) = SkillS) and (InRange(StrToIntDef(GetNumbers(SkillS), -1), 1, Length(SkillArr))) then
skNo := StrToInt(SkillS) - 1
else
if (not(InStrArrEx(SkillS, SkillArr, skNo))) then
begin
srl_Warn('SkillToCoords', 'Invalid Skill Name/Number: ''' + Skill + '''', warn_AllVersions);
Exit;
end;
if (InRange(skNo + 1, 1, 21)) then
begin
CX := skNo div 7 + 1;
CY := skNo mod 7 + 1;
end else
begin
CX := skNo mod 3 + 1;
CY := skNo div 3 + 1;
end;
Result := skillcoords1(CY, CX);
Scroll := (ScrollDownIfNeeded) and (InRange(skNo + 1, 21, 24));
ScrollP := Point(724, 240 + 194 * Integer(Scroll));
Col := 1316634 - 658704 * Integer(Scroll);
//GameTab(2);
if (GetColor(ScrollP.X, ScrollP.Y) <> Col) then
begin
MMouse(ScrollP.X, ScrollP.Y + 10 * (2 * Integer(Scroll) - 1), 5, 5);
GetMousePos(CX, CY);
HoldMouse(CX, CY, True);
while (GetColor(ScrollP.X, ScrollP.Y) <> Col) and (GetColor(724, 239) = 657930) do
Wait(500 + Random(500));
ReleaseMouse(CX, CY, True);
end;
end;
{*******************************************************************************
function GetSkillInfo(skill: Variant; Amount : Boolean): Integer;
By: Raymond
Description: Gets the amount / level of a skill.
E.G.
0/15
Amount = True will return 0.
Amount = False will return 15 (The actual level).
*******************************************************************************}
function GetSkillInfo1(skill: Variant; Amount : Boolean): Integer;
var
TP: TPoint;
Box : TBox;
TPA : TPointArray;
Cts : Integer;
begin
GameTab(2);
TP := SkillToCoords1(True,skill);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(0);
if not Amount then
TP := Point(TP.x + 7,TP.y + 13);
FindColorsTolerance(TPA,65535,TP.x - 2,TP.y - 2, TP.x + 15,TP.y + 15,0);
Box := GetTPABounds(TPA);
Result := StrToIntDef(GetNumbers(GetTextAtEx(Box.x1-2, Box.y1 -1, 100,
StatChars, False, True, 0, 5,65535, 2, True, tr_Digits)),0);
ColorToleranceSpeed(CTS);
end;
{*******************************************************************************
Function GetSkillLevel(skill: Variant): Integer;
By: Raymond
Description: Gets the max level for a particular skill.
*******************************************************************************}
Function GetSkillLevel1(skill: Variant): Integer;
Begin
Result := GetSkillInfo1(skill, False);
End;
begin
SetupSRL;
For x := 1 to 24 Do
Writeln(GetSkillLevel1(x));
end.