Program that enables you to log from scripts inside Arma
The program also monitors the Arma.rpt - file for errors so it will catch and log it instantly:
You can monitor variables and the program will keep track of the history of the how the variable was changed:
It is possible to create "ScriptEvents" that can be fired from your code and invoke "ScriptModules", programs that can send and receive messages from Arma:
Using log4net the applications logging capabilities is extendable to whatever supports that library,
1. Start ArmaScriptingEnvironment.exe
2. Click "ScriptModules"
3. Choose "ScriptModuleDemo.dll" in the drop-down list
4. Click "Load ScriptModule"
5. Click "Variable watch"
6. Click "Add..." and type in "position player select 0".
7. Double click the variable in the list to see any changes made to it (when you move)
8. Click "Connection", "Connect"
9. Click "Log console" to see the console
10. Copy mission\ScriptingEnvironmentDemo.Intro to your mission-folder
12. Start Arma (preferably in window mode so you can see the log console)
13. Start the mission in the mission editor
14. Go to the "Variable watch" in the "Arma Scripting Environment"- window and move around in Arma
How to use logging in your mission:
1. Copy "ScriptLogging.h" and "MessageHandler.sqf" to you mission directory
#include "ScriptLogging.h"at the very top of the script-file(s) you want to use logging in.
startLog;once somewhere early in the file and mission, before any logging-calls would be made. Use should only issue this command once in every mission though.
4. Use any of these commands in your script-files:
logDebug("Message"); logInfo("Message"); logWarn("Message"); logError("Message"); logFatal("Message");5. If you want to stop using logging (ie for release) open up "ScriptLogging.h" and comment out this line:
#define USESCRIPTLOGGINGso that it reads
// #define USESCRIPTLOGGINGor similar.
How to make your own ScriptModule:
1. Write a .Net 3.5 class-library based on ScriptModuleBase
2. Name the main class (the one base on ScriptModuleBase) the same thing as the assembly
3. Copy the assembly to the ScriptModules folder
4. To use ScriptEvents:
#include "ScriptLogging.h"at the top of the script-file
below it or someplace early on in the mission (only once)
ScriptEvent("MyScriptEvent", MyObject)somewhere you want a scriptevent to be fired. Replace "MyScriptEvent" (string) with name of your event and MyObject with any parameter you want to pass. Credits & thanks:
- Armaholic forums
- Microsoft .NET Framework 3.5
Tags: No tags