Hello there, please comment, feedback, ridicule, insult /etc.
1) A SetGraphics (Autoing Defaults) procedure which works for both, the loginscreen and in game. This means you do not need Login_SetGraphics:
SCAR Code:
Procedure FixGraphics;
Var X, Y, F : Integer; //Variables!
TPA : TPointArray;
ATPA : T2DPointArray;
TB : TBox;
Label Animations;
Begin
If FindTextTPAEx(2070783, 1, 0, 0, 758, 498, x, y, 'tanda', StatChars, Nothing) Then
Begin // ^ Checks for Orange text of 'Standard Detail'
MouseBox(x, y - 35, x + 50, y, 1); // If it finds it then it clicks on it, to activate it
Wait(1300 + Random(800)); // Waits while it sets itself.
End;
If FindTextTPAEx(2070783, 1, 0, 0, 758, 498, x, y, 'ixe', StatChars, Nothing) Then
Begin // Checks for the 'Fixed Size' text, in Orange
MouseBox(x - 14, y - 40, x + 30, y, 1);// If it finds it then it clicks on it, to activate it
Wait(500 + Random(800)); // Waits while it sets itself.
End;
If GetColor(232 + (127 * Integer(Not LoggedIn)), 215 + (103 * Integer(Not LoggedIn))) = 14474979 Then
Begin //This sets the Brightness
Mouse(232 + (127 * Integer(Not LoggedIn)), 215 + (103 * Integer(Not LoggedIn)), 5, 5, True);
Wait(900 + Random(700));
End;
If FindTextTPAEx(2070783, 1, 0, 0, 758, 498, x, y, 'x', StatChars, Nothing) Then //Finds the orange 'x'
If Not FindText(x, y, '0x6', StatChars, x - 50, y - 50, x + 50, y + 50) Then //Finds the text around it
Begin
Mouse(x, y, 30, 10, True); //Sets it at 800x600
Wait(200 + Random(200)); //Waits.
Mouse(x, y + 15, 1, 4, True);
End;
If FindText(x, y, 'Ad', UpChars, 0, 0, 758, 498) Then //Finds the Advanced Settings text
TB := IntToBox(x, y - 50, x + 520, y + 150); //Makes boundaries for FindColors, hence its global
FindColorsTolerance(TPA, 3753553, TB.x1, TB.y1, TB.x2, TB.y2, 0); //Finds Occurances of the Background 'Box color'
ATPA := TPAToATPAEx(TPA, 13, 13); //Splits then into squares of 13x13
SortATPAFromFirstPoint(ATPA, Point(197, 89)); //Sorts them
For F := 0 To High(ATPA) Do //This loop will now set it.
Begin
TB := GetTPABounds(ATPA[F]); //Gets the boundaries of the box
If FindText(x, y, 'any', StatChars, TB.x1 - 65, TB.y1 - 4, TB.x2 + 2, TB.y2 + 3) Then
GoTo Animations; //^ since animations have 3 options, if the given TPA is the option then it will skip the check.
If CountColor(2070783, TB.x1, TB.y1, TB.x2, TB.y2) >= 5 Then //To filter the text from arrows.
If CountColor(2070783, TB.x1 - 45, TB.y1, TB.x1 + 3, TB.y1 + 3) = 0 Then //To check the option isn't already set
Begin
Animations :
MouseBox(TB.x1 - 45, TB.y1, TB.x2, TB.y2, 1); //Clicks on one of the options
Wait(800 + Random(200)); //Waits.
If FindColor(x, y, 2070783, TB.x1 - 55, TB.y1 + 11, TB.x1 - 6, TB.y2 + 7) Then //Finds the orange color in the pop-up
Mouse(x, y, 20, 8, True); //Randomly clicks it
Begin
Wait(50 + Random(80)); //Waits
MMouse(x, y - 10, 6, 4); //Moves mouse off the box, so it doesn't muck up the ATPA
Wait(900 + Random(180)); //Waits while it is being set.
End;
End;
End;
End;
2) OrderWorlds in WorldSwitcher.scar does NOT work. I made a fix for it, plus I made it much shorter:
SCAR Code:
Procedure OrderWorlds(By : String; Descending : Boolean);
Var TPA : TPointArray;
ATPA : T2DPointArray;
I : Byte;
Arr : T2DStringArray;
TB : TBox;
Begin
Arr := [TStringArray(['world', 'w', 'worlds']), TStringArray(['players', 'pl', 'player']), TStringArray(['activity', 'location', 'loc', 'act']),
TStringArray(['ls', 'lootshare']), TStringArray(['type', 't']), TStringArray(['ping', 'pi'])];
For I := 0 To High(Arr) Do
If InStrArr(Lowercase(By), Arr[i], False) Then
Break;
FindColorsTolerance(TPA, 1074576, 0, 0, 716, 141, 1);
ATPA := SplitTPA(TPA, 2);
SortATPAFromFirstPoint(ATPA, Point(91, 124));
TB := GetTPABounds(ATPA[(I * 2)+Integer(Descending)]);
MouseBox(TB.x1, TB.y1, TB.x2, TB.y2, 1);
End;
3) The SetAngle shorten, using Integer();
SCAR Code:
procedure SetAngle(Highest : Boolean);
begin
if (not LoggedIn) then exit;
KeyDown((Integer(Not Highest)*2)+38);
Sleep(1000 + Random(300));
KeyUp((Integer(Not Highest)*2)+38);
Wait(500 + Random(100));
end;
This should also be done to 'RandomAngle'.
4) A DragMouse(); procedure:
SCAR Code:
Procedure DragMouse(StartX, StartY, SRandX, SRandY, EndX, EndY, ERandX, ERandY : Integer);
Begin
MMouse(StartX, StartY, SRandX, SRandY);
Wait(150 + Random(20));
GetMousePos(x, y);
HoldMouse(x, y, True);
Wait(50 + Random(20));
MMouse(EndX, EndY, ERandX, ERandY);
Wait(150 + Random(20));
ReleaseMouse(x, y, True);
End;
Would help cut down on the code for few things, for example DragItem, Bee_DragMouse and a few others.
Usage: If I wanted to click on 500, 500 with 6 randomness on the x and 7 on the y co-ord, I would do:
SCAR Code:
DragMouse(500, 500, 6, 7 ....);
If I wanted to drag it to 800, 800 and release it with 3 randomness and 6 for x and y respectively, I would then add:
SCAR Code:
DragMouse(500, 500, 6, 7, 800, 800, 3, 3);
:)
5) In Text.Scar, TypeSend:
SCAR Code:
C:= GetKeyCode(StrGet(Text, I));
could be:
Cuts out the un-needed 'StrGet'..
6) In Agility.Scar, a typo
SCAR Code:
'agiliy dungeon ledge': CourseXP := 22.5;
To:
SCAR Code:
'agility dungeon ledge': CourseXP := 22.5;
7) ClickNorth shorten:
SCAR Code:
procedure ClickNorth(AngleHigh: boolean);
begin
if Random(4) = 1 then
begin
Mouse(542, 24, 15, 15, False);
WaitOptionMulti(['ace', 'orth'], 1200);
end else
Mouse(542, 24, 15, 15, True);
if AngleHigh then
begin
Wait(RandomRange(500, 1250));
SetAngle(True);
end;
end;
To :
SCAR Code:
procedure ClickNorth(AngleHigh: boolean);
begin
if Random(4) = 1 then
begin
Mouse(542, 24, 15, 15, False);
WaitOptionMulti(['ace', 'orth'], 1200);
end else
Mouse(542, 24, 15, 15, True);
Wait(RandomRange(500, 1000));
SetAngle(AngleHigh);
end;
The compass in RuneScape, when clicked on will NOT set it to the lowest angle, it seems to set it somewhere in-between.
8) A new procedure called MouseCircle()
SCAR Code:
Procedure MouseCircle(MidX, MidY, Radius : Integer);
Var TP : TPoint;
Control : Array [0..1] Of Integer; //The random controls
Begin
Control[0] := Random(Radius) + 1; //Finds a radius between 0 and 'Radius'
Control[1] := Random(361); //Gives a Random Angle in Degrees.
TP := Point(Round(Control[0] * Sin(Control[1] * Pi / 180)) + MidX,
Round(-Control[0] * Cos(Control[1] * Pi / 180)) + MidY); //Works out the point
Mouse(TP.x, TP.y, 0, 0, True); //Clicks There
End;
I was thinking of a new mouse procedure. For example we have mousebox, this clicks anywhere in the boundaries specified. So I thought about MouseCircle, this would click randomly in the circle specified by the MidPoints - MidPointX and MidPointY, and Radius 'Radius'.
It's main uses would be for clicking on the world map for example or the compass, to face north or whatever.
Will add more If I find :).
Thanks!