PDA

View Full Version : Using SRL Stats



pwnaz0r
10-14-2007, 02:33 AM
Ok, well since alot of people had trouble using SRL Stat's, I thought I would post this here to help you guys out :D. (hy71194 :D)

Contents:

Setting up your own SRLId
Setting up Your Script Stats on SRL
Understanding SRLId and SRLPassword
Using Script Stats in your script



Setting up your own SRLId

To start off using SRL Stats, you must first make your own ID. To make a new id, go here (http://www.stats.srl-forums.com/?action=register). You will have to answer a confirmation letter through your email address so you can recover your SRL Id password if you loose it. Note that your SRL Stats Id (SRLId) is not the same as your username on SRL Forums!. Now, with your SRLId setup, you can add your SRLId (not your username, the number they give you) and your SRLPassword (the password for your SRLId) into certain scripts that support SRL Stats. This may be in declare players or in the constants at the top. If the script has SRL Stats, there must be a place for you to put your SRL Id and password.




Setting up Your Script Stats on SRL

Ok, now to learn how to set up a Script Stats page. This is not hard since SRL has so professionally added a template for you to fillout. Go here (http://www.stats.srl-forums.com/?action=register_script) to register a script. You need to insert variables that apply to your script only, such as rocks mined. All of the random variables are included for you. After filling in this template, SRL will give you a script id. Hold on to this number! you will need it!



Understanding SRLId and SRLPassword

Now, one of the biggest things that I had trouble with in the beginning of trying to learn SRL Stats was "why doesn't the SRL Stats register!", even after I did everythign right? Well the answer is(are you ready?): you must have a SRLId and a SRLPassword stated in your script before any stats can be sent. Therefore, if you dont enter any id or password, your script stats simply wont be sent!. Now SRLId and SRLPassword are variables, therefore you cannot add them to the constants. SO, there are two ways you can tell the script the SRL ID and Pass.

1. Make a constant with a similar name at the beginning of the script(like so)


YourSRLId = '';
YourSRLPassword ='';


note that these are not the same as SRLid and SRLPassword because they have your infront. Now add this at the beginning of the mainloop.


SRLId := YourSRLId;
SRLPassword:= YourSRLPassword;


And now the second option.

2. Simply add this to DeclarePlayers (or whatever your procedure is named to declare your players)


SRLId:= '';
SRLPassword:= '';


either way, SRLid and SRLpassword will be set.



Using Script Stats in your script

Ok now, to the best part adding srl stats to your script. Now remember that Script Id I was telling you to keep? THIS IS WERE YOU NEED IT. At the beginning of your script, possible right after SetupSRL say


ScriptId:= '(ScriptIDHERE)';


so SCAR will know where to send the stats. Now every custom variable you set has a number. The first variable would be zero, the second would be 1 etc. Now these vars are called SRLReportVars. So, lets say you put "Rocks Mined" as your first var (check here (http://www.stats.srl-forums.com/index.php?action=view_script&id=287) for an example of this). Now, everytime I mined a rock, I would put.


SRLReportVars[0]:= 1;{Report var 0 because it was the first var and it equals 1 because
we mined one rock}
SendSRLReport;


every time you call SendSRLReport your variables get set back to zero!. Also, note that this does not depend on the number already in script stats.


SO DO NOT SAY

ReportVars[0]:= ReportVars[0] + 1;


THIS IS WRONG!

Last but not least, Call SRLRandomsReport in your progress report and you should be set!

Harry
10-14-2007, 02:37 AM
Nice.

But why is ReportVars[0]:= ReportVars[0] + 1; wrong? I use it on my script and it works fine :rolleyes:

Edit: Hah, good joke on the top :p I am very good with stats :D

ZephyrsFury
10-14-2007, 02:38 AM
SO DO NOT SAY

ReportVars[0]:= ReportVars[0] + 1;


THIS IS WRONG!


Not neccesarily. If what happens if you mine two ores before SendSRLReport is called? And it doesn't really matter because 0 + 1 = 1 :p... No harm done.

Oh and make your font a bit bigger. :D

EDIT: NVM mind about the font.
Also, its either SendSRLReport or SRLRandomsReport.

BobboHobbo
10-14-2007, 02:50 AM
Ah nice TUT, i was about to request this in your thing :D

pwnaz0r
10-14-2007, 02:59 AM
Not neccesarily. If what happens if you mine two ores before SendSRLReport is called? And it doesn't really matter because 0 + 1 = 1 :p... No harm done.

Oh and make your font a bit bigger. :D

EDIT: NVM mind about the font.
Also, its either SendSRLReport or SRLRandomsReport.

yeah sorry, messed up in SendSRLRandomsReport. I had sendsrlreport though

Also, about the 0 + 1 = 1, thats not the point. Its the concept of understanding that the script doesnt count on the stats from the SRL Stats page to send them.

EX. if you say ReportVars[0]:= 1 and the RocksMined are alread 3453, the RocksMined will not change to 1.

ZephyrsFury
10-14-2007, 03:17 AM
EX. if you say ReportVars[0]:= 1 and the RocksMined are alread 3453, the RocksMined will not change to 1.

Yea I know. What I mean is if your mining for example and ReportVars[0] already has a value in it (for example if you incremented your reportvars but hadn't called SendSrlReport yet), that value would be set to one. Whereas if you made it ReportVars[0] := ReportVars[0] + 1, it would keep incrementing until you SendSRLReport.

Harry
10-14-2007, 03:20 AM
Yea I know. What I mean is if your mining for example and ReportVars[0] already has a value in it (for example if you incremented your reportvars but hadn't called SendSrlReport yet), that value would be set to one. Whereas if you made it ReportVars[0] := ReportVars[0] + 1, it would keep incrementing until you SendSRLReport.

EXACTLY WHAT I WAS TRYING TO SAY!!! :)

And you should not say SRLRandomsReport; after EVERYTIME YOU MINE. It will DOS SRL's Stats server with how much it sends it.

pwnaz0r
10-14-2007, 03:24 AM
thats why i said, Call SRLRandomsReport every time you do the proggy

ZephyrsFury
10-14-2007, 04:55 AM
thats why i said, Call SRLRandomsReport every time you do the proggy

Thats why ReportVars[0] := 1 will not work. (Unless you have the proggie procedure called after everytime you mine but that causes the same problem as Hy71195 mentioned). ReportVars[0] := ReportVars[0] + 1 would be better as it works in every situation.

pwnaz0r
10-14-2007, 06:53 AM
No you call SendSRLReport after everytime you add a report var, and SRLRandomsReport everytime you do a proggy, the proggy should not be after every rock mine if thats what you mean.

ZephyrsFury
10-14-2007, 02:56 PM
You realise that SRLRandomsReport is the same as SendSRLReport except SRLRandomsReport adds the number of randoms encountered into your report box. Anyway... I personally like ReportVars[0] := ReportVars[0] + 1 better but as long as you don't go creative (like me) and make it send the report based on a timer instead of the position in the main loop it should be ok. :D

pwnaz0r
10-15-2007, 03:17 AM
whatever....

Negaal
12-19-2007, 04:51 PM
This is worth to gravedig!
Hehe, it was easier than i thought, Big thx pwnaz0r(lol i didn't knew how to use stats in scripts before... until i found this tut)

pwnaz0r
12-24-2007, 05:16 PM
Hah, I guess its not really a gravedig, I meant for everyone to know how to use them. Your welcome. :D

Sir R. M8gic1an
01-12-2008, 10:34 AM
rated 5 stars, needed this for my script :) thank you.

~RM

Torrent of Flame
02-25-2008, 05:58 PM
Yeah, I register my script but dont get any ScriptID

Metagen
07-23-2008, 01:04 AM
ty!!