SRL Archive - Research & Development Lounge

A Little New Autocolor Function By Me...


Pure1993

2008-05-11 18:27:29

Now I added an Alkharid auto road color function! For those of you who already read this thread, please take your time to read through the new one, thanks! :)

Some people might still remember my old autocolor function for the mining rocks in the mining guild, it worked quite well, but i guess jagex made some big color change at somepoint, because it doesn't work correctly anymore. oh well, i might update that once i get time, but until then, here is another function which is quite useful in alkharid. ^^
program New;
{.include srl/srl.scar}

var
GArea, GTol, x, y, i, t: Integer;

function PureRockDDTM: Integer;
var
PRMainPoint: TDTMPointDef;
PRSubPoints: Array [0..4] of TDTMPointDef;
PureRockTDTM: TDTM;
begin
PRMainPoint.x := 766;
PRMainPoint.y := 247;
PRMainPoint.AreaSize := 1;
PRMainPoint.AreaShape := 0;
PRMainPoint.Color := 2840716;
PRMainPoint.Tolerance := GTol;

PRSubPoints[0].x := 766;
PRSubPoints[0].y := 247;
PRSubPoints[0].AreaSize := GArea;
PRSubPoints[0].AreaShape := 0;
PRSubPoints[0].Color := 2840716;
PRSubPoints[0].Tolerance := GTol;

PRSubPoints[1].x := 766;
PRSubPoints[1].y := 251;
PRSubPoints[1].AreaSize := GArea;
PRSubPoints[1].AreaShape := 0;
PRSubPoints[1].Color := 1654631;
PRSubPoints[1].Tolerance := GTol;

PRSubPoints[2].x := 770;
PRSubPoints[2].y := 248;
PRSubPoints[2].AreaSize := GArea;
PRSubPoints[2].AreaShape := 0;
PRSubPoints[2].Color := 2840716;
PRSubPoints[2].Tolerance := GTol;

PRSubPoints[3].x := 766;
PRSubPoints[3].y := 244;
PRSubPoints[3].AreaSize := GArea;
PRSubPoints[3].AreaShape := 0;
PRSubPoints[3].Color := 3367836;
PRSubPoints[3].Tolerance := GTol;

PRSubPoints[4].x := 763;
PRSubPoints[4].y := 248;
PRSubPoints[4].AreaSize := GArea;
PRSubPoints[4].AreaShape := 0;
PRSubPoints[4].Color := 2444664;
PRSubPoints[4].Tolerance := GTol;

PureRockTDTM.MainPoint := PRMainPoint;
PureRockTDTM.SubPoints := PRSubPoints;
Result := AddDTM(PureRockTDTM);
end;

