Results 1 to 6 of 6

Thread: Adding MultiPlayer

  1. #1
    Join Date
    Nov 2008
    Location
    Belgium
    Posts
    254
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Adding MultiPlayer

    I started making a prayer script, but I was wondering if anyone could help me with adding multiplayer, I think its added but im not sure if it would work, and i only have 1 account so i can't really test

    Please don't forget this is my first(real) script, so it probably isn't that good.
    I don't recommend testing since I haven't add Login because of the easter event and it probably wouldn't work good...

    If you have any other feedback, then please be so kind to post it

    Please don't flame me if you don't like it, since i had a bad experience with it before

    Code:
    program BBB;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Magic.scar}
    
    var
      Colors: TIntegerArray; // Global variable.
      BB,m,o: integer;
      SleepMark, RandomSleepTime : Integer;
      Sleeping : Boolean;
    Const
    Bone = 100;
    
    MIN = 6;
    MAX = 8;
    
    MINS = 5;
    MAXS = 120;
    
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers); // Leave do not change
      CurrentPlayer  :=0;   // 0,1,2,3
    
      Players[0].Name     :=''; // Runescape name between quotes
      Players[0].Pass     :=''; // Rs Password here
      Players[0].Nick     :=''; // Use three letters in order after your first letter
      Players[0].Active   := True; // If you want them Used
      Players[0].Strings[1]  := '';
    {  Players[1].Name     :='';
      Players[1].Pass     :='';
      Players[1].Nick     :='';
      Players[1].Active   := true;
    
      Players[2].Name     :='';
      Players[2].Pass     :='';
      Players[2].Nick     :='';
      Players[2].Active   := true;
    
      Players[3].Name     :='';
      Players[3].Pass     :='';
      Players[3].Nick     :='';
      Players[3].Active   := true;}
    
    end;
    Function BankBone: Boolean; forward;
    Function ExWait(Time: Integer): Boolean; forward;
    Procedure ExNextPlayer;
    begin
      if BankScreen then
        CloseBank;
      if LoggedIn then
        Logout;
      if Players[CurrentPlayer].Active = true then
      SetAudioOff;
      RandomNextPlayer(Players[CurrentPlayer].Active);
      SetAngle(true);
      ExWait(2);
    end;
    
    Procedure Antiban;
    Var
    MouseSpeed1, Deg, x, y, GTab: Integer;
    Begin
      If not LoggedIn then
      Exit;
      Case random(60) of
       1: Begin
            KeyDown(VK_Down);
            Wait(random(1000));
            KeyUp(VK_Down);
            KeyDown(VK_Up);
            Wait(500 + random(1000));
            KeyUp(VK_Up);
            MakeCompass('n');
            GameTab(4);
          end;
       2: Begin
            KeyDown(VK_Left);
            Wait(random(1000));
            KeyUp(VK_Left);
            KeyDown(VK_Right);
            Wait(random(1000));
            KeyUp(VK_Right);
            MakeCompass('n');
            GameTab(4);
          end;
       3: Begin
            KeyDown(VK_Left);
            Wait(random(1000));
            KeyUp(VK_Left);
            KeyDown(VK_Right);
            Wait(random(1000));
            KeyUp(VK_Right);
            MakeCompass('n');
            GameTab(4);
          end;
       4: Begin
            KeyDown(VK_Up);
            KeyDown(VK_Left);
            Wait(random(1000));
            KeyUp(VK_Up);
            Wait(random(800));
            KeyUp(VK_Left);
            MakeCompass('n');
            GameTab(4);
          end;
       5: Begin
            PickupMouse;
            GetMousePos(x,y);
            Writeln('Mouse moved to '+IntToStr(x)+', '+IntToStr(y)+'.');
         end;
       6: Begin
            BoredHuman;
            GetMousePos(x,y);
            Writeln('Mouse moved to '+IntToStr(x)+', '+IntToStr(y)+'.');
          end;
       7..10: Begin
                   MMouse(116-Random(100), 285-Random(256),60,60);
                   PickupMouse;
                   GetMousePos(x,y);
                   Writeln('Mouse moved to '+IntToStr(x)+', '+IntToStr(y)+'.');
                 end;
       11..14: Begin
                 PickupMouse;
                 GetMousePos(x,y);
                 Writeln('Mouse moved to '+IntToStr(x)+', '+IntToStr(y)+'.');
               end;
       15..20: Begin
                 Deg := (1+random(359));
                 MakeCompass(IntToStr(Deg));
                 Wait(1500+random(5000));
                 Writeln('Made compass '+IntToStr(Deg)+' degrees');
                 MakeCompass('n');
               end;
       21..26: Begin
                 GTab := 1 +random(12);
                 Gametab(GTab);
                 Wait(1500+random(4000));
                 GameTab(4);
                 Writeln('Switched to gametab '+IntToStr(GTab)+'.');
               end;
       26..31: Begin
                 RandomRClick;
                 GetMousePos(x,y);
                 Writeln('Randomly right clicked at '+IntToStr(x)+', '+IntToStr(y)+'.');
               end;
       32..40: Begin
                 MouseSpeed1 := (12+random(6));
                 MouseSpeed := (MouseSpeed1);
                 Writeln('Mouse speed changed to '+IntToStr(MouseSpeed1)+'.');
               end;
        end;
    end;
    
    procedure ExSleep;
    begin
      if (TimeFromMark(SleepMark)>RandomSleepTime)then
      begin
        Sleeping := True;
      repeat
        LogOut;
      until(not(LoggedIn));
        Wait(RandomRange(MINS*1000, MAXS*1000));
        LogInPlayer;
        Sleeping :=False;
      end;
    end;
    
    procedure Fail(s: string);
    begin
      Players[CurrentPlayer].Active := false;
      Inc(o);
      Writeln(s);
      if BankScreen then
        CloseBank;
      Logout;
    end;
    
    Function ExWait(Time: Integer): Boolean;
    var
      F,n: Integer;
    begin
      if not(LoggedIn) then exit;
      for F := 1 to Time do
      begin
        if FindNormalRandoms then
        Wait(200 + Random(50));
        n := RandomRange(0,10);
        If n=2 then AntiBan;
      end;
    end;
    
    function AutoLC: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
    
      FindColorsSpiralTolerance(MMCX, MMCY, arP, 7567228, MMX1, MMY1, MMX2, MMY2, 0);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);
    
        if (H >= 7.39) and (H <= 7.43) and (S >= 3.75) and (S <= 3.79) and (L >= 46.84) and (L <= 46.88) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);
    
          if (X >= 17.98) and (X <= 18.02) and (Y >= 18.70) and (Y <= 18.74) and (Z >= 18.86) and (Z <= 18.90) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
    
      if (i = arL + 1) then
        Fail('AutoColor failed in finding the color.');
    end;
    
    function FindStair: Boolean;
    var
      X, Y, A, I, II, L, M, curCTS, ClickColor: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    
    begin
      Result := False;
      if not LoggedIn then exit;
      curCTS := GetColorToleranceSpeed;
      if Length(Colors) = 0 then
      begin
        SetArrayLength(Colors, 7);
        Colors := [7897218, 8884113, 4676201, 5659484, 3556689, 3754068, 4280929];
      end;
      L := High(Colors);
      for II := 0 to 1 do
        for I := 0 to L do
        begin
          ColorToleranceSpeed(1);
          FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[I], MSX1, MSY1, MSX2, MSY2, II * 8);
          if Length(TPA) > 0 then
          begin
            ATPA := TPAtoATPAEx(TPA, 250, 250);
            M := High(ATPA);
            for A := 0 to M do
              if MiddleTPAEx(ATPA[A], X, Y) then
              begin
                if II = 1 then
                  ClickColor := GetColor(X, Y);
                MMouse(X, Y, 6, 6);
                Wait(100 + Random(50));
                if Pos('aircase', RS_GetUpText) > 0 then
                begin
                  GetMousePos(X, Y);
                  Mouse(X, Y, 0, 0, False);
                  wait(200+random(50));
                  ChooseOption('up');
                  Result := True;
                  ColorToleranceSpeed(curCTS);
                  if (II = 0) or InIntArrayEx(Colors, I, ClickColor) then
                  begin
                    if I > 0 then
                      Swap(Colors[I], Colors[I - 1]);
                    Exit;
                  end;
                  SetArrayLength(Colors, L + 2);
                  Colors[L + 1] := ClickColor;
                  Exit;
                end;
              end;
          end;
        end;
      ColorToleranceSpeed(curCTS);
    end;
    
    Procedure BankHome;
    var
    bx,by: integer;
    begin
         Players[CurrentPlayer].Strings[1] := 'lb';
         If CastSpell(1) then
          begin
           ExWait(50);
           SetAngle(True);
           ExWait(1);
           AutoLC;
           RadialWalk(AutoLC, 239, 239, 68, 0, 0);
           FFlag(5);
           ExWait(1);
           FindStair;
           FindStair;
           If not(FindSymbol(bx,by,'Bank')) then
            begin
             RunTo('n',false);
             ExWait(1);
             BankBone;
           end else
           MMouse(bx,by,5,5);
           BankBone;
         end else Fail('BankHome failed');
    end;
    
    function FindBoneTPA: Boolean;
    var
      X, Y, A, I, II, L, M, curCTS, ClickColor: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      Result := False;
      if not LoggedIn then exit;
      curCTS := GetColorToleranceSpeed;
      if Length(Colors) = 0 then
      begin
        SetArrayLength(Colors, 6);
        Colors := [12895436, 11447993, 6776687, 9079701, 9606046, 10592685];
      end;
      L := High(Colors);
      for II := 0 to 1 do
        for I := 0 to L do
        begin
          ColorToleranceSpeed(1);
          FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[I], MSX1, MSY1, MSX2, MSY2, II * 10);
          if Length(TPA) > 0 then
          begin
            ATPA := TPAtoATPAEx(TPA, 26, 20);
            M := High(ATPA);
            for A := 0 to M do
              if MiddleTPAEx(ATPA[A], X, Y) then
              begin
                if II = 1 then
                  ClickColor := GetColor(X, Y);
                MMouse(X, Y, 6, 6);
                Wait(100 + Random(50));
                if Pos('ones', RS_GetUpText) > 0 then
                begin
                  GetMousePos(X, Y);
                  Mouse(X, Y, 0, 0, False);
                  Wait(100+random(50));
                  if ChooseOption('ithdraw-All') then
                     begin
                     Result := True
                  end else Result := False;
                  ColorToleranceSpeed(curCTS);
                  if (II = 0) or InIntArrayEx(Colors, I, ClickColor) then
                  begin
                    if I > 0 then
                      Swap(Colors[I], Colors[I - 1]);
                    Exit;
                  end;
                  SetArrayLength(Colors, L + 2);
                  Colors[L + 1] := ClickColor;
                  Exit;
                end;
              end;
          end;
        end;
      ColorToleranceSpeed(curCTS);
    end;
    
    Function FindBoneDTM: Boolean;
    var
      Bones,x,y : integer;
    begin
      Bones := DTMFromString('78DA63E463606060654001B7AE5E656001D28' +
            'C40FC1F081839810C5E0634C088440269901A2E22D47010500392' +
            '6721A006E45E36026A98883487890837331050230C249809A8112' +
            '2D21C56026AA488F0BB2811E1CC4B449CF200097EFC6A00602E07' +
            'E0');
      if (FindDTM(Bones,x,y,MSX1, MSY1, MSX2, MSY2))then
       begin
       Mouse(X, Y, 0, 0, False);
        if ChooseOption('ithdraw-All') then
         Result := True
        else Result := False;
      end else Result := False;
    end;
    
    Function BankBone: Boolean;
    var
    a : integer;
    Label
    Bank;
    begin
    Bank:
    if not LoggedIn then exit;
    
     if not(FindBank(Players[CurrentPlayer].Strings[1])) then
      begin
       BankHome;
     end else
      begin
       If OpenBankFast(Players[CurrentPlayer].Strings[1])then
        begin
         Writeln('Found bank using OpenBankFast');
         DepositAll;
         Result :=True;
       end else
        begin
         If OpenBank(Players[CurrentPlayer].Strings[1],true,true)then
          begin
           Writeln('Found bank using OpenBank');
           DepositAll;
           Result :=True;
         end else
          begin
           Fail('Could not open bank');
          end;
        end;
      end;
    end;
    
         
    
    Function WithdrawBone: Boolean;
    var
    b :integer;
    begin
     if not LoggedIn then exit;
    
     if FindBoneTPA then
      begin
       Writeln('FindBoneTPA worked.');
       ExWait(1+random(1));
       Closebank;
       Result := True;
     end else
      If FindBoneDTM then
       begin
        Writeln('FindBoneDTM worked.');
        ExWait(1+random(1));
        CloseBank;
        Result := True;
      end else
       begin
        Fail('Could not find bones.')
       end;
    end;
    
    
    Procedure BuryBones;
    var
      i,x,y,bones:Integer;
      TB:TBox;
    begin
      Bones := DTMFromString('78DA63E463606060654001B7AE5E656001D28' +
            'C40FC1F081839810C5E0634C088440269901A2E22D47010500392' +
            '6721A006E45E36026A98883487890837331050230C249809A8112' +
            '2D21C56026AA488F0BB2811E1CC4B449CF200097EFC6A00602E07' +
            'E0');
    if not LoggedIn then Exit;
    
    Gametab(4);
     for i:= 1 to 28 do
      begin
       if Not LoggedIn then break;
       ExWait(1);
       TB := InvBox(i);
        if FindDTM(Bones,x,y,TB.x1,TB.y1,TB.x2,TB.y2) then
         begin
          case Random(5) of
           0: begin
               Mouse(x,y,5,5,false);
               Wait(100+random(50));
               ChooseOption('ury');
               Wait(650+random(200));
               Inc(BB);
              end;
           else
            begin
             Mouse(x, y, 0, 0, True);
             Wait(650+random(200));
             Inc(BB);
            end;
         end;
        end;
      end;
    end;
    
    var
    c : integer;
    
    Procedure Mainloop;
      begin
      BankBone;
      ExWait(1);
      WithdrawBone;
      AntiBan;
      ExWait(RandomRange(1, 2));
      BuryBones;
      ExWait(1);
      end;
      
    begin
     SetUpSRL;
     ActivateClient;
     DeclarePlayers;
     ExWait(1 + Random(1));
      repeat
       MarkTime(SleepMark);
       RandomSleepTime := RandomRange(MIN*1000*60, MAX*1000*60);
       If (o>=1) then
       ExNextPlayer;
       o:=0;
        repeat
         Mainloop
        until (o>=1)or (BB>=Bone)or (not(LoggedIn))and(not(Sleeping));
      until(AllPlayersInactive);
    end.

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

    Default

    NextPlayer(False); and NextPlayer(True);?



    the False and True is for activity.. True if you want to use them again.. False if not..

  3. #3
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    This tutorial might be of help too.

  4. #4
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  5. #5
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    NextPlayer(False); and NextPlayer(True);?



    the False and True is for activity.. True if you want to use them again.. False if not..
    his next player procedures were right...

    He used randomnextplayer(currentplayers.active) = if current player active = true.

    Also use neslie
    I do visit every 2-6 months

  6. #6
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    NextPlayer(Players[CurrentPlayer].active); ftw <-- I Learned from Nielsie's
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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
  •