SRL Archive - Help

Function boolean


Paradoxium

2012-05-22 13:05:07

Hi, I am making a script in scar, not rs related but was wondering if my 'FindReadys' func is correct :D

Thanks in advance!

program Main;

var
X,Y: Integer;

function FindReadys:Boolean;

begin
if FindColorTolerance(X, Y,16120397, 765, 208, 786, 229, 20) and FindColorTolerance( X, Y,16120397, 763, 176, 787, 202,20) then

Result:= True
end;


procedure Logintogame;
begin


ClickMouse(671,1018,true); //clicks back into client
Wait(500);

repeat
Wait(200);
Writeln('Waiting for others to be ready'); //(waits until other players are ready)
until(FindReadys = True);

MoveMouseSmooth(748,440);
ClickMouse(748,440,true);
Wait(200);
ClickMouse(748,440,true); //clicks start twice
end;



{procedure WalkOver;
begin

end;}





begin
Logintogame;
//WalkOver;
end.

Abu

2012-05-22 13:13:37

Yep, seems fine :)

Paradoxium

2012-05-22 14:26:21

Hmm weird, its not working… Maybe its in the rest of the scrpt?

Main

2012-05-22 14:39:20


Result := (FindColorTolerance(X, Y,16120397, 765, 208, 786, 229, 20) and FindColorTolerance( X, Y,16120397, 763, 176, 787, 202,20));

There ya go


EDIT:

Also

repeat
Wait(200);
Writeln('Waiting for others to be ready'); //(waits until other players are ready)
until(FindReadys = True);

you can simplify to

repeat
Wait(200);
Disguise('Waiting for others to be ready'); //(waits until other players are ready)
until FindReadys

To be less clutty and shorter hehe

Abu

2012-05-22 17:23:41

From: Paradoxium
Hmm weird, its not working… Maybe its in the rest of the scrpt?


Maybe, all that function is doing is finding the colour.

Add a Debug to it:
function FindReadys:Boolean;
begin
if FindColorTolerance(X, Y,16120397, 765, 208, 786, 229, 20) and FindColorTolerance( X, Y,16120397, 763, 176, 787, 202,20) then
Result:= True
else
begin
Writeln('Couldn''t find the colour'); // so you know if it's finding it or not.
Result := False;
end;
end;

Paradoxium

2012-05-22 20:41:02

From: abu_jwka
Maybe, all that function is doing is finding the colour.

Add a Debug to it:
function FindReadys:Boolean;
begin
if FindColorTolerance(X, Y,16120397, 765, 208, 786, 229, 20) and FindColorTolerance( X, Y,16120397, 763, 176, 787, 202,20) then
Result:= True
else
begin
Writeln('Couldn''t find the colour'); // so you know if it's finding it or not.
Result := False;
end;
end;


Thanks abu, yeah i figured it out, since im switching windows, the coor are tricky and i messed up on those lol