*** ArmaLib To .Net library by Ragnar_Darude ***This is a .Net - library to connect a program to ARMA through Kegety's ArmaLib ScriptLink-feature. You can send messages between your program and Arma and this library also helps you detect and parse the different types in Arma (arrays, numbers, strings...)
Some examples of usages for this library:
- Monitor and control your mission progress from another program
- Write a wrapper program so you can connect ARMA with your favorite database-engine (MySQL, MSSQL, Postgre...)
- Create AI-enhancments like neural-networks (example included)
- Create a program that photographs the Sahrani-terrain
- Control your house-robot from within ARMA
and so on...
Features of this library:
- Simple methods to connect and disconnect, read and write to the named pipe (the message stream)
- Asynchronous operation with a message loop that monitors the pipe for new messages and fires an event (example included)
- Parse or create ARMA-types: arrays, strings, numbers, code and objects.
Download:http://files.filefront.com/ArmaLibToNetrar/;11780401;/fileinfo.htmlA quick example code (in C#):
Code Sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ArmaLibToNet;
namespace SimpleScriptLinkDemo
{
class Program
{
static void Main(string[] args)
{
ScriptLink sl = new ScriptLink(); // Create the connection object
sl.Connect("my_pipe"); // Wait for a connection
sl.Write("Hello!"); // Write to the pipe
Console.WriteLine(sl.ReadString()); // Read from the pipe and print it out
sl.Disconnect(); // Disconnect the pipe
Console.ReadLine();
}
}
}
Init.sqf:
call compile preprocessfile "armalib\alibinterface.sqf"; // Compile the ArmaLib wrapper
THEPIPENAME = "my_pipe"; // Set a name for the connection
_sl = THEPIPENAME call slInit; // Initialize the connection
waitUntil{_sl call slIsConnected}; // Wait for it to connect
sleep 1; // Sleep a little while to wait for a new message
_data = _sl call slReadData; // Read new messges
player sideChat format["%1", _data select 0]; // Print out the first message
"sl_WriteData" extCall [THEPIPENAME, "Hi!"]; // Write to the pipe
Outputs "Hello" in ARMA and "Hi" in your program.
Links:Kegety's Homepage - Creator of ArmaLib (required)
http://www.kegetys.net/arma/Microsoft Visual Studio Express Editions
http://www.microsoft.com/expressPlease tell me if you find this useful!