n3ss3s
2007-10-30 13:16:21
I wonder why havent I made one of these before, plus MK made one so it reminded me. Better way than always making a new thread, or is it?
Okay, update - made a VE roadcolor finder. Works most of the time, but sometimes it mixes with the grasscolor, maybe the hue and sat of the color also change a little, not only luminosity, so if you wanna use and wanna be perfect I think you should do like
Color := FindVarrockRoadColor;
Color := GetVEMRoadColor;
Color := GetVEMRoadColor;
Color := GetVEMRoadColor;
and update the color inside the GetVEMRoadColor to some of your global var or make a param…
EDIT: OH MAW GAD! I created a 'monster'!
Dont know about time, buts its damn sexy… And does work (tested on tree stump xD)
Ox, Oy - coords the closest obj returns
ObjTPA - all objects return
Colors - array of the colors..
ColorTS - Color Tolerance Speed
Wid, Hei - Width, Height
MW - Max X spacing between pixels when deciding do they belong to same thing
MH - =||= for Y
x1 ,y1, x2, y2 - -.-
Tol - tolerance
PTS - How many points atleast this color in the Colors must be.
Like if you have Colors as [0, 1, 2, 3] you set the amount you want to find '0' in the obj, set the first one in PTS to the amount. Like PTS[3 (is the amount of 0), etc..]
Behold!
EDIT: Yay, I finished my 'SomeWalkShit', and it even works!
It is currently for clicking an area when walking vertical.
Soo,
Color - Color of this area.
Tolerance - lol
CTS - Color tolerance speed
MinColorPxls, the amount of pixels the area wide the length of minimap's circular part in that Y, and height is 2 pixels.
Height - height of the area in pixels you want it to count, so there wont be any more searching than you need.
UpOrDown - to click top or bottom of the area.
Play with it…
So, first -
FindMMDoors: TPointArray
Finds all doors on MM and skips drop dots.
Then something that opens the door for ya -
Dont use in places where there is same color as the door in ground or like that, fucks up. Tested in Al-Kharid, works great.
Then my general object finder -
Finds all instances of the obj.
Then another "general" object finder, which is used for usually skill objects, like old rocks, trees, etc all kinds of objects that have kind of same color, but different lightness and darkness.
E is the minimum percent you want the color to cover the object area.
Note: remember to think of the little things, like old rock, its not fully rock, it has some ground between the real rocks there.
Next one finds all the tutors (the blue/white guys in lumby) on the mainscreen.
I know that there isnt more than one tutor visible on the mainscreen at a time, but JuKKa requested it so I made it:
Deleted find tutor, someone maybe would've copy the technique.
Then the legendary SRL Tool:
I recommend using NoobLevel 0, or someone tries to maybe even calm you down…
Then one for finding - and clicking furnace on minimap:
StartR = Start radial
EndR = EndRadial
Next one is for finding the axe head, picking up and re-attaching. O btw this is only for axe NOT equiped.
You also may have to edit some thing (Booleans[0] etc) for your custom needs.
Now FindBankers: Boolean
This one is pretty handy, it finds the bankers on minimap, and clicks a little right from them so you end up in bank, not outside.
Tested only in banks that booth's are west, like draynor, kharid etc.
FindRockVein - finds an instance of the newer rocks, the vein color you fill in in "Color: Integer"
Then a general monster finder, though why wouldn't it work on other objects too…
MainC = MainColor
This ones name is too long to be remembered/ typed.
You might want to edit the colors of the Array 'O', since Im not sure how to-date they are, finds all the trees on mainscreen, tested with trees like Oak, normal trees…
And then a small autocolor function, that is not based on a DTM nor BitMap or color, it is based on inventory slot.
It removes duplicates from the result, ignores the black color (65536) and ignores the inventory background color.
Im not sure does it work good with items like fishing net since its colors remind a lot the bckg of inventory.
I'll be posting more as I make, and I think I made a good decision not posting all obj finders of mine (over 30 in my scripts folder xD ).
You are free to use anything there, crediting me would be nice though.
Hopefully someone can learn something from them, ask questions if you feel like you didnt understand something.
Okay, update - made a VE roadcolor finder. Works most of the time, but sometimes it mixes with the grasscolor, maybe the hue and sat of the color also change a little, not only luminosity, so if you wanna use and wanna be perfect I think you should do like
Color := FindVarrockRoadColor;
Color := GetVEMRoadColor;
Color := GetVEMRoadColor;
Color := GetVEMRoadColor;
and update the color inside the GetVEMRoadColor to some of your global var or make a param…
Function GetVEMRoadColor: Integer;
//* EDIT: Now includes hot RoadColor finder //*
Var
I, Le, X, CTS, Sx, Sy, Col: Integer;
TPAA: Array Of TPointArray;
TPA, TPA2: TPointArray;
HSL: Array Of Array Of Extended;
TP: TPoint;
Begin
Result := 0;
SetArrayLength(HSL, 3);
SetArrayLength(HSL[0], 3);
SetArrayLength(HSL[1], 3);
SetArrayLength(HSL[2], 3);
CTS := GetColorToleranceSpeed;
If Not CTS = 2 Then
Begin
ColorToleranceSpeed(2);
End;
FindColorsSpiralTolerance(MMCX, MMCY, TPA2, 6975605, MMX1, MMY1, MMX2, MMY2, 25);
For I := 0 To High(TPA2) Do
Begin
If InCircle(TPA2[i].x, TPA2[i].y, MMCX, MMCY, 64) Then
Begin
SetArrayLength(TPA, GetArrayLength(TPA) + 1);
TPA[High(TPA)] := TPA2[i];
End;
End;
TPAA := SplitTPA(TPA);
Writeln(IntToStr(GetArrayLength(TPAA)));
Le := GetArrayLength(TPAA[0]);
For I := 0 To High(TPAA) Do
Begin
If Not SimilarColors(Col, 6975605, 25) Then Continue;
If GetArrayLength(TPAA[i]) <= 50 Then
Begin
Continue;
End;
If GetArrayLength(TPAA[i]) > Le Then
Begin
TP := TPAA[i][0];
{ Col := GetColor(TP.x, TP.y);
ColorToHSL(Col, HSL[0][0], HSL[0][1], HSL[0][2]);
ColorToHSL(6186087, HSL[1][0], HSL[1][1], HSL[1][2]);
HSL[2][0] := 0.005;
HSL[2][1] := 0.005;
HSL[2][2] := 35.0;
If SimilarColors2(HSL) Then }
If SimilarColors(Col, 8291465, 25) Then
Begin
If Not FindSymbolIn(Sx, Sy, 'mining site', TP.x - 12, TP.y - 12, TP.x + 12, TP.y + 12) Then
Begin
Le := GetArrayLength(TPAA[i]);
X := I;
End;
End;
End;
End;
Try
Result := GetColor(TPAA[x][0].x, TPAA[x][0].y);
Writeln(IntToStr(Result));
//MMouse(TPAA[x][0].x, TPAA[x][0].y, 0, 0);
Except
Writeln('Could not find road color!');
End;
If Result = 0 Then Result := FindVarrockRoadColor;
ColorToleranceSpeed(CTS);
End;
EDIT: OH MAW GAD! I created a 'monster'!
Dont know about time, buts its damn sexy… And does work (tested on tree stump xD)
Ox, Oy - coords the closest obj returns
ObjTPA - all objects return
Colors - array of the colors..
ColorTS - Color Tolerance Speed
Wid, Hei - Width, Height
MW - Max X spacing between pixels when deciding do they belong to same thing
MH - =||= for Y
x1 ,y1, x2, y2 - -.-
Tol - tolerance
PTS - How many points atleast this color in the Colors must be.
Like if you have Colors as [0, 1, 2, 3] you set the amount you want to find '0' in the obj, set the first one in PTS to the amount. Like PTS[3 (is the amount of 0), etc..]
Behold!
Program New;
{.include SRL/SRL.scar}
Var
Rx, Ry: Integer;
TheObject: TPointArray;
Function FindObjectEx(Var Ox, Oy: Integer; Var ObjTPA: TPointArray; Colors: TIntegerArray; ColorTS, Wid,
Hei, MW, MH, x1, y1, x2, y2, Tol: Integer; PTS: TIntegerArray): Boolean;
Var
CTS, CenterX, CenterY, L, X, D, Q, I, C, S: Integer;
TPA, fTPA, FinalTPA: TPointArray;
TPAA: Array Of TPointArray;
SkipB: TBoxArray;
BCMD: Boolean;
TP: TPoint;
Begin
If Not LoggedIn Then Exit;
If GetColorToleranceSpeed <> ColorTS Then
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(ColorTS);
End;
CenterX := x1 + ((X2 - X1) / 2);
CenterY := y1 + ((Y2 - Y1) / 2);
SetArrayLength(TPAA, GetArrayLength(Colors));
L := GetArrayLength(TPAA) - 1;
For I := 0 To L Do
Begin
FindColorsSpiralTolerance(CenterX, CenterY, TPAA[i], Colors[i], x1, y1, x2, y2, Tol);
TPA := CombineTPA(TPAA[i], TPA);
End;
SetArrayLength(TPAA, 0);
TPAA := SplitTPA(TPA);
L := GetArrayLength(TPAA) - 1;
SetArrayLength(fTPA, L + 1);
For C := 0 To L Do
Begin
fTPA[c] := MiddleTPA(TPAA[c]);
End;
L := GetArrayLength(fTPA) - 1;
SetArrayLength(TPA, 0);
For X := 0 To GetArrayLength(Colors) - 1 Do
Begin
For D := 0 To L Do
Begin
BCMD := False;
TP := fTPA[d];
For S := 0 To GetArrayLength(SkipB) - 1 Do
Begin
If PointInBox(TP, SkipB[s]) Then
Begin
BCMD := True;
Break;
End;
End;
If BCMD Then Continue;
FindColorsTolerance(TPA, Colors[x], TP.x - Wid, TP.y - Hei, TP.x + Wid, TP.y + Hei, Tol);
If GetArrayLength(TPA) >= PTS[x] Then
Begin
finalTPA := CombineTPA(FinalTPA, TPA);
SetArrayLength(SkipB, GetArrayLength(SkipB) + 1);
SkipB[GetArrayLength(SkipB) - 1] := IntToBox(TP.x - Wid, TP.y - Hei, TP.x + Wid, TP.y + Hei);
End;
End;
End;
SetArrayLength(TPAA, 0);
TPAA := SplitTPAEx(finalTPA, MW, MH);
SetArrayLength(ObjTPA, GetArrayLength(TPAA));
For Q := 0 To GetArrayLength(TPAA) - 1 Do
Begin
ObjTPA[q] := MiddleTPA(TPAA[q]);
MMouse(ObjTPA[q].x, ObjTPA[q].y, 0, 0);
End;
RAaSTPA(ObjTPA, (Wid + Hei) / 2);
SortTPAFrom(ObjTPA, IntToPoint(MSCX, MSCY));
If Not GetArrayLength(ObjTPA) <= 0 Then
Begin
Ox := ObjTPA[0].x;
Oy := ObjTPA[0].y;
Result := True;
End;
ColorToleranceSpeed(CTS);
End;
Begin
SetupSRL;
If FindObjectEx(Rx, Ry, TheObject, [3957890, 4353677], 2, 10, 10, 1, 1, 20, 10, MSX2 - 10, MSY2 - 10, 10, [5, 5]) Then
Begin
MMouse(Rx, Ry, 0, 0);
End;
End.
EDIT: Yay, I finished my 'SomeWalkShit', and it even works!
It is currently for clicking an area when walking vertical.
Soo,
program New;
{.include SRL/SRL.scar}
Function SomeWalkShit(Color, Tolerance, CTS, MinColorPxls, AreaHeight: Integer; UpOrDown: Boolean): Boolean;
Var
C, TPA, finalTPA, xTPA: TPointArray;
I, CTSS, L, X, Y, R: Integer;
x1, y1, x2, y2: Integer;
Begin
If Not LoggedIn Then Exit;
If Not GetColorToleranceSpeed = CTS Then
Begin
CTSS := GetColorToleranceSpeed;
ColorToleranceSpeed(CTS);
End;
SetArrayLength(C, 2);
For R := 10 To 349 Do
Begin
R := R + 1;
I := I + 1; // So it increases 2
C[0].x := Round(70 * Sine(r)) + MMCX;
C[0].y := Round(-70 * Cose(r)) + MMCY;
C[1].x := Round(70 * Sine(-r)) + MMCX;
C[1].y := Round(-70 * Cose(-r)) + MMCY;
If C[0].x < C[1].x Then
Begin
x1 := C[0].x;
y1 := C[0].y;
x2 := C[1].x;
y2 := C[1].y;
End Else
Begin
x1 := C[1].x;
y1 := C[1].y;
x2 := C[0].x;
y2 := C[0].y;
End;
FindColorsTolerance(TPA, Color, x1, y1, x2, y2 + 2, Tolerance);
If GetArrayLength(TPA) >= MinColorPxls Then
Begin
SetArrayLength(xTPA, L + 1);
xTPA[L] := MiddleTPA(TPA);
If GetArrayLength(xTPA) / 2 >= AreaHeight Then Break;
L := L + 1;
End;
End;
FinalTPA := CombineTPA(FinalTPA, xTPA);
MiddleTPAEx(FinalTPA, X, Y);
If UpOrDown Then
Y := xTPA[0].y
Else
Y := xTPA[GetArrayLength(xTPA) - 1].y;
MouseFindFlag(X, Y, -1, 1);
Flag;
Wait(250 + Random(50));
Result := True;
ColorToleranceSpeed(CTSS);
End;
Begin
SetupSRL;
SomeWalkShit(2577008, 5, 2, 5, 20, False);
End.
Color - Color of this area.
Tolerance - lol
CTS - Color tolerance speed
MinColorPxls, the amount of pixels the area wide the length of minimap's circular part in that Y, and height is 2 pixels.
Height - height of the area in pixels you want it to count, so there wont be any more searching than you need.
UpOrDown - to click top or bottom of the area.
Play with it…
So, first -
FindMMDoors: TPointArray
Finds all doors on MM and skips drop dots.
Function FindMMDoors: TPointArray;
Var
TPAA: Array of TPointArray;
Var
TPA, SemiR: TPointArray;
Var
I, CTS: Integer;
Var
TP: TPoint;
Begin
FindColorsSpiralTolerance(MMCX, MMCY, TPA, GetDoorColor, MMX1, MMY1, MMX2, MMY2, 3);
TPAA := TPAToATPA(TPA, 4);
SetArrayLength(SemiR, GetArrayLength(TPAA));
For I := 0 To GetArrayLength(TPAA) - 1 Do
Begin
SemiR[i] := MiddleTPA(TPAA[i]);
End;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
For I := 0 To GetArrayLength(SemiR) - 1 Do
Begin
TP := SemiR[i];
FindColorsTolerance(TPA, 255, TP.x - 2, TP.y - 2, TP.x + 2, TP.y + 2, 20);
If(Not(GetArrayLength(TPA) >= 5))Then
Begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[GetArrayLength(Result) - 1] := TP;
End;
End;
ColorToleranceSpeed(CTS);
End;
Then something that opens the door for ya -
Function OpenDoor(DoorColor: Integer; Rotate: Boolean): Boolean;
Var
TPA, TPA2: TPointArray;
C, X, Y, I: Integer;
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
For I := 0 To 3 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, DoorColor, 20, 20, MSX2 - 10, MSY2 - 10, 10);
For C := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[c];
FindColorsTolerance(TPA2, DoorColor, TP.x - 25, TP.y - 25, TP.x + 25, TP.y + 25, 10);
If(GetArrayLength(TPA2) > 150)Then
Begin
MiddleTPAEx(TPA2, X, Y);
MMouse(X, Y, 5, 5);
If(Pos('lose', GetUpText) > 0)Then
Begin
Result := True;
Exit;
End Else
Begin
If(Pos('pen', GetUpText) > 0)Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 1, 1, True);
Result := True;
Exit;
End;
End;
End;
End;
If Not Rotate Then
Begin
Exit;
End Else
Begin
ActivateClient;
Wait(125 + Random(25));
SendArrowSilentWait(1, 1100 + Random(150));
End;
End;
End;
Dont use in places where there is same color as the door in ground or like that, fucks up. Tested in Al-Kharid, works great.
Then my general object finder -
Function iSpyWithMyLittleEye(ObjColors: TIntegerArray; ObjWidth, ObjHeight: Integer): TPointArray;
Var
TPAA: Array of TPointArray;
Var
CTS, I, C, D, T: Integer;
Var
TPA, TPA2: TPointArray;
Var
FinalTPA: TPointArray;
Var
TP: TPoint;
Var
TB: TBox;
Begin
T := GetSystemTime;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, ObjColors[0], 20, 20, MSX2 - 20, MSY2 - 20, 10);
TPAA := TPAToATPAEx(TPA, ObjWidth, ObjHeight);
SetArrayLength(TPA, Length(TPAA));
For I := 0 To GetArrayLength(TPAA) - 1 Do
Begin
TPA[i] := MiddleTPA(TPAA[i]);
End;
SetArrayLength(TPAA, 0);
If(Not(GetArrayLength(TPA) <= 0))Then
Begin
SetArrayLength(TPAA, GetArrayLength(ObjColors));
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[i];
TB.x1 := TP.x - ObjWidth;
TB.y1 := TP.y - ObjHeight;
TB.x2 := TP.x + ObjWidth;
TB.y2 := TP.y + ObjHeight;
For C := 0 To GetArrayLength(ObjColors) - 1 Do
Begin
FindColorsTolerance(TPA2, ObjColors[c], TB.x1, TB.y1, TB.x2, TB.y2, 10);
TPAA[c] := CombineTPA(TPA2, TPAA[c]);
End;
For D := 0 To GetArrayLength(TPAA) - 1 Do
Begin
FinalTPA := CombineTPA(FinalTPA, TPAA[d]);
End;
End;
Result := ReArrangeandShortenArrayEx(FinalTPA, ObjWidth, ObjHeight);
End;
Writeln(IntToStr(GetSystemTime - T));
ColorToleranceSpeed(CTS);
End;
Finds all instances of the obj.
Then another "general" object finder, which is used for usually skill objects, like old rocks, trees, etc all kinds of objects that have kind of same color, but different lightness and darkness.
Function SpySkillObj(Var Ox, Oy: Integer; ObjColors: TIntegerArray; Width,
Height, E: Integer): Boolean;
Var
HSL: Array of Array of Extended;
C, Le, I, Color, X: Integer;
TPA, TPA2: TPointArray;
Time, CTS: Integer;
Semi: Extended;
PerC: Integer;
TB: TBox;
TP: TPoint;
H, S, L: Extended;
Colors: TIntegerArray;
Begin
If Not LoggedIn Then Exit;
Time := GetSystemTime; // Saves current time in ms to Time
CTS := GetColorToleranceSpeed; // Saves current CTS to CTS
If Not GetArrayLength(ObjColors) = 0 Then
Begin
If GetArrayLength(ObjColors) Mod 2 = 0 Then
// ^^ If hard to explain, try the mod a lil so you know, like 8 mod 2 etc..
Begin
Le := GetArrayLength(ObjColors) - 1;
Writeln('Color array length was even...');
End Else
Begin
Le := GetArrayLength(ObjColors) - 2;
Writeln('Color array length was odd...');
End;
Color := ObjColors[0]; // for "default"
Try
// below calculates the middle of two colors.
For I := 0 To Le Do
Begin
Colors := [Color, ObjColors[i + 1]];
SetArrayLength(HSL, 2);
SetArrayLength(HSL[0], 3);
SetArrayLength(HSL[1], 3);
For C := 0 To 1 Do
Begin
ColorToHSL(Colors[c], HSL[c][0], HSL[c][1], HSL[c][2]);
End;
H := HSL[1][0] - ((HSL[1][0] - HSL[0][0])/4);
S := HSL[1][1] - ((HSL[1][1] - HSL[0][1])/4);
L := HSL[1][2] - ((HSL[1][2] - HSL[0][2])/2);
Color := HSLToColor(H, S, L);
End;
Except
Writeln('Could not use crazy professor formula');
End;
End Else
Begin
Color := ObjColors[0];
End;
ColorToleranceSpeed(1); // Uses RGB for color comparison
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, 20, 20, MSX2 - 20, MSY2 - 20, 5);
TPA := ReArrangeAndShortenArrayEx(TPA, Width, Height);
// Rearranges and shortens TPA so that there is only one point per "square"
// - the Round(wi....)
Le := GetArrayLength(TPA) - 1;
For X := 0 To Le Do
Begin
TP := TPA[x];
TB.x1 := TP.x - Round(Width / 2);
TB.y1 := TP.y - Round(Height / 2);
TB.x2 := TP.x + Round(Width / 2);
TB.y2 := TP.y + Round(Height / 2);
FindColorsSpiralTolerance(TP.x, TP.x, TPA2, Color, TB.x1, TB.y1, TB.x2, TB.y2, 10);
// Now we calculate percent of the color in the box
Semi := GetArrayLength(TPA2) / (Width * Height);
PerC := Round(Semi * 100);
If PerC > E Then
// ^^ Checks if the colors percent in box is greater than E
Begin
// Then we take middle of the TPA2 and save it to Ox and Oy, result true.
If MiddleTPAEx(TPA2, Ox, Oy) Then
Begin
Result := True;
Break;
End;
End;
End;
ColorToleranceSpeed(CTS); // Sets color comparison back to original
Writeln('Finding took: '+IntToStr(GetSystemTime - Time));
End;
E is the minimum percent you want the color to cover the object area.
Note: remember to think of the little things, like old rock, its not fully rock, it has some ground between the real rocks there.
Next one finds all the tutors (the blue/white guys in lumby) on the mainscreen.
I know that there isnt more than one tutor visible on the mainscreen at a time, but JuKKa requested it so I made it:
Deleted find tutor, someone maybe would've copy the technique.
Then the legendary SRL Tool:
{.Script Info:
# ScriptName = SRLTool
# Author = n3ss3s
# Description = I have obviously too much time xD
# Version = Infinite
# Date = 23 of September 2007
# Comments = "This should do"
/Script Info}
program SRLTool;
var
Reqz: TStringArray;
procedure LoadRequirements;
begin
SetArrayLength(Reqz, 7);
Reqz[0] := '[*]DTMs / DDTMs';
Reqz[1] := '[*]RadialWalk / DDTM Walking';
Reqz[2] := '[*]MultiPlayer';
Reqz[3] := '[*]FailSafes';
Reqz[4] := '[*]Break out of potential endless loops';
Reqz[5] := '[*]Standards! Without them no one reads script';
Reqz[6] := '[*]Decent complex working script.';
end;
procedure Ban(BanD: Boolean; WhichBan: Integer);
begin
if(BanD)then
begin
case WhichBan of
0: Writeln('BUSTED! Ban shampoo!');
1: Writeln('Please, copy a working script which fills the requirements!');
2: Writeln('Sorry, copy a better script next time');
3: Writeln('Burn in hell pl0x?');
4: Writeln('You copyed the script I made today?!');
end;
end;
end;
procedure PrintRequirements;
var
I, C, I2: Integer;
var
Printd: array[0..6] of Boolean;
begin
LoadRequirements;
repeat
if(not(Printd[i]))then
begin
Writeln(Reqz[i]);
Printd[i] := True;
I2 := I2 + 1;
end;
I := Random(7);
until(I2 = 7);
end;
procedure KThxBaiiNoob(NoobLevel: Integer);
begin
case NoobLevel of
1: begin
// noob of the level 1
Writeln('Sorry, better luck next time');
end;
2: begin
// :O "2" we are witnessing history
Writeln('Geez you are wasting the time of both of us! No script, auto-deny');
end;
3: begin
// :O :O :O *Funeral church bells ringin* the level 3 noob. "How to use searx"
Writeln('omfg I made a fucking tutorial for search button, go home!');
end;
end;
if(NoobLevel = 0)then
begin
Writeln('Good try, better luck next time');
end;
Writeln('[LIST]');
PrintRequirements;
Writeln('[/LIST]');
// Ye ye go home nub..
end;
I recommend using NoobLevel 0, or someone tries to maybe even calm you down…
Then one for finding - and clicking furnace on minimap:
Function InPizzaSlice(xx, yy, StartR, EndR, MidX, MidY, MaxRadius: Integer): Boolean;
Var
Rx, Ry, Dx, Dy, D: Integer;
Begin
Rx := Round( MaxRadius * Sine(StartR)) + MidX;
Ry := Round(- MaxRadius * Cose(StartR)) + MidY;
Dx := Round( MaxRadius * Sine(EndR)) + MidX;
Dy := Round(- MaxRadius * Cose(EndR)) + MidY;
If (XX > Rx) And (XX < Dx) Then
Begin
Result := (Distance(xx, yy, MidX, MidY) <= MaxRadius);
End;
End;
Function ToFurnace(StartR, EndR, x1, y1, x2, y2: Integer): Boolean;
Var
X, Y, C, D, XX, YY, CTS, Q: Integer;
TPA, fTPA, sTPA: TPointArray;
fOrange: TIntegerArray;
Begin
If Not LoggedIn Then Exit;
fOrange := [125678, 1215215, 876014];
For C := 0 To 2 Do
Begin
FindColorsSpiralTolerance(MMCX, MMCY, sTPA, fOrange[c], x1, y1, x2, y2, 5);
For Q := 0 to GetArrayLength(sTPA) - 1 Do
Begin
X := sTPA[q].x;
Y := sTPA[q].y;
If Not InPizzaSlice(X, Y, StartR, EndR, MMCX, MMCY, 60) Then Continue;
For D := 0 To 2 Do
Begin
FindColorsTolerance(TPA, fOrange[d], X - 4, Y - 4, X + 4, Y + 4, 10);
If GetArrayLength(TPA) + GetArrayLength(fTPA) >= 5 Then
Begin
fTPA := CombineTPA(fTPA, TPA);
fOrange[d] := GetColor(TPA[0].x, TPA[0].y);
// Following is in a script of mine, for this function I had to
// make fOrange a local so this wont have any effect kinda..
End;
If GetArrayLength(fTPA) >= 5 Then Break;
End;
End;
End;
If GetArrayLength(fTPA) >= 5 Then
Begin
MiddleTPAEx(fTPA, X, Y);
Result := InCircle(X, Y, MMCX, MMCY, 60);
If Result Then
Begin
MouseFindFlag(X, Y, -2, 2);
Flag;
Wait(250 + Random(250));
End;
End;
End;
StartR = Start radial
EndR = EndRadial
Next one is for finding the axe head, picking up and re-attaching. O btw this is only for axe NOT equiped.
You also may have to edit some thing (Booleans[0] etc) for your custom needs.
Function HandleLostAxe: Boolean;
Var
X, Y, Z, CTS, H, S, I, Q, Px, Py, Hx, Hy: Integer;
Var
TPA, TPA2, TPA3: TPointArray;
Var
C: TIntegerArray;
Var
TP: TPoint;
Begin
If(GotHead) Or (Not(LoggedIn)) Then Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
C := [hc1, hc2, hc3, hc4, hc5];
H := GetClientWindowHandle;
S := BitmapFromString2(False, '');
CopyClientToBitmap(S, MSX1, MSY1, MSX2, MSY2);
SetTargetBitmap(S);
For Z := 0 To GetArrayLength(C) - 1 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, C[z], MSX1, MSY1, MSX2, MSY2, 15);
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[i];
FastSetPixel(s, TP.x, TP.y, 255);
End;
X := MSCX;
Y := MSCY;
FindColorSpiral2(X, Y, 255, MSX1, MSY1, MSX2, MSY2);
FindColorsTolerance(TPA2, 255, X - 5, Y - 5, X + 5, Y + 5, 0);
If(GetArrayLength(TPA2) >= 6)Then
Begin
SetArrayLength(TPA3, GetArrayLength(TPA3) + 1);
TPA3[GetArrayLength(TPA3) - 1] := MiddleTPA(TPA2);
End;
End;
If(Not(GetArrayLength(TPA3) <= 0))Then
Begin
For Q := 0 To GetArrayLength(TPA3) - 1 Do
Begin
MMouse(TPA3[q].x, TPA3[q].y, 2, 2);
If(IsUpTextMulti('ake', 'ick', 'ead'))Then
Begin
If(InvFull)Then
Begin
DropItem(28);
Wait(750 + Random(250));
End;
Mouse(TPA3[q].x, TPA3[q].y, 1, 1, True);
Wait(500 + Random(25));
If(FindBitmapToleranceIn(PickHead, Px, Py, MIX1, MIY1, MIX2, MIY2, 50))
And(FindBitmapToleranceIn(PickHandle, Hx, Hy, MIX1, MIY1, MIX2, MIY2, 50))Then
Begin
Mouse(Px, Py, 2, 2, True);
Wait(50 + Random(25));
Mouse(Hx, Hy, 2, 2, True);
Wait(500 + Random(25));
Result := True;
End Else
Begin
Writeln('Sorry m8, we lost your pick =/ ');
If(Players[CurrentPlayer].Booleans[0])Then
Begin
NeedNew := True;
End;
Exit;
End;
End;
End;
End;
End;
Now FindBankers: Boolean
This one is pretty handy, it finds the bankers on minimap, and clicks a little right from them so you end up in bank, not outside.
Tested only in banks that booth's are west, like draynor, kharid etc.
Function FindBankers: Boolean;
Var
I, X, Y: Integer;
Var
TB: TBox;
Var
TP, T: TPoint;
Var
TPA, Bankers: TPointArray;
Begin
If (Not (LoggedIn)) Then Exit;
If (Not (AL_Kharid)) Then Exit;
MakeCompass('n');
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 195836, MMX1, MMY1, MMX2, MMY2, 15);
For I := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[i];
TB := IntToBox(TP.x - 4, TP.y - 25, TP.x + 4, TP.y + 25);
T := IntToPoint(TB.x1 + ((TB.x2 - TB.x1) / 2), TB.y1 + ((TB.y2 - TB.y1) / 2));
FindColorsSpiralTolerance(T.x, T.y, Bankers, 195836, TB.x1, TB.y1, TB.x2, TB.y2, 15);
If (GetArrayLength(Bankers) >= 6) Then
Begin
If(FindColorTolerance(X, Y, 6392206, T.x - 10, T.y - 10, T.x + 10, T.y + 10, 25))Then
Begin
Mouse(T.x + 6, T.y - 6, 2, 2, True);
Flag;
Result := True;
Exit;
End;
End;
End;
End;
FindRockVein - finds an instance of the newer rocks, the vein color you fill in in "Color: Integer"
Function FindRockVein(Var Rx, Ry: Integer; Color, x1, y1, x2, y2: Integer): Boolean;
Var
L, I, Mx, My, P, Col: Integer;
TPA, TPA2, TPA3: TPointArray;
Box, B2: TBox;
TP: TPoint;
Begin
If Not LoggedIn Then Exit;
Box := IntToBox(MSCX - 15, MSCY - 20, MSCX + 15, MSCY + 20);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, 15);
L := GetArrayLength(TPA) - 1;
For I := 0 To L Do
Begin
TP := TPA[i];
Col := GetColor(TP.x, TP.y);
If(Not(PointInBox(TP, Box)))Then
Begin
FindColorsTolerance(TPA2, 875655, TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10, 35);
If(GetArrayLength(TPA2) >= 40)Then
Begin
B2 := IntToBox(TP.x - 10, TP.y - 10, TP.x + 10, TP.y + 10);
Mx := B2.x1 + ((B2.x2 - B2.x1) / 2);
My := B2.y1 + ((B2.y2 - B2.y1) / 2);
FindColorsSpiralTolerance(Mx, My, TPA3, Col, B2.x1, B2.y1, B2.x2, B2.y2, 5);
If(GetArrayLength(TPA3) >= 8)Then
Begin
P := Round((GetArrayLength(TPA3) / GetArrayLength(TPA2)) * 100);
If(P > 3) And (P < 15)Then
Begin
Result := True;
MiddleTPAEx(TPA3, Rx, Ry);
RockColor := GetColor(Rx, Ry);
Break;
End;
End;
End;
End;
End;
End;
Then a general monster finder, though why wouldn't it work on other objects too…
Function FastFindMonster(MainC: Integer; Colors: TIntegerArray; Var Mx, My: Integer): Boolean;
Var
I, C, CTS, L, X, Y, T: Integer;
Var
TPAA: TPointArrayArray;
Var
FinalTPA: TPointArray;
Begin
T := GetSystemTime;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
L := GetArrayLength(Colors);
SetArrayLength(TPAA, L);
If(FindColorTolerance(X, Y, MainC, MSX1, MSY1, MSX2, MSY2, 10))Then
begin
For I := 0 To L - 1 Do
Begin
FindColorsTolerance(TPAA[i], Colors[i], X - 15, Y - 15, X + 15, Y + 15, 10);
If(GetArrayLength(TPAA[i]) <= 0)Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;
End;
SetArrayLength(FinalTPA, L);
For C := 0 To L - 1 Do
Begin
FinalTPA[c] := MiddleTPA(TPAA[c]);
End;
MiddleTPAEx(FinalTPA, Mx, My);
Result := True;
End;
Writeln(IntToStr(GetSystemTime - T));
ColorToleranceSpeed(CTS);
End;
MainC = MainColor
This ones name is too long to be remembered/ typed.
You might want to edit the colors of the Array 'O', since Im not sure how to-date they are, finds all the trees on mainscreen, tested with trees like Oak, normal trees…
Function HahaNoobTreesYouCanRunButYouCantHideBuahahaha: TPointArray;
{===================================================================]
[================= Finds all trees on the screen ===================]
[===================================================================}
Var
HolyShitA3DArray: Array of Array of TPointArray;
Var
TPAA: Array of TPointArray;
Var
FinalTPA: TPointArray;
Var
I, C, CTS, M: Integer;
Var
O: TIntegerArray;
Var
Q, Z, R: Integer;
Var
TP: TPoint;
Begin
M := GetSystemTime;
O := [1850674, 1857871, 1995625];
CTS := GetColorToleranceSpeed;
Z := GetClientWindowHandle;
CopyClientToBitmap(R, MSX1, MSY1, MSX2, MSY2);
SetTargetBitmap(R);
ColorToleranceSpeed(2);
SetArrayLength(TPAA, 3);
For C := 0 To 2 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPAA[c], O[c], 5, 5, MSX2 - 5, MSY2 - 5, 5);
Status('Finding all colors...');
End;
SetClientWindowHandle(Z);
Writeln('Picked up all tree colors...');
Status('Sorting points to trees');
SetArrayLength(HolyShitA3DArray, 3);
For I := 0 To 2 Do
Begin
HolyShitA3DArray[i] := TPAToATPA(TPAA[i], 100);
End;
For C := 0 To 2 Do
Begin
For I := 0 To 2 Do
Begin
Try
FinalTPA := CombineTPA(FinalTPA, HolyShitA3DArray[c][i]);
Except
Writeln('Shit happens');
End;
End;
End;
TPAA := TPAToATPA(FinalTPA, 75);
Q := GetArrayLength(TPAA);
SetArrayLength(Result, Q);
For C := 0 To Q - 1 Do
Begin
Result[c] := MiddleTPA(TPAA[c]);
Status('sorting out middles of the trees...');
End;
Writeln('We have '+IntToStr(GetArrayLength(Result))+' trees on the screen!');
TP := IntToPoint(MSCX, MSCY);
SortTPAFrom(Result, TP);
Writeln('Arranged points to order closest to MSC');
ColorToleranceSpeed(CTS);
Writeln('We Took '+IntToStr(GetSystemTime - M)+' ms to find the trees!');
End;
And then a small autocolor function, that is not based on a DTM nor BitMap or color, it is based on inventory slot.
It removes duplicates from the result, ignores the black color (65536) and ignores the inventory background color.
Im not sure does it work good with items like fishing net since its colors remind a lot the bckg of inventory.
Function InitInvTPA(Slot: Integer): TPointArray;
Var
W, H, L, CTS: Integer;
TB: TBox;
Begin
TB := InvBox(Slot);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
For W := TB.x1 To TB.x2 Do
Begin
For H := TB.y1 To TB.y2 Do
Begin
If( Not SimilarColors(GetColor(W, H), 3489352, 10))
And (Not (GetColor(W, H) = 65536)) Then
Begin
L := GetArrayLength(Result);
SetArrayLength(Result, L + 1);
Result[L] := IntToPoint(W, H);
End;
End;
End;
ColorToleranceSpeed(CTS);
End;
Function ItemColors(Slots: TIntegerArray): Array of Array of Integer;
Var
SL, F, T, S, L: Integer;
TPA: TPointArray;
Begin
If Not LoggedIn Then Exit;
SL := GetArrayLength(Slots);
If Not GetArrayLength(Slots) = 1 Then
Begin
F := 0;
T := SL - 1;
End Else
Begin
F := 0;
T := 0;
End;
For S := F To T Do
Begin
If Not ExistsItem(Slots[s]) Then Continue;
TPA := InitInvTPA(s);
L := GetArrayLength(Result);
SetArrayLength(Result, L + 1);
SetArrayLength(Result[L], GetArrayLength(TPA));
Result[L] := GetColors(TPA);
ClearSameIntegers(Result[l]);
End;
End;
I'll be posting more as I make, and I think I made a good decision not posting all obj finders of mine (over 30 in my scripts folder xD ).
You are free to use anything there, crediting me would be nice though.
Hopefully someone can learn something from them, ask questions if you feel like you didnt understand something.