Modding:C Sharp Scripting: Difference between revisions
Kernelmethod (talk | contribs) m Add to the modding resources category |
fix typo: cproj -> csproj |
||
Line 19: | Line 19: | ||
# Create a folder somewhere to act as your modding folder, and create a folder inside of that for your specific mod. This will serve as the working directory for the mod. It is not recommended that this be inside the Mods folder of the game, as this folder will also contain some auto-generated files from Visual Studio that are not necessary to include in your finished mod. | # Create a folder somewhere to act as your modding folder, and create a folder inside of that for your specific mod. This will serve as the working directory for the mod. It is not recommended that this be inside the Mods folder of the game, as this folder will also contain some auto-generated files from Visual Studio that are not necessary to include in your finished mod. | ||
# Launch Caves of Qud. In the settings menu, navigate to the "Modding" section and enable "Enable Mods (restart required.)", "Select enabled mods on new game.", and "Allow scripting mods. Scripting mods may contain malicious code!". <br>[[File:CoQ_cs_ModdingSettings.png|1024px]] | # Launch Caves of Qud. In the settings menu, navigate to the "Modding" section and enable "Enable Mods (restart required.)", "Select enabled mods on new game.", and "Allow scripting mods. Scripting mods may contain malicious code!". <br>[[File:CoQ_cs_ModdingSettings.png|1024px]] | ||
# Close and re-open the game to allow mods to be enabled. In the bottom-right corner of the title screen, there will be two new options: "Installed Mod Configuration" and "Modding Utilities". Click "Modding Utilities", then select "Write Mods. | # Close and re-open the game to allow mods to be enabled. In the bottom-right corner of the title screen, there will be two new options: "Installed Mod Configuration" and "Modding Utilities". Click "Modding Utilities", then select "Write Mods.csproj file". This will create a <code>Mods.csproj</code> file in your [[File_locations | configuration files directory]]. <code>.csproj</code> files are C# project files that Visual Studio can load to configure your development environment. | ||
# Copy <code>Mods. | # Copy <code>Mods.csproj</code> into the folder that you created as a working directory for your mod, then open it in Visual Studio. Visual Studio will automatically create <code>obj</code>, <code>bin</code>, and <code>.vs</code> directories, which are metadata used by Visual Studio and can be ignored. | ||
# From here, you are fully set-up to start coding. However, you may want to make some edits to <code>Mods. | # From here, you are fully set-up to start coding. However, you may want to make some edits to <code>Mods.csproj</code>. Changing its name will change the project name in Visual Studio, which may be helpful for distinguishing multiple projects. You can also edit the fields of the file in order to change your Author title, AssemblyName, or other fields. <br>Due to [https://bitbucket.org/bbucklew/cavesofqud-public-issue-tracker/issues/9116 Issue #9116], you may see approximately 50 warnings in the error list. This is because <code>Mods.csproj</code> erroneously contains references to files which do not actually exist in the public release of Caves of Qud. These warnings may safely be ignored, or the erroneous references can be deleted from the <code>Mods.csproj</code> file. | ||
# You can press F12 in order to navigate to the definition of a selected object, variable, or method. If the definition is in the source code, Visual Studio will automatically decompile and open the relevant file. | # You can press F12 in order to navigate to the definition of a selected object, variable, or method. If the definition is in the source code, Visual Studio will automatically decompile and open the relevant file. | ||