Errors and Troubleshooting
Quite often you will encounter error or warning messages on compiling or running
a level. No reason to worry: most error messages occur during compiling the
script file and indicate simple syntax errors. You have mistyped something
or referred to a file or object that does not exist. The script file and line
in question is given, so you can easily correct the mistake. Under bugs you'll find some general hints what to do in more complicated a case, and a complete list of Gamestudio bugs. However, how can you find bugs in your script that are not indicated by an error message? Here are some general hints.
- Use the SED debugger for single stepping through your code and observing variables. If you are not familiar with using a debugger, read the lite-C Workshops - two of them deal with debugging.
- If the error occurs randomly, check if it's an uninitialized variable. Use PRAGMA_ZERO and check whether this changes the behavior.
- Set warn_level at its highest value.
- Sometimes it's desirable to check the status of certain entities at runtime. Make sure that default.c is included. Press [Shift-F11]. The game freezes and a cursor appears on the screen. Click onto the entity you want to observe. The watched pointer will be set to that entity, causing it's status display to appear on the screen. Pressing [Shift-F11] a second time will resume gameplay, but the status display is permanently updated with the status of the last clicked entity. If you want to get rid of the status display, click an empty position while in frozen mode.
- If your script behaves erratically and debugging does not help, place diag() or diag_var() calls in your functions. This way you can isolate problematic script lines. This also helps to find the bug when your script causes random crashes.
► latest
version online