SRL Archive - Help and Support

Stats


RISK

2012-02-25 12:44:54

I'm not sure if I'm just using it wrong or what, but my script does not send stats to SRL stats. I have it on the final report for now, so here's the procedure:
procedure FinalReport;
var
compsDone, startTickets, curTickets, gained, expGained: Integer;
timeRan: string;
begin
if (not(ENABLE_DEBUG_MODE)) then
ClearDebug;

compsDone := (competitionsDone);
timeRan := (MSToTime(GetTimeRunning, Time_Bare));
startTickets := (startingTickets);
curTickets := (TicketAmount);
gained := (curTickets - startTickets);
expGained := (Gained * 5);

stats_IncVariable('Ranged EXP (Gained)', expGained);
stats_IncVariable('Total EXP Gained', expGained);
if (stats_Commit) then
Write('We have committed stats to SRL stats!');

WriteLn('__________________________');
WriteLn('');
WriteLn(' RISK''s Range Guilder');
WriteLn(' Script version: ' + SCRIPT_VERSION);
WriteLn(' Time ran: ' + timeRan);
WriteLn(' Competitions done: ' + ToStr(compsDone));
WriteLn(' Tickets gained: ' + ToStr(gained));
WriteLn(' EXP gained: ' + ToStr(expGained));
WriteLn('__________________________');

WriteLn('');
WriteLn('Thanks for using my script!');
WriteLn('If you have encountered an error, please enable debug mode in the script setup and rerun the script.');
WriteLn('Thank you!');
end;


Am I doing it wrong?


Thanks for any help, I really appreciate it!

Hero

2012-02-25 15:14:26

I thought for progress reports the variables that actually are recorded(starting tickets and current) had to be global to be shared instead you are defining your variables privately and therefore are set to 0 by default and will not increase since they are privately controlled?


Also you put Write( … Is that a typo?


Edit:
  stats_IncVariable('Ranged EXP (Gained)', expGained);
stats_IncVariable('Total EXP Gained', expGained);
stats_Commit;//Maybe you have to actually call the function and then the next line will react if true. :)
if (stats_Commit) then
Write('We have committed stats to SRL stats!');


Edit2: I might just be too high to read.

RISK

2012-02-25 15:19:18

Write(..) isn't a typo. :) It's what I use instead of WriteLn in all of my scripts. For a clean debug:
02:17:32 PM: Waiting for the chat-box confirmation text to show.

I have StartingTickets as a global and to get the experience, you just times the gained tickets by 5. So there's no need for a lot of global variables since the maths to get the experience gained is easy.

mormonman

2012-02-25 15:20:25

Make sure you set up all the variables. User/pass, script id, etc. I'm sure you did, but just in case(since its not in the snippet you posted). Also, I suggest just adding committing to the mainloop with a timer(I use a 5 min timer).

Hero

2012-02-25 15:23:57

From: RISK
Write(..) isn't a typo. :) It's what I use instead of WriteLn in all of my scripts. For a clean debug:
02:17:32 PM: Waiting for the chat-box confirmation text to show.

I have StartingTickets as a global and to get the experience, you just times the gained tickets by 5. So there's no need for a lot of global variables since the maths to get the experience gained is easy.



Well since you said you have startTickets globally set or whatever your variable is then if the snippet is accurate you have defined it privately too? Could the be causing conflicts? I personally never ran into issues with making my progress reports :3 I also always had stats_Commit; in my proggy :P

RISK

2012-02-25 15:26:17

@ mormonman : Yes sir, I already do all of that. Along with the mainloop. Here's the mainloop:
procedure MainLoop();
var
T, maxComps: Integer;
begin
repeat
maxComps := (Players[CURRENTPLAYER].Integers[HOW_MANY_COMPS]);
competitionsDone := 0;
startingTickets := (TicketAmount);
T := 0;

MarkTime(T);
FixChats;

repeat
Inc(competitionsDone);

StartGame;
Wait(RandomRange(300, 500));
FireAtTargets;
Wait(RandomRange(300, 500));
AntiBan;

if (TimeFromMark(T) >= 300000) then
begin
ProgressReport;
MarkTime(T);
end;

if (ENABLE_BREAKS) then
BreakHandler(BREAK_IN, BREAK_FOR, BREAK_IN_RANDOM, BREAK_FOR_RANDOM);
until((competitionsDone >= maxComps) or (not(LoggedIn)));

ExitPlayer(' ');
until((AllPlayersInactive));
end;

Here's the stat page for my script:


And here's the line where I set SRL stats up:
SetupSRLStats(836, STATS_USER, STATS_PASS);


What's strange is that it records the time fine, but when I attempt to send variable increases, nothing happens. I've changed from the final report to a regular progress report every 5 minutes since I thought of a way to stop it from sending wrong information of total gathered experience every 5 minutes. So here's my procedure for my progress report:
procedure ProgressReport;
var
compsDone, startTickets, curTickets, gained, expGained, expThisReport, comExp: Integer;
timeRan: string;
begin
if (not(ENABLE_DEBUG_MODE)) then
ClearDebug;

compsDone := (competitionsDone);
timeRan := (MSToTime(GetTimeRunning, Time_Bare));
startTickets := (startingTickets);
curTickets := (TicketAmount);
gained := (curTickets - startTickets);
expGained := (Gained * 5);

expThisReport := (expGained);
if (not(comInc = 0)) then
begin
comExp := (expThisReport - expLastReport);
end else
comExp := (expThisReport);

expLastReport := (expThisReport);
Write(ToStr(comExp));

if (stats_Commit) then
Write('We have committed stats to SRL stats!');
stats_IncVariable('Ranged EXP (Gained)', comExp);
stats_IncVariable('Total EXP Gained', comExp);

WriteLn('__________________________');
WriteLn('');
WriteLn(' RISK''s Range Guilder');
WriteLn(' Script version: ' + SCRIPT_VERSION);
WriteLn(' Time ran: ' + timeRan);
WriteLn(' Competitions done: ' + ToStr(compsDone));
WriteLn(' Tickets gained: ' + ToStr(gained));
WriteLn(' EXP gained: ' + ToStr(expGained));
WriteLn('__________________________');

Inc(comInc); // To keep track of how many times we have done a report
end;

Here's my global variables:
var
breakRounds, totalBreaks, competitionsDone, startingTickets,
expLastReport, comInc: Integer;


@ Hero : :x Eh, it's weird that it just sends the time properly but not variables.


Perhaps I should have my stats_Commit after I increase variables. But I read somewhere that when they put it after, it wouldn't increase the variables properly.

Hero

2012-02-25 15:33:56

You don't seem be the only one with these stat issues.

http://villavu.com/forum/showthread.php?p=941320#post941320


Edit: Testing something out real quick about the commiting.

__________________________

RISK's Range Guilder
Script version: 1.0.2
Time ran: 00:07:12
Competitions done: 2
Tickets gained: 868
EXP gained: 4340
__________________________

Ran for like 20 minutes and it did not want to commit anything. Even with stats_commit; being used.

RISK

2012-02-25 19:36:02

It didn't want to commit anything? Weird. I'm trying to mess with it again right now, so I'll see if I can find out if I did anything wrong.

Thanks for testing. :)

