Troubleshooting Modules

From ASSS Wiki
Jump to: navigation, search

Here are some general solutions to help you solve a problem with a module that you just wrote. Keep in mind that these are suggestions, and may not always be correct.

My module works when I put it in modules.conf, but the zone crashes when I use ?insmod, why?

Chances are, you are doing something in the CB_ARENAACTION callback, and are doing something in the AA_PRECREATE or AA_CREATE states. Simply do this when the module loads:

Arena *a;
Link *link;

When my module is in modules.conf, players can not enter the zone, or when I use ?insmod, players can not switch arenas and I get errors about player states!

You may be using arena data improperly. Be sure you have gotten the I_ARENAMAN interface and have used AllocateArenaData() properly.

My module keeps failing to load!

Be sure you have all the necessary modules needed for your module to run. Make sure your module loads after the modules it is dependant on are already loaded.

My module crashes whenever I try to use an interface!

Make sure you have gotten the interface by using GetInterface() properly, that the assigned interface variable is unique, and that you verify whether or not the interface is valid by checking to see if it is not defined. The latter is typically done in the entry point, as shown here, by adding an if-statement and returning MM_FAIL on failure. If the interface is being called at some other point in the code, make sure to verify if it is defined and to handle cases throughout your code where it may not be valid.

Also note that if a parent interface does not check to see if it is still being used by other modules before unloading, it may cause instability in your zone and eventually result in a crash when a module calls that interface again.

My module will not compile! Why can't my compiler find certain things?

Sometimes, #include asss.h is not enough. Only the core header files are in asss.h, and you will need to manually include any others. This may also be true if you are using a custom interface.

Why does my module keep crashing when a player leaves the zone?

You may be saving the player pointer somewhere, and then are trying to access it after the player leaves. This does not work because the pointer becomes invalid when the player leaves. Your module is informed when this happens by the CB_NEWPLAYER callback.