SRL Archive - OSR Help

(A)TPA filtering


woo hoo

2015-04-21 15:51:50

program new;

{$i AeroLib/AeroLib.Simba}


procedure bank
var
BankTPA: TPointArray;
BankATPA: T2DPointArray;



begin
if cs_FindColorsTolerance(BankTPA, 'COLORHERE', 15, IntToBox(MSX1, MSY1, MSX2, MSY2), cs_ToColorSettings(2, 0.28, 1.26)) then
BankATPA := FloodFillTPA(BankTPA);
FilterTPAsBetween(BankATPA, 1, 800);
SortATPAFromMidPoint(BankATPA, Point(259, 170));
terminatescript;

end;

begin
initAL();
bank
end;

I'm trying to make a banking procedure which finds the color and makes a tbox around the chest. Sometimes another player comes near with a similar color to the bank which results in a larger than desired tbox. What can I add or edit to filter out protruding similar colors?

The image attached shows roughly what appears in the debug; the red tbox is what happens when there is a nearby similar color and the black tbox is what is desired.

Flight

2015-04-22 08:18:36

Have you tried using the TMSObject type? It can look for dual colors (TColEx) to give you more accurate results. First check out the "ColorEx" file (AeroLib>core>engine>ColorEx.simba) to get to know the 'TColEx' type then take a look at the Objects file (AeroLib>entites>object>Object.simba) to get a better understanding on 'TMSObjects'.

woo hoo

2015-04-22 19:09:40

program bankonly;
{$i AeroLib/AeroLib.Simba}
var
Obj_Stove,
Obj_Bank : TMSObject;
x, y : integer


procedure loadVars();
begin
Obj_Bank.create('CatherbyBooth', ['ank B','nk bo','booth'], [createCol(8024897, 30, 3.37, 2.30)], [createCol(207937, 30, 0.15, 1.71)]);
end;


procedure openbank;
var
pnt : Tpoint;
z : integer;
begin
if Obj_Bank.Find(25, point(MSCX+30,MSCY-15), Pnt) then
begin
writeln('found something');
end;
if not Obj_Bank.find(5, point(MSCX+30,MSCY-15), Pnt) then
writeln('nothing found');
Exit;
end;

begin
loadvars();
openbank
end.
This was my attempt at taking just the bank finding out of the AL catherby cooker. The result was "nothing found" for both the colors already there and manually inputted colors from aca v2(CTS 2). It's quite possible that my color selection was poorly done, so I've uploaded the "mark best color" debug from aca.

I also took a look through colorex.simba and object.simba. One thing that I'm unsure about is where the colortolerancespeed would be set to 2 from the include or inside the script.

Flight

2015-04-23 09:49:00

Ok mate, the first issue is that you never called "initAL();" when beginning the script. Secondly you didn't use the same colors provided by ACA and your color tolerance is very high, especially for CTS2. I chose the colors myself, using the top of the bank booth post (the very light brown) as the inner color and the dark brown booth post as the outer color. So give this a try instead:

program bankonly;
{$i AeroLib/AeroLib.Simba}

var
Obj_Stove,
Obj_Bank : TMSObject;
x, y : integer


procedure loadVars();
begin
Obj_Bank.create('CatherbyBooth', ['ank B','nk bo','booth'], [createCol(2974847, 2, 0.04, 0.55)], [createCol(607323, 2, 0.08, 0.90)]);
end;


procedure openbank;
var
pnt : Tpoint;
z : integer;
begin
if Obj_Bank.Find(25, point(MSCX+30,MSCY-15), Pnt) then
writeln('found something')
else
writeln('nothing found');
end;

begin
initAL();
loadvars();

openbank();
end.

Also TColEx automatically sets the CTS to 2 if if contains Hue & Saturation modifiers, if not the default CTS remains while searching for the color.

Edit:
I also noticed you're not using SMART so don't forget to set your browser with Simba's crosshair client-selector.

xujnea

2015-05-13 11:54:01

From: Flight
How can i find object, if it has only small clickable area and has same color everythere? It would be really cool,if you would help me with this one, thanks. o/ Here is picture and part code:

[ATTACH=CONFIG]25906[/ATTACH]



program FindObj;
{$DEFINE SMART}
//{$DEFINE WALKER}
{$i AeroLib/AeroLib.Simba}
//{$i Reflection/Reflection.Simba}

var
Obj_Convey: TMSObject;

procedure LoadObjects
begin
Obj_Convey.create('Conveyor belt', ['belt', 're', '-on', 'ut-ore'],
[createCol(10807, 5, 0.12, 3.59)], [createCol(8751, 5, 0.12, 3.54)]);
end;

procedure FindConvey
var
x, y : Integer;
pnt : Tpoint;

begin
if Obj_Convey.Find(25, point(MSCX+20,MSCY-15), pnt) then
begin
customMouse(position);
fastClick(mouse_Right);
WaitUpText('Put-ore-on', randomrange(300, 500));
ChooseOptionMulti(['Put-ore', '-on', 'Conveyor', 'belt']);
end;
end;

begin
ClearDebug;
InitAL;
LoadObjects;
FindConvey;
end.

Flight

2015-05-13 12:21:22

Can you show me a screenshot with your compass angle and height set to how you'll be using the script?

xujnea

2015-05-13 13:08:14

From: Flight
Can you show me a screenshot with your compass angle and height set to how you'll be using the script?


Thanks for reply,Flight, actually I thought,I can find at any angle lol. But if I would have to choose,i would do this,but my standing position may be abit different :

[ATTACH=CONFIG]25908[/ATTACH]

also full procedure :


procedure FindConvey
var
x, y : Integer;
pnt : Tpoint;

begin
case random(2) of
0: lor := vk_right;
1: lor := vk_left;
end;
tim4.start;
repeat
if handleRandoms then
waitEx(50);
if not isLoggedIn() then
break;
if Nalogas then
begin
susimoketi;
RandomWait;
RSW.WalkPath(ToConvey);
end else
if tim4.timeElapsed > 60000 then
begin
Writeln('Timed out: Could not find Convey - Terminating script');
logoutPlayer;
break;
end;
WriteLn('Looking for Convey');
keyDown(lor);
Wait(RandomRange(200,400));
keyUp(lor);
if isPlayerWalking then
begin
Wait(RandomRange(500, 1000));
end;
if Obj_Convey.Find(25, point(MSCX+20,MSCY-15), pnt) then //findObject(604749, 8, 20, 0.09, 2.62)
begin
customMouse(position);
fastClick(mouse_Right);
WaitUpText('Put-ore-on', randomrange(300, 500));
if ChooseOptionMulti(['Put-ore', '-on', 'Conveyor', 'belt']) then
begin
tim5.start;
repeat
if tim5.timeElapsed > 60000 then
begin
Writeln('Timed out: Could not find Convey - Terminating script');
logoutPlayer;
break;
end;
randomWait;
until(nalogas); //or YesAll);
end;
end else
begin
keyDown(lor);
Wait(RandomRange(500,1000));
keyUp(lor);
end;
until(nalogas); //or YesAll));
end;

xujnea

2015-05-14 19:34:41

From: Flight
Can you show me a screenshot with your compass angle and height set to how you'll be using the script?


I really got stuck at this :/ I might find obj,but I need to position really precise. I'm having problems with "Walker" it clicks on area,not the single point. And if I get lucky to position myself,I cant click on it,because it has moving surface and my mouse goes along with it. Any ideas what should I do? Anything would be great,I tried searching forum all day long. Tried bitmaps and lots of other stuff. Sorry for double post,but I can't sleep peacefully until I finish lol.