SRL Archive - OSR Intermediate Scripting Tutorials

Adding SRL Stats to your script


Shuttleu

2010-11-03 20:30:32

Adding SRL Stats to your script


okay well this is just a draft so i will improve it later on

first of all you need to have your script, as your reading this them im sure you will already have one.

Go to http://stats.villavu.com/ and create a account
once you have logged in click on "My Scripts" in the top right then "Create a New Script" half way down on the left.

fill in all the name andclick on the link to manage the script.
add the vars you want to use by clicking on "Add variable".

Once this is done you can get the script ID number from the url.
The script ID is used by the stats to uniquely identify each script.
The script ID is the last and final digits in the URL.
For example for http://stats.villavu.com/manage/script/114 the script ID is 114

now that you have the script ID we can begin with adding it to the script

now at the very start of your script you need to add a include
{$i srl/srl/misc\stats.simba}

then create 2 constants, this is where the user will be able to put their username and password
const
SRLStats_User = 'username'; // Your SRL Stats ID (If you dont have one then just leave it as it is)
SRLStats_Password = 'pass'; // Your SRL Stats Password (If you dont have one then just leave it as it is)

and in the main part of the script you need to add this line
  SetupSRLStats({scriptid} 114, SRLStats_User, SRLStats_Password); 
this sets all the data which is needed to add the stats to your script stats account

then there is one last thing left to do
add these lines to the main loop or the proggy

SRLRandomsReport;
Stats_Commit;

now you have to add the vars for the stats such as "Rune Essence (Mined)". You just need to run one function when you increase the proggy var
so for example, just change this
incEx(EssenceMines, 27);
to
incEx(EssenceMined, 27);
stats_IncVariable('Rune Essence (Mined)', 27);

then everything else will be taken care for you

~shut

Failpailirl

2010-11-04 07:35:53

may i ask, and this is no offense to you or anyone at all

What is the point in adding this to your script, what do you gain out of it?

Overtime

2010-11-04 09:15:35

You get too see who's using it, and how much they are using it.

You will also be able to see what randoms its able to solve and how much logs/exp/total time etc, it has done.

Overall able to see how popular your script is, and if people are using it.

any_one

2010-11-11 05:37:20

Thanks for the tutorial. I just want to ask, where is the "Stats_UserID" and password actually chosen? (ie. how do you register for one?) I remember doing it a few years ago and a thread from 2008 has a picture of a stats link on the front page of the main website, however that is no longer there. I tried both the login username and the UID listed on the profile tab of the scriptmanager site with my password, and it still gave an "incorrect user name or password" when trying to send stats with a script. Could you please clarify where exactly the stats are sent to and what the UID and password should be? Thank you.

Shuttleu

2010-11-11 06:21:03

From: any_one
Thanks for the tutorial. I just want to ask, where is the "Stats_UserID" and password actually chosen? (ie. how do you register for one?) I remember doing it a few years ago and a thread from 2008 has a picture of a stats link on the front page of the main website, however that is no longer there. I tried both the login username and the UID listed on the profile tab of the scriptmanager site with my password, and it still gave an "incorrect user name or password" when trying to send stats with a script. Could you please clarify where exactly the stats are sent to and what the UID and password should be? Thank you.


you can register for a User account at http://scriptmanager.freehostia.com
from there you can go into your profile and in the url it will say http://scriptmanager.freehostia.com/profile.php?uid=13
the uid is your Stats_UserID
so for me i would put Stats_UserID = 13;
the password is the password you use to log into the script manager site

~shut

any_one

2010-11-11 08:12:04

OK I think I will try changing my password as it may not like some of the characters in it, that is exactly what I've been doing.. Thanks for your quick reply :)

Feroc1ty

2011-03-18 23:26:02

do you still add SRL stats the same way, cuz im getting a shit load of errors in my script, no compile errors just HTTP errors

Harry

2011-03-19 00:07:47

Yeah this method is outdated. I'll make a current one in the morning if I remember.

Shuttleu

2011-05-07 18:29:35

updated, sorry for the time it took :s

~shut

Yago

2011-05-07 21:09:58

From: Shuttleu
updated, sorry for the time it took :s

~shut


Might wanna explain what the number 114 is for (script id)

BraK

2011-05-26 03:03:02

I took off the Outdated Tag in the title. Good to have you back Shut.

~BraK

masterBB

2011-05-26 03:48:20

From: Yago
Might wanna explain what the number 114 is for (script id)

He did that somewhere above.

Once this is done you can get the script ID number from the url.
The script ID is used by the stats to uniquely identify each script.
The script ID is the last and final digits in the URL.
For example for http://stats.villavu.com/manage/script/114 the script ID is 114

Drax

2012-01-31 19:18:41

I think this method is outdated again because when i try to use your method i get a syntax error. When using this.

 stats_IncVariable("Woodcutting EXP (Gained))",4725);
stats_IncVariable("Yew Logs Chopped",27);


But when i do it like this

 stats_IncVariable('Woodcutting EXP (Gained))',4725);
stats_IncVariable('Yew Logs Chopped',27);

i don't get the error. Instead my stats wont update. Wtf am i doing wrong?

yentaokia

2012-03-23 09:06:12

I don't get it -.- Can anyone post a screenshot so i can get a look of it??