SRL Archive - OSR Help

Problem with main loop..loop


GREEN GIANT

2013-08-07 08:09:01

Hi Guys,
When repeating my main loop it seems to skip out a few lines at the start resulting in it failing :( Can anyone see why?

I haven't included the whole loop just the beginning and end.

Begin
begin
ClearDebug;
setupsrl;
DeclarePlayers;
LoginPlayer;
Loads := 0;
end;
Begin
Repeat
Loads := (Loads + 1);
begin
wait(1500);
StairSetUno;
wait(1500);
StairSetDos;
wait(1500);
end;
If AreaCheckNPC < 3 then
begin
Writeln('Not in Main Hall');
TerminateScript;
end else
begin......
........
end;



end;
until Loads = Trips;
end;
End.

For some reason after completing the loop and starting again it skips out StairsetUno and StairsetDos then does the NPCCheck, writes 'Not in main hall' and terminates. Cant figure why it is skipping the first few lines of the repeat?

Itankbots

2013-08-07 08:28:33

I was pretty confused as to what you were trying to accomplish with the main loop, was pretty messy for me to understand :s So sorry if this isnt correct.
But Pretty much you had it so it would only Repeat adding +1 Loadcount. Since you had another begin right after that, it would only repeat what was between Repeat–>Begin.

If i understood what you were trying to do correctly, i would do something like below (should work, might just need another Begin/End)


Begin
setupsrl;
begin
ClearDebug;
DeclarePlayers;
LoginPlayer;
Loads := 0;
end;
Begin
Repeat
Loads := (Loads + 1);
wait(1500);
StairSetUno;
wait(1500);
StairSetDos;
wait(1500);
until Loads = Trips or AreaCheckNPC < 3 ;
end;
End.

riwu

2013-08-07 09:41:17

How did you know it completed the loop once?
Also 'begin' and 'end' is only needed after a conditional statement when you want to include multiple statements.

DemiseScythe

2013-08-07 09:51:48

From: GREEN GIANT
Hi Guys,
When repeating my main loop it seems to skip out a few lines at the start resulting in it failing :( Can anyone see why?

I haven't included the whole loop just the beginning and end.

For some reason after completing the loop and starting again it skips out StairsetUno and StairsetDos then does the NPCCheck, writes 'Not in main hall' and terminates. Cant figure why it is skipping the first few lines of the repeat?


Just to get in the habit of scripting better, you should have randomness on all Waits to make it harder for RS to detect us since no human can wait exactly 1.5 seconds. Do something like:

Wait(1400 + Random(100));

You will wait an amount of time between 1400 and 1499 ms. Add that to your script and you should be harder to detect.

GREEN GIANT

2013-08-07 10:38:52

From: Itankbots
I was pretty confused as to what you were trying to accomplish with the main loop, was pretty messy for me to understand :s So sorry if this isnt correct.
But Pretty much you had it so it would only Repeat adding +1 Loadcount. Since you had another begin right after that, it would only repeat what was between Repeat–>Begin.

If i understood what you were trying to do correctly, i would do something like below (should work, might just need another Begin/End)


Begin
setupsrl;
begin
ClearDebug;
DeclarePlayers;
LoginPlayer;
Loads := 0;
end;
Begin
Repeat
Loads := (Loads + 1);
wait(1500);
StairSetUno;
wait(1500);
StairSetDos;
wait(1500);
until Loads = Trips or AreaCheckNPC < 3 ;
end;
End.


Yh sorry its very messy :( That is just the first few and last few lines of my entire main loop, i want to repeat the entire main loop between the repeat at the beginning and the until at the end. Each loop should add +1 to the count until the it reaches the same number as trips that i have as a const at the start of the script. This should be a simple repeat until with a counter but ive somehow managed to make it confusing :/