Game Inheriting

Sora574
06 Apr 2013, 16:56
Ok, so I was wondering... Is it possible to force the game to inherit a type in a library? For example, force the game to inherit 'editor_game' so you can change the start script from a library (which is what I'm trying to do).
This would make a lot of things so much easier, but I can't seem to find a way to do it.


P.S. Sorry if this has already been asked, but I'm lazy and don't feel like searching lol

jaynabonne
06 Apr 2013, 20:02
I don't know of any way for a library to ensure it's run at game startup. This is something I'd love to see put into Quest. My personal idea is that at startup, Quest would look through all objects and run an "ongamestart" script for each object that has one. That would allow libraries to initialize (with an appropriate object to manage it) but it would also allow other nifty uses, like just initializing objects in general.

The problem with forcing inheritance is that an inherited type is overridden by whatever is in the game author's derived class. For example, I have a start script in my game, so even forced inheritance wouldn't run the base code since my start script overrides. (In fact, if you *want* to run base code, you can't.)

As a hack which I haven't tried and which might not even work, you might be able to invoke a function from a Javascript module using ASLEvent. But then the library user would have to include the JS code as well, which seems to be just compounding things.

Sora574
07 Apr 2013, 01:12
Hm... So I guess the only current way to run a script is through a function that calls the script?

Libraries seem to need a huge update. There's so many things that you can't do.
Of course, I've found ways around most of them, but still... They could be so much simpler