ID:1249769
 
The Red Book

I'm sure some of you have seen or heard of the Red Book before. It's essentially just a list of Undocumented features (Un-doc), Previously-documented features (Pre-doc), and Semi-documented features (Semi-doc) with some documentation about them thrown in! It's not anything definitive, just...some information.

I created it around...a year ago? Not entirely sure, but I got lazy and decided to make a post "announcing" that it exists! There's a lot of stuff in the 'to do list' at the bottom, which, I will get to eventually.

However, I'd like some user input - if anything needs to be expanded or clarified, or if you have submissions of your own. Stuff about organization, etc.


Currently, the Red Book contains information about:
  • Client side commands
  • Hub and member page text format
  • +- Infinity
  • to, step, in
  • client.Export() calls
  • /proc or /verb references
  • static modifier
  • modified types
  • and a bunch of other silly things!


    Here's a link to the stddef as of 3/29/15: ID:1820598
No one commented here, and I cried.

Anyways, if anyone reads this, I need some suggestions for organization of the document.
I've been thinking of splitting up the book into like,
"reference entry" vs "discussion of a topic".
Since some things are just discussion of an existing documented feature, while other things are more suited for a reference entry-style thing.

I've also thought about adding like, a sort of "status" label to each section. Like, whether it is guide-only documented, completely undocumented, etc.

THOUGHTS? PLEASE.
The section on to, step, and in was informative. You may be able to improve it by providing performance comparisons between them and other common loop methods. Though, that may be outside the scope of your guide.
I never commented because I didn't have much to say aside from it was extremely informative and opened my eyes to a few new ways to did things that I didn't think was possible. Overall I enjoyed the read and fiddling that came about with it.
This is pretty cool, a little informal but I'd imagine that kept it more enjoyable to write. Love all the old pictures of DUNG.
More stuff:

You can escape identifiers:
mob
verb
testverb()
var/\1 = 0
var/a\ b = 1
var/\!a = 2

world << \1 + a\ b + \!a


Token pasting and stringification operator for macros:
#define STRING(a) #a
#define PASTE(a, b) a##b

mob
verb
testverb()
var/ab = "Test"
world << PASTE(a, b)
world << STRING(teststring)


Passing commas to macros:
#define debug(_x_) broadcast(arglist(list(__FILE__, __LINE__) + list _x_))

proc/broadcast()
for(var/k in args)
world << k

mob
verb
testverb()
debug(("test1", "test2"))

test


(the 'test' at the end is because __FILE__ and __LINE__ don't work at the end of a file)
Another particularly undocumented feature that has its uses would be the packet structure for world/Topic() input:

packet = "\x00\x83[length(message) + 6]\x00\x00\x00\x00\x00[message]\x00"


Basically, what this means is if you have any external program running capable of creating a connection to a byond server using sockets, you can send messages to it through world/Topic() and even return messages back through the . value of world/Topic(), or, in other words, the return value.


To receive a message back from the game server, all you need to do is keep a socket open until feedback is received in the form of an entirely different packet structure.

return_packet = "\x00\x83[length(return_message) + 1][is_ascii ? "\x06" : "\x2a"][return_message]"



This might be a little weird or inaccurate, but works in the few instances I've applied this theory to a simple php script and C++ app.

Source: http://www.byond.com/forum/?post=276414
Functional PHP script: http://pastebin.com/T9MW4u5p
Interesting read, learned a few things there.

Nice work.
That was interesting to learn... especially +- infinity... Now I can mimic arithetic bit shifting :D (I want to do this with numbers larger than 65535. The >> and << operators only work with numbers between 0 and 65535 :/). *Experiments with other values*
In response to Doohl
Thanks for posting the script. I was able to convert it over to Objective-C and successfully got my iPhone communication back and forth with BYOND. The code can be found at id:1299098
"0,0" is a magic icon_state that allows an icon or image to be drawn on the map from further than the allowed draw distance. Shhhh... don't tell Lummy.
love it