Results 1 to 3 of 3

Thread: Help with players array

  1. #1
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with players array

    SCAR Code:
    {]|====================================================================================|[]
    []|        _________________________________________________                           |[]
    []|        || Macrosoft Lumbridge Swamp Tar Collector V.1 ||                           |[]
    []|        \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\                           |[]
    []|                          Instructions                                              |[]
    []|                          <><><><><><>                                              |[]
    []| 1. You may start the script anywere, however it is recomended                      |[]
    []|    that you start in the Lumbridge Swamp, as the script will                       |[]
    []|    most likely run longer due to the fact that it uses Lumb Home Tele to           |[]
    []|    reset its place if it gets lost.                                                |[]
    []| 2. Use Runescape on Low Detail, and set it to V-Bright in the Options menu         |[]
    []| 3. Setup Players and other Stuff                                                   |[]
    []| 4. Do not set Players[].Integer1 and Players[].Integer2, I have not added that yet |[]
    []| 5. Please Post Proggies and Happy Autoing!                                         |[]
    []|====================================================================================|[}

    program SwampTarCollector;

    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Magic.scar} //for lumb home tele
    //{.include SRL/SRL/Extended/xBitMap.scar}

    var
     i,n,x,y,TarCollected,TTarCollected, a,b,CTime, TimesSwitched, WalkBacks, Strikes: Integer;
     FlagBmap: Integer;
     MaybeStrike: Boolean;
    {-_-_-_-_Player Setup_-_-_-_-}
    {}Procedure DeclarePlayers;
    {} begin
    {}  HowManyPlayers := 6;
    {}  NumberOfPlayers(HowManyPlayers);
    {}  CurrentPlayer := 0; //Player to start on.
    {}
    {}  Players[0].Name := 'Username';
    {}  Players[0].Pass := 'Password';
    {}  Players[0].Nick := 'ame'; //A 3 to 4 letter section of your username that does not have any capitals
    {}  Players[0].Integers[0] := 100; //How much tar to collect before switching players?
    {}  Players[0].Integers[1] := 120;  //Maximum amount of time (in minutes) to auto on this player
    {}  Players[0].Booleans[0] := True;{If true, the player will become Active again
    {}
                                 //after 30 mins because it will be able to reset itself with
    {}                              //lumb home tele}
    {}  Players[0].Booleans[1] := True;{If true, the script will reset itself with lumb home tele
    {}
                               //if it gets lost}
    {}  Players[0].Active := True; //Will you be using this player to auto?
    {}
    {}
    {}
    {}  Players[1].Name := 'Username';
    {}  Players[1].Pass := 'Password';
    {}  Players[1].Nick := 'ame'; //A 3 to 4 letter section of your username that does not have any capitals
    {}  Players[1].Integers[0] := 500; //How much tar to collect before switching players?
    {}  Players[1].Integers[1] := 120;  //Maximum amount of time (in minutes) to auto on this player
    {}  Players[1].Booleans[0] := True;{If true, the player will become Active again
    {}
                                 //after 30 mins because it will be able to reset itself with
    {}                              //lumb home tele}
    {}  Players[1].Booleans[1] := True;{If true, the script will reset itself with lumb home tele
    {}
                                 //if it gets lost}
    {}  Players[1].Active := False; //Will you be using this player to auto?
    {}
    {}
    {}
    {}  Players[2].Name := 'Username';
    {}  Players[2].Pass := 'Password';
    {}  Players[2].Nick := 'ame';
    {}  Players[2].Integers[0] := 100;
    {}  Players[2].Integers[1] := 120;
    {}  Players[2].Booleans[0] := True;
    {}  Players[2].Booleans[1] := True;
    {}  Players[2].Active := False;
    {}
    {}
    {}  Players[3].Name := 'Username';
    {}  Players[3].Pass := 'Password';
    {}  Players[3].Nick := 'ame';
    {}  Players[3].Integers[0] := 100;
    {}  Players[3].Integers[1] := 120;
    {}  Players[3].Booleans[0] := True;
    {}  Players[3].Booleans[1] := True;
    {}  Players[3].Active := False;
    {}
    {}
    {}  Players[4].Name := 'Username';
    {}  Players[4].Pass := 'Password';
    {}  Players[4].Nick := 'ame';
    {}  Players[4].Integers[0] := 100;
    {}  Players[4].Integers[1] := 120;
    {}  Players[4].Booleans[0] := True;
    {}  Players[4].Booleans[1] := True;
    {}  Players[4].Active := False;
    {}
    {}
    {}  Players[5].Name := 'Username';
    {}  Players[5].Pass := 'Password';
    {}  Players[5].Nick := 'ame';
    {}  Players[5].Integers[0] := 100;
    {}  Players[5].Integers[1] := 120;
    {}  Players[5].Booleans[0] := True;
    {}  Players[5].Booleans[1] := True;
    {}  Players[5].Active := False;
    {}
    {}
    {}  Players[6].Name := 'Username';
    {}  Players[6].Pass := 'Password';
    {}  Players[6].Nick := 'ame';
    {}  Players[6].Integers[0] := 100;
    {}  Players[6].Integers[1] := 120;
    {}  Players[6].Booleans[0] := True;
    {}  Players[6].Booleans[1] := True;
    {}  Players[6].Active := False;
    {}
    {}
    {}  Players[7].Name := 'Username';
    {}  Players[7].Pass := 'Password';
    {}  Players[7].Nick := 'ame';
    {}  Players[7].Integers[0] := 100;
    {}  Players[7].Integers[1] := 120;
    {}  Players[7].Booleans[0] := True;
    {}  Players[7].Booleans[1] := True;
    {}  Players[7].Active := False;
    {}
    {}
    {}  Players[8].Name := 'Username';
    {}  Players[8].Pass := 'Password';
    {}  Players[8].Nick := 'ame';
    {}  Players[8].Integers[0] := 100;
    {}  Players[8].Integers[1] := 120;
    {}  Players[8].Booleans[0] := True;
    {}  Players[8].Booleans[1] := True;
    {}  Players[8].Active := False;
    {}
    {}
    {}  Players[9].Name := 'Username';
    {}  Players[9].Pass := 'Password';
    {}  Players[9].Nick := 'ame';
    {}  Players[9].Integers[0] := 100;
    {}  Players[9].Integers[1] := 120;
    {}  Players[9].Booleans[0] := True;
    {}  Players[9].Booleans[1] := True;
    {}  Players[9].Active := False;
    {}
    {}  LoadPlayerArray;
    {}  var  STime: Array[0..HowManyPlayers -1] of Integer;
    {}  PlayerUsed: Array[0..HowManyPlayers -1] of Boolean;
    {}  LumbMins: Array[0..HowManyPlayers -1] of longint;
    {}  TarCollected: Array[0..HowManyPlayers -1] of integer;
    {}end;

    Procedure PregressReport;
     begin
       writeln('_-_-_-_-_-Macrosoft Lumbridge Swamp Tar Collector-_-_-_-_-_');
       writeln('_-_-_-_-_-_-_-_-_-_-_-Progress Report-_-_-_-_-_-_-_-_-_-_-_');
       writeln('');
       writeln('Worked for: ' + ScriptTime2(2));
       writeln('Colected a total of ' + inttostr(TTarCollected) + ' swamp tar');
       begin
         For a:= 0 to HowManyPlayers -1 do
           begin
             if(PlayerUsed[a]=True) then
               writeln('Collected ' + inttostr(TarCollected[a])+' on ' + Players[a].Name)
           end;
       end;
       writeln('Switched Players ' + inttostr(TimesSwitched) + ' time(s)');
       writeln('Teleported to lumbridge and walked back ' + inttostr(WalkBacks) + ' time(s)');
       writeln('Post this progress report and any other comments or suggestions');
       writeln('on [url]http://www.srl-forums.com/[/url] or suffer the title of leecher!');
       writeln('You Leech, You Die!');
    end;
    Function NoneActive: Boolean;
     begin
       begin
         for n:=0 to HowManyPlayers - 1 do
           begin
               begin
                 If(Players[n].Active) then
                   begin
                     result:=False;
                     Exit;
                   end;
               end;
             n:=n+1;
           end;
       end;
       Result:=True;
     end;
     
     
    Function ReActivatePlayers: Boolean;
     begin
        NoneActive;
        begin
          if(NoneActive) then
            begin
              for CurrentPlayer:=0 to HowManyPlayers - 1 do
                begin
                  if(Players[CurrentPlayer].Boolean1) then
                    begin
                      GetSystemTime=CTime;
                      begin
                        If(CTime - STime[CurrentPlayer]=>LumbMins[CurrentPlayer] * 6000) then
                          Player[CurrentPlayer].Active:=True;
                      end;
                    end;
                    CurrentPlayer:=CurrentPlayer+1;
                end;
            end;
            NoneActive;
            begin
              If(NoneActive)then
                Result:= False
              else
                begin
                  Result:= True;
                end;
            end;
        end;
     end;

    Procedure NextPlayerCycle;
     begin
        logout;
        a:=0;
        GetSystemTime:=Stime[CurrentPlayer];
        Player[CurrentPlayer].Active:=False;
        repeat
          a:=a+1;
          begin
            If(CurrentPlayer>HowManyPlayers - 1) then
              CurrentPlayer:=0
            else
              CurrentPlayer:=CurrentPlayer + 1;
          end;
          begin
            if(a=HowManyPlayers) then
              begin
                ReActivatePlayers;
                begin
                  if(ReActivatePlayers) then
                    a:=0;
                  else
                    ProgressReport;
                    TerminateScript;
                end;
              end;
          end;
        until(Players[CurrentPlayer].Active);
        LoginPlayer;
        TimesSwitched:= TimesSwitched + 1;
    end;

    Procedure LogInIfNot;
     begin
       if(not(LoggedIn))then
         begin
           LoginPlayer;
           wait(1000 + random(100));
         end;
     end;
     
    Function LumbTele: Boolean;
     begin
       GameTab(7);
       wait(1000 + random(100));
       GetLumbridgeMins= LumbMins[CurrentPlayer];
       begin
         if (not(GetLumbridgeMins=0)) then
           Result:=False;
         else
           Reslult:=True;
       end;
     end;
    Function WalkToSwamp: Boolean;
     begin
       RadialWalk( 608291, 176, 208, 67, 2, 2);
       wait(500 + random(50));
       Flag;
       FindColorTolerance(x, y, 8097105, MMX1, MMY1, MMX2, MMY2, 10);
       wait(100 + random(50));
       Mouse(x, y, 5, 5, True);
       FlagBmap := BitmapFromString2(False, 'a2A0D078DAEDD0310AC0200C8' +
           '5E12BBDD818ED285AEF7FA426BA08A238746C869F123E2B080029' +
           '6AE0B3E566EB631BCF8F3539AD8B6DDF4D15ADD81A9CEC3B38DB4' +
           'B206B095A6AFFBCDAD9CD1041EF604705B1561C4E97277E947B3F' +
           'CB955FC9D9EFE5E84FE4F9FBF4C9E205FCFB6FFD0B918');
       i:=0;
       wait(5000 + random(500);
       repeat
         begin
           Wait(1000 +random(50));
           i:=i +1;
         end;
       until(FindBitMapTolRaiser(FlagBmap, x, y, 2, 10, MMX1, MMY1, MMX2, MMY2))or(i=4);
       FreeBitmap(FlagBmap);
       wait(100 + random(25));
       Flag;
       RadialWalk(6059563 , 166, 210, 54, 2, 2);
       Wait(500 + random(100);
       Flag;
       begin
         if(SwampCheck) then
           begin
             Writeln('Walked to Swamp Succesfully');
             WalkBacks:=WalkBacks +1;
             Result:=True
         end else
           begin
             Writeln('Didnt Walk to Swamp succesfully');
             Result:=False;
           end;
       end;
    end;
    Function SwampCheck: Boolean;//checks if in the swamp
     begin
       begin
         if (not(FindMMColorTol(x, y, 7965518, 15))) and (not(FindMMColorTol(x, y, 6191915, 20)))then
           begin
             Result:= False;
           end else
             Result:= True;
        end;
     end;

    Function PickUpTar: Boolean;
     begin
       FindMMColorTol( x, y, 2105598, 10);//find the red color of the item dot
       begin
         if(not(FindMMColorTol( x, y, 2105598, 10))) Then
         begin
           result:= False;
           Exit;
         end;
       end;
       Mouse(x, y, 5, 5, True);
       Wait(500);
       Flag;
       begin
         if FindObjCustom(x, y, ['ake', 'wamp', 'tar',], [3552827, 2434343, 3289655,] 10) then
          begin
           case Random(3) of
            0: Mouse(x, y, 5, 5, True);
            1: Mouse(x, y, 5, 5, True);
            2: begin Mouse(x, y, 10, 10, False);
               ChooseOption('ake');
             end;
            TarCollected[CurrentPlayer]:= TarCollected[CurrentPlayer] + 1;
            TTarCollected:= TTarColected + 1;
            Result:=True;
          end else
            Result:=False;
          end;
       end;
     end;
    Procedure IDontAuto;
     begin
       wait(1000 + random(500));
       Case Random(100) of
         1: AlmostLogout;
         7: PickUpMouse;
         17: RandomRClick;
         27: PickUpMouse
         37: begin
               Case Random(10) of
                 1: TypeSend('I heard this is a good way to make money');
                 2: Typesend('Sorry if i dont respond, I am doing hw :p');
                 7: Typesend('Im bored...');
             end;
     end;
     
    function FindFastRandoms: Boolean; //By WT-Fakawi. I edited some things to make it work for me :p
    var
      i: Integer;
    begin
      for i := 1 to 8 do
      begin
        case I of
          1: if FindDead then
              Result := True;
          2: if FindMod then
              Result := True;
          3: if FindMime then
              Result := True;
          4: if FindMaze then
              Result := True;
          5: if FindQuiz then
              Result := True;
          6: if FindDemon then
              Result := True;
          7: begin
              if NoGameTab then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'No GameTab';
                Logout;
                Exit;
              end;
            end;
          7: begin
              if InBlack then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'InBlack';
                NextPlayerCycle;
                Exit;
              end;
            end;
          8: RC;
        end;
        wait(1);
      end;
    end;
    begin
      ClearDebug;
      SetupSrl;
      ActivateClient;
      DeclarePlayers;
      LogInIfNot;
      TarCollected:=0;
      TimesSwitched:=0;
      WalkBacks:=0;
      Strikes:=0;
      TTarCollected:=0;
      MaybeStrike:=False;
      repeat
        SwampCheck;
        IDontAuto;
        begin
          if(FindFastRandoms) then
          Continue;
        end;
        FindNormalRandoms;
        begin
          If(not(SwampCheck))then
            begin
              LumbTele;
              begin
                If(not(LumbTele))then
                  Writeln('Player was not in swamp and was not able to tele to Lumbridge, Next Player...');
                  NextPlayerCycle;
                  Continue;
              end;
              begin
                FindFastRandoms;
                FindNormalRandoms;
                if(WalkToSwamp) then
                  writeln('Picking up tar')
                else
                  NextPlayerCycle;
                  Continue;
            end;
        end;
        begin
          wait(1000 + random(200));
          begin
            if(FindFastRandoms) then
              Continue;
          end;
          FindNormalRandoms;
          if(not(PickUpTar))then
            begin
              if(MaybeStrike=True) then
                begin
                  MaybeStrike:=False;
                  Strikes:=Strikes +1;
                  if(Strikes=3) then
                    begin
                      if(LumbTele) then
                        begin
                          if(WalkToSwamp) then
                            begin
                              Strikes:=0;
                              Continue;
                          end else
                            begin
                              NextPlayerCycle;
                              Strikes:=0;
                              Continue;
                            end;
                      end else
                        begin
                          NextPlayerCycle;
                          Strikes:=0;
                          Continue;
                        end;
                    end;
                end;
            end;
            begin
              if(not(FindColorTolerance( x, y, 2105598, MMX1, MMY1, MMX2, MMY2, 10))) Then
                begin
                  if(SwampCheck) Then
                    begin
                      i:=0;
                      repeat
                        wait(1000);//Wait for a swamp tar to respawn
                        i:=i+1;
                        begin
                          begin
                            if(FindFastRandoms) then
                              Continue;
                          end;
                          FindNormalRandoms;
                          case Random(30) of//antiban for when waiting
                            1: RandomRClick;
                            7: PickUpMouse;
                            10: BoredHuman;
                            17: AlmostLogout;
                        end;
                      until(FindColorTolerance(x, y, 2105598, MMX1, MMY1, MMX2, MMY2, 10)) or (i=15);
                      begin
                        if(i=15) and (Players[CurrentPlayer].Boolean2 = True) then //if it waited for 15 seconds without a respawn, reset the place in the swamp
                          begin
                            If(LumbTele) then
                              begin
                                If(WalkToSwamp) then
                                  begin
                                    Continue;
                                end else
                                  begin
                                    NextPlayerCycle;
                                    Continue;
                                  end;
                            end else
                              begin
                                NextPlayerCycle;
                                Continue;
                            end;
                        end else
                          begin
                            if(i=15) then
                              begin
                                NextPlayerCycle;
                                Continue;
                            end else
                              begin
                                MaybeStrike:=True;
                                Continue;
                              end;
                          end;
                      end;
                    end;
                end;
            end;
        end;
      until(isfkeydown(12))//not only way it stops, see Function NextPlayerCycle
      writeln('User Stopped Script');
      ProgressReport;
    end.

    dont tell me to search for a tut because srl and 4 are both too short...

    ok, i get the error:

    Line 140: [Error] (14821:5): Unknown identifier 'LoadPlayerArray' in script C:\Program Files\SCAR 3.12\Scripts\Macrosoft Lumbridge Swamp Tar Collector.scar

    why is this happening?

    also, am I doing player array thing right?

    Finally, anyone know what happened to srl/extended includes?

  2. #2
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Extended-routines were deleted upon making SRL 4...
    LoadPlayerArray is an outdated function (I think).

    Just delete LoadPlayerArray, and try and run the script.

    -Knives

  3. #3
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i think im soposed to use howmanybooleans aswell, but it gives me an unknown identifier, whats up with that?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Players array error.
    By Sanjuro in forum OSR Help
    Replies: 2
    Last Post: 10-02-2008, 01:19 AM
  2. Adding Players to Array
    By IEatJ00erBaybees in forum OSR Help
    Replies: 3
    Last Post: 04-11-2007, 10:37 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
  •