Custom documentation

Started by EK.IceFlake, Mar 03, 2017, 06:56 AM

Previous topic - Next topic

EK.IceFlake

Well... since SLC can't keep up with documenting and developing at the same time, I decided to make my own documentation and post what I discover there.
http://sqmod.iceflake.cf/

It currently has an introduction and a 'getting started' page.
Feel free to contact me for any mistakes, if you find them.

.

#1
I would suggest that you don't link to the binary files directly. Instead, the binary directory. Because the file name changes with each release. For example, now is named "build_10.7z" but on the next release, it'll be named "build_11.7z". I do plan to make a symbolic link named "build_latest.7z" that always points to the latest release.

EDIT: There should now be a "build_latest.7z" available which always points to the latest version.
.

EK.IceFlake

There are a few functions that I don't understand.
http://sqmod.iceflake.cf/reference/sqcore/#sqcorereloadbecause
http://sqmod.iceflake.cf/reference/sqcore/#sqcoresetreloadinfo
Both SqCore.ReloadBecause and SqCore.SetReloadInfo take two parameters: int header and object payload.
What do these parameters do?
Also, all DestroyEntity functions take 3 parameters: int id, int header and object payload.
What does header and payload do?

.

SqCore.On().ScriptReload.Connect(function(header, payload) {
    printf("Reload reason: %d", header);
    print("Reload payload: " + payload);
    switch (header)
    {
        case 1: /* do something... */ break;
        case 2: /* do something... */ break;
        case 3: /* do something... */ break;
        case 4: /* do something... */ break;
        default: /* do something... */
    }
});

// Somewhere else in the code
SqCore.ReloadBecause(3, ["Anything", true,  function() { print("I want"); }, ["to", "send"], {Yes = 2.534}, "as payload"]);

They're just a bunch of custom values that you can send to the reload event in order to do certain things. The header is just an integer to help specify what kind of things might be found in the payload. So you don't have to manually dig in the payload to find that out. And the payload is anything you want. Any type can be specified there. Think of it as the parameters that complement the reload reason/header.

The script does not reload when you call SqCore.ReloadBecause(). Because it can't kill the current code execution and guarantee nothing will break. So instead, it will reload the script at the end of whatever event is currently triggered. When the control is returned back to the server, so to speak.

And SqCore.SetReloadInfo(), SqCore.GetReloadHeader(), SqCore.GetReloadPayload() allows you to retrieve or modify the header payload even after you specified them. So you may add or react from other places to it.

Why all this fuss for something that may not even be used by most people? Because I like the idea of knowing that there's a feature out there which allows me to take this approach if need be. Doesn't cost you or me anything. So why not have it there in case anyone needs it.
.