Naum
2009-08-18 15:36:39
Hey, I kinda got distracted from writing my tutorial, so I decided to take a break. My breaks don't consist of a walk in the park, or 15 minutes playing runescape. More likely they consist of checking the SRL Include for stuff. So yeah, the trilogy.
1) World Screen - world.scar = No x and y vars
to
2) SkillCoords Shorten:
3) GetTolerance, in Color.scar usefull for finding tolerance against two colors. Taken from Abyssal, all credits to him and noidea ;)
4) DepositScreen. No x and y variables needed. Used FindTextTPA:
5) A FindWallColor function could be added.
6) RandomRClick, could be made much shorter:
to
Changed 'M' from an integer to a Byte. There was a huge wastage of lines.
7) A BarToPoint shorten:
to
8) Woodcutting.scar, FindBirdsNest needs MAJOR re-decoration.
9) GetCourseXP Arrayized:
to:
Fixed the spelling on one course as well.
10) FindFishingEquipment Array'ization', Fishing.scar:
to:
11) A suggestion for Symbol bitmaps to be put in Bitmaps.scar, if anyone else wants to use it :).
Thanks for reading :)
1) World Screen - world.scar = No x and y vars
function WorldScreen: Boolean;
var
x, y: integer;
begin
Result := FindTextTpaEx(16777215, 0, 57, 130, 162, 458, x, y, 'orld ', SmallChars, Nothing);
end;
to
function WorldScreen: Boolean;
begin
Result := FindTextTpa(16777215, 0, 57, 130, 162, 458, 'orld ', SmallChars, Nothing);
end;
2) SkillCoords Shorten:
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;3) GetTolerance, in Color.scar usefull for finding tolerance against two colors. Taken from Abyssal, all credits to him and noidea ;)
Function GetTol(Col1, Col2 : TColor) : Integer;
Begin
While Not SimilarColors(Col1, Col2, Result) Do Inc(Result);
End;4) DepositScreen. No x and y variables needed. Used FindTextTPA:
Function DepositScreen : Boolean;
Begin
Result := FindTextTPA(2070783, 0, 92, 29, 396, 54, 'eposit', UpChars, Nothing);
End;5) A FindWallColor function could be added.
6) RandomRClick, could be made much shorter:
procedure RandomRClick;
var
M: Integer;
begin
if not LoggedIn then exit;
M := MouseSpeed;
MouseSpeed := 7 + Random(5);
ActivateClient;
case Random(7) of
0: MouseBox(533, 7, 757, 200, 2);
1: MouseBox(521, 3, 553, 496, 2);
2: MouseBox(743, 3, 764, 497, 2);
3: MouseBox(4, 467, 763, 498, 2);
4: MouseBox(499, 343, 552, 496, 2);
5: MouseBox(3, 343, 521, 355, 2);
6: MouseBox(2, 346, 14, 499, 2);
end;
MouseSpeed := M;
end;
to
Procedure RandomRClick;
Var M : Byte;
Begin
If not LoggedIn then exit;
M := MouseSpeed;
MouseSpeed := 7 + Random(5);
MouseBox(MSX1, MSY1, MIX2, MIY2, 2);
Wait(RandomRange(200, 600));
MouseSpeed := M;
If Random(2) = 0 Then
ChooseOption('ancel') Else
MMouse(MSX1, MSY1, 200, 200);
End;
Changed 'M' from an integer to a Byte. There was a huge wastage of lines.
7) A BarToPoint shorten:
Function BarToPoint(Bar: String): TPoint;
Begin
Result.y := 410;
Case LowerCase(Bar) of
'bronze': Result.x := 0;
'blurite': Result.x := 1;
'iron': Result.x := 2;
'silver': Result.x := 3;
'steel': Result.x := 4;
'gold': Result.x := 5;
'mithril': Result.x := 6;
'adamant': Result.x := 7;
'runite': Result.x := 8;
Else
Begin
srl_Warn('BarToPoint', 'Invalid bar name', warn_Warning);
Result.x := -1;
End;
End;
If Result.x = -1 Then
Result := Point(0, 0)
Else
Result.x := Result.x * 50 + 53;
End;
to
Function BarToPoint(Bar: String): TPoint;
Var TSA : TStringArray;
I : Integer;
Begin
Result.y := 410;
TSA := ['bronze', 'blurite', 'iron', 'silver', 'steel', 'gold', 'mithril', 'adamant', 'runite'];
If InStrArrEx(LowerCase(Bar), TSA, I) Then
Begin
Result.x := I * 50 + 53
Exit;
End;
srl_Warn('BarToPoint', 'Invalid bar name', warn_Warning);
Result := Point(0, 0);
End;
8) Woodcutting.scar, FindBirdsNest needs MAJOR re-decoration.
9) GetCourseXP Arrayized:
function GetCourseXP(Course: string): Extended;
var
CourseXP: Extended;
begin
case LowerCase(Course) of
'agiliy dungeon ledge': CourseXP := 22.5;
'gnome course': CourseXP := 86.5;
'gnome course extra': CourseXP := 725;
'barbarian course': CourseXP := 153.2;
'barbarian course extra': CourseXP := 740.67;
'werewolves course': CourseXP := 540;
'penguin course': CourseXP := 540;
'wilderness course': CourseXP := 571.4;
'ape atoll course': CourseXP := 580;
'agility pyramid': CourseXP := 1014;
'dorgesh-kaan long(2)': CourseXP := 2750;
'dorgesh-kaan long+grapple': CourseXP := 1429;
'dorgesh-kaan grapple(2)': CourseXP := 108;
end;
Result := CourseXP;
end;
to:
Function GetCourseXP(Course: String) : Extended;
Var InfoArr : TVariantArray;
I : Integer;
Begin
InfoArr := ['agility dungeon ledge', 22.5, 'gnome course', 86.5, 'gnome course extra', 725, 'barbarian course', 153.2,
'barbarian course extra', 740.67, 'werewolves course', 540, 'penguin course', 540, 'wilderness course', 571.4,
'ape atoll course', 580, 'agility pyramid', 1014, 'dorgesh-kaan long(2)', 2750, 'dorgesh-kaan long+grapple', 1429,
'dorgesh-kaan grapple(2)', 108];
If InStrArrEx(LowerCase(Course), InfoArr, I) Then
Result := InfoArr[I+1];
end; Fixed the spelling on one course as well.
10) FindFishingEquipment Array'ization', Fishing.scar:
function FindFishingEquipmentColor(Equipment: string): Integer;
var
TheBitmap, iX, iY: Integer;
begin
case LowerCase(Equipment) of
'smallnet': TheBitmap := srl_GetBitmap(42);
'fishingrod': TheBitmap := srl_GetBitmap(43);
'flyfishingrod': TheBitmap := srl_GetBitmap(44);
'cage': TheBitmap := srl_GetBitmap(45);
'harpoon': TheBitmap := srl_GetBitmap(46);
end;
if FindTransparentBitmapTolerance(TheBitmap, iX, iY, clBlack, MIX1, MIY1, MIX2, MIY2, 25) then
begin
WriteLn(Equipment + ' Found at (' + IntToStr(iX) + ', ' + IntToStr(iY) + ')');
Result := GetColor(iX, iY);
WriteLn('Fishing Equipment Color is ' + IntToStr(Result));
end
else Result := -1;
end;
to:
Function FindFishingEquipmentColor(Equipment : String) : Integer;
Var iX, iY: Integer;
Arr : TStringArray;
Begin
Result := -1;
Arr := ['smallnet', 'fishingrod', 'flyfishingrod', 'cage', 'harpoon'];
If InStrArrEx(LowerCase(Equipment), Arr, iX) Then
If FindTransparentBitmapTolerance(srl_GetBitmap(iX+42), iX, iY, clBlack, MIX1, MIY1, MIX2, MIY2, 25) Then
Begin
WriteLn(Equipment + ' Found at (' + IntToStr(iX) + ', ' + IntToStr(iY) + ')');
Result := GetColor(iX, iY);
WriteLn('Fishing Equipment Color is ' + IntToStr(Result));
End;
End;11) A suggestion for Symbol bitmaps to be put in Bitmaps.scar, if anyone else wants to use it :).
Thanks for reading :)