function PureRockAutocolor: integer;
begin
Status('Looking for the rock auto color DDTM...');
GTol:= 0;
GArea:= 0;
for i:= 0 to 5 do
begin
GTol:= i*3+15;
GArea:= i+2;
if (DTMRotated(PureRockDDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Result:=GetColor(x,y);
Writeln('RockColor = '+IntToStr(Result));
exit;
end;
end;
Writeln('RockColor NOT Found!');
Result:=0;
TerminateScript;
end;

begin
t:=0;
ActivateClient;
Wait(1000);
MarkTime(t);
Writeln(IntToStr(PureRockAutocolor));
Writeln('Took '+IntToStr(TimeFromMark(t))+' ms');
end.
Here is the pic of the rock it detects 100% of the time (haven't tried the others yet, but it should work on them, too, they are quite similar:

My only recorded time so far was:
Successfully compiled (1060 ms)
RockColor = 2840716
2840716
Took 32 ms
Successfully executed
I guess that is pretty good ^^

Feel free to comment, post constructive critisism. :D (I might try to make one with RGB coloring once I have more experience with the parameters, until then, anyone who is too lazy/not experienced enough, feel free to use this, but you must give me credits… ;))

~~~~~Another function by me~~~~~
This One detects the road and building color in Alkharid:
 program New;
{.include srl/srl.scar}
var
GTol, GArea, x, y, i, t, ICounter: Integer;

function FindAlkharidBuildingDDTM: Integer;
var
FAMainPoint: TDTMPointDef;
FASubPoints: Array [0..4] of TDTMPointDef;
FindAlkharidBuildingTDTM: TDTM;
begin
FAMainPoint.x := 806;
FAMainPoint.y := 311;
FAMainPoint.AreaSize := 1;
FAMainPoint.AreaShape := 0;
FAMainPoint.Color := 5932165;
FAMainPoint.Tolerance := GTol;

FASubPoints[0].x := 813;
FASubPoints[0].y := 318;
FASubPoints[0].AreaSize := GArea;
FASubPoints[0].AreaShape := 0;
FASubPoints[0].Color := 5932165;
FASubPoints[0].Tolerance := GTol;

FASubPoints[1].x := 799;
FASubPoints[1].y := 304;
FASubPoints[1].AreaSize := 1;
FASubPoints[1].AreaShape := 0;
FASubPoints[1].Color := 5932165;
FASubPoints[1].Tolerance := GTol;

FASubPoints[2].x := 799;
FASubPoints[2].y := 318;
FASubPoints[2].AreaSize := GArea;
FASubPoints[2].AreaShape := 0;
FASubPoints[2].Color := 5932165;
FASubPoints[2].Tolerance := GTol;

FASubPoints[3].x := 813;
FASubPoints[3].y := 304;
FASubPoints[3].AreaSize := GArea;
FASubPoints[3].AreaShape := 0;
FASubPoints[3].Color := 5932165;
FASubPoints[3].Tolerance := GTol;

FASubPoints[4].x := 799;
FASubPoints[4].y := 304;
FASubPoints[4].AreaSize := GArea;
FASubPoints[4].AreaShape := 0;
FASubPoints[4].Color := 5932165;
FASubPoints[4].Tolerance := GTol;

FindAlkharidBuildingTDTM.MainPoint := FAMainPoint;
FindAlkharidBuildingTDTM.SubPoints := FASubPoints;
Result := AddDTM(FindAlkharidBuildingTDTM);
end;

function PureAlkhiBuildingColor: Integer;
begin
GArea :=1;
GTol :=0;
ICounter := 0;
for i:=0 to 15 do
begin
GTol:= i * 5;
Icounter := ICounter + 1;
if (ICOunter mod 3 = 0) then GArea := GArea + 1;
if DTMRotated(FindAlkharidBuildingDDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
Writeln('Color found with a Tolerance of '+IntToStr(GTol));
Result:= GetColor(x, y);
Writeln('AlkharidBuildingColor = '+IntToStr(Result));
Exit;
end;
end;
Result := 0;
Writeln('AlkharidBuildingColor NOT Found!');
end;

begin
ActivateClient;
Wait(1000);
MakeCompass('N');
MarkTime(t);
Writeln(IntToStr(PureAlkhiBuildingColor));
Writeln('The search took '+IntToStr(TimeFromMark(t))+'ms');
end.

And again, a report on how it went:
Successfully compiled (1053 ms)
Color found with a Tolerance of 25
AlkharidBuildingColor = 5011320
5011320
The search took 1594ms
Successfully executed

I know, i know, this is kinda slow, and it causese a lag for less than 1 sec, but this was the worst world, and it took some experimenting, because if the SPs are too close to the MP, it detetcts the color on the stuff surrounding the minimap, so yeah… But oh well, it works, any suggestions on how to make it better?



EDIT: OMG, I am a King Black Dragon! :D (Now let's go pown some noobs who are trying to kill me in my cave… xD)

EDIT 2: Added a few more lines into the PureRockAutocolor function to make it saver if i should be used more than once.

Cazax

2008-05-11 18:29:46

Yes i remember your old AutoColor function :) Good Job on this :) Btw, you can just use FindRockColor if im not wrong ;)

Pure1993

2008-05-11 18:32:16

Tried it, but it failed utterly ^^

EvilChicken!

2008-05-11 18:39:22

Yes, Cazax, but it is broken at the moment as far as I know. There are fixes, and they are pretty easy to make, yes, but if JaGex continues to make theese small changes constantly, this is a genious alternative! Well done, Stur!

Maybe this would be good as a backup, as in something like this?
if FindRockColor > 0 then
RockColor := PureRockAutocolor;

Why as a backup? Because, the SRL one is a lot more accurate.
Great job, Stur. Rep+ :)

Pure1993

2008-05-11 18:46:53

Thanks a lot! :D

Hehe, never thought that somthing i would make will be called genious… Sweetness… xD

EvilChicken!

2008-05-11 19:01:33

Wait, sorry for spamming, but I just thought of one important thing.
You've taken into consideration that the pixels shift, right?
(That the rock does not allways maintain the same shape.)

Edit: Thanks for your answer.
You should make more tutorials. Yours are fun and interesting to read. ^^

Pure1993

2008-05-11 19:10:02

Yes, I have taken it into consideration. As long as the compass is pointing north, there is no problem, but it should also work with any other angle. The thing is, the colors don't disappear, they just change slightly change their location, and by increasing the area a bit, which it does by itself, it detects the pixels, even if it is not a 100% match. All the pixel change will affect is which part of that rock is being colored. In the best case scenario, the MP is directly where the biggest part of the color should be, but if the pixels are slightly off, it will color some other part of the rock, but unless you are working with ddtms/dtms which need 100% accuracy (which you shoul never do though), it wouldn't affect it at all in the outcome, so yeah, no problem with those little shifts. :)

