SRL Archive - OSR Help

Can you see the error?


GREEN GIANT

2013-07-26 18:13:09

Just a quick one, can anyone see why this 'if/ until' loop wont work?
I want to loop the function until the chatbox appears or until TimeFromMark > 10000.

begin
MarkTime(T);
repeat
if (TimeFromMark(T) > 10000) then
break else
begin
if FindObjCustom(x, y, ['-to'], [8158599], 2) then
Wait(randomRange(100, 250));
ClickMouse2(Mouse_Right);
WaitOption('alkuu', 300);
Wait(RandomRange(800, 1000))
until AreTalking();
exit;
end;
end;

serajin

2013-07-26 18:17:30

You're missing an end. You end your Until, before you end your second if.

begin
MarkTime(T);
repeat
if (TimeFromMark(T) > 10000) then
break else
begin
if FindObjCustom(x, y, ['-to'], [8158599], 2) then
Wait(randomRange(100, 250));
ClickMouse2(Mouse_Right);
WaitOption('alkuu', 300);
Wait(RandomRange(800, 1000))
end;
until AreTalking();
exit;
end;

Chris!

2013-07-26 18:24:07

procedure Something;
var
T: Integer;
begin
MarkTime(T); //Must be global var if not including in vars here.
begin
if (TimeFromMark(T) > 10000) then
Exit;
repeat
begin
Wait(RandomRange(100, 250));
ClickMouse2(Mouse_Right);
WaitOption('alkuu', 300);
Wait(RandomRange(800, 1000));
end;
if (TimeFromMark(T) > 10000) then
Exit;
until (AreTalking);
end;
end;

This compiles, not sure if it works or does what you want.

For starters, you cannot do this:


if (Something) then
Break else
begin..

Break needs to be in a loop or what's it going to break out of? I suggest you adopt the SRL standards so you can troubleshoot your script better and easier next time! ;) Good luck.

The Mayor

2013-07-26 18:39:55

From: Chris!
Break needs to be in a loop


It was in a repeat…until loop ;)


You could make it repeat until areTalking OR t > 10sec.


procedure something;
begin
markTime(t);
repeat
if findObjCustom(x, y, ['-to'], [8158599], 2) then
begin
wait(randomRange(100, 250));
clickMouse2(mouse_Right);
waitOption('alkuu', 300);
wait(randomRange(800, 1000))
end;
until(timeFromMark(t) > 10000) or areTalking;
end;

GREEN GIANT

2013-07-26 18:58:47

It was in a repeat…until loop


You could make it repeat until areTalking OR t > 10sec.

Simba Code:
procedure something;
begin
markTime(t);
repeat
if findObjCustom(x, y, ['-to'], [8158599], 2) then
begin
wait(randomRange(100, 250));
clickMouse2(mouse_Right);
waitOption('alkuu', 300);
wait(randomRange(800, 1000))
end;
until(timeFromMark(t) > 10000) or areTalking;
end;


Break needs to be in a loop or what's it going to break out of? I suggest you adopt the SRL standards so you can troubleshoot your script better and easier next time! ;) Good luck.


Thanks guy, all were very helpful but i opted for 'The Mayor's' method.

In regard to adopting standard, yes i should, but like a lot of people on here i'm trying to run before i can walk, who has the time ;)

Thanks.