Hub Datum

by Foomer
A simple library which makes it easy to access data from a game's hub entry. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Foomer.HubDatum##version=3

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Foomer.HubDatum##version=3

295 downloads
Version 3
Date added: Aug 10 2009
Last updated: Aug 13 2009
4 fans
The purpose of this library is to make it easy to extract information from a BYOND game's hub page and use that information inside the game. An example of how this could be used would be to generate a list of available game servers for the player to connect to from within the game. That means you may never have to visit the BYOND hub in order to connect to an online game, because you can do it from within the game itself!

How this library works is that you create a new hub datum by any name you want, and specify the game path for the datum to extract its information from, like this:

var/hub_page/page = new(path)

The "path" can be something like Abra.Castle or Foomer.SolarConquest. It should be NOTED however that this function does periodically fail to extract information from the hub because of being unable to contact it, so you should always make sure that the newly created datum is not null, meaning it failed to contact the hub.

var/hub_page/page = new("Foomer.SolarConquest")
if(!page)
return

Once the datum has been created, you can read any of its variables just like you could any other object in the game. The datum may also include a list containing a series of server datums with information about each of the games servers.

If at any time you want to update the datum to contain the most recent information from the hub (NOTE: There is still a chance this mail fail), you can use the datum.Update() proc to update its variables.

page.Update()

If Update() is called on a datum that has already had its information filled out, it will use the datum's path as the argument for this, so you may not need to supply one.

Here is a complete list of all the hub and server datum variables:

HUB DATUM VARIABLES:
  • title - This is the name of the game.
  • author - The key which created the game.
  • path - The hub entry's path, such as Abra.Castle.
  • short_desc - The short description seen in game listings.
  • long_desc - The complete description seen on the hub page itself.
  • version - The displayed version number.
  • banner - The address of the game's banner graphic.
  • icon - The address of the game's 64x64 icon.
  • small_icon - The address of the game's 32x32 icon, if it has one.
  • servers - This is a /list of server datums.
SERVER DATUM VARIABLES:
  • url - The url that is used to connect to the game. If a player clicks on this link, they will be connected with the server being linked to.
  • status - The status message being displayed by the server.
  • users - A /list of users who are currently logged into this server.

Comments

Trogdor15: (Mar 15 2011, 2:48 pm)
Very helpful.