Основные советы
Хороший способ отладки — это вставка команды MessageBox в ключевые точки скрипта.
Если выходят сообщения об ошибке, а вы не можете найти причину, попытайтесь удалить подозрительные строки кода одну за другой (используя “;” чтобы пометить их как комментарии), чтобы выяснить строку с ошибкой
Обратите внимание на коды ошибок, которые выдают редактор и игра, обычно они указывают на источник проблемы и то, как ее устранить.
Savegame issue
If you have not realised already, when you save your game while in motion, the object coordinates updated in the your savegame are the ones during the cell changed.
In order to position the object correctly, it is always best to keep a global parameters of the object coordinates.
When you first load the game, do a detection on the object existing coordinates vs its global coordinates.
If there is a big discrepancy, set the object to the global coordinates. In this way, when you first load the game, the object will be in precisely the same position when you save it.
General hints
• A good way to debug is to insert MessageBox commands at key points in your script.
• If you produce error messages and can't find the cause, try to remove suspect lines of codes one by one (using ; to mark them as comments) to pinpoint the error causing line.
• Pay attention to the error codes that the editor and the game give you, they usually let you pinpoint the source of the problem to some degree.
• When you make changes to a script, it's a very good idea to save the script twice afterwards, to make sure the compiler properly checks it for errors.
For example, if you delete a variable declaration but forget to remove the variable from the script, the compiler may not report an error the first time you save the script. This also happens when you change the name of a script (in the 'Begin' statement), but leave the original name in a StopScript statement.
Apparently, the compiler doesn't update its internal list of variables, script names, etc. until after it compiles the script. End result is that the compiler will use the stored variable declarations and script names from its previous pass through the script, rather than the current ones.
This probably explains why you have to save a script at least once before its name (from the 'Begin' statement) will be recognized in a StopScript statement in the same script. -(DinkumThinkum)