Results 1 to 6 of 6

Thread: switching player

  1. #1
    Join Date
    Dec 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default switching player

    does anyone know how i can make a random to set different times my bots wait before logging back in?

    im going to be switching players
    i want it to wait a different random time before logging back in

    i modified the nextplayer functing thing to do it for a set time but i want it random

    SCAR Code:
    procedure NextPlayer(Active: Boolean);
    var
      I : integer;
      OneActive : Boolean;
    begin
      if RandomPlayer then
        RandomNextPlayer(Active)
      else
      begin
        WriteLn('NextPlayer');
        Players[CurrentPlayer].Active := Active;
        Logout;
        Sleep(900000); //<----------i did this and it works for waiting 15 minutes and loggin in
        PlayerCurTime := (GetSystemTime div 1000);
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
          ((PlayerCurTime - PlayerStartTime) / 60);
        CurrentPlayer := (CurrentPlayer + 1) mod HowManyPlayers;
        while Players[CurrentPlayer].Active = False do
        begin
          OneActive := False;
          CurrentPlayer := (CurrentPlayer + 1) mod HowManyPlayers;
          for I := 0 to HowManyPlayers - 1 do
            if Players[I].Active then
              OneActive := True;
          if OneActive = False then
            Wait(60000); // Everybody False. Endless Loop.
        end;
        SRL_Logs := SRL_Logs + 1;
        LoginPlayer;
      end;
    end;

    is there some kind like random sleep that i can put a bunch of
    different times and it will randomly choose em?

  2. #2
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure Waittime;
    begin
    case random(10) of
    0: wait(500000)
    1: wait(600000)
    2: wait(700000)
    3: wait(800000)
    4: wait(900000)
    5: wait(500000+random(100000))
    6: wait(600000+random(100000))
    7: wait(700000+random(100000))
    8: wait(800000+random(100000))
    9: wait(900000+random(100000))
    end;

    procedure NextPlayer(Active: Boolean);
    var
      I : integer;
      OneActive : Boolean;
    begin
      if RandomPlayer then
        RandomNextPlayer(Active)
      else
      begin
        WriteLn('NextPlayer');
        Players[CurrentPlayer].Active := Active;
        Logout;
        Waittime; //<----------It will wait a randomly chossen amount now
        PlayerCurTime := (GetSystemTime div 1000);
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
          ((PlayerCurTime - PlayerStartTime) / 60);
        CurrentPlayer := (CurrentPlayer + 1) mod HowManyPlayers;
        while Players[CurrentPlayer].Active = False do
        begin
          OneActive := False;
          CurrentPlayer := (CurrentPlayer + 1) mod HowManyPlayers;
          for I := 0 to HowManyPlayers - 1 do
            if Players[i].Active then
              OneActive := True;
          if OneActive = False then
            TerminateScript; // <------- Shouldnt this also end the script? so it doesnt just sit there and lag?
        end;
        SRL_Logs := SRL_Logs + 1;
        LoginPlayer;
      end;
    end;
    You can set the times to whatever you please. Hope this helped and lookin forward to your script
    Kindof Inactive...

  3. #3
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    procedure Waittime;
    begin
    case random(10) of
    0: wait(500000)
    1: wait(600000)
    2: wait(700000)
    3: wait(800000)
    4: wait(900000)
    5: wait(500000+random(100000))
    6: wait(600000+random(100000))
    7: wait(700000+random(100000))
    8: wait(800000+random(100000))
    9: wait(900000+random(100000))
    end;
    SCAR Code:
    procedure wait;
    begin
      for i:= 1 do random(5) to
      wait(i0000);
      end;
    end; // i dont think this would work but along the lines of this

    ~Spaz

  4. #4
    Join Date
    Feb 2007
    Location
    EST (US East Coast)
    Posts
    250
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by spaztaz666 View Post
    SCAR Code:
    procedure wait;
    begin
      for i:= 1 do random(5) to
      wait(i0000);
      end;
    end; // i dont think this would work but along the lines of this

    ~Spaz
    That wouldn't work at all because a for loop would go "for i := 1 to (number) do" instead of "do (number) to".

    And i0000 would be written as "i * 10000"

    Would this work for what you want?

    SCAR Code:
    Sleep(600000 + random(300000)); //waits 10 minutes + a random of 5 minutes
    Temporarily inactive.

  5. #5
    Join Date
    Dec 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i added this onto it tell me what u think?

    SCAR Code:
    procedure NextPlayer(Active: Boolean);
    var
      I : integer;
      OneActive : Boolean;
    begin
      if RandomPlayer then
        RandomNextPlayer(Active)
      else
      begin
        WriteLn('NextPlayer');
        Players[CurrentPlayer].Active := Active;
        Logout;
        Sleep(300000 + random(900000)); //<--- tell me what u think
        PlayerCurTime := (GetSystemTime div 1000);
        Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
          ((PlayerCurTime - PlayerStartTime) / 60);
        CurrentPlayer := (CurrentPlayer + 1) mod HowManyPlayers;
        while Players[CurrentPlayer].Active = False do
        begin
          OneActive := False;
          CurrentPlayer := (CurrentPlayer + 1) mod HowManyPlayers;
          for I := 0 to HowManyPlayers - 1 do
            if Players[i].Active then
              OneActive := True;
          if OneActive = False then
            Wait(60000); // Everybody False. Endless Loop.
        end;
        SRL_Logs := SRL_Logs + 1;
        LoginPlayer;
      end;
    end;

    Sleep(300000 + random(900000));
    thanks for help!

  6. #6
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah that should work, totally forgot about the sleep proc xD i wouldn't have made that long case if i would have remembered lmao, glad you found an answer (if only my help thread could be solved )
    Kindof Inactive...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Ultimate Merchanter (first player to player seller!)
    By Timothegreat in forum RS3 Outdated / Broken Scripts
    Replies: 63
    Last Post: 05-14-2009, 02:07 PM
  2. Player not found in player array?quikchat?
    By jerrysyron in forum OSR Help
    Replies: 2
    Last Post: 08-01-2008, 12:44 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
  •