Home   Help Search Login Register  

Author Topic: ArmaLib To .Net - library  (Read 3193 times)

0 Members and 1 Guest are viewing this topic.

Offline Ragnar_Darude

  • Members
  • *
ArmaLib To .Net - library
« on: 14 Sep 2008, 22:26:00 »
*** 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.html

A quick example code (in C#):

Code: [Select]
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:

Code: [Select]
 
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/express

Please tell me if you find this useful!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: ArmaLib To .Net - library
« Reply #1 on: 14 Sep 2008, 22:49:57 »
This seems most interesting  :clap:
May the pipe you use have a network path (You run ArmA in a computer and run your client in another)?

Offline Ragnar_Darude

  • Members
  • *
Re: ArmaLib To .Net - library
« Reply #2 on: 14 Sep 2008, 23:21:30 »
Thank you! No, not currently. Did'nt think of that but i will fix that as soon as i can...



#removed unnecessary quote - bedges
« Last Edit: 06 Oct 2008, 23:15:42 by bedges »

Offline i0n0s

  • Moderator
  • *****
Re: ArmaLib To .Net - library
« Reply #3 on: 06 Oct 2008, 22:18:47 »
Hi, I finally took a look at it.
Nice work on that lib!

But there are some bad points:
  • The ArmaTypesDemo crashes with an unhandled exception when starting them without .net 3.5. And you need to start it via the console to see the exact exception to find out what happens. When I finally "uninstalled" .net 3.5 (that's what the setup told  :blink: ), the demos work fine.
  • No documentation on those demo. You have to find out yourself what they should show and what they should do.
  • Your lib has no licence. Please add a licence to it.
  • .net, so I can't use it easily without coding in .net.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: ArmaLib To .Net - library
« Reply #4 on: 07 Oct 2008, 02:32:28 »
Can't really complain about this being for .NET since it is a .NET library :scratch:. Still, .NET is sadly a bit obscure and/or unattainable for most people (Though I'm ashamed to admit it, I've worked with it a fair bit when I was last working, but that doesn't mean I own a copy myself).

Any chance this might work with Mono?
« Last Edit: 07 Oct 2008, 02:36:40 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)