SRL Archive - SRL Archives

Function AutoColor(Thing : String) : integer;


JuKKa

2007-03-16 14:31:53


function AutoColor(Thing : String) : integer;
begin
if not loggedin then exit;
Writeln('');
Writeln('Hover Your Mouse Over ' + Thing);
repeat
if not loggedin then break;
wait(500);
until(IsUpText(Thing));
if not loggedin then exit;
Getmousepos(x,y);
MMouse(x,y,2,2)
Result:= GetColor(x,y);
writeln('Color = ' + inttostr(Result));
end;


{.include srl/srl.scar}

var color : integer;

function AutoColor(Thing : String) : integer;
begin
if not loggedin then exit;
Writeln('');
Writeln('Hover Your Mouse Over ' + Thing);
repeat
if not loggedin then break;
wait(500);
until(IsUpText(Thing));
if not loggedin then exit;
Getmousepos(x,y);
MMouse(x,y,2,2)
Result:= GetColor(x,y);
writeln('Color = ' + inttostr(Result));
end;

begin
Setupsrl;
Color:= AutoColor('Tree')
Writeln('Color: ' + inttostr(Color))
end.

basically u just run this and hover ur mouse over a tree or something that will trigger the keyword of (Autocolor('Tree')) in that case Tree.

when u move ur mouse over a tree it will pick a color of the tree.
dunno if this already exists in SRL, if not add it or.. this autocolor will not be there..

Pentti

2007-03-16 14:37:08

Or just use SCAR's color picker…
Or the easy way:
Function New:Integer;
var Color:Integer;
begin
FindObj(x,y,'Tree',4255234,5)
Result:=Getcolor(x,y)
end;

Sumilion

2007-03-16 14:45:45

i kinda agree with Pentti ;) as soon as it spots Tree, or whatever you want, it will take the color, but the box in which the mouse must be for it to show Tree isnt always exactly on the tree if im not mistaking. Besides that, the edges usually are more dark than the middle.

tarajunky

2007-03-16 15:02:16

Perhaps increase the delay between checks, and give some sort of feedback in the status bar so the person knows when it's checking.

Like you could have it wait 3 seconds, and have a countdown in the status bar like…


function AutoColor(Thing : String) : integer;
var i:integer;
var e:extended;
begin
if not(LoggedIn) then exit;
Writeln('');
Writeln('Hover Your Mouse Over ' + Thing);
repeat
if not(LoggedIn) then exit;
i:=0;
repeat
if not(LoggedIn) then exit;
i:=i+1;
wait(100);
e:=3-(i*0.1);
Status('Checking color in '+FloatToStr(e)+' seconds...');
until(i>=30);
Status('Checking color!');
Wait(250);
until(IsUpText(Thing));
if not loggedin then exit;
Result:= GetColor(x,y);
writeln('Color = ' + inttostr(Result));
end;