SRL Archive - SRL Archives

My 2 new functions: RadialWalk2 and DetectEnt. COME HELP ME IMPROVE EM!


n3ss3s

2007-08-03 06:39:00

Okay, the first one, RadialWalk2 :


{*******************************************************************************
function RadialWalk2(TheColor: Integer; StartRadial, EndRadial, Xmod,
Ymod: Integer; Randoms, OffRoad: Boolean): Boolean;

By: n3ss3s
Description: option for randoms and offroad , antiwall, other lil changes.
click.
*******************************************************************************}

function RadialWalk2(TheColor: Integer; StartRadial, EndRadial, Xmod,
Ymod: Integer; Randoms, OffRoad: Boolean): Boolean;
var
Tempx, Tempy, Fx, Fy, SR, ER, i, X1, Y1, Tempi, Radius: Integer;
D1, D2: Boolean;
Oper: string;
begin
Radius := 70;
SR := StartRadial;
ER := EndRadial;
if (RoadColorChecker) then
if (DebugRadialRoad) then
WriteLn(' THROUGH RADIALROADWALK= ---> ' + IntToStr(RoadColor));
if (SR = ER) then
begin
if(not(SR = 0))then
begin
SR := SR - 1;
ER := ER + 1;
end else
begin
SR := SR;
ER := ER + 2;
end;
end
else if (StartRadial < EndRadial) then
begin
repeat
for i := StartRadial to EndRadial do
begin
x1 := Round(Radius * Sine(i)) + 646;
y1 := Round(-Radius * Cose(i)) + 84;
if Not LoggedIn then Exit;
if (FindColor(x, y, TheColor, X1, Y1, X1 + 1, Y1 + 1)) then
begin
if(FindColorCircleTolerance(Fx, Fy, 16250871, x, y, 5, 10))then
begin
if(GetColor(Fx, Fy + 3) = 16250871)then
begin
Writeln('Oh noes! We tried to clickie a wall!');
Writeln('Me likey not clicking wall :(');
Writeln('Exitting VarrockRadialRoadWalk');
Exit;
end;
end else
begin
if(OffRoad)then
begin
TempX := X;
TempY := Y;
case Random(2) + 1 of
1: Oper := 'minus';
2: Oper := 'plus';
end;
repeat
while Tempi <= 5 do
begin
case Oper of
'plus': TempX := TempX + 1;
'minus': TempX := TempY - 1;
end;
if(not(GetColor(TempX, TempY) = TheColor))then
begin
X := TempX;
Y := TempY;
D2 := True;
D1 := True;
end;
if(Tempi = 5)then
begin
case Oper of
'plus': Oper := 'minus';
'minus': Oper := 'plus';
end;
end;
end;
until(D1) and (D2);
end;
MouseFindNoFlag(X,Y,Xmod,Ymod);
Result := True;
if(Randoms)then
begin
while FlagDistance > 10 do
begin
FTWait(1);
Wait(10);
end;
end;
Exit;
end;
end;
end;
Radius := Radius - 4;
until (Radius <= 1);
end else
begin
if (StartRadial > EndRadial) then
begin
repeat
for i := StartRadial downto EndRadial do
begin
x1 := Round(Radius * Sine(i)) + 646;
y1 := Round(-Radius * Cose(i)) + 84;
if Not LoggedIn then Exit;
if (FindColor(x, y, TheColor, X1, Y1, X1 + 1, Y1 + 1)) then
begin
if(FindColorCircleTolerance(Fx, Fy, 15723511, x, y, 5, 10))then
begin
Writeln('Oh noes! We tried to clickie a wall!');
Writeln('Me likey not clicking wall :(');
Writeln('Exitting VarrockRadialRoadWalk');
Exit;
end else
begin
if(OffRoad)then
begin
TempX := X;
TempY := Y;
case Random(2) + 1 of
1: Oper := 'minus';
2: Oper := 'plus';
end;
repeat
while Tempi <= 8 do
begin
Wait(20);
case Oper of
'plus': TempX := TempX + 1;
'minus': TempX := TempY - 1;
end;
if(not(GetColor(TempX, TempY) = TheColor))then
begin
X := TempX;
Y := TempY;
D2 := True;
D1 := True;
end;
if(Tempi = 5)then
begin
case Oper of
'plus': Oper := 'minus';
'minus': Oper := 'plus';
end;
end;
end;
until(D1) and (D2);
end;
MouseFindNoFlag(X,Y,Xmod,Ymod);
Result := True;
if(Randoms)then
begin
while FlagDistance > 10 do
begin
FTWait(1);
Wait(10);
end;
end;
Exit;
end;
end;
end;
Radius := Radius - 4;
until (Radius <= 1);
end;
end;
end;
Yeh tell me ways that I could make it better.


