SRL Archive - OSR Intermediate Scripting Tutorials

How to add SRL Stats to your script


Harry

2011-03-19 16:36:02

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

2011-03-19 16:38:32

Nice tut :) Will add this to my next script! :D

Wizzup?

2011-03-19 17:12:00

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

2011-12-21 01:28:30

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

2011-12-30 19:44:33

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

2011-12-30 19:50:07

From: HardRockers
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

2011-12-30 19:53:06

What is different about what you typed and what i typed?

Dynamite

2011-12-30 19:56:12

From: HardRockers
What is different about what you typed and what i typed?


Space after "…(Mined)"

-Boom

HardRockers

2011-12-30 20:00:12

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

2011-12-30 20:10:24

It takes 5 minutes of runtime for the stats up update. Are you using the stats_commit?

HardRockers

2011-12-31 16:02:33

Yes, It got fixed. :)

putonajonny

2012-01-08 13:02:33

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

2012-02-09 06:24:33

Thank you for the tutorial. Helped me fix the errors I had with SRL Stats. :)

eska

2012-03-15 05:11:24

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".