SRL Archive - OSR Help

Negative TPA's =o


Getdropped

2012-07-31 01:20:50

Bet the title pulled in a lot of people ;) ok so here is what i am proposing I want to find an object but the color of the object varies vastly however hehehe the background color does not very much. So I wanted to know if anyone has tried this or something like this with the tpa returning all the area that doesnt match might be kind of a noob question but it just came to me as an idea I will link a picture of what i discovered ;)

RISK

2012-07-31 01:29:43

If I remember correctly you can count the gap in pixels in a TPA (Put the table in to a TPA) and then judge what you need to do based on the gaps.

You could also ask Flight for his method of finding objects by getting the floor TPA and finding odd colors compared to the floor. He did it for mining nodes, IIRC.

Flight

2012-07-31 02:42:30

I'm a bit confused about it, but if I'm understanding right you're wanting to make a TPA of the unique colors on the mainscreen, yes? If so, let me know if this makes sense to you:

function FilterBackground: TPointArray;
var
MSTPA,CommonTPA: TPointArray;
begin
MSTPA := TPAFromBox(IntToBox(MSX1, MSY1, MSX2, MSY2)); //Create a TPA of the full main screen ("MainScreen TPA")
//Set your CTS & modifiers
FindColorsSpiralTolerance(MSCX, MSCY, CommonTPA, BackgroundColors, MSX1, MSY1, MSX2, MSY2, BackgroundColor_Tolerance); //Make a TPA of all the common colors
if (Length(CommonTPA) < 1) then
Exit;

Result := ClearTPAFromTPA(MSTPA, CommonTPA); //Remove the common colors TPA from the mainscreen TPA for the 'unique' colors
end;

Getdropped

2012-07-31 03:03:20

From: Flight
I'm a bit confused about it, but if I'm understanding right you're wanting to make a TPA of the unique colors on the mainscreen, yes? If so, let me know if this makes sense to you:

function FilterBackground: TPointArray;
var
MSTPA,CommonTPA: TPointArray;
begin
MSTPA := TPAFromBox(IntToBox(MSX1, MSY1, MSX2, MSY2)); //Create a TPA of the full main screen ("MainScreen TPA")
//Set your CTS & modifiers
FindColorsSpiralTolerance(MSCX, MSCY, CommonTPA, BackgroundColors, MSX1, MSY1, MSX2, MSY2, BackgroundColor_Tolerance); //Make a TPA of all the common colors
if (Length(CommonTPA) < 1) then
Exit;

Result := ClearTPAFromTPA(MSTPA, CommonTPA); //Remove the common colors TPA from the mainscreen TPA for the 'unique' colors
end;


Ya that is exactly what I wanted I didnt know about cleartpafrom that will be very helpful in the long run. How ever I just had a brain spart and decided to go with something like minimap to main screen…. Here is what I have so far:

function MMMS(MM: TPoint): TPoint;
Var
X, Y :Extended;
begin
X := (((MM.X - 626.5) * 9.81119354838709677419354838709677) + 258.531);
Y := (((MM.Y - 84.5) * 8.84193548387096774193548387096777) + 175.341);
Result := Point(Round(X), Round(Y));
end;

procedure TakeAllLoot;
var
LootTPA : TPointArray;
i : integer;
begin
LootTPA := GetMiniMapDots('red');
for i := 0 To High(LootTPA) Do
begin
MMMS(LootTPA[i]);
MMouse(MMMS(LootTPA[i]).x, MMMS(LootTPA[i]).y, 2, 2);
Wait(500);
if ((IsUpText('Take')) and not(InvFull)) or (IsUpText('ey')) then
begin
ClickMouse2(Mouse_Left);
Wait(RandomRange(600, 700));
while IsMoving do
Wait(RandomRange(250, 350));
end;
end;

end;

however i have noticed that based on the distance you are from the object this wont work ie it needs to locate them with srl_anglehigh because it just converts the locations ;) Stills works well coupled with my walk to loot dot function so it doesnt really fail :p.

ps. starting to get a head ach coding this dung script and i still havnt really scripted down a room yet lol might take a nap soon and pick it up again in the morning. Not like i will sleep much anyways because last night when i went to bed all I could think about was how to solve different things in the script. Ah well.:stirthepot:

Flight

2012-07-31 05:26:35

In that case I believe you'd find this most interesting:
http://villavu.com/forum/showthread.php?t=72985

J J

2012-07-31 06:06:03

I used something similiar
{*******************************************************************************
procedure TalkToMolly;
by: J J
Description: Talks to Molly at start
*******************************************************************************}
procedure TalkToMolly;
var
FloorColors, MollyColors: TPointArray;
SearchBox: TBox;
MollySplit: T2DPointArray;
P: TPoint;

begin
SearchBox := IntToBox(60, 215, 125, 265);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.17, 0.54);
if FindColorsSpiralTolerance(260, 200, FloorColors, 4215386, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 8) then
begin
MollyColors := TPAFromBox(SearchBox);
MollyColors := ClearTPAFromTPA(MollyColors, FloorColors);
SplitTPAExWrap(MollyColors, 1, 1, MollySplit);
SortATPASize(MollySplit, True);
if Length(MollySplit[0]) > 20 then
begin
P := MiddleTPA(MollySplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [Searchbox], clYellow);
SMART_DrawBoxes(False, [GetTPABounds(MollySplit[0])], clRed);
SMART_DrawCircle(False, P, 5, False, clAqua);
end;
MMouse(P.X, P.Y, RandomRange(-2, 2), RandomRange(-2, 2));
Wait(50 + Random(100));
ClickMouse2(1);
end;
end;
end;

But in your case MMToMS will most likely be the way to go.

Getdropped

2012-07-31 15:57:59

From: Flight
In that case I believe you'd find this most interesting:
http://villavu.com/forum/showthread.php?t=72985


This was a very interesting read. However it seems that when i enter a dungeon for some reason my screen zoom will zoom in really far. Does anyone else have they problem… it messes up the main screen points…. =/

Brandon

2012-07-31 16:08:43

From: getdropped69
This was a very interesting read. However it seems that when i enter a dungeon for some reason my screen zoom will zoom in really far. Does anyone else have they problem… it messes up the main screen points…. =/


Happens to me too. It's part of RS now. Their camera feature is annoying as hell! You have to get out of the section of the zoom radius and it'll go back to normal or just wait for it to render properly lol.

Happens when running from varrock square to vwb as well. Right between the clothes store and the anvil.

Flight

2012-07-31 20:44:55

From: Brandon
Happens to me too. It's part of RS now. Their camera feature is annoying as hell! You have to get out of the section of the zoom radius and it'll go back to normal or just wait for it to render properly lol.

Happens when running from varrock square to vwb as well. Right between the clothes store and the anvil.


Indeed it is. :/ To set it back to normal I have to open up the graphics panel again and set the camera zoom to the second bar from the left. It's quite annoying that this angle changes at random times. IMO, Jagex is getting sloppy…