And then the ent finder. It detects the ent by movements (hopefully, havent tested)


{*******************************************************************************
function DetectEnt(TreeColors: TIntegerArray): Boolean;
By: n3ss3s
Description: Finds many as possible tree pixels, waits 1/2 sec and detects the
ent by that if the pixels are not in their places anymore.
*******************************************************************************}
function DetectEnt(TreeColors: TIntegerArray): Boolean;
var
TPA: TPointArray;
var
ECA: TIntegerArray;
var
I, C, F: Integer;
Dx, Dy: Integer;
MovedPixs: Integer;
begin
for I := 0 to GetArrayLength(TreeColors) - 1 do
begin
if(FindColorTolerance(Dx, Dy, TreeColors[i],
MSX1, MSY1, MSX2, MSY2, 10))then
begin
Dx := TPA[i].x;
Dy := TPA[i].y;
ECA[i] := TreeColors[i];
F := F + 1;
end;
end;
Wait(500 + Random(25));
for C := 0 to F do
begin
if(not(GetColor(TPA[f].x, TPA[f].y) = ECA[f]))then
begin
MovedPixs := MovedPixs + 1;
end;
end;
if(MovedPixs > 5)then
begin
Result := True;
Writeln('Ent Found!!');
Exit;
end;
end;

If someone gets ent hurry up and test lol :D¨

Comments and suggestions appreciated!

ZephyrsFury

2007-08-03 07:01:58

With your DetectEnt function, what happens if the compass is moved or if the tree is cut down? Won't it detect an ent everytime that happens.

Miitchyy

2007-08-03 07:07:26

Someone should make RadialWalkTol that'd be cool.
Rather then having to use RadialWalkEx and the Mouse

n3ss3s

2007-08-03 07:09:39

With your DetectEnt function, what happens if the compass is moved or if the tree is cut down? Won't it detect an ent everytime that happens.

You should've read through the code.
You only put "if(DetectEnt(Bla))then…"
Not any "traps".

All happens in the same function, the compass wont be moved unless you add it to do so, and 500ms is a small time, not much happens there :D We need to trust that :D

Miitchyy

2007-08-03 07:16:22

EDIT: I'm stupid…partly


Instead of Using FindColorTolerance use FindColorSpiral and make X := MSCX and Y := MSCY;
So it finds the tree nearest to you

n3ss3s

2007-08-03 07:21:03

I quite didnt get your post…

Miitchyy

2007-08-03 07:26:08

>_< Sorry, I updated it

Starblaster100

2007-08-03 07:28:56

He has a point. out of the 3000 ish tree pixels you will find, if 5 of them move, an ent will be detected.

[php]
for C := 0 to F do
begin
if(not(GetColor(TPA[f].x, TPA[f].y) = ECA[f]))then
begin
MovedPixs := MovedPixs + 1;
end;
end;
[/php]

should be

[php]
for C := 0 to F do
begin
if(not(GetColor(TPA[c].x, TPA[c].y) = ECA[c]))then //C, not F.
begin
MovedPixs := MovedPixs + 1;
end;
end;
[/php]

n3ss3s

2007-08-03 07:35:45

lalw, seems like im a bit sleepy :)

Miitchyy

2007-08-03 07:39:20

GOOFBALLS!

"lalw"

ZephyrsFury

2007-08-03 07:43:26

From: n3ss3s
You should've read through the code.
You only put "if(DetectEnt(Bla))then…"
Not any "traps".

All happens in the same function, the compass wont be moved unless you add it to do so, and 500ms is a small time, not much happens there :D We need to trust that :D


I mean if the function is called in the middle of a loop for example:


while TreeExists do
begin
Wait(1000);
AntiBan;
AntiRandom;
if (DetectEnt) then
Mouse(MMCX, MMCY, 0, 0, true);
end;

and the tree gets cut down in the middle of the loop. It will think it is an ent. But I suppose it doesn't matter really. I've seen what other ent finders do. They check to see if any points have changed. If all of them have then the tree is cut. If only some of them move then its an ent. I'm not exactly sure if this will work because the ent might make all the points move anyway.

n3ss3s

2007-08-03 08:33:12

Lol, all can be > 5 lol

