Arma2NETMySQL Plugin ReadMe

Contents

Introduction

Links:

This program acts as an intermediary between Arma2/Arma3 and a MySQL or SQLite database. It uses the Arma2NET wrapper system. It is written in C#. The program has to be run on the same system as your Arma2/Arma3 server, however, the MySQL database can be either local or remote. The SQLite database runs on the local machine.

History:

This program has had a long history. Initially, the program used JayArma2Lib because DLL injections were the only way to pass information between Arma2 and the outside. Eventually, BIS added callExtension which allowed for a more structured (non-hacky) way to pass information. JayArma2Lib switched to this and things continued. Development was done here and an example mission was here. Technically, all that code should still work but the bad part was all the formatting and ugly stuff that had to be done in game via the SQF scripting in order to get the data into a reasonable format. It involved iterating through strings and creating arrays and generally was still pretty hacky. Then, Arma2NET came along and things got better. This wrapper system allowed us to return nice results back to Arma2 and not have to deal with all the formatting nonsense. I ended up just copying the bits and pieces that were needed from the past project and creating a new application. Development is all done via the Github pages. In addition, the Persistent Database Scripts system as created by [KH]JMan currently uses builds of this program for saving data. In addition, MSO, a modular mission framework uses it for saving information.

With the recent Arma3 Alpha release, testing is ongoing. However, the functionality appears to be working just like in Arma 2.

Requirements

To run the plugin:

How To Use Arma2NETMySQL

Arma2NETMySQL looks two places for the relevant files and folders. First, it checks the Arma2/Arma3 root directory. If it can't find them there, it looks in the AppData folder. I would recommend using the AppData location if possible. This makes future upgrades and changes easier to manage. However, some people on limited rental servers may need to put them in the root Arma2/Arma3 folder. Make sure the file/folder structure matches one of these. Don't put some files in one location and some in the other, that could result in problems.

This location is for Windows 7/Vista, if you're running an older version, this location will probably be different.

The folder structure for Arma2NET should look like the following. Note that if you downloaded a compiled version of the plugin, this should already be included and already setup correctly.

Known Issues

Arma2NETMySQL Plugin uses the callExtension function, however, there are some technical considerations as part of this.

Returning results in Arma 2 beta 97299 or greater has a limit of 16383 (~16 KB) characters. If you try to run a query that will return a result longer than 16383 characters, it will return the string "TooLong". Then you know you will need to limit the number of results that are returned. In MySQL, you can use the limit parameter, or in SQLite, the limit parameter. This is a limitation of Arma2 so don't ask for this to be fixed.

The length limit for Arma 3 appears to be similar, however, this may change in the future.

Currently, commas cannot be used as data to be sent back and forth because the system uses commas to identify splitting up the database columns. If you have a suggestion for how to solve this or would like to submit a fix, I would certainly appreciate it.

Troubleshooting

If you are getting a returned result of "Error" in the game, this means there's something wrong with your query. Check the logs to track down the problem.

Stuck? First check the "logs" folder. The plugin creates a new log file each time it's run. Go into your appdata folder or the root Arma game folder and then find the "logs" folder. If there are errors or things, they will show up there.

C:\Users\Yourname\AppData\Local\Arma2NETMySQL\logs\
If you don't have a logs folder or it's empty, this is a sign the plugin isn't running. Try the second step:

Arma2NET also stores log files which are located here:

C:\Users\Yourname\AppData\Local\Arma2NET\
This will tell you if the plugin is loading appropriately. If it's not, check your launcher and make sure that is all correct.

You can also check the RPT files generated by Arma 2/Arma 3. These are located here:

C:\Users\Yourname\AppData\Local\{ArmA 2 OA\Arma 3}
These can get very long so scroll all the way to the bottom to see the latest run. This will tell you if you have an error in your SQF scripting code or other such problems. Note, these path locations are for Windows 7 (and Vista?) and may be different for other versions of Windows.

If you're still having problems, please go back and double check that you did everything correctly. If you skipped a step or got an error and just decided to continue to the next step, nothing will work.

If you found a bug, please create an issue ticket here: Github page.

There is also a thread on the BIS forums so if you're stuck, you can ask there. The forums are preferred over emailing me because then the question/answer is available to future people who have similar problems. If you post any questions anywhere, please post ALL log files, otherwise we will have problems helping you.

For Developers

To examine the sourcecode, open up the provided Visual Studio project. To compile the code into a .DLL check to make sure the references are pointing to the correct place. MySql.Data needs to be listed in the references and should point to "MySql.Data.dll" which is provided by the MySQL Connector listed above. System.Data.SQLite should point to "System.Data.SQLite.dll" which is provided by the SQLite precompiled binaries listed above. Once these are set, you can compile the sourcecode. The resulting .DLL should be placed in the Arma2NET Addins folder here: @Arma2NET\AddIns\Arma2NETMySQLPlugin. Each plugin is stored in a folder with the name of the DLL. Any dependency DLLs can also be placed in this folder as well.

For easy testing, you can use Arma2NetExplorer.exe provided by Arma2NET. After launching this program, click "list addins" to see if Arma2NETMySQL loaded in correctly. Then you can run straight commands as outlined in the above documentation. For example:

Arma2NETMySQLCommand ['weapons', 'SELECT * FROM users LIMIT 3']

If the Databases.txt file and your database is setup correctly, you can run straight commands here and see the result. This is extremely helpful for testing without having to load up the entire game. Make sure if you make a change to the C# code that you recompile and copy over the .DLL to the appropriate folder, otherwise you'll be running the old version and won't see any changes.

Changelog

License

Arma2NETMySQL is licensed under the GPL version 3. If you would like to contribute code or fixes, please fork the project on Github and submit a pull request.

Thanks To