SRL Archive - SRL Stats

Using the SRL Stats Signature API


Wizzup?

2010-12-26 17:15:24

The SRL Stats API exports data in JSON format. Languages like PHP, Python etc can easily parse this.

Getting Script Details

http://stats.villavu.com/api/script/<SCRIPTIDHERE>

Example: http://stats.villavu.com/api/script/1
Output:

{
"last_commit_by:": "whiplash",
"vars": [
[
491,
"Essence"
]
],
"script": "Essence Miner",
"commits": 35,
"time": 642,
"owner": "whitely",
"last_commit_on:": "Sun Dec 26 23:03:25 2010"
}

Getting User Details

http://stats.villavu.com/api/user/<USERIDHERE>

Example: http://stats.villavu.com/api/user/1
Output:


{
"last_commit_to:": "Wizzup's Essence Miner",
"vars": [
[
"Rune Essence (Mined)",
28
]
],
"commits": 1,
"rank": 294,
"user": "Wizzup",
"time": 5,
"last_commit_on:": "Sat Jan 1 12:56:20 2011"
}

Getting the last commit

http://stats.villavu.com/api/commit/last

Output:
{
"timestamp": "Sun Dec 26 23:02:52 2010",
"time_added": 24,
"user": "whereupon",
"script": "Woodcutter"
}

Getting the user stats to a specific script

http://stats.villavu.com/api/user/<USERID/script/<SCRIPTID>

Example: http://stats.villavu.com/api/user/235/script/21
Output:


{
"vars": [
[
46,
"Abyss (Solved)"
],
[
3218,
"Adamant Ore (Mined)"
],
[
9346,
"Anchovies Caught"
],
[
911,
"Anchovies Cooked"
],
[
31,
"Arnav (Solved)"
],
[
43,
"Beekeeper (Solved)"
],
[
1,
"Beekeeper (Unsolved)"
],
[
168,
"Bowls Filled"
],
[
38,
"Certer (Solved)"
],
[
33591,
"Clay (Mined)"
],
[
54407,
"Clay (Softened)"
],
[
75766,
"Coal Ore (Mined)"
],
[
14409,
"Copper Ore (Mined)"
],
[
36,
"Demon (Solved)"
],
[
3,
"Demon (Unsolved)"
],
[
27,
"Evil Bob (Solved)"
],
[
9,
"Evil Bob (Unsolved)"
],
[
37,
"Forester (Solved)"
],
[
28,
"Frog (Solved)"
],
[
6,
"Frog (Unsolved)"
],
[
5630,
"Gold Ore (Mined)"
],
[
236,
"Herring Caught"
],
[
386937,
"High Level Alchs"
],
[
190551,
"Iron Ore (Mined)"
],
[
25,
"Leo (Solved)"
],
[
21,
"Leo (Unsolved)"
],
[
41258,
"Loads Done"
],
[
29329,
"Lobster Caught"
],
[
25466,
"Lobster Cooked"
],
[
922,
"Magic Logs Chopped"
],
[
3682,
"Maple Logs Chopped"
],
[
29,
"Maze (Solved)"
],
[
15,
"Maze (Unsolved)"
],
[
32,
"Mime (Solved)"
],
[
2,
"Mime (Unsolved)"
],
[
20869,
"Mithril Ore (Mined)"
],
[
35,
"Molly (Solved)"
],
[
6,
"Molly (Unsolved)"
],
[
40,
"Mordaut (Solved)"
],
[
14,
"Mordaut (Unsolved)"
],
[
57558,
"Normal Logs Chopped"
],
[
27533,
"Oak Logs Chopped"
],
[
34,
"P. Pete (Unsolved)"
],
[
104,
"Pike Caught"
],
[
40,
"Pillory (Solved)"
],
[
5,
"Pillory (Unsolved)"
],
[
42,
"Pinball (Solved)"
],
[
4,
"Pinball (Unsolved)"
],
[
32,
"Quiz (Solved)"
],
[
7006,
"Salmon Caught"
],
[
38,
"Sandwich (Solved)"
],
[
2,
"Sandwich (Unsolved)"
],
[
302,
"Sardines Caught"
],
[
18392,
"Shrimp Caught"
],
[
2933,
"Shrimp Cooked"
],
[
449,
"Silver Ore (Mined)"
],
[
10786,
"Swordfish Caught"
],
[
3047,
"Swordfish Cooked"
],
[
29732,
"Times Banked"
],
[
59355,
"Times Walked"
],
[
8387,
"Tin Ore (Mined)"
],
[
78582375,
"Total EXP Gained"
],
[
2566,
"Total Levels Gained"
],
[
6635,
"Total Logins"
],
[
10478,
"Trout Caught"
],
[
1450,
"Trout Cooked"
],
[
12368,
"Tuna Caught"
],
[
86495,
"Tuna Cooked"
],
[
202214,
"Willow Logs Chopped"
],
[
27723,
"Yew Logs Chopped"
]
],
"script": "MSI Phoenix Scripts",
"commits": 28634,
"user": "Anonymous",
"time": 264902,
"last_commit_on:": "Fri Aug 19 14:00:22 2011"
}

