Log in

View Full Version : Function boolean



Paradoxium
05-22-2012, 05:05 PM
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
05-22-2012, 05:13 PM
Yep, seems fine :)

Paradoxium
05-22-2012, 06:26 PM
Hmm weird, its not working... Maybe its in the rest of the scrpt?

Main
05-22-2012, 06:39 PM
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
05-22-2012, 09:23 PM
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
05-23-2012, 12:41 AM
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