Harry

2012-02-25 19:40:21

Check the cmd window, it will say the stats error.

RISK

2012-02-25 19:45:47

That's the thing, it doesn't say anything. It commits successfully yet it doesn't increase the variables for some reason. I can test it again to make sure, though.

Harry

2012-02-25 20:07:01


I don't see what's wrong? Unless you mean the variables not going up on the stats, that's probably because you have them defined locally so they will equal zero once you exit the procedure. Writeln the vars you're sending, I bet it's sending zeros.

RISK

2012-02-25 20:29:59

I switched to complete global variables for the progress report and made it write the variables just to make sure they are returning them properly. But when it sends the stats, it doesn't show the variables it sent. But it does write the variables properly.

Here's the progress report procedure:
procedure ProgressReport;
var
timeRan: string;
begin
if (not(ENABLE_DEBUG_MODE)) then
ClearDebug;

compsDone := (competitionsDone);
timeRan := (MSToTime(GetTimeRunning, Time_Bare));
startTickets := (startingTickets);
curTickets := (TicketAmount);
gained := (curTickets - startTickets);
expGained := (Gained * 5);

expThisReport := (expGained);
compsThisReport := (compsDone);
if (not(comInc = 0)) then
begin
comExp := (expThisReport - expLastReport);
comComps := (compsThisReport - compsLastReport);
end else
begin
comExp := (expThisReport);
comComps := (compsThisReport);
end;

expLastReport := (expThisReport);
compsLastReport := (compsThisReport);


stats_IncVariable('Ranged EXP (Gained)', comExp);
stats_IncVariable('Total EXP Gained', comExp);
stats_IncVariable('Competitions Done', comComps);
if (stats_Commit) then
Write('We have committed stats to SRL stats!');

WriteLn('__________________________');
WriteLn('');
WriteLn(' RISK''s Range Guilder');
WriteLn(' Script version: ' + SCRIPT_VERSION);
WriteLn(' Time ran: ' + timeRan);
WriteLn(' Competitions done: ' + ToStr(compsDone));
WriteLn(' Tickets gained: ' + ToStr(gained));
WriteLn(' EXP gained: ' + ToStr(expGained));
WriteLn('__________________________');

Inc(comInc);
end;

Here's my global variables:
var
breakRounds, totalBreaks, competitionsDone, startingTickets,
expLastReport, comInc, compsLastReport, compsDone, startTickets,
curTickets, gained, expGained, expThisReport, comExp, comComps,
compsThisReport: Integer;


It still commits time fine, but it refuses to send variables. And the cmd itself shows no errors, only it saying it sent them without any problems.


Am I just doing it wrong somewhere or what? Thanks for any help with this matter! I really appreciate it! :)

Harry

2012-02-25 20:55:03

Commit using your stats username, I don't see you on the commit log..

RISK

2012-02-25 21:02:22

Sorry about that, committed stats with my account now.