SRL Archive - RS3 Help

Click specific area of TPA?


Brotein

2014-01-25 22:58:59

Hey I was going through my old script and updating all my procedures to work with SRL6. So I have everything else working fine, but I'm stuck on this one line of one of my procedures.

So the problem at hand is the balance beam TPA needs to have a specific part clicked on. In-game it has 3 segments. The one closest to the player is clickable, the one in the middle isn't, and the one furthest away is "out of reach". So my original solution was to take my ATPA[0] since my ATPA was sorted by size, use the Bounds of the top left corner(X1,Y1) and add 25 to X1 and 2 to Y1 to create a MouseBox that would click on only that portion.

Here's a picture of how it used to work…

The line of code to generate what I wanted(outdated)…
Mousebox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2, 2);

And an example of the procedure as I have it updated without that line since I don't know what to do.
procedure colorCheck3;
var
x,y:Integer;
BalanceTPA:TPointArray;
BalanceATPA:T2DPointArray;
begin
if findColorsSpiralTolerance(x, y, BalanceTPA, 4809844, mainScreen.getBounds(), 5, colorSetting(2, 0.1, 0.2)) then
begin
BalanceATPA := BalanceTPA.toATPA(30, 30);
BalanceATPA.sortBySize(true);
smartImage.debugTPA(BalanceTPA, true);
smartImage.debugATPA(BalanceATPA);
//mouseBox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2, 2);
wait(150 + random(25));
if isMouseOverText(['alanc']) then
begin
wait(150 + random(50));
fastClick(MOUSE_LEFT);
writeLn('Found Balance!');
smartImage.clear;
wait(150 + random(50));
minimap.setAngle(MM_DIRECTION_EAST);
Wait(2700 + random(100));
end;
end;
end;

Lost as to what to do for this, any help is welcome.

*Edit*
Just to further explain. I have ATPA[0] as shown in white in the picture. I want to get the coordinates(used to be X1,Y1) of the top left of the bounds, and create a tbox with those coordinates as X1,Y1,X1+25,Y1+2, and then click within that tbox(which is the purple clickable area).

Kaladin

2014-01-25 23:05:59

http://villavu.com/forum/showthread.php?t=107716

Thread might help (The mayor specifically) :)

Wu-Tang Clan

2014-01-25 23:17:59

I'm pretty sure that the search option of findcolorstolerance has a thing… sec while I look

(mainscreen.playerpoint.x - 100, mainscreen.playerpoint.x + 100), mainscreen.playerpoint.y)
Something like that.

Flight

2014-01-25 23:32:53

Instead of sorting by size why not sort by distance from your player? I don't know specifically how it's done in SRL-6 but Simba has the "SortATPAFromMidPoint" procedure, just plug in your player's X/Y coordinate and your ATPA[0] will be the closest to your player.

By the way that image is very low quality, I can't really see anything clearly. It looks like you took a screenshot from a low quality video. Could you post an actual screenshot instead with the same debugging?

sdf

2014-01-25 23:38:28

Just define the edited box you want as a TBox, and use the new syntax.

e.g.
Box1 := GetTPABounds(BalanceATPA[0]);
Box2 := [Box1.x1, Box1.y1, Box1.x1 + 25, Box1.y2 +2];
MouseBox(Box2, MOUSE_MOVE, MOUSE_HUMAN);

For the MouseBox bit you wanted updated.

Ashaman88

2014-01-25 23:45:03

From: sdf
Just define the edited box you want as a TBox, and use the new syntax.

e.g.
Box1 := GetTPABounds(BalanceATPA[0]);
Box2 := [Box1.x1, Box1.y1, Box1.x1 + 25, Box1.y2 +2];
MouseBox(Box2, MOUSE_MOVE, MOUSE_HUMAN);

For the MouseBox bit you wanted updated.


Just edit box1

Box1.edit := [0,0,25,2]

Janilabo

2014-01-25 23:45:23

From: Brotein
…
Mousebox(GetTPABounds(BalanceATPA[0]).X1, GetTPABounds(BalanceATPA[0]).Y1, GetTPABounds(BalanceATPA[0]).X1 + 25, GetTPABounds(BalanceATPA[0]).Y2 + 2, 2);
Going slightly offtopic here, but just to point out, you should store the BalanceATPA bounds to TBox variable instead - with single GetTPABounds! Running through the GetTPABounds function 4 times (in this case) is just unneccessary and simply waste of time. :\

Brotein

2014-01-26 00:00:21

From: Ashaman88
Just edit box1

Box1.edit := [0,0,25,2]


That was almost too easy :) Thanks!

The Mayor

2014-01-26 00:12:09

Like Flight said, the easiest way would be to sort if from the player point, then you are always going to click on the closest part of the plank. You just need to make sure you split the TPA into the correct size. I'm not sure if a width of 30 is too big or not? Then just mouse the middle of ATPA[0].

E:


sdf

2014-01-26 00:35:10

From: Ashaman88
Just edit box1

Box1.edit := [0,0,25,2]


Not quite, I did originally type that - but if you look at his code it's creating a box using one of the top left coordinates (X1, Y1, X1 + x, Y2 + x) and not (X1, Y1, X2, Y2). Hence why I made a new box, and didn't just edit.