Difference between revisions of "Troubleshooting Modules"
m (→My module crashes whenever I try to use an interface!: redundant) |
|||
Line 37: | Line 37: | ||
Make sure you have gotten the interface by using <tt>GetInterface()</tt> 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 [[Writing Modules In C#Using Interfaces|here]], by adding an if-statement and returning <tt>MM_FAIL</tt> 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. | Make sure you have gotten the interface by using <tt>GetInterface()</tt> 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 [[Writing Modules In C#Using Interfaces|here]], by adding an if-statement and returning <tt>MM_FAIL</tt> 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. | ||
− | Note also 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. | + | Note that also 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? == | == My module will not compile! Why can't my compiler find certain things? == |
Revision as of 18:23, 22 January 2011
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.
Contents
- 1 My module works when I put it in modules.conf, but the zone crashes when I use ?insmod, why?
- 2 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!
- 3 My module keeps failing to load!
- 4 My module crashes whenever I try to use an interface!
- 5 My module will not compile! Why can't my compiler find certain things?
- 6 Why does my module keep crashing when a player leaves the zone?
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; aman->Lock(); FOR_EACH_ARENA(a) { ArenaAction(a,AA_PRECREATE); ArenaAction(a,AA_CREATE); } aman->Unlock();
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.
Note that also 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.