SRL Archive - OSR Utility Scripts

AntiRandom - Exploding Rock.


speedster

2013-02-28 19:33:13

procedure P07_FindRockBomb;
var
tpa: TPointArray;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.14, 0.51);
FindColorsTolerance(tpa, 6190211, 217 , 127, 329, 228, 19);
SetColorToleranceSpeed(1);
SetColorspeed2Modifiers(0.2, 0.2);
if Length(tpa) > 70 then
begin
MMouse(P07_MMCX,P07_MMCY,1,1);
wait(95);
ClickMouse2(mouse_left);
wait(RandomRange(35000,60000)); // Edit this as you please.
end;
end;

keerit

2013-02-28 19:34:38

rep+

Word

2013-02-28 19:36:32

From: keerit
rep+


This.

Word

2013-02-28 19:38:36

From: speedster
procedure P07_FindRockBomb;
var
tpa: TPointArray;
begin
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.14, 0.51);
FindColorsTolerance(tpa, 6190211, 217 , 127, 329, 228, 19);
SetColorToleranceSpeed(1);
SetColorspeed2Modifiers(0.2, 0.2);
if Length(tpa) > 65 then
begin
MMouse(P07_MMCX,P07_MMCY,1,1);
wait(95);
ClickMouse2(mouse_left);
wait(RandomRange(35000,60000)[B])[/B]; // Edit this as you please.
end;
end;


Also, just forgot the second bracket on wait(RandomRange(35000,60000)), otherwise perfect!

speedster

2013-02-28 19:38:58

Thank you word, missed that :) Added the random range within this post, didn't compile it :o
Il do more anti randoms when i get em :) this one was really annoying lol it broke me too many pickaxes lol

rj

2013-02-28 19:44:26

Not reliable, it would be better to combine pixel shift and a what I call double TPA, Example:

function Bank: Boolean;
var
i, CTS, c, Timeout: Integer;
TPA, TPA1, TPA2: TPointArray;
ATPA: T2DPointArray;
P: TPoint;
begin
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Timeout := 5000 + Random(1000);
SetColorSpeed2Modifiers(BankHue_1, BankSat_1);
FindColorsTolerance(TPA1, BankCol_1, MSX1, MSY1, MSX2, MSY2, BankTol_1);
SetColorSpeed2Modifiers(BankHue_2, BankSat_2);
FindColorsTolerance(TPA2, BankCol_2, MSX1, MSY1, MSX2, MSY2, BankTol_2);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
CombineTPAWrap(TPA1, TPA2, TPA);
SplitTPAWrap(TPA, 5, ATPA);
SortATPASize(ATPA, True);
if Length(TPA) < 1 then
Exit;
for i := 0 to High(ATPA) do
if Length(ATPA[i]) > 30 then
begin
P := MiddleTPA(ATPA[i]);
HumanMMouse(P.X, P.Y, RandomRange( - 5, 5), RandomRange( - 5, 5));
if (P07_IsUpTextMultiCustom(['Use', 'Bank', 'ooth'])) then
begin
case LowerCase(ClickMethod) of
'booth':
Begin
RandomLeftClick;
clickmouse2(mouse_Right);
RandomChooseWait;
P07_ChooseOptionMultiHuman(['Use-q']);
RandomBankWait;
While (IsMoving) Do
FastWait;
If Not P07_BankScreen Then
Begin
Bank;
End;
Exit;
End;
'chest':
Begin
RandomRightClick;
clickmouse2(mouse_Left);
Wait(RandomRange(100, 700));
RandomBankWait;
While (IsMoving) Do
FastWait;
If Not P07_BankScreen Then
Begin
Bank;
End;
Exit;
End;
End;
Exit;
End;
End;
End;

It uses 2 colors for sharp object detection but if this works then it would be ok temporarily

Word

2013-02-28 19:47:34

From: speedster
Thank you word, missed that :) Added the random range within this post, didn't compile it :o
Il do more anti randoms when i get em :) this one was really annoying lol it broke me too many pickaxes lol


No problem, you did all the hard work, haha! I'm working on a few myself, but just the combat ones which seem to be simpler so far!

speedster

2013-02-28 19:51:10

Well your method would use a ton more CPU power - specially for a function which should be used quite often to check for randoms - you don't have that much time to react either., and I agree there is one bug for this thing, come in some sort of gray armor, but so far it doesn't take in to account Iron or Steel, so I don't know what else would be there to break it. Also pixelshift would have to scan the entire area around the character

Flight

2013-02-28 19:52:01

That's a good start mate! Indeed there's multiple ways to go about this.

If it were me I'd use a combination of color and, like rjj95 said, pixelshift, to first detect the gas rock. Then probably walking within a couple of tiles, waiting until we've stopped moving, find that gas rock again, and wait until the color/pixelshift of the 'gas' has gone. It's much better than a static wait of X seconds.

rj

2013-02-28 19:54:50

From: speedster
Well your method would use a ton more CPU power - specially for a function which should be used quite often to check for randoms - you don't have that much time to react either., and I agree there is one bug for this thing, come in some sort of gray armor, but so far it doesn't take in to account Iron or Steel, so I don't know what else would be there to break it. Also pixelshift would have to scan the entire area around the character


Pixel shift only takes around 50-100 ms lol

speedster

2013-02-28 19:55:45

I still have no idea how pixelshift would work : If pixelshift > number => scan for color ? wait until color or pixelshift disappears.

And i put a simple randomrange because I didn't want my script to use any more of my cpu power. A simple wait will do the trick taken someone could time how long the exploding gas lasts.

And yes 50-100Ms, which should be checked every few miliseconds while mining (swinging pickaxe) causing a ton of lag. It might not be much :D if you are running a single script. I will take in to consideration and try to see how it would work with pixelshift, but so far this has worked for me for the past 2 hours :D

Flight

2013-02-28 19:58:32

From: speedster
I still have no idea how pixelshift would work > If pixelshift > number => scan for color ? wait until color or pixelshift disappears.

And i put a simple randomrange because I didn't want my script to use any more of my cpu power. A simple wait will do the trick taken someone could time how long the exploding gas lasts.

And yes 50-100Ms, which should be checked every few miliseconds while mining causing a ton of lag. It might not be much :D if you are running a single script. I will take in to consideration and try to see how it would work with pixelshift, but so far this has worked for me for the past 2 hours :D


I know this tutorial isn't directly related to what you're trying to do here but it should aid you in figuring out how pixelshift works:
http://villavu.com/forum/showthread.php?t=74090

speedster

2013-02-28 20:34:16

Thanks :) Will check it out - I will probably personalize my version to search within a dynamic box based on the tpa which is mined, that should save up a lot of cpu and time :)

Still thinking on how to add pixelshift to the function so to work with any other kind of mining. There are usually a lot of pixels shifting around the player to scan the entire area around.

exuals

2013-03-03 20:54:15

I use pixelshift in a very small location that the mining animation can't reach.

If there is gas, the result is almost always 360.

Works perfectly for me/

speedster

2013-03-04 07:15:46

What do you do when you have different angles and multiple rocks that need to be mined? :) You need to identify that small location dynamically which would be quite hard to achieve.

hulk2106

2013-03-23 08:30:00

Thank you very much for this

Riylo69

2013-06-14 13:51:16

thank god