And nop, that cut down thing doesnt happen because the function also finds the colors, then checks, not only checks.

GoF

2007-08-03 09:43:36

Nice .. I might test that ent detector.

Dan Cardin

2007-08-03 09:59:57

i can see what zephyrsfury is saying so maybe have it find colors check then if its different make sure that the color is some type of tree color?

n3ss3s

2007-08-03 10:31:24

-.- The user is supposed to input an array of integer which he has himself or herself picked the colors from a tree into :duh:

Unless you mean id check for uptext.

Dan Cardin

2007-08-03 10:48:03

ummm…yes;) lets go with the isuptext

_ChArMz

2007-08-03 13:49:54

Ent finder that uses uptext, should work very well, made real fast, atm its just for willows but same some values and it could be used for anything..

function IsUpTextWillow : Boolean;
begin
Result := CountColorTolerance(14211600, 9, 9, 150, 20, 50) = 154;
end;

function FindEnt(var ex, ey : Integer; Handle : Boolean) : Boolean;
var
tx, ty : Integer;
Hue, Sat, Lum : Extended;
begin
Result := False;
GetMousePos(tx, ty);
if Distance(tx, ty, ex, ey) > 10 then
MMouse(ex, ey, 4, 4);
Wait(50 + Random(50));
if IsTextInAreaEx(7, 7, 150, 20, x, y, 'Willow', 100, UpChars, True, True, 0, 2, -1) then
begin
if IsUpTextWillow then
Exit
else
ColorToHSL(GetColor(x + 4, y + 3), Hue, Sat, Lum);
if (Hue > 9.0) and (Hue < 21.0) then
Result := (CountColorTolerance(122333, 9, 9, 150, 20, 50) - CountColor(65535, 9, 9, 150, 20)) = 154;
if Result then
begin
WriteLn('Found ent!');
if Handle then
begin
MouseFindNoFlag(MMCX, MMCY, 1, -1);
FTWait(10);
IdleTime(5000 + Random(5000), 5000, 1.0);
end
end
end
end;

n3ss3s

2007-08-03 14:02:41

ok, thanks.

Wanted

2007-08-03 14:08:07

Add compass/mini-map angle support?

CAW.X := Round(Radius * Sin((Pi / 180) * FixD(RS_GetCompassAngleDegrees + Angle)) + MMCX);
CAW.Y := Round(-Radius * Cos((Pi / 180) * FixD(RS_GetCompassAngleDegrees + Angle)) + MMCY);

IDK you tell me which is more accurate...

MMAW.X := Round(Radius * Sin((Pi / 180) * FixD(RS_GetMiniMapAngle + Angle)) + MMCX);
MMAW.Y := Round(-Radius * Cos((Pi / 180) * FixD(RS_GetMiniMapAngle + Angle)) + MMCY);

n3ss3s

2007-08-03 14:18:31

What?

Wanted

2007-08-03 15:32:31

From: n3ss3s
What?


Lol, thought you might say that.

What I was saying was, make your radialroadwalk2 work regardless of the compass/ mini-map angle. I.E. It will still work if the compass or mini-map angle changes.

n3ss3s

2007-08-03 15:35:27

What I was saying was, make your radialroadwalk2 work regardless of the compass/ mini-map angle. I.E. It will still work of the compass or mini-map angle changes.


Lol, the user shouldnt change compass angle, because thats why there are the radial thingies and I've never seen anyone do anything except wait or flag between radial walks… But good suggesiton.

The Claw

2007-08-03 20:44:47

Ent finder might not work, cause Jagex like to move the main screen one or two degrees randomly while your logged in, which might make 5 pixels or more of the tree move

n3ss3s

2007-08-04 08:30:22

Ent finder might not work, cause Jagex like to move the main screen one or two degrees randomly while your logged in, which might make 5 pixels or more of the tree move
Gosh… It doesnt happen in the god damn 500 milliseconds! :D Or I hope so…

Lorax

2007-08-09 06:10:15

From: n3ss3s
Gosh… It doesnt happen in the god damn 500 milliseconds! :D Or I hope so…


@n3ss3s: 5-6 people have told you that the screen moves.. including SB..
500ms is a lot of time! and I can tell you that it could change in 1ms, it happens totally random..

n3ss3s

2007-08-09 06:12:47

I got pwned :D
Yeah, Its true a lot can happen, but when you think about it
"starts to find ent"
"waits half second"
"is moved?"

Feels like the falling and shiftin couldnt happen in that time, but with a deeper look…