It has to be manually created mainly because I need the object name to referrence to. For instance, if I did object_add(), it would return the object's id. I would then have to store this somewhere, like a global variable, which everything references to. However, if this global variable is somehow overwritten, then we run into problems.
Why don't you create that dummy object in the script sxms_create() and store its id?
Does it have to manually be created?
Another reason I perfer the dummy object method is that it gives a user a clear and clean way to reference constants/variables stored inside this object. So instead of doing:
you can just do
This also allows for fully cleaning up after itself without global variables just sitting in memory (Once mark comes up with some way to delete variables on command, I may change back, but until then, making an instance which holds everything is the best idea).
Currently, I do this with all my extentions (SXMS, SIRC, SVC, etc) and have even updated other extentions I use to follow this route (GMsock Threaded, N_Menu, etc).
Maybe when Game Maker 7.0 comes along, this won't be needed anymore or maybe some other method will present itself. But until then, this appears to be the best way to contain everything releated to an extention in a single area. It allows for easy custom constants without having to worry about resource name overlapping and also allows for me to make custom sub systems that automatically run without the user needing to make them. (For example, SIRC (which is an API I made to allow Game Maker to interface with the IRC protocol) has a sub system which automatically keeps track of ping for the user, and seperates/build received and sent messages accordingly without the user needing to understand the raw IRC protocol).