Custom documentation
[SNIPPET] Simple Irc Bot »

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,759
Custom documentation
« on March 3rd, 2017, 06:56 AM »
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.

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,801
Re: Custom documentation
« Reply #1, on March 3rd, 2017, 07:01 AM »Last edited on March 3rd, 2017, 07:07 AM
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

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,759
Re: Custom documentation
« Reply #2, on March 4th, 2017, 06:55 PM »
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?

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,801
Re: Custom documentation
« Reply #3, on March 4th, 2017, 09:02 PM »
Code: [Select]
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.
.