SRL Archive - Research & Development Lounge

new autocolor function quite fast


Waddo

2008-05-11 12:34:01

will update tongiht so that the main colour can be selected in the function declaration


this is used to locate dynamic colours and find what the current colour is =]

program autocolorit;
{.include srl\srl.scar}


function autocolorit(color,tolmod,tol:integer):integer;
var
x,y,ncolor,pcolor,tcolor,rcolor:integer;
begin
ncolor:=color;
pcolor:=color;
begin
if findcolorspiraltolerance(x,y,color,mmx1,mmy1,mmx2,mmy2,0) then
writeln('color is '+inttostr(color));
end;
if (not(findcolorspiraltolerance(x,y,color,mmx1,mmy1,mmx2,mmy2,0))) then
repeat
ncolor:=ncolor-tolmod;
pcolor:=pcolor+tolmod;
//wait(100);
until((findcolorspiraltolerance(x,y,ncolor,mmx1,mmy1,mmx2,mmy2,tol)or(findcolorspiraltolerance(x,y,pcolor,mmx1,mmy1,mmx2,mmy2,tol))));
rcolor:=pcolor;
if findcolorspiraltolerance(x,y,ncolor,mmx1,mmy1,mmx2,mmy2,10) then rcolor:=ncolor;
writeln('color is '+inttostr(rcolor));




end;

begin
cleardebug;
setupsrl;
makecompass('N');
autocolorit(1);
end.

Cazax

2008-05-11 14:34:30

This can get a wrong color. If you pick a color, then you logout, change the world and you try it, you may get another color since there are a lot of differents colors in the minimap.

Waddo

2008-05-11 17:09:49

yer i know i can make it almost perfect easy but it is slower
im gunna edit it a little biit and make it a hell of alot better

it works good for finding roads that cant be found by the other autocolor functions

its mainly for scripters so they can use it and then the user doesnt have to pick the colors eithen if they are dynamic


it shud get the closet colour perfect if tol mod and tol are set to 1(might be 0 which ever is lowest)

Cazax

2008-05-11 17:12:40

From: waddo
yer i know i can make it almost perfect easy but it is slower
im gunna edit it a little biit and make it a hell of alot better

it works good for finding roads that cant be found by the other autocolor functions

its mainly for scripters so they can use it and then the user doesnt have to pick the colors eithen if they are dynamic

For Road they can use SRL's autocolorers. So make an AutoColor functions for something more dynamic, like mine's.

mixster

2008-05-11 17:13:30

With Scar's colours, - or +'ing a number onto it will change one of the RGB values and not all 3 (will have a different affect on HSL or XYZ numbers) due to the way Scar sets them up. Have an RGB converter to make sure that it evenly applies the minimum and maximum colour searches and they will take way under 1ms so not slow the script down.
Edit: Change the Blue value by the way as I believe Scar makes colours by (R * 255 * 255) + (G * 255) + B.