Simple example plugin for Dalamud.
This is not designed to be the simplest possible example, but it is also not designed to cover everything you might want to do. For more detailed questions, come ask in the Discord.
- Simple functional plugin
- Slash command
- Main UI
- Settings UI
- Image loading
- Plugin json
- Simple, slightly-improved plugin configuration handling
- Project organization
- Copies all necessary plugin files to the output directory
- Does not copy dependencies that are provided by dalamud
- Output directory can be zipped directly and have exactly what is required
- Hides data files from visual studio to reduce clutter
- Also allows having data files in different paths than VS would usually allow if done in the IDE directly
- Copies all necessary plugin files to the output directory
The intention is less that any of this is used directly in other projects, and more to show how similar things can be done.
- Open up
SamplePlugin.sln
in your C# editor of choice (likely Visual Studio 2022 or JetBrains Rider). - Build the solution. By default, this will build a
Debug
build, but you can switch toRelease
in your IDE. - The resulting plugin can be found at
SamplePlugin/bin/x64/Debug/SamplePlugin.dll
(orRelease
if appropriate.)
- Launch the game and use
/xlsettings
in chat orxlsettings
in the Dalamud Console to open up the Dalamud settings.- In here, go to
Experimental
, and add the full path to theSamplePlugin.dll
to the list of Dev Plugin Locations.
- In here, go to
- Next, use
/xlplugins
(chat) orxlplugins
(console) to open up the Plugin Installer.- In here, go to
Dev Tools > Installed Dev Plugins
, and theSamplePlugin
should be visible. Enable it.
- In here, go to
- You should now be able to use
/pmycommand
(chat) orpmycommand
(console)!
Note that you only need to add it to the Dev Plugin Locations once (Step 1); it is preserved afterwards. You can disable, enable, or load your plugin on startup through the Plugin Installer.
Basically, just replace all references to SamplePlugin
in all of the files and filenames with your desired name. You'll figure it out 😁
Dalamud will load the JSON file (by default, SamplePlugin/SamplePlugin.json
) next to your DLL and use it for metadata, including the description for your plugin in the Plugin Installer. Make sure to update this with information relevant to your plugin!