Added some information about how the testing will go to the OPThe function will be tested live i.e. implemented in the script! There is no better way to see how it works than that, right?
Added some information about how the testing will go to the OPThe function will be tested live i.e. implemented in the script! There is no better way to see how it works than that, right?
Last edited by Markus; 09-25-2014 at 01:43 PM.
I made a new script, check it out!.
You should incorporate the fact that the portal colors change every log in. For instance, looking at my .gif and NKN's .gif, the portal is blue in mine, but purple in his.
So within those 25 trials maybe 5 trials per log in?
Scripts: ClarityNex | ClaritySlayer | ClarityElfThief | ClarityBurialArmour | ClarityMudRunes | ClarityWells | ClarityProTables | ClarityArmadyl | ClarityHarps
ClarityDominonTower | ClarityAltar | ClarityCitadel | ClarityBarrows | ClarityEsswraith | ChampionScrollCamperTools & Extensions: OpenGL ID Highlight Tool | SRL-6 Messaging System | SRL Companion | Item DTM Generator | BBCode Converter
I'll use around five accounts, switch every 4-7 loads as usual. Should take most random factors into account as I can't run it for more than three hours straight.
I made a new script, check it out!.
Wow, this thread grew pretty quickly. Good to see my old code has been used as an exampleI might give this competition a try later this week. I might have an old school trick up my sleeves
![]()
Same, and same. @Markus, apologies in advance if I end up embarrassing myself.
[10/14/13:19:03] <BenLand100> this is special relatively, just cleverly disguised with yachts
No need to, I'd love you all to participate.
The currently submitted finders weren't perfect so you still have a good chance of winning!
I made a new script, check it out!.
Everybody get your portal finders in! Quite a bit of GP up for grabs!
Fyi: My account got permed so my prize might be delayed in getting to you :/
#slack4admin2016
<slacky> I will build a wall
<slacky> I will ban reflection and OGL hooking until we know what the hell is going on
Hello people, (Long time no post)
I just couldn't resist taking a part of this competition.
Bear with me, it has been like 1, 5 years since I touched Simba
Simba Code:function FindPortal() :Boolean;
var
Le, I, X, Y, W, H, Bmp, Bmp2: Integer;
TPA: TPointArray;
TIA, TIA2 :TIntegerArray;
ATPA :T2DPointArray;
TBA :TBoxArray;
PortalPoint :TPoint;
begin
Result := False;
Bmp := bitmapFromClient(mainScreen.getBounds);
Wait(52);
Bmp2 := bitmapFromClient(mainScreen.getBounds);
GetBitmapSize(Bmp, W, H);
If (W < 100) or (H < 100) then
begin
FreeBitmap(Bmp);
FreeBitmap(Bmp2);
Exit;
end;
for Y := 1 to H - 1 do
for X := 1 to W - 1 do
If FastGetPixel(Bmp, X, Y) <> FastGetPixel(Bmp2, X, Y) then
TPA.Append(Point(X, Y));
ATPA := TPA.cluster(5);
TBA := ATPA.getEachBounds;
Bmp := ContrastBitmap(Bmp, 100);
Le := Length(TBA);
If (Le = 0) then
begin
FreeBitmap(Bmp);
FreeBitmap(Bmp2);
Exit;
end;
SetLength(TIA2, Le + 1);
for I := 0 to Le - 1 do
If (Distance(Point(0, TBA[I].Y1), Point(0, TBA[I].Y2)) > 40) then
TBA[I] := IntToBox(0, 0, 0, 0);
for I := 0 to Le - 1 do
for Y := TBA[I].Y1 to TBA[I].Y2 do
for X := TBA[I].X1 to TBA[I].X2 do
If FastGetPixel(Bmp, X, Y) = clWhite then
TIA2[I] := TIA2[I] + 1;
PortalPoint := MiddleTPA(ATPA[TIA2.returnInArray(MaxA(TIA2))]);
Mouse(PortalPoint, MOUSE_MOVE);
Result := isMouseOverText(['rtal'], 50, True);
FreeBitmap(bmp);
FreeBitmap(bmp2);
end;
Edit: Updated code.
Note: I didn't wan't to use any kind of Minimap symbols to aid on this one, mainly because of the challenge :P
So how above code works:
Script gets 2 Bitmaps, calculates difference between them and outputs TPA.
Divides them into ATPA Using TPA.Cluster.
Clears all ATPA's which height is more than 40px.
Grab first bitmap again and add Maximum brightness to it (So pretty much everything is white).
Calculates white color from inside all ATPA Boundaries.
Results biggest amount white color Index and applies it to ATPA Index.
Above code should work very well, angle doesn't matter, all it needs that portal is just a little bit shown in mainscreen.
Ask if you have any questions about the code
~Home
Last edited by Home; 10-08-2014 at 08:45 PM.
Pretty short, but works perfectly!
The GIFs make it look slow but it takes about 40-60ms per search.
Good luck to everyone participating!
Simba Code:program ClarityPortalFinder;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
const
DESIRED_TEST_LENGTH = 60; //in seconds
TIME_DELAY = 100; //delay between repeated function performance trials, in ms
//Place these functions in your script so that they are in the correct order, the
//portal point will result from findPortal; in line 112;
var
bmp, dtm, x, y: integer;
captureBox: TBox;
pnt, portalPoint: TPoint;
timer: TTimeMarker;
{<credit to Bonsai>}
procedure greyBmp(var bmp: integer);
var
b, g: integer;
begin
b := copybitmap(bmp);
g := greyscalebitmap(b);
freebitmaps([bmp, b]);
bmp := g;
end;
function getMotionBitmap(b: TBox; n: integer = 1; c: integer = 255): integer;
var
image1, image2, work1, work2, diffBmp, i, j, w, h, old, new, diffCount: integer;
begin
image1 := bitmapfromclient(b);
sleep(38);
image2 := bitmapfromclient(b);
getbitmapsize(image1, w, h);
diffBmp := createbitmap(w, h);
work1 := copybitmap(image1);
work2 := copybitmap(image2);
greyBmp(work1);
greyBmp(work2);
for i := 0 to w - 1 with n do
for j := 0 to h - 1 with n do
begin
old := fastgetpixel(work1, i, j);
new := fastgetpixel(work2, i, j);
if (old <> new) then
begin
inc(diffCount);
if (diffCount > 6000) then
break(2);
if (c = 0) then
fastsetpixel(diffBmp, i, j, old)
else if (c = - 1) then
fastsetpixel(diffBmp, i, j, new)
else
fastsetpixel(diffBmp, i, j, c);
end;
end;
result := diffBmp;
freebitmaps([image1, image2, work1, work2]);
end;
{</credit to Bonsai>}
function processMotionOutput(b: integer): TPoint;
var
oldTarget, w, h, i, dtm: integer;
pnt: TPoint;
tpa: TPointArray;
begin
oldTarget := GetImageTarget();
setTargetBitmap(b);
getbitmapsize(b, w, h);
findcolors(tpa, 255, 0, 0, w - 1, h - 1);
setImageTarget(oldTarget);
mainscreen.filterPointsPlayer(tpa);
tpa.filterPointsBox(captureBox);
if length(tpa) >= 15 then
begin
result := tpa.getMiddle();
smartImage.drawPolygon([point(result.x, result.y + 10), point(result.x, result.y + 30)], clBlue);
smartImage.drawPolygon([point(result.x + 10, result.y), point(result.x + 30, result.y)], clBlue);
smartImage.drawPolygon([point(result.x - 10, result.y), point(result.x - 30, result.y)], clBlue);
smartImage.drawPolygon([point(result.x, result.y - 10), point(result.x, result.y - 30)], clBlue);
smartimage.drawCross(result, 5, clBlue);
smartimage.drawCircle(result, 25, false, clRed);
end;
end;
function findPortal: TPoint;
var
dtm, x, y: Integer;
begin
timer.start;
dtm := DTMFromString('mWAAAAHicY2FgYMhkYWDIAeJUIM4AYlFGBgZuIOYFYnYgLu7az3BlmhrDtCg1BmdnZwY2oB5mJMyIhkEAAIX2By0=');
if findDTM(dtm, x, y, minimap.getBounds()) then
begin
pnt := minimap.pointToMainscreen(point(x, y));
captureBox := IntToBox(pnt.x - 40, pnt.y - 40, pnt.x + 40, pnt.y + 40);
end;
bmp := getMotionBitmap(mainscreen.getBounds(), 2);
result := processMotionOutput(bmp);
freebitmap(bmp);
freeDTM(dtm);
writeln('Found portal in: ' + tostr(timer.getTime) + 'ms');
end;
//Testing code
begin
smartEnableDrawing := true;
setupSRL();
while getTimeRunning < (DESIRED_TEST_LENGTH * 1000) do
begin
findPortal; //Result of this function is TPoint of the portal.
wait(TIME_DELAY);
smartImage.clear;
clearDebug;
end;
end.
Last edited by Clarity; 10-08-2014 at 01:56 AM.
Scripts: ClarityNex | ClaritySlayer | ClarityElfThief | ClarityBurialArmour | ClarityMudRunes | ClarityWells | ClarityProTables | ClarityArmadyl | ClarityHarps
ClarityDominonTower | ClarityAltar | ClarityCitadel | ClarityBarrows | ClarityEsswraith | ChampionScrollCamperTools & Extensions: OpenGL ID Highlight Tool | SRL-6 Messaging System | SRL Companion | Item DTM Generator | BBCode Converter
Woops! Guess I disappeared again.
Will try them asap! Got exams now*hates differential equations*
I made a new script, check it out!.
@Markus Any update on this?
New to scripting? Procedures & Functions for Beginners
Do you use your computer at night? Just get f.lux
I'll look into it later this week, thanks for all the submissions!
I made a new script, check it out!.
I might actually try this if I knew didn't know there was already over 3 entries from skilled people here. Seeing things like this challenges me to get better at scripting and try to achieve what I probably couldn't now.
Guides:Lape Basics ---Multi-Dimensional Arrays --- Dung Guide , Scripts:Cooking guilder --- Enslaved Fletcher --- EnslavedHumidity
@Markus; Any news on this competition?
My Outdated ScriptsEdgeville Log Cutter | Edgeville AIO Jewelry | AIO Pickpocketer | Urn Activator | Slayer Tower | Slaying KuradalMy Working Scripts: Tutorials:Function Pointers and Why You Should Care! | Forms and Saving Settings | The Magic Behind Programming Tutorial | Recursive Recursion![]()
Will take a good look at this in the first week of February, dw!
I made a new script, check it out!.
@J J; is the winner!
His portal finder is very accurate and works in both RS3 and OSRS without modifications!
Sorry it took three years to go the grading but never late than never!
Edit: sorry! It's a tie with @Clarity! His finder is just as good
Both finders use very similar approaches: use the symbol location from the minimap and convert it to MS coordinates. Very smart.
Last edited by Markus; 01-15-2017 at 09:54 AM.
I made a new script, check it out!.
Scripts: ClarityNex | ClaritySlayer | ClarityElfThief | ClarityBurialArmour | ClarityMudRunes | ClarityWells | ClarityProTables | ClarityArmadyl | ClarityHarps
ClarityDominonTower | ClarityAltar | ClarityCitadel | ClarityBarrows | ClarityEsswraith | ChampionScrollCamperTools & Extensions: OpenGL ID Highlight Tool | SRL-6 Messaging System | SRL Companion | Item DTM Generator | BBCode Converter
There are currently 1 users browsing this thread. (0 members and 1 guests)