SRL Archive - OSR Help

Doesnt make the loop.


Mor

2012-04-07 12:07:51

Hi,As you can see there is "repeat…until" in the MainLoop procedure
The problem is that it doesnt make this loop.
after picking one banana(in Karamja), the mouse returns to the inventory tab and doesnt pick anymore.
the strange thing here is that: if I put "until(not(loggedIn));" instead of the
"until(InvFull)", the script works well, and the loop is done.


procedure PickBanana;
Var
x, y : Integer;
TPA : TPointArray;
I : Integer;

begin
if not FindColorsSpiralTolerance(MSCX,MSCY,TPA, 1503736, MSX1, MSY1, MSX2, MSY2, 17) then
Exit;
for I := 0 to High(TPA) do
begin
x := TPA[I].x;
y := TPA[I].y;
MMouse(x, y, 3, 3);
wait(400);
if IsUpText('ick') then
begin
Wait(100 + Random(150));
GetMousePos(x, y);
Mouse(x, y, 1, 1, True);
Wait(500 + Random(250));
Break;
end;
end;
end;

procedure MainLoop;
begin
WalkToPort;
TalkWithNPC;
GoToBananas;
[B]repeat
if(not(loggedin)) then
Exit;
PickBanana;
until(InvFull);[/B]
end;



begin
//{$IFDEF SMART}
// Smart_Server := 0;
// Smart_Members := True;
// Smart_Signed := True;
// Smart_SuperDetail := False;
//{$ENDIF}
SetUpSRL();
ActivateClient();
DeclarePlayers();
LoginPlayer();
repeat
Wait(1000)
until(RsReady());
MainLoop;

end.

Frement

2012-04-07 12:40:38

I'm not quite sure, but could it be that you are missing the "(" and ")"?

until(InvFull());

Mor

2012-04-07 13:29:11

From: Frement
I'm not quite sure, but could it be that you are missing the "(" and ")"?

until(InvFull());


First, thank you for trying to help.:)
Second, I have tried also with (), it's not the problem…

nickrules

2012-04-07 14:09:54

Add more debuging to your picking functions and mainloop. See if you can figure out where something is going wrong.

Mor

2012-04-07 17:24:17

From: nickrules
Add more debuging to your picking functions and mainloop. See if you can figure out where something is going wrong.


Here is what I did to check whats going wrong:

program New1;

{$i srl/srl.simba}
{$i sps/sps.simba}
//{$DEFINE SMART}
//{$IFDEF SMART}
//{$i srl/srl/misc/paintsmart.simba}
//{$ENDIF}

Procedure DeclarePlayers;
begin
HowManyPlayers:=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:=0;


Players[0].Name:='';
Players[0].Pass:='';
Players[0].Active:=True;
end;

[B]
function InvFull22: Boolean //Copy-Paste from the srl folder
begin
Result := (InvCount = 28);
end;[/B]

procedure PickBanana;
Var
x, y : Integer;
TPA : TPointArray;
I : Integer;

begin
if not FindColorsSpiralTolerance(MSCX,MSCY,TPA, 1503736, MSX1, MSY1, MSX2, MSY2, 100) then
begin
[B]Writeln('didnt find a color');[/B]
Exit;
end;
for I := 0 to High(TPA) do
begin
x := TPA[I].x;
y := TPA[I].y;
MMouse(x, y, 3, 3);
wait(300);
if IsUpText('ick') then
begin
Wait(100 + Random(150));
GetMousePos(x, y);
wait(200);
Mouse(x, y, 1, 1, True);
Wait(500 + Random(250));
Break;
end;
end;
end;



procedure MainLoop;
begin
repeat
[B]Writeln(' find a color');[/B]
PickBanana;
[B]Writeln('didnt find a color1');[/B]
until (InvFull22);
[B]Writeln('didnt find a color2');[/B]
end;

begin
//{$IFDEF SMART}
// Smart_Server := 0;
// Smart_Members := True;
// Smart_Signed := True;
// Smart_SuperDetail := False;
//{$ENDIF}
SetUpSRL();
ActivateClient();
DeclarePlayers();
LoginPlayer();
repeat
Wait(1000)
until(RsReady());
MainLoop;

end.


And here is the result in the debug after running the code:

Compiled successfully in 734 ms.
SRL Compiled in 0 msec
Current player: xxx
find a color
didnt find a color1
Successfully executed.

The meaning is that it runs only one time and doesn't make the loop.
But I don't know why. :(

edit: It works in SMART but not in the brwoser