Train

2010-12-26 19:04:19

I think you meant stats.villavu.com/api/

Craig`

2010-12-26 19:23:13

From: Train
I think you meant stats.villavu.com/api/


No, I'm positive it's old.villavu, that's the URL he's been using when discussing it on IRC.

craig.

mormonman

2010-12-26 19:25:30

From: Craig`
No, I'm positive it's old.villavu, that's the URL he's been using when discussing it on IRC.

craig.


That's his test database.

Dgby714

2010-12-26 19:28:47

From: Wizzup?

Getting User Details

http://old.villavu.com/stats/api/script/<USERIDHERE>

Example: http://old.villavu.com/stats/api/user/1
Output:

Inside of the [noparse]
[/noparse] tags you need to change script to user

From: Train
I think you meant stats.villavu.com/api/

I think he did also.

Wizzup?

2010-12-27 03:35:22

Nah, I used old.villavu.com as examples. (So you can verify it works)
Once the SRL Stats are populated I'll update the post.

Sgt Soul

2011-01-16 20:41:41

about time to update the post Wizzup? ;)

Wizzup?

2011-01-17 14:04:47

Done. Thanks. :)

Flight

2011-08-18 03:31:00

Wizzup?, would it be possible to add variables to the API based on the user ID and/or script ID?

Wizzup?

2011-08-19 05:12:57

Do you mean add variables to a specific script owned by a specific user? Like, adding a variable to a script. Not creating entirely new variables?

Flight

2011-08-19 05:37:19

Hm, keeping the variables that are already defined to the User/Script. At the moment, for grabbing User details, we can get their 'commits, last_commit_to,user,last_commit_on', but what about that User's variables? Essence mined, Strength exp gained, fish cooked, ect… Specific to that user. And maybe, if possible (I think this would be a bit more difficult), getting a User's variables obtained from a specific script only.

Example:

Variables for UserID (208):
"Runecraftin Exp (Gained)": 9999999

Wizzup?

2011-08-19 05:39:30

From: Flight
Hm, keeping the variables that are already defined to the User/Script. At the moment, for grabbing User details, we can get their 'commits, last_commit_to,user,last_commit_on', but what about that User's variables? Essence mined, Strength exp gained, fish cooked, ect… Specific to that user. And maybe, if possible (I think this would be a bit more difficult), getting a User's variables obtained from a specific script only.

Example:

Variables for UserID (208):
"Runecraftin Exp (Gained)": 9999999


I probably misread. Yes, that is possible. I'll look into it and update this thread accordingly.

Flight

2011-08-19 05:41:05

From: Wizzup?
I probably misread. Yes, that is possible. I'll look into it and update this post accordingly.


Thank you very much, that would be wonderful. :spot:

Wizzup?

2011-08-19 08:03:32

Sorry for slight stats downtime ( 30s for a few times, I was testing on the production environment. :p )

Updated first post; I think everything is now added, including stats for user to a specific script.

Now get them signature services up!

Flight

2011-08-19 08:15:25

Now I need a tutorial on how to make custom signatures for everyone. :p

Something like… "http://site.com/S50U208.php" Which would grab the User's (208) variable specific to that script (50). S=Script, U=User

Very nice work, Wizzup?!

Wizzup?

2011-08-19 08:20:33

Perhaps http://villavu.com/forum/showthread.php?t=61088 helps?

Flight

2011-08-19 08:36:45

Yep that's what I've been going on, but I was meaning like anyone could simply put in their User ID and Script ID into the PHP address and put that directly into their signature.

1 person might want a sig for their ID and Script so they'd use, for example, "http://site.com/S39U105.php" which would automatically grab the info for Script ID 39 and User ID 105. Another person would want something different so the
I'm sorry if I'm unclear, I guess it's not easy to explain it. :p I think I might drop Frement a line, I think he could give me a couple points.">

Wizzup?

2011-08-19 09:04:04

Use GET variables plus some rewrite rules. :)

Like, rewrite sigs/user5.png to sig.php?user=5

Flight

2011-08-19 09:25:47

From: Wizzup?
Use GET variables plus some rewrite rules. :)

Like, rewrite sigs/user5.png to sig.php?user=5


I was just reading over that on W3s, I'll see what I can put together, thanks. :)