In version 1.21 scripts were extensively commented, which can be really helpful when working with them. This has the positive side effect of not being needed to comment your debug code out before you package your mod and put it up for download, and giving another way of having users diagnose problems with you-just have them turn on the scriptslog and send you the log! An article on how to enable the scriptslog and how to use it is available here.
Instead of using the combat log or sounds to help debug your program, consider using the logging functions built into the game. Don't forget that you can use it to trigger a script recompile without launching the game. Script Studio can be an incredible tool if you know how to use it and its limitations.
Use Script Studio (even if you don't use it to edit script) Or if you're modifying a larger section of code, you should have a begin and end comment, something like this:Īdding comment tags like this make it obvious which sections of code that you've modified so that users installing your mod can easily merge your mod in. If you are changing a single line, you could use a simple comment tacked on to the end of the line like this:ĭefault useNativeTargeting = false //modEnhancedTargeting You should clearly mark sections of code that are modified or added by your mod. You should also try to avoid changing things like whitespace in sections of code that you are not modifying, because these changes can make it difficult for a user to merge in your mod. While modding, you should keep in mind that every change that you make can affect other mods that a user installs, so you should do your best to keep your changes self-contained and with as few side-effects as you can. Tips and Best Practices Do No Harm (and mind your whitespace edits!) 7.3 Check If item Is Equipped In Slot By Item Name.7.2 Check If Player Has Item In Inventory.6.4 Teleport To Position In The Same location.6.2 Fast Travel To Location With Specified Travel Point.6.1 Fast Travel To Location With Specified Position.5 Execute Code When Item Is Equipped/Unequipped.3 Executing Code On Game Load And Location Change.2 Game Facts System (Saving/Loading Data).1.3 Use Script Studio (even if you don't use it to edit script).1.1 Do No Harm (and mind your whitespace edits!).