Results 1 to 6 of 6

Thread: Main Loop Issue

  1. #1
    Join Date
    Nov 2006
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Main Loop Issue

    Can someone please help me sort this out. Sorry it is a little long, but trying to clean up / learn from this. This is the Main Loop, but my players only log in each once then the script stops.

    SCAR Code:
    begin
     SetUpSRL;
     ScriptID :='95';
     beginscript;

     NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
     activateclient;
     If Not(loggedin) Then
       LoginPlayer;
     If (LoggedIn) Then
     Begin
     Repeat
      Repeat
       cuttree;
      until(Invfull)
      burn;
      dropit;
      ProgressReport;
     Until(LoadsToFinish <= Loads)
     if (LoadsToFinish <= Loads) Then
     Begin
       ProgressReport;
       Writeln('Logging on to next player...')
       ProgressReport;
       Logout;
       NextPlayer(True);
       begin
            if not loggedin then
             RandomNextPlayer(True);
          end;

      End;
      end;
       If Not(loggedin) Then
       LoginPlayer;
     
      If (LoggedIn) Then
     Begin
     Repeat
      Repeat
       cuttree;
      until(Invfull)
      burn;
      dropit;
      ProgressReport;
     Until(LoadsToFinish <= Loads)
     if (LoadsToFinish <= Loads) Then
     Begin
       ProgressReport;
       Writeln('Logging on to next player...')
       ProgressReport;
       Logout;
       NextPlayer(true);
       begin
            if not loggedin then
             RandomNextPlayer(True);
          end;



      End;
      If Not(loggedin) Then
       LoginPlayer;

      If (LoggedIn) Then
     Begin
     Repeat
      Repeat
       cuttree;
      until(Invfull)
      burn;
      dropit;
      ProgressReport;
     Until(LoadsToFinish <= Loads)
     if (LoadsToFinish <= Loads) Then
     Begin
       ProgressReport;
       Writeln('Logging on to next player...')
       ProgressReport;
       Logout;
       NextPlayer(true);
       begin
            if not loggedin then
             LoginPlayer;
          end;
      end;
    End;
    end;
    end.

    so then I modified it down to
    SCAR Code:
    begin
     SetUpSRL;
     ScriptID :='95';
     beginscript;

     NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
     activateclient;
     If Not(loggedin) Then
       LoginPlayer;
     If (LoggedIn) Then
     Begin
     Repeat
      Repeat
       cuttree;
      until(Invfull)
      burn;
      dropit;
      ProgressReport;
     Until(LoadsToFinish <= Loads)
     if (LoadsToFinish <= Loads) Then
     Begin
       ProgressReport;
       Writeln('Logging on to next player...')
       ProgressReport;
       Logout;
       NextPlayer(true);
       begin
            if not loggedin then
             LoginPlayer;
          end;
      end;
    End.
    But then it logs them in, but never do they do anything, they just stand there, then log out, and back in.

    Can someone illuminate how I should run this Main Loop properly?
    Thanks a million in advance

  2. #2
    Join Date
    Dec 2006
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What you have isn't really a loop. I'm assuming you want it to keep doing this for each player, so you would have to put
    SCAR Code:
    begin
      repeat
        //put the code here that you want in the main loop
      until(false) //this will make it loop forever
    end.

    also, in the modified version, i only see 3 end's, however there are 4 begin's

  3. #3
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Umm....what he has there is a loop

    I'm not sure how to solve your problem, cause I'm having the same problem, too
    Interested in C# and Electrical Engineering? This might interest you.

  4. #4
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    You'll have to show us your procedure. We can't do anything with what you're telling us right now.

  5. #5
    Join Date
    Dec 2006
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well sure there are loops, 2 of them in fact, however there is no loop to keep the whole thing going, meaning that after the first player goes through, the script will stop, rather than going to the next player.

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    Nucular: True. You need one extra big surrounding endless loop, the only useful one

    Repeat
    until (False);


    because the final line of your program is NextPlayer(True);. There is nothing anymore, so the program End. 's. Just put:

    SCAR Code:
    REPEAT
    If Not(loggedin) Then
       LoginPlayer;
     If (LoggedIn) Then
     Begin
     Repeat
      Repeat
       cuttree;
      until(Invfull)
      burn;
      dropit;
      ProgressReport;
     Until(LoadsToFinish <= Loads)
     if (LoadsToFinish <= Loads) Then
     Begin
       ProgressReport;
       Writeln('Logging on to next player...')
       ProgressReport;
       Logout;
       NextPlayer(true);
       begin
            if not loggedin then
             LoginPlayer;
          end;
      end;
    UNTIL(FALSE);
    End.

    Doing great!
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Main loop???
    By cloutier15 in forum OSR Help
    Replies: 3
    Last Post: 05-11-2008, 09:53 PM
  2. Restarting your main loop.
    By Rambozin in forum OSR Help
    Replies: 27
    Last Post: 05-02-2007, 12:40 AM
  3. main loop
    By syberium in forum OSR Help
    Replies: 5
    Last Post: 01-23-2007, 07:00 AM

Posting Permissions

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