Results 1 to 3 of 3

Thread: SRL Stats messing up the report?

  1. #1
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default SRL Stats messing up the report?

    Ok, my srl stats are WAY wrong.

    What happens is this:

    1. CurrentWins := 0.
    2. Wins := 15. CurrentWins := 15 - 0.
    3. CurrentWins is now 15.
    4. So the next time, CurrentWins := 20 - 15.
    5. But it still reports 20.


    Anyone have any ideas? Do the Locals in this need to be Globals?

    SCAR Code:
    Procedure ProgressReporting;
    Var
      CurrentDuels, CurrentWins, CurrentLosses, Currentdenied : Integer;
    Begin
      ClearDebug;
      Duels := Wins + Lost;
      CurrentWins := Wins - CurrentWins;
      ReportVars[0] := CurrentWins;
      CurrentLosses := Lost - CurrentLosses;
      ReportVars[1] := CurrentLosses;
      CurrentDuels := Duels - CurrentDuels;
      ReportVars[2] := CurrentDuels;
      Currentdenied := denied - Currentdenied;
      ReportVars[3] := Currentdenied;
      WriteLn('You won: ' + IntToStr(Wins) + ' duels.');
      WriteLn('You lost: ' + IntToStr(Lost) + ' duels.');
      WriteLn('You have dueled: ' + IntToStr(Duels) + ' times.');
      WriteLn('You have denied ' + IntToStr(Denied) + ' duels');
      WriteLn('The script has been running for: ' + TimeRunning);
      WriteLn('Thanks for using the Duel Arena Trainer by Sandstorm!');
      SRLRandomsReport;
      Marktime(Marking);
    End;

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Local variables are lost as soon as the function is executed, so all of the previous information in the Current* variables is reset to 0 each time you enter the function. You can fix that by making some of the variables global, or relying on the last ReportVars[x] entry to calculate the new one.
    :-)

  3. #3
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah, that's why. I'll just make them Global then. Thanks!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Script messing up..
    By faster789 in forum OSR Help
    Replies: 5
    Last Post: 04-26-2008, 12:30 PM
  2. Messing up =[
    By siroober in forum News and General
    Replies: 12
    Last Post: 02-16-2008, 08:06 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
  •