Lumina Posted February 12, 2017 Share Posted February 12, 2017 (This tutorial is mainly for beginner) Of course, you could use any text editor to open .lua files. But it's better to use an editor highlighting the code, so you can easily see what is important. One is included in Don't Starve Tool : Sublime. I use Notepad++. But the most important is to find one fitting your taste. Since i use Notepad++ i'll use it as an example, but you should find the same functionality on your own program. Here you can see the difference between a program highlighting code and one classic notepad : Spoiler So you can see that some key words are shown in some specific colors. This is helpful to quickly see how the code is articulated. You also see the number of lines. It's especially useful when an error log say "line 23 in modmain.lua" so you can see where is the problem exactly. Another useful functionality : if you double-click on a word, it is highlighted in all the document. So here i can see all the occurences of "SILVER_BIRDCAGE". Useful to verify i didn't make mistake (if i wrote "SIVER_BIRDCAGE" it will not be highlighted), useful also when looking at a game code trying to see where a function is used. Of course, you could also use the search function. Note : the double-click highlight doesn't take in account the case (at least with my setting in notepad++, sublime seems to have a different behaviour). Don't forget, however, that case is really important. In term of code, Silver_birdcage, silver_birdcage and SILVER_BIRDCAGE aren't the same things. Some part of the code will require lower case, some others will require upper case. Don't create prefab files with mixed case. For example, a mod didn't work because the character was named Will in all the files, and the game was searching for a "will" prefab. Another search option, in the same spirit, but in a larger scale, is the "Find in files" (ctrl+shift+f). This research option allows you to search something in all the files of the specified folder. Why is it useful ? Because if you see a function you don't really understand, you could search in all the game files for others examples. Let say i want to add a "onattackother" function to my character or monster, and want a better example of how and what i can do. I search "onattackother", i select "C:\Steam\steamapps\common\Don't Starve Together\data\scripts\prefabs", because i want to see how it works in prefab (i could select script if i want to see all the files), and i got this : So here i can clearly see the monster and character using this function. I just have to double click on a line to open the related file. When you want to do something and search for example, this function is really useful. If you don't know what a tag is supposed to do, or what entities are using this tag, for example. Ok, so it's really basics informations but i think i would have find them useful if i knew them when i started modding. If you see anything i could add that could be welcome, let me know Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now