
Originally Posted by
nero_dante
Thanks again all for the quik reply and support you guys give and I'm probably going to be bring out quite a few different posts to help me through my beginning scripting days. Hope its okay to all :P
What I'm stuck on n ow, is finding out how to repeat a procedure if it fails. That's the code below. It hovers over the log beam and if it finds the text it clicks, but if it doesn't I want it to repeat the procedure, is there a way of doing that?
Code:
procedure WalkLogBeam();
var
logBeam: Tbox;
begin
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_MOVE);
if isMouseOverText('alk log bea, log beam') then
fastClick(MOUSE_LEFT)
else begin
writeLn('Can not find Looking again');
WriteLn('Walking over LogBeam');
wait(gaussRangeInt(5600,5800));
end;
Simba Code:
program blahaalala;
var t:ttimemarker;
function WalkLogBeam():boolean;// <-function will return if succesfull or not;
var
logBeam: Tbox;
begin
result:=false;//<- declare result as false because you havent clicked it yet;
LogBeam := intTobox(286, 50, 293, 180);
mouseBox(LogBeam, MOUSE_MOVE);
if isMouseOverText('alk log bea, log beam') then
begin
result:=didclick(true);// <- will give true if mouseclick is red color which means clicked
WriteLn('Walking over LogBeam');
wait(gaussRangeInt(5600,5800));
end
else writeLn('Can not find'); //<- otherwise if fails result stays at false;
end;
begin
if not walklogbeam() then walklogbeam();// <- will repeat once if didnt clicked on beam
//optional//\
t.start();
repeat
wait(200);
until walklogbeam() or t.gettime()>25000;// <- will repeat untill walks through beam, so need failsafe ttimemarker to stop doing infinity loop after 25 secs for example.
//////////
end;
Edit: by the way started to write it as junior member, now member
So you should pretty much apreciate it for that amount of time spended