Timer

2008-05-11 21:31:06

How About This?

If (FindStoneColor = 0) Then
RockColor := PureRockAutocolor;
If (Not RockColor > 0) Then
Begin
NextPlayer(False);
WriteLn('Failed Auto Coloring');
Exit;
End;

Harry

2008-05-11 21:34:57

@EvilChicken: Yeah, those stupid little changes :mad: Jagex likes pushing our buttons… how about we design a new autocolor that for Jagex to mess it up, they would need to mess up the game more than they already have :p

Gu3st...

2008-05-12 04:02:07

From: Hy71194
@EvilChicken: Yeah, those stupid little changes :mad: Jagex likes pushing our buttons… how about we design a new autocolor that for Jagex to mess it up, they would need to mess up the game more than they already have :p


like rotation items in inventory and rotating game tabs :D

MasterKill

2008-05-12 04:29:52

does this allways work? allways?!

If yes i'll use it to fix my iron miner and give you a credit.

ShowerThoughts

2008-05-12 04:55:51

1337 our script is gonna be cool, hope so.

Pure1993

2008-05-12 05:15:15

After many tests and experiments, I am proud to present you with the results.
-The color was found 100% of the time!
-In 7 different minimap locations!
-With an average speed of 40,6ms!
Here are the locations:
Little side info, it won't find the color of every rock, tbecause it only finds the rock which looks like the one close to alkharid bank. but luckyly, in every bundle of rocks the is more than one which looks like it, so it finds the color of that rock. But, all the other rocks have that color included, so for example if i use findcolorsspiraltolerance, it finds all of them, and with MMouse, it moves the mouse to all of them, so yeah, technically, it finds every rock ;)

ShowerThoughts

2008-05-12 05:23:45

He's cheating i'm sure, he is paying the jury off with cookies, how i know that.
try to guess it.

Pure1993

2008-05-12 05:46:52

From: Hermpie
He's cheating i'm sure, he is paying the jury off with cookies, how i know that.
try to guess it.


OMFG! Hermpie! I told you to shut up if you found anything specific! Now my entire plot is laid bare! You'd better watch out in the dark, cause I'll be there someday :mad: ……
xD
ah heck, just joking, i don't give out cookies, i eat all i have, so yeah, i can't give out cookies…. :D

HyperSecret

2008-05-12 12:14:12

how did you get the subpoint and mainpoint colors? just randomly pick the rock colors or did you get an 'average' color?

tarajunky

2008-05-12 14:21:42

This new function will be included in the next version of SRL.

If anyone needs to use it before then, feel free.

ShowerThoughts

2008-05-12 14:35:47

From: tarajunky
This new function will be included in the next version of SRL.

If anyone needs to use it before then, feel free.


Tara when i openened it i saw a bug i saw the color 7200 the ones at the furnace around the 3 hourses is 7500 to 7900 i know colors are not right but they start with those 2 numbers.

Pure1993

2008-05-12 14:57:19

From: HyperSecret
how did you get the subpoint and mainpoint colors? just randomly pick the rock colors or did you get an 'average' color?


No, neither, the colors i chose represent the darkest point of the rock, down to the brightest one, the Main Point is the one appearing the most often, and i think it is just in the middle brightness, but I am not 100% sure. I used that so there is a bigger color difference so it doesn't mistake anything else for the rock I am looking for.

From: tarajunky
This new function will be included in the next version of SRL.

If anyone needs to use it before then, feel free.

Um… Wouldn't this be hijacking my thread…?

EDIT: Intresting… I post this in the public section, and yet only members reply… i thought at least one leecher would write something like: "Wow, great! Good Job! Rep++ for You!"… I am dissapointed…. xD

ShowerThoughts

2008-05-12 15:20:07

From: Pure1993
No, neither, the colors i chose represent the darkest point of the rock, down to the brightest one, the Main Point is the one appearing the most often, and i think it is just in the middle brightness, but I am not 100% sure. I used that so there is a bigger color difference so it doesn't mistake anything else for the rock I am looking for.


Um… Wouldn't this be hijacking my thread…?

EDIT: Intresting… I post this in the public section, and yet only members reply… i thought at least one leecher would write something like: "Wow, great! Good Job! Rep++ for You!"… I am dissapointed…. xD


Can i play like one! Its not that hard for me!

Leecher:
Great Fletching script 1337 i got even a proggy for you

Script ran for 99:99:99 hours
Fish catch:3

Thanks!

Pure1993

2008-05-12 16:16:40

That post was epic… This is one memory I am not willing to lose, you are going right into my sig mister… xD

ShowerThoughts

2008-05-12 16:19:15

From: Pure1993
That post was epic… This is one memory I am not willing to lose, you are going right into my sig mister… xD


yay!, w00t i want tah l33ch3r cup :D