This simple tutorial will guide you to making your own plugin and then calling it from SQF code.
Creating a new project
First, create a new class library project using your favourite .NET language. For this tutorial we will be using C# and Visual Studio to create a plugin that reverses text.
Your window should look something like this:
Adding the references
Add a reference to Arma2Net.AddInProxy.dll. Right click References in your Solution Explorer and click Add Reference.
You can remove the references that were already there such as System.Data, because we don't need them.
Creating the plugin
Decorate your plugin class with
Arma2Net.AddInProxy.AddInAttribute, specifying the function name as the name argument. For this plugin we will be using "ReverseText".
The plugin class needs to inherit from
Arma2Net.AddInProxy.AddIn and override the
Invoke method. This method is what will expose the functionality of the plugin.
Now go ahead and implement the plugin. Since we are reversing text we'll probably want to use the
Go ahead and build the project. You'll probably want to use the Release configuration. Now to test the plugin.
Running the plugin
Head to your Release directory, or wherever you built your project. Create a folder inside ArmA 2\@Arma2NET\AddIns with the name of the plugin. Copy your built .dll file into the directory.
You can now call your plugin from Arma 2. For this particular tutorial we will be hinting the result of reversing the text.
hint ("Arma2Net.Unmanaged" callExtension "ReverseText hello world")
Click Preview. The game hints "dlrow olleh" to the screen.