PDA

View Full Version : How to add SRL Stats to your script



Harry
03-19-2011, 08:36 PM
This tut has 2 sections, one for the site-end, and script end.

Site-end:

1) Sign up for an account at http://stats.villavu.com/

2) Go to http://stats.villavu.com/manage/script/new

3) Fill in script name and click Next.

4) You will now get:
> "You just created SCRIPTNAME. You can Manage it here.".
In the URL for "manage", it will have a number at the end. This is your script ID.

5) Go there and add your vars. If they aren't there (it's a bit hard to find what you want, but most common ones are there), you may suggest them at http://villavu.com/forum/showthread.php?t=61070 .

Script-end (the fun part!):
6) Include the Stats (after SRL):
{$i SRL/SRL/Misc/stats.simba}

7) Add a const for your users to fill their Stats info into:
const
SRLStats_Username = 'YourUsernameYouSignedUpWith';
SRLStats_Password = 'Password';

8) In your script setup (main program, before the loop), probably best right after SetupSRL;, you will need to add:
SetupSRLStats(SCRIPT_ID_FROM_ABOVE, SRLStats_Username, SRLStats_Password);

9) Calling "Stats_Commit;" will commit your stats! You should call it every progress report. Note, it will only activate every 5 minutes at most, so you will need to run your script for a few minutes to test it.
Stats_Commit;

10) Now the generic stats:
stats_IncVariable('Variable Name', Count);
Replace 'Variable name' with the variable you added on the stats.villavu page, and Count with an integer representing how much you want it increased.


Congrats, your script now has stats. Bot it up!

Emaziz
03-19-2011, 08:38 PM
Nice tut :) Will add this to my next script! :D

Wizzup?
03-19-2011, 09:12 PM
I don't think you want to call SetupSRL; SetupSRLStats in your main loop. (Point 8; call it main program, before the loop)

Press Play
12-21-2011, 06:28 AM
Thanks for this! Very easy to follow and implement into my new fletcher! I reckon this should be stickied, because it wasn't as easy as I'd like to find :P

HardRockers
12-31-2011, 12:44 AM
Ya, I followed it very nicely, I just can't get it to upload my Variables. I want it to upload Iron Ore (Mined).

stats_IncVariable('Iron Ore (Mined) ', 1);

Correct?

Dynamite
12-31-2011, 12:50 AM
Ya, I followed it very nicely, I just can't get it to upload my Variables. I want it to upload Iron Ore (Mined).

stats_IncVariable('Iron Ore (Mined) ', 1);

Correct?

Try:
stats_IncVariable('Iron Ore (Mined)', 1);
Tell me if that works ;)

-Boom

HardRockers
12-31-2011, 12:53 AM
What is different about what you typed and what i typed?

Dynamite
12-31-2011, 12:56 AM
What is different about what you typed and what i typed?

Space after "...(Mined)"

-Boom

HardRockers
12-31-2011, 01:00 AM
oh, well thank you. I couldn't even tell. I am running it now to see if it updates correctly.

Edit: Working good :)

Kyle Undefined
12-31-2011, 01:10 AM
It takes 5 minutes of runtime for the stats up update. Are you using the stats_commit?

HardRockers
12-31-2011, 09:02 PM
Yes, It got fixed. :)

putonajonny
01-08-2012, 06:02 PM
You no longer need to add:
{$i SRL/SRL/Misc/stats.simba}
or you will get Duplicate Idnet error. Just thought it should be noted :)

Wetish
02-09-2012, 11:24 AM
Thank you for the tutorial. Helped me fix the errors I had with SRL Stats. :)

eska
03-15-2012, 09:11 AM
For some reason it only adds time, but not my variable. Tried 4 time, this is the result:
http://stats.villavu.com/script/913


Yes I added the variable in SRL Stats but it only show up in "manage".