Hi, I'm still learning gsc scripting and I keep seeing the REGISTER_SYSTEM line around. I'm not completely new to coding but I can't figure out what this line actually doing. I was just hoping someone could shine some light on this one for me.
Example Use from _zm_perk_staminup.gsc:
My only guess so far about what this is doing is that it's creating a singleton/ static instance of the class with the arguments being (string the same as the namespace, pointer to the constructor, ???).
I looked through the code for documentation, here is what I found (In scripts/shared system_shared.gsc)
In order to use it, you need to have this line at the top of your gsc file.
Hope this helped.
Interesting, so in other words #namespace is only effective when used in conjuction with the register_system function. If I understand this correctly, using this method eliminates the need to manually add your init() and main() functions in your mapname.gsc as the usual process, when calling your custom scripts. Setting up your script this way will automatically call your init and main functions pre and post-load respectively. Do I have that right?
From what I can gather, yeah, it just makes it call itself, which is cool. The only other thing I'm curious about is if you can later call a system by name using this, but it sounds like you would just be calling the namespace which would accomplish the same thing. Cool though. Thanks for finding this, this makes a couple things makes more sense. Sorry for late response btw, life got busy and I forgot about this for a bit.