SRL Archive - OSR Help

Finding Portals


Yanhua

2011-12-23 18:23:15

Hello Scripters,

Working on my essence miner script at the moment and, the bit that is really hard is the portal finding.

I can manage to get it to walk to portals flawlessly using symbol recognition, but when the actual portal is on screen I can't think of any good way to find it.

I'm talking about the portal in the essence miner where you hop through to go back to the main RuneScape surface.

The problem with it is, it is constantly changing in contrast, brightness and colour (Green, blue, pink, purple, yellow, orange) etc… It is completely random and you cannot know when it will happen or what colour it will change into.

Suggestions for a better method below please, currently I'm using FindObjEx.


The portals are like these, but way more colours.


PatDuffy

2011-12-23 18:28:29

You could do a TPA to ATPA function.

What I mean is, go through a cycle of FindColorsSpiralTolerance for a color, then if the length of the TPA is less than 1 go onto the next color. Then, when colors are found, you can sort the ATPA from a central point, such as (MSCX,MSCY). If you need an example I could show you a function from one of my scripts that does something similiar, and I can add comments.

Blumblebee

2011-12-23 18:30:13

take a look at my old essence miner, I'm pretty sure I had a good one. The color is pretty profound so you should easily be able to find it, just search for multiple colors/color ranges until you find a match

Yanhua

2011-12-23 18:32:37

From: Blumblebee
take a look at my old essence miner, I'm pretty sure I had a good one. The color is pretty profound so you should easily be able to find it, just search for multiple colors/color ranges until you find a match


Trust me, I've got 50+ colours on there and it still has trouble finding the portals.

Adding some pictures of the portals to OP for reference.


From: PatDuffy
You could do a TPA to ATPA function.

What I mean is, go through a cycle of FindColorsSpiralTolerance for a color, then if the length of the TPA is less than 1 go onto the next color. Then, when colors are found, you can sort the ATPA from a central point, such as (MSCX,MSCY). If you need an example I could show you a function from one of my scripts that does something similiar, and I can add comments.


Yes, it would be awesome if you could give me an example :) What you said was quite confusing.

RISK

2011-12-23 18:35:33

The inner-swirl might not change too dramatically. You could also check the pixels of it and see if they are changing over a certain amount of time.

Blumblebee

2011-12-23 18:37:03

From: Yanhua
Trust me, I've got 50+ colours on there and it still has trouble finding the portals.

Adding some pictures of the portals to OP for reference.


download ACAv2 (Auto-Color Aid), it will help you pick the right colors and tolerances, etc.

Edit: You can also try to use X amount of colors with a large tolerance, SplitTPA and search for the specific size rather than the color itself. Should work

PatDuffy

2011-12-23 18:38:24

Although I no longer use this function in my Tele-Tabber, it served it's purpose well.

function FindTab(Var Q,T:Integer; thing:string):Boolean;
var
x,y,H,I,cmount,Fails:Integer;
Tab:TPointArray;
ATPA:T2DPointArray;
Box : TBox;
begin
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX,MSCY,Tab,16591653,MSX1,MSY1,MSX2,MSY2,10);
//only looks for one color, but you can add another one below
ATPA := TPAtoATPA(Tab,25);
if Length(ATPA) < 1 then
Exit; // you would put another FindColors here
SortATPAFromFirstPoint(ATPA, Point(422,91)); //sorts from a spot on-screen, you would use MSCX,MSCY
H :=High(ATPA); //declares a value for the largest numbered point
DrawDotsMulti(True,ATPA); //draws on Smart the points found
For I:=0 to H do //from the begginning point to the end
begin
Box := GetTPABounds(ATPA[I]); //creates a box from specific point
SMART_DrawBoxEx(False, IntToBox(Box.X1,Box.Y1,Box.X2,Box.Y2),65280); //draws the box
MiddleTPAEx(ATPA[I],X,Y); //returns the value of the middle of the TPA
HumanMMouse(x,y,6,6); //Flight's very nice function similar to MMouse
Wait(100); //after here would go whatever fit your needs
if IsUpText('ouse') then
begin
Fails:=0;
Writeln('FoundTab');
case thing of
'hybrid':begin
case Random(100) of
0..98:begin
Mouse(x,y,0,0,true);
Wait(500+Random(100));
Long:=False;
Result:=True;
Inc(TabNum);
Writeln('Made Tab #'+IntToStr(TabNum));
Exit;
end;
99..100:begin
Mouse(x,y,0,0,false);
if OptionsExist(['ouse','use'],false) then
if ChooseOption('ll') then
begin
cmount := InvCount-4;
IncEx(TabNum,cmount);
Wait(500+Random(50));
Writeln('Clicked Tab');
Long:=True;
Writeln('making all');
Result:=True;
Exit;
end else
Result:=False;
end;
end;
end;

'slow':begin
Mouse(x,y,0,0,false);
if OptionsExist(['ouse','use'],false) then
if ChooseOption('ll') then
begin
cmount := InvCount-4;
Wait(500+Random(50));
IncEx(TabNum,cmount);
Writeln('Clicked Tab');
Result:=True;
Exit;
end else
Result:=False;
end;

'fast':begin
Mouse(x,y,0,0,true);
Wait(500+Random(100));
Long:=False;
Inc(TabNum);
Writeln('Made Tab#'+IntToStr(TabNum));
Result:=True;
Exit;
end;
end;
end else
begin
Inc(Fails);
Writeln('failed to find tab to make');
if (Fails>1) then
begin
Result:=False;
Exit;
end;
end;
end;
end;

Yanhua

2011-12-23 18:40:17

From: Blumblebee
download ACAv2 (Auto-Color Aid), it will help you pick the right colors and tolerances, etc.

Edit: You can also try to use X amount of colors with a large tolerance, SplitTPA and search for the specific size rather than the color itself. Should work


Will try that for the portals now :)

euphemism

2011-12-23 19:56:42

Haven't tried it recently, but it should still work. The trick is to not look for the portal. http://pastebin.com/4KtntpXU

Yanhua

2011-12-23 20:13:46

From: euphemism
Haven't tried it recently, but it should still work. The trick is to not look for the portal. http://pastebin.com/4KtntpXU


Thanks Euphemism, never thought of that, haha!

Anyways, I've managed to create my own method using multiple ACA autocolours, it is now working flawless.

I'm going to submit another members app shortly with my essence script, just need to tweak my door methods.