Results 1 to 5 of 5

Thread: Doesnt make the loop.

  1. #1
    Join Date
    Mar 2012
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Doesnt make the loop.

    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.


    Code:
    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;
      repeat
        if(not(loggedin)) then
           Exit;
        PickBanana;
      until(InvFull);
     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.
    Last edited by Mor; 04-07-2012 at 04:09 PM.

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

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

    Simba Code:
    until(InvFull());
    There used to be something meaningful here.

  3. #3
    Join Date
    Mar 2012
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Frement View Post
    I'm not quite sure, but could it be that you are missing the "(" and ")"?

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

  4. #4
    Join Date
    May 2008
    Location
    ;)
    Posts
    576
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

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

  5. #5
    Join Date
    Mar 2012
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by nickrules View Post
    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:

    Code:
    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;
    
    
    function InvFull22: Boolean //Copy-Paste from the srl folder
    begin
      Result := (InvCount = 28);
    end;
    
    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
            Writeln('didnt find a color');
            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
       Writeln(' find a color');
       PickBanana;
       Writeln('didnt find a color1');
     until (InvFull22);
       Writeln('didnt find a color2');
    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:

    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
    Last edited by Mor; 04-07-2012 at 09:56 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •