ID:121931
 
I'm working on a new library that'll make some of BYOND's existing hub-based features easier to use. It's not ready to be posted yet. There's still some more work to do and it's limited by what I can only imagine are BYOND bugs. Currently, it addresses the following topics:

Scores: The library provides a client.SetScore() and client.GetScore() proc. The SetScore() proc takes a score name, operation, value, and data type (though the data type is optional). The goal of this is to satisfy this feature request. For example:

client.SetScore("kills", ADD, 1)
client.SetScore("level", SET, 10)
client.SetScore("highest-level", MAX, 10)

The first call adds 1 to your "kills" score. The second call sets your level to 10, regardless of what value is currently there. The third call sets your "highest-level" value to be the greater of the two values: the current value and the value passed to it (10).

The other operations are SUBTRACT and MIN. You can probably figure out what they'd do. Each operation omits the last parameter, data type, which is assumed to be NUMERIC. You can also specify TEXT as the data type.

The GetScore() proc takes a score name and a data type constant (either TEXT or NUMERIC). This determines how the value is parsed before returning it. If the type is NUMERIC (which is the default type) it'll call text2num() on the result so that client.GetScore("level") returns the number 10, not the string "10".

Medals: The library provides the client.AddMedal(), client.RemoveMedal(), and client.GetMedals() procs. The first two take a medal name as the argument and call the built-in medal procs. Both of these procs return 1 if the operation was successful and 0 if the hub couldn't be reached. The GetMedals() proc gets the list of all medals that client has. It returns a list of medals or null if the hub could not be reached.

Unforunately, BYOND's handling of medals is very unreliable and often fails so the library's procs often fail. I don't want to post a library that doesn't work most of the time, but I'm not sure if or when these features will be fixed.

Servers: The library also provides a world.GetServers() proc. It takes a author name and game name as arguments (if no arguments are provided, it parses world.hub to get the author and game). It pulls the text version of the game's hub page from the website and parses out the information about which servers are publicly available. This proc returns a list of /Server objects, each containing the server's URL, version, host, status, and player list.

I'd also like to add some client procs to this section to handle connecting to remote servers. For example, you could call the client.Link() proc and pass it a /Server object or IP address/port to connect to and it'd call link(). I need to play around with this more and see what's possible with the different types of byond:// links that you can use.


If there are other features related to these topics that you'd like to see, feel free to suggest them here.

As much as I'd like to stop making libraries and focus on other things, this library will help me with Tiny Heroes and with my game development tutorial. I won't have much time to work on either of those projects until mid-January, but when I do get the time I'll be able to get more stuff done.
Would you mind if i use the Tutorial to make a quick side-scroller game? Not only to show what the current tutorial could be made into, but just because it makes me want to A) make a side-scroller, and B) Program something in general.
I don't mind at all. I plan to add more to the tutorial but it'll never be a complete game. I always figured I'd release the end result and let people make whatever changes they'd like to it, even if it's just simple stuff like adding new levels.
Well i was just going to make one long(100x40?) level. Add a HP system, scores, medals, maybe a few other encounters and such. Just a quick thing.
I planned to add scores and medals to the tutorial. You can always implement it yourself then compare it to how the tutorial does it =)
Alright =3
After trying it out, I would like to suggest a proc that deletes scores.