SRL Archive - SRL Archives

SetBar


Sir R. M8gic1an

2008-06-11 10:05:32

well, SetBar sometimes messes up for me, it doesn't get the brightness on the right spot, or clicks too to the left and messes it up.


procedure SetBar(Bar: String; Point: Integer);
var
P: TPoint;
TIA: TIntegerArray;
begin
if (not LoggedIn) then Exit;
if (Point < 0) or (Point > 4) then Exit;
GameTab(11);
Wait(100 +Random(50));

if LowerCase(Bar) = 'brightness' then
begin
if Point = 0 then Point:=1;
TIA := [0, 31, 62, 96, 12437197]; //last int is color
end else
TIA := [0, 24, 51, 77, 103, 12436682]; //last int is color

case LowerCase(Bar) of
'brightness': P := IntToPoint(611 + TIA[Point-1] , 229);
'volume': P := IntToPoint(608 + TIA[Point] , 266);
'effect': P := IntToPoint(608 + TIA[Point] , 302);
'area': P := IntToPoint(608 + TIA[Point] , 339);
else srl_Warn('SetBar', 'ERROR: Unknown bar: ''' + Bar + '''', warn_AllVersions);
end;

for point:=0 to 4 do //using point just not to waste any more vars.
begin
if (GetColor(P.x, P.y) = TIA[High(TIA)]) then //check if bar is not already set
Mouse(P.x, P.y, 3, 3, True);

if GetColor(P.x, P.y) <>TIA[High(TIA)] then //checking if RS reacted right
break
else
wait(500+Random(200));
end;
end;

checked the colors and coords in 3 worlds, they were static.

~RM

Freddy1990

2008-06-11 17:55:35

It's funny how the next version of SCAR is actually going to have a function that has TIA in it's name :p

Looks good, except for the few formatting horrors like that capitalised string identifier and the occasional missing space in between operators :p