Results 1 to 13 of 13

Thread: Logging out early but not ending

  1. #1
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Logging out early but not ending

    well it cuts some times drops them but not always and then just logs out and does not do the proggy
    I don't have a clue where i have muck up please help and thanks
    SCAR Code:
    Program New;
    {.include SRL/SRL.scar}
    {.include srl/srl/misc/Reports.scar}

    Var x, y, i, LoadsDone, Loads2Do, Tree, LogsCut, AntibanUsed, Timer, Failed, A: Integer;
          Text: array of string;

    procedure DeclarePlayers;
    begin
       HowManyPlayers := 1; //How many Players
       NumberOfPlayers(HowManyPlayers);
       CurrentPlayer :=0; //Starting Player

       Players[0].Name := '';
       Players[0].Pass := '';
       Players[0].Nick := '';
       Players[0].Active := True;
       Players[0].Integers[0]:= 10;        // Loads to Do.
       Players[0].Strings[0] := 'normal'; // ALL lowercase; normal, oak, willow, normal/oak (To make less botty)
       Players[0].Strings[1] := 'true';   // Is your axe equipped? Lowercase
    end;

    Procedure Spin;
    begin
    MarkTime(Timer);
    repeat
    Case Random(4) of
    1: begin
       MakeCompass('N');
       end;
    2: begin
       MakeCompass('E');
       end;
    3: begin
       Makecompass('W');
       end;
    4: begin
       MakeCompass('s');
       end;
    end;
       begin
       Wait(250 + random(500));
       end;
    until (TimeFromMark(Timer) > 2000+random(1000))
    end;

    Procedure AntiBan;
    begin
      if not LoggedIn then Exit;
      Inc(AntibanUsed);
      case 7+random(18) of
        0: HoverSkill('Random', false);
        1: PickUpMouse;
        3: BoredHuman;
        4: begin
             MakeCompass('N');
             wait(10+random(55));
             MakeCompass('S');
             wait(10+random(55));
             MakeCompass('N');
           end;
        5: RandomRClick;
        6: RandomMovement;
        10: Spin;
      end;
    end;

    procedure AntiRandoms;
    begin
      LampSkill := 'Woodcutting';
      FindNormalRandoms;
    end;

     Procedure SetTree;
    begin
       case lowercase(Players[CurrentPlayer].Strings[0]) of
       'normal' : begin
                    Tree := 4555383;
                    Text := ['ree']
                    end;
       'oak'    : begin
                    Tree := 5017731;
                    Text := ['Oak']
                    end;
       'willow' : begin
                    Tree := 6653571;
                    Text := ['illow']
                    end;
     'normaloak':begin
                    Tree := 4555383;
                    Text := ['ree', 'Oak', 'ak']
                    end;
       end;
    end;

    procedure Drop;
    begin
     Inc(LoadsDone);
        case lowercase(Players[CurrentPlayer].Strings[1]) of
        'true': begin
                 for i:= 1 to 28 do
                  begin
                    DropAll;
                    IncEx(LogsCut, 28);
                  end;
                end;
        'false': begin
                  for i:= 2 to 28 do
                   begin
                     DropItem(i);
                     IncEx(LogsCut, 27);;
                   end;
                 end;
        end;
        AntiBan;
        AntiRandoms;
    end;



    Procedure CutTree;
    Begin
      If (not LoggedIn) then
       Exit;
       MouseSpeed := RandomRange(14, 19);
        begin
         MarkTime(Timer);
          repeat
           if(TimeFromMark(Timer) > 600000+random(100000))then
            begin
             Writeln('Problem chopping the logs');
             Exit;
            end;
             SetTree;
             FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text);
             GetMousePos(x,y);
             Wait(50 + random(150));
              if(random(8) = 1)then
               begin
                 Mouse(x, y, 0, 0, False);
                 ChooseOption('hop');
                 Wait(5500 + Random(5000));
               end else
                 begin
                  Mouse(x, y, 0, 0, True);
                  Wait(5000 + Random(5000));
                  AntiRandoms;
                  AntiBan;
                 end;
                   if not(FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)) then
                     repeat
                       Spin;
                       AntiBan;
                       Wait(6000 + random(1000));
                       Inc(Failed);
                     until (FindObjTPA(x, y, Tree, 7, 2, 20, 20, 12, Text)) or (Failed = 7);
                       if (Failed = 7) then
                       NextPlayer(False);
          until (Invfull)
        end;
    end;

    Procedure Intro;
    begin
      ClearDebug;
      Writeln('                                 ____________     ')
      Wait(100)
      Writeln('                                / Thanks     \    ')
      Wait(100)
      Writeln('                               /     For      \   ')
      Wait(100)
      Writeln('                              /       Using    \  ')
      Wait(100)
      Writeln('                              |         Power   | ')
      Wait(100)
      Writeln('                              |        Tree     | ')
      Wait(100)
      Writeln('                               \      Noobe     / ')
      Wait(100)
      Writeln('                                \______________/  ')
      Wait(100)
      Writeln('           Please post Proggys      |     |       ')
      Wait(100)
      Writeln('           And Bugs                 |     |       ')
      Wait(100)
      Writeln('           Thanks                   |     |       ')
      Wait(100)
      Writeln('                                    |     |       ')
      Wait(100)
      Writeln('                                    |_____|       ')
      Writeln('          By Rya                                  ')
      Wait(750)
    end;


    Procedure Proggy;
    begin
      ClearDebug;
      Writeln('===================================');
      Writeln('===== Time Running : ' + TimeRunning);
      Writeln('===== Logs Cut     : ' + IntToStr(LogsCut));
      Writeln('===== Loads Done   : ' + IntToStr(LoadsDone));
      Writeln('===== This is Version  1.3');
      Writeln('===== Please Post This Proggy');
      Writeln('===================================');
    end;

    Procedure Mainloop;
    begin
      DeclarePlayers;
      LoginPlayer;
      LoadsDone := 0;
      MakeCompass('N');
      SetAngle(True);
      Wait(1000);
       repeat
        repeat
          CutTree;
          AntiRandoms;
          AntiBan;
          Drop;
          AntiRandoms;
        until (LoadsDone >= Loads2Do) or (not LoggedIn)
              if LoadsDone >= Loads2Do then
              NextPlayer(False);
              Proggy;
                if (not LoggedIn) then
                NextPlayer(False);
                LoginPlayer;
       until (AllPlayersInactive);
         Proggy;
    end;


    begin
    SetupSRL;
    Intro;
    Mainloop;
    end.
    P.S. This is my first Scirpt
    Last edited by rya; 08-21-2009 at 07:11 PM.
    I see Now, says the blind man

  2. #2
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Left User + Pass in script. Changed + PM'd.

  3. #3
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    If after an 'if' statement you have more than one line, then you need a begin and end clause:

    SCAR Code:
    if LoadsDone >= Loads2Do then
    Begin  
      NextPlayer(False);
      Proggy;
    End;

  4. #4
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Procedure Mainloop;
    Begin
      DeclarePlayers;
      LoginPlayer;
      LoadsDone := 0;
      MakeCompass('N');
      SetAngle(True);
      Wait(1000);
      Repeat
        Repeat
          CutTree;
          AntiRandoms;
          AntiBan;
          Drop;
          AntiRandoms;
        Until (LoadsDone >= Loads2Do) Or (Not LoggedIn)
          If LoadsDone >= Loads2Do Then NextPlayer(False);
        Proggy;
        If (Not LoggedIn) Then NextPlayer(False);
        LoginPlayer;
      Until (AllPlayersInactive);
      Proggy;
    End;

    Should be

    SCAR Code:
    Procedure Mainloop;
    Begin
      DeclarePlayers;
      LoginPlayer;
      LoadsDone := 0;
      MakeCompass('N');
      SetAngle(True);
      Wait(1000);
      Repeat
        Repeat
          CutTree;
          AntiRandoms;
          AntiBan;
          Drop;
          AntiRandoms;
        Until (LoadsDone >= Loads2Do) Or (Not LoggedIn)
          If LoadsDone >= Loads2Do Then
        Begin
          NextPlayer(False);
          Proggy;
        End;
        If (Not LoggedIn) Then
        Begin
          NextPlayer(False);
          LoginPlayer;
        End;
      Until (AllPlayersInactive);
      Proggy;
    End;

    Try that.

    Work on your standards. Easier to see where you go wrong.

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  5. #5
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well i changed the main loop and it just does the same thing
    Help please


    and in the debug i get
    Dropping by pattern: 1
    NextPlayer
    SwitchToPlayer(PlayerNo: 0, Active: False);
    Player is not Active...
    NextPlayer
    Last edited by rya; 08-21-2009 at 09:55 PM.
    I see Now, says the blind man

  6. #6
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think I know why this happens. Because you got not other active players left. If you want to do something against it write a function that checks if we got any active players left or no. If yes you can call NextPlayer, if no just terminate the script.

  7. #7
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Actually, it's due to the fact that if you call NextPlayer when there are no active characters, it'll send the script into an infinite loop.

  8. #8
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if you wish to break the infinate nextplayer loop simply add something like this:

    SCAR Code:
    Procedure Finish;
    begin
      TerminateScript;
    end;

    and at the start of your mainloop (under setupSRL) add:

    SCAR Code:
    SRL_Procs[srl_InNextPlayerLoop] := @Finish;


  9. #9
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    if you wish to break the infinate nextplayer loop simply add something like this:

    SCAR Code:
    Procedure Finish;
    begin
      TerminateScript;
    end;

    and at the start of your mainloop (under setupSRL) add:

    SCAR Code:
    SRL_Procs[srl_InNextPlayerLoop] := @Finish;


    Thanks it ends now but still its not doing more then one load it just does one drops and loggs off
    I see Now, says the blind man

  10. #10
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Program New;
    {.include SRL/SRL.scar}
    {.include srl/srl/misc/Reports.scar}

    var
      x, y, i, LoadsDone, Loads2Do, Tree, LogsCut, AntibanUsed, Timer, A: Integer;
      Text: TStringArray;

    procedure DeclarePlayers;
    begin
       HowManyPlayers := 1; //How many Players
       NumberOfPlayers(HowManyPlayers);
       CurrentPlayer := 0; //Starting Player

       Players[0].Name := '';
       Players[0].Pass := '';
       Players[0].Nick := '';
       Players[0].Active := True;
       Players[0].Integers[0]:= 10;        // Loads to Do.
       Players[0].Strings[0] := 'normal'; // ALL lowercase; normal, oak, willow, normal/oak (To make less botty)
       Players[0].Booleans[0] := True;   // Is your axe equipped? BOOLEAN: "TRUE" or "FALSE"
    end;

    Procedure Spin;
    begin
      MarkTime(Timer);
      repeat
        case Random(4) + 1 of
          1: MakeCompass('N');
          2: MakeCompass('E');
          3: Makecompass('W');
          4: MakeCompass('s');
        end;
        Wait(250 + random(500));
      until (TimeFromMark(Timer) > 2000 + Random(1000));
    end;

    Procedure AntiBan;
    begin
      if (not LoggedIn) then exit;
      Inc(AntibanUsed);
      case Random(18) of
        0: HoverSkill('Random', false);
        1: PickUpMouse;
        3: BoredHuman;
        4: begin
          MakeCompass('N');
          Wait(10 + Random(55));
          MakeCompass('S');
          Wait(10 + Random(55));
          MakeCompass('N');
        end;
        5: RandomRClick;
        6: RandomMovement;
        10: Spin;
      end;
    end;

    procedure AntiRandoms;
    begin
      FindNormalRandoms;
    end;

     Procedure SetTree;
    begin
       case lowercase(Players[CurrentPlayer].Strings[0]) of
         'normal': begin
           Tree := 4555383;
           Text := ['ree']
         end;
         'oak': begin
           Tree := 5017731;
           Text := ['Oak']
         end;
         'willow' : begin
           Tree := 6653571;
           Text := ['illow']
         end;
        'normaloak': begin
          Tree := 4555383;
          Text := ['ree', 'Oak', 'ak']
        end;
      end;
    end;

    procedure Drop;
    var
      StartInvSpot: Byte;
     
    begin
      Inc(LoadsDone);
      if Players[CurrentPlayer].Booleans[0] then
        DropAll;
      end else
        DropArray([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
          18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]);
      IncEx(LogsCut, 27 + Integer(Players[CurrentPlayer].Booleans[0]));
      AntiBan;
      AntiRandoms;
    end;

    procedure CutTree;
    var
      Failed: Integer;
     
    begin
      if (not LoggedIn) then exit;
      MouseSpeed := RandomRange(14, 19);
      MarkTime(Timer);
      repeat
        if (TimeFromMark(Timer) > 600000 + Random(100000)) then
        begin
          Writeln('Problem chopping the logs');
          Exit;
        end;
        SetTree;
        if FindObjTPA(X, Y, Tree, 7, 2, 20, 20, 12, Text) then
        begin
          GetMousePos(X, Y);
          if (Random(8) = 1) then
          begin
            Mouse(x, y, 0, 0, False);
            ChooseOption('hop');
          end else
            Mouse(x, y, 0, 0, True);
        end else
        begin
          WriteLn('#' + IntToStr(Failed) + ' times finding the tree.');
          if (Failed > 7) then
          begin
            WriteLn('Failed to find the tree over 7 times now, logging out player.');
            LogOut;
            Players[CurrentPlayer].Active := False;
            Exit;
          end;
          Spin;
        end;
        Wait(5500 + Random(5000));
        AntiRandoms;
        AntiBan;
      until (Invfull);
    end;

    Procedure Intro;
    begin
      ClearDebug;
      Writeln('                                 ____________     ')
      Wait(100)
      Writeln('                                / Thanks     \    ')
      Wait(100)
      Writeln('                               /     For      \   ')
      Wait(100)
      Writeln('                              /       Using    \  ')
      Wait(100)
      Writeln('                              |         Power   | ')
      Wait(100)
      Writeln('                              |        Tree     | ')
      Wait(100)
      Writeln('                               \      Noobe     / ')
      Wait(100)
      Writeln('                                \______________/  ')
      Wait(100)
      Writeln('           Please post Proggys      |     |       ')
      Wait(100)
      Writeln('           And Bugs                 |     |       ')
      Wait(100)
      Writeln('           Thanks                   |     |       ')
      Wait(100)
      Writeln('                                    |     |       ')
      Wait(100)
      Writeln('                                    |_____|       ')
      Writeln('          By Rya                                  ')
      Wait(750)
    end;


    Procedure Proggy;
    begin
      ClearDebug;
      Writeln('===================================');
      Writeln('===== Time Running : ' + TimeRunning);
      Writeln('===== Logs Cut     : ' + IntToStr(LogsCut));
      Writeln('===== Loads Done   : ' + IntToStr(LoadsDone));
      Writeln('===== This is Version  1.3');
      Writeln('===== Please Post This Proggy');
      Writeln('===================================');
    end;

    Procedure Mainloop;
    begin
      DeclarePlayers;
      LampSkill := 'Woodcutting';
      LoginPlayer;

      MakeCompass('N');
      SetAngle(True);
      Wait(1000);
      repeat
        repeat
          CutTree;
          AntiRandoms;
          AntiBan;
          Drop;
          AntiRandoms;
        until (LoadsDone >= Loads2Do) or (not LoggedIn);
        NextPlayer(False);
        Proggy;
      until (AllPlayersInactive);
    end;


    begin
      SetupSRL;
      Intro;
      Mainloop;
    end.

    Something like this should do it.
    I'm not sure, but I think I fixed the problem.
    Plus, I tried to improve some of your code.

  11. #11
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I may not right, but when I was a beginner(yesterday? :P) and I wanted to learn I didn't like this kind of help as much as explaining(still very nice, don't misunderstood me). It's more or less copy/pasting. It would be cool to comment what you have changed and why. Especially why. So even others can learn from it.
    Sorry if this sounded too harsh.

  12. #12
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sabzi View Post
    I may not right, but when I was a beginner(yesterday? :P) and I wanted to learn I didn't like this kind of help as much as explaining(still very nice, don't misunderstood me). It's more or less copy/pasting. It would be cool to comment what you have changed and why. Especially why. So even others can learn from it.
    Sorry if this sounded too harsh.
    I guess you're right, I'll try to adjust more to that in the future.
    It's just that I find editing scripts so much easier than explaining..
    Plus, I've learned the most from personally looking at scripts and figuring how they work by myself, so I guess it might have something to do with that.

    Still, thanks for correcting me, I'll try to take that into consideration in the future.

  13. #13
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by EvilChicken! View Post
    I guess you're right, I'll try to adjust more to that in the future.
    It's just that I find editing scripts so much easier than explaining..
    Plus, I've learned the most from personally looking at scripts and figuring how they work by myself, so I guess it might have something to do with that.

    Still, thanks for correcting me, I'll try to take that into consideration in the future.
    Yeah, I have learned much from figuring out scripts too but not everybody is the same. So when I am helping(well, trying) I also tries to explain, hoping it will make more sense. And I am not talking about explaining every line of every script you write. Just fixes/changes when somebody asks for help in his/her procedure/function/script.
    Plus you are a . You should be able to explain as you have mentioned it's harder

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
  •