// give the player a medal
// get a list of the player's medals
var/list/medals = client.GetMedals()
for(var/m in medals)
world << m
// add 3 to the player's kill count
client.SetScore("kills", ADD, 3)
You can specify different operations in the SetScore proc so with a single proc call you can update the score however you'd like. You don't need to handle getting the current score, adding to it, then updating the scoreboard with the new score. That's all taken care of for you.
The library also provides you with a way to get information from a hub entry. You can get a list of servers that are publicly available:
var/list/servers = world.GetServers("Forumaccount", "AMinerAdventure")
for(var/Server/s in servers)
world << s.url
This makes it very easy to create an in-game list of servers the player can choose from.
Version 4 (posted 06-16-2012)
- Changed the return values of the AddMedal and ClearMedal procs. They return 0 if the operation failed, 1 if the operation wasn't necessary (ex: you called AddMedal to give the player a medal they already had), and 2 if the operation was necessary and succeeded. This lets you still use the return value to determine whether the player has (or doesn't have) the medal and also gives you the ability to distinguish between cases where the player already had the medal and the case where they're getting it for the first time.
- Updated the world.GetServers proc to use savefiles to read the information returned by the BYOND hub.
- Added the world.GetFans() proc, which returns a list of users who are fans of the specified hub entry. If no hub entry is specified, the proc uses world.hub.
- Made the world.GetServers proc accept a single string of the form "author.game". If you pass it one string it splits the string - everything before the period is the author and everything after it is the game's name.
- Made the world.GetServers proc handle the case that no servers are running.
- Added the score-demo example which shows how to abstract out the library to make hub scores even easier to use.
- Initial version.