Results 1 to 4 of 4

Thread: Multiplayer proggy trouble...

  1. #1
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default Multiplayer proggy trouble...

    I'm using this function to get the experience gained, right? And it works perfectly, other than Players[CurrentPlayer].Extendeds[12] is returning 0, no matter how many logs are cut.

    SCAR Code:
    function Prg_ExpGained: Extended;
    var
      XpGain : TStringArray;
      i : Integer;
    begin
      XpGain := ['tree', IntToStr(25), 'oak', FloatToStr(37.5),
                 'willow', FloatToStr(67.5), 'yew', IntToStr(175)];

      if InStrArrEx(Lowercase(Players[CurrentPlayer].Strings[0]), XpGain, i) then
      begin
        Result := (StrToFloat(XpGain[i + 1]) * Players[CurrentPlayer].Integers[10]);
        Players[CurrentPlayer].Extendeds[12] := Players[CurrentPlayer].Extendeds[12] + Result;
      end else
      begin
        Writeln('String not in DeclarePlayers.');
        S_SwitchPlayer;
      end;
    end;

    Anyone have any ideas?

  2. #2
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    hmm, what i use is
    SCAR Code:
    function loadexp: extended;
    begin
      case lowercase(ta.name) of //ta is a TTree variable
        'normal': result:= 25;
        'oak': result:= 37.5;
        'willow': result:= 67.5;
        'maple': result:= 100;
        'yew': result:= 175;
        'teak': result:= 85;
        'mahogany': result:= 125;
        'magic': result:= 250;
      end;
    end;

    procedure dropallex(start : integer);
    var i: integer;
    begin
      for i:= start to 28 do dropitem(i);
    end;


    procedure DropLogs;
    begin
      if not loggedin then exit;
      if not invfull then exit;
      if players[CurrentPlayer].booleans[0] then
      begin
        dropallex(1);
        incex(players[currentplayer].integers[2], 28);
        exp:= players[currentplayer].integers[2] * loadexp; //then it multiplies
        players[currentplayer].integers[4]:= round(exp);
        inc(players[currentplayer].integers[3]);
        inc(sleepl);
        incex(Stats_CustomVars[1], 28);
        incex(Stats_CustomVars[1], round(exp));
      end;
      if not players[CurrentPlayer].booleans[0] then
      begin
        dropallex(2);
        incex(players[currentplayer].integers[2], 27);
        exp:= players[currentplayer].integers[2] * loadexp; //and the same :p
        players[currentplayer].integers[4]:= round(exp);
        inc(players[currentplayer].integers[3]);
        inc(sleepl);
      end;
      prog;
    end;
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  3. #3
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It is not a problem with that function. Maybe something is resetting the value of Extendeds[12]? Such as calling DeclarePlayers often in the script (such as right before your progress report).

    Where do you call declare players at in your script, and would it be possible for you to post more code then this?

  4. #4
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    @Akwardsaw - I'm not going to use your functions, but looking at them made me realize what I did wrong.

    @JAD - That is exactly what I was doing wrong. I moved that line to the start of the progress report, and it's calculating the exp perfectly for each player.

    Thanks to the both of you.

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
  •