Results 1 to 10 of 10

Thread: Multiplayer

  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default Multiplayer

    Is there a way so that I can repeat something until all players are inactive?

    This is my main loop:
    SCAR Code:
    begin
      SetupSRL;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      repeat
        DummyHit;
        NextPlayer(False);
      until(False)
    end.

    Is there a way so that I can change that
    SCAR Code:
    until(False)
    to something like
    SCAR Code:
    until(Players[AllPlayers].Active := False)

    Thanks,
    Richard
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function AllPlayersFalseSOMETHINGLIKETHAT: boolean;
    var
      I: integer;
    begin
      for I := 0 to High(Players) do
        if Players[I].Active then
          Exit;
      Result := True;
    end;
    ~Hermen

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    SCAR Code:
    repeat
    ...
    until(AllPlayersInactive);

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

    Default

    until(AllPlayersInactive)

    Edit: Double ninja'd! I'm getting slow...

  5. #5
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Thanks guys! I knew there was something like that.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  6. #6
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    From experience, I found that AllPlayersInactive doesn't work, so I just end up doing something like this:

    SCAR Code:
    Function RAllPlayersInactive: Boolean;
    Var
    i, Players: integer;
    Begin
      Players := 0;
      For i := 0 to HowManyPlayers - 1 do
      Begin
        If Players[i].Active := True then
          Players := Players + 1;
      end;
      If Players = 0 then
        Result := True;
    end;
    Last edited by Richard; 05-02-2009 at 02:30 AM.

  7. #7
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Richard View Post
    From experience, I found that AllPlayersInactive doesn't work, so I just end up doing something like this:

    SCAR Code:
    Function RAllPlayersInactive: Boolean;
    Var
    i, Players: integer;
    Begin
      Players := 0;
      For i := 0 to HowManyPlayers - 1 do
      Begin
        If Players[i].Active := True then
          Players := Players + 1;
      end;
      If Players = 0 then
        Result := True;
    end;
    Tell me why it doesn't works?
    ~Hermen

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

    Default

    Quote Originally Posted by Richard View Post
    From experience, I found that AllPlayersInactive doesn't work, so I just end up doing something like this:

    SCAR Code:
    Function RAllPlayersInactive: Boolean;
    Var
    i, Players: integer;
    Begin
      Players := 0;
      For i := 0 to HowManyPlayers - 1 do
      Begin
        If Players[i].Active := True then
          Players := Players + 1;
      end;
      If Players = 0 then
        Result := True;
    end;
    No it does work. ( I have thought the same thing at one point )
    When you call nexplayer(False); and there are no more active players, it goes into an infinate wait loop.

    If be like.
    SCAR Code:
    logout;
      if AllPlayersInactive then
        terminatescaript;
      else
        nexplayer(Players[CurrentPlayer].active);
    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

  9. #9
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Ohh! Didn't know that it went into an infinite loop.

    Might make an adjustment to the include so if there's no more active players it will terminate.

  10. #10
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Maybe it's supposed to if you combine it with RC Remote Control, when you set a user to false and want to let it run again?
    ~Hermen

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
  •