Make a buffer and write some data to it:
buffer = buffer_create(64, buffer_fixed, 1); var my_health = 7, win = true; var output = new BitOutput(buffer); output.writeInt(my_health, 0, 10); output.writeBool(win); output.finish(); // <- don't forget!
You can later read the data back from the buffer in the same order:
var input = new BitInput(buffer); var my_health = input.readInt(0, 10); var win = input.readBool(); input.finish(); show_debug_message(my_health); show_debug_message(win);
And, as usual, don't forget to destroy your (GameMaker) buffers after you're done working with them!