SRL Archive - Jr. Member General Help and Discussion

Differentiate between moving and non moving in script?


Lolsen

2014-02-24 04:57:34

Hi guys,

back after over a year, made a couple of simple scripts over the time, one being a fight cave stunner and simple things like that.

I'm onto doing a charm sprite hunter and all my previous scripts I've used colours, so my bot would click on colours, now I'm heading to more advanced.

In charm sprite hunting they have about 20 bushes, they shake randomly and that's when you lure them, how would I get my script to differentiate between a non shaking bush and a shaking bush?

cheers

Frement

2014-02-24 05:01:35

PixelShift should be a good solution, I'm sure you can find a tutorial on these forums about it.

Lolsen

2014-02-24 05:05:31

From: Frement
PixelShift should be a good solution, I'm sure you can find a tutorial on these forums about it.


Hey thanks for the quick reply, I'll give it a shot tomorrow!

Hoodz

2014-02-24 05:30:45

just like frement said..

you should find the bushes with cts2 (you can use aca for that) and make a box around that point and check the pixelshift in it

Clarity

2014-02-24 05:40:57

From: Lolsen
how would I get my script to differentiate between a non shaking bush and a shaking bush?

From my private charm sprites script.

{ClarityCharmSprites v1.02}
{...}
{FUNCTION -- findNeverberry
Purpose: Locates shaking neverberry bushes.
Comments: None.}
function findNeverberry: boolean;
var
x, y, i, j, k: Integer;
TPA: TPointArray;
ATPA, newATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
ClarityDebug('FindNeverberry was initiated.');
if findColorsSpiralTolerance(x, y, TPA, 2195333, mainScreen.getBounds(), 7, colorSetting(2, 0.27, 0.47)) then
begin
TPAtoATPAWrap(TPA, 30, ATPA);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
newATPA := copyATPA(ATPA);
for i := 0 to high(newATPA) do
begin
if getPixelShift(ATPA[i], 300) > 15 then
begin
mouse(newATPA[i].getMiddle, MOUSE_MOVE, MOUSE_HUMAN);
if showScriptDebug then smartImage.debugATPA(newATPA);
if isMouseOverText(['arget'], 500) then
begin
bushLocation := newATPA[i].getMiddle;
exit(didClick(true, gaussRangeInt(100, 200)));
end;
end;
end;
end;
end;

The nature of this function is a bit nontraditional to get around some errors I was getting, but I believe it answers your question.

Notice how I utilize a color search to find all the bushes, sorting the matches into an ATPA. I then sort the results based on distance from the player, so that it will check the nearest shaking bush first. Then I check these against a certain movement criteria:
if getPixelShift(ATPA[i], 300) > 15 then
In English, if over 15 pixels change within 300ms in ATPA, then the script will classify that TPA as a shaking bush and move the mouse towards it. If the overtext is correct, it will click on it and your character will throw the sprite lure at the bush. If not, it will continue looking at all the shaking bush matches.

The bushes keep shaking after you have stirred the sprites, so at another point in the script I take this into account so that this function does not click on already-disrupted bushes.

Good luck with your own script! :)

Lolsen

2014-02-25 00:22:57

From: Clarity
From my private charm sprites script.

{ClarityCharmSprites v1.02}
{...}
{FUNCTION -- findNeverberry
Purpose: Locates shaking neverberry bushes.
Comments: None.}
function findNeverberry: boolean;
var
x, y, i, j, k: Integer;
TPA: TPointArray;
ATPA, newATPA: T2DPointArray;
begin
if not isLoggedIn then
exit;
ClarityDebug('FindNeverberry was initiated.');
if findColorsSpiralTolerance(x, y, TPA, 2195333, mainScreen.getBounds(), 7, colorSetting(2, 0.27, 0.47)) then
begin
TPAtoATPAWrap(TPA, 30, ATPA);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
newATPA := copyATPA(ATPA);
for i := 0 to high(newATPA) do
begin
if getPixelShift(ATPA[i], 300) > 15 then
begin
mouse(newATPA[i].getMiddle, MOUSE_MOVE, MOUSE_HUMAN);
if showScriptDebug then smartImage.debugATPA(newATPA);
if isMouseOverText(['arget'], 500) then
begin
bushLocation := newATPA[i].getMiddle;
exit(didClick(true, gaussRangeInt(100, 200)));
end;
end;
end;
end;
end;

The nature of this function is a bit nontraditional to get around some errors I was getting, but I believe it answers your question.

Notice how I utilize a color search to find all the bushes, sorting the matches into an ATPA. I then sort the results based on distance from the player, so that it will check the nearest shaking bush first. Then I check these against a certain movement criteria:
if getPixelShift(ATPA[i], 300) > 15 then
In English, if over 15 pixels change within 300ms in ATPA, then the script will classify that TPA as a shaking bush and move the mouse towards it. If the overtext is correct, it will click on it and your character will throw the sprite lure at the bush. If not, it will continue looking at all the shaking bush matches.

The bushes keep shaking after you have stirred the sprites, so at another point in the script I take this into account so that this function does not click on already-disrupted bushes.

Good luck with your own script! :)


Hi Clarity, thanks for the great reply, this script is going to be quite advanced compared to what I've done in the past, so you're reply is greatly appreciated!
Thought I'd be the only one with a working charm sprite script, damn :P Not to worry mine will be private as well, if I succeed