Jump to content

Recommended Posts

This is amazing. Good work :D

yes so much possibility :) perhaps it will be a good idea to directly insert a serial dll in arma2net

Share this post


Link to post
Share on other sites

nice addon scott_NZ

I''ve written 2 little plugins, one to write a file and one to read, both do the job i want but I can't get them into one plugin without the read part adding extra quotation marks eg:""gun"" instead of "gun"

any help would be appreciated.....I've only ever done one C# program and that was to read times off a microchip for a slotcar system.

using Arma2Net.AddInProxy;
using System.IO;
using System.Linq;

namespace SaveStuffplugin
{
   [AddIn("SaveStuff")]
   public class SaveStuff : MethodAddIn
   {

       public override string Invoke(string args, int maxResultSize)
       {
           string path = (@"C:\file.txt");
           File.WriteAllText(path, args);
           return null;
       }
   }
}

using Arma2Net.AddInProxy;
using System.IO;
using System.Linq;

namespace ReadStuffplugin
{
   [AddIn("ReadStuff")]
   public class ReadStuff : MethodAddIn
   {
       public override string Invoke(string args, int maxResultSize)
       {
           if (File.Exists(@"C:\file.txt"))
           {
               string text = System.IO.File.ReadAllText(@"C:\file.txt");
               return text;
           }
           else
           {
               return null;
           }
       }
   }
}

Share this post


Link to post
Share on other sites

yes i call both

_stuff = "Arma2Net.Unmanaged" callExtension "ReadStuff";
and
call compile format["'Arma2Net.Unmanaged' callExtension 'SaveStuff %1%2%3%4%5%6'",
_mArray,_wArray,_pArray,str(typeof _Backpack),_BackpackmArray,_BackpackwArray];

but I'd like to make the 1 plugin called ReadWriteFile and call either method

_stuff = "Arma2Net.Unmanaged" callExtension "ReadWriteFile [ReadStuff]";
and
call compile format["'Arma2Net.Unmanaged' callExtension 'ReadWriteFile [saveStuff %1%2%3%4%5%6]'",
_mArray,_wArray,_pArray,str(typeof _Backpack),_BackpackmArray,_BackpackwArray];

Share this post


Link to post
Share on other sites

OK, try something like this:

using Arma2Net.AddInProxy;
using System.IO;
using System.Linq;

namespace ReadWriteFileAddIn
{
   [AddIn("ReadWriteFile")]
   public class ReadWriteFile : MethodAddIn
   {
       public string SaveStuff(string stuff) { save stuff here; }
       public string ReadStuff() { return stuff here; }
   }
}

Then you'd go like...

"Arma2Net.Unmanaged" callExtension "ReadWriteFile [saveStuff, stuff goes here]"

"Arma2Net.Unmanaged" callExtension "ReadWriteFile [ReadStuff]"

Share this post


Link to post
Share on other sites

yep i did it that way.....txt file has ["gun"] but when i read it with that method i get "[""gun""]"

no big deal, I'll stick with the 2 plugins for now....thanks

Share this post


Link to post
Share on other sites

I have been redirected here from the PersistentDB thread by Jman. It seems I am having problems getting Arma2NET to run correctly on my dedicated server. The game is installed through steam and run using TA2DST. The errors I am receiving are shown below:

10/02/2012 20:54:56 Error Caught exception of type System.IO.FileNotFoundException
System.IO.FileNotFoundException: C:\Program Files (x86)\Steam\steamapps\common\arma 2 operation arrowhead\Expansion\beta\Arma2Net.Managed.dll
  at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
  at Arma2Net.AddInProxy.Utils.get_FileVersion()
  at Arma2NETMySQLPlugin.Startup.StartupConnection()
  at Arma2NETMySQLPlugin.Arma2NETMySQLPlugin.Invoke(String args, Int32 maxResultSize)
  at Arma2Net.Managed.AddInManager.DomainInvokeAddIn()
  at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
  at Arma2Net.Managed.AddInManager.InvokeAddIn(String addInName, String arguments, Int32 maxResultSize)
  at Arma2Net.Managed.Bridge.InvokeBuiltInOrAddIn(String function, Int32 maxResultSize)
  at Arma2Net.Managed.Bridge.InvokeFunction(String function, Int32 maxResultSize)
10/02/2012 20:54:56 Error function: Arma2NETMySQL ['arma','UpdatePlayer','tsc=any,tpos=4694.76|2591.53|0.00143909,tdam=0,tdhe=any,tdbo=any,tdha=any,tdle=any,tdir=148.695,tsta=Stand,tsid=any,tveh=any,tsea=,ttyp=BAF_Soldier_TL_MTP,trat=0,tvd=any,ttd=any,tran=any,tfir=any,tek=any,tck=any,tfk=any,tsui=any,tlif=ALIVE,tdea=any,ttp=any,tlc=any,tld="10/2/2012 7:54:56 PM",tpid=2413766,tna=Aenigma,tmid=any']
10/02/2012 20:54:56 Error maxResultSize: 4095
10/02/2012 20:55:02 Error Caught exception of type System.IO.FileNotFoundException
System.IO.FileNotFoundException: C:\Program Files (x86)\Steam\steamapps\common\arma 2 operation arrowhead\Expansion\beta\Arma2Net.Managed.dll
  at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
  at Arma2Net.AddInProxy.Utils.get_FileVersion()
  at Arma2NETMySQLPlugin.Startup.StartupConnection()
  at Arma2NETMySQLPlugin.Arma2NETMySQLPlugin.Invoke(String args, Int32 maxResultSize)
  at Arma2Net.Managed.AddInManager.DomainInvokeAddIn()
  at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
  at Arma2Net.Managed.AddInManager.InvokeAddIn(String addInName, String arguments, Int32 maxResultSize)
  at Arma2Net.Managed.Bridge.InvokeBuiltInOrAddIn(String function, Int32 maxResultSize)
  at Arma2Net.Managed.Bridge.InvokeFunction(String function, Int32 maxResultSize)
10/02/2012 20:55:02 Error function: Arma2NETMySQL ['arma','RemoveLandVehicles','[tmid=any]']
10/02/2012 20:55:02 Error maxResultSize: 4095

So from what I can see Arma2NET is calling for the required files in the wrong location. I have circumvented this problem by moving said files into the directory listed and this seemed to fix the errors.

I am posting here however to see if anyone has had a similar issue and if there is a fix for it.

Share this post


Link to post
Share on other sites

Are you using the latest version of Arma2NET? If so, this may be a bug which I thought I had fixed...

Share this post


Link to post
Share on other sites

I am using a version linked to me by Jman, I'm assuming it is the latest version but I shall check for sure once I am home from work.

EDIT: I am using version 2.2 of Arma2NET

Edited by iOGC_Aenigma

Share this post


Link to post
Share on other sites

A nice piece of software so far. I'm just beginning to explore the possibilities, but the fist question already popped up. How am I able to use a array as an argument for a method Add-In?

I'm using Lists as data type on the c# side, but I can't call my method from within arma2 or the Arma2Net Explorer. I always get a MissingMethodException. Any advice would be appreciated.

Share this post


Link to post
Share on other sites

Arma2NET converts them into ReadOnlyCollections. Here's an example from a Str plugin I wrote for string manipulation:

public string[] Split(string s, ReadOnlyCollection<object> separators)
{
   return s.Split(separators.Cast<string>().ToArray(), StringSplitOptions.None);
}

Then you'd call it like so:

> Str [split, 'A|B\C', ['|','\']]
["A", "B", "C"]

There are some small limitations at the moment like not being able to specify IEnumerable as the parameter type.

Edited by Scott_NZ

Share this post


Link to post
Share on other sites

Thanks a lot!

I thought arrays from Arma were always interpreted as a list, thanks for the advice :)

Share this post


Link to post
Share on other sites

where should the arma2net folder be added? i have steam version arma2 combined operation

Share this post


Link to post
Share on other sites

It should be placed where you have your modfolders, usually in the main game directory.

Share this post


Link to post
Share on other sites

Just to let you know again Scott I checked my version of Arma2Net and my beta version and still after a fresh install of Arma and the plugins I still have to place the contents of @Arma2Net in my Expansion/Beta folder. Do you think this could have something to do with me using TA2DST launcher instead of a batch file?

Share this post


Link to post
Share on other sites

Is it possible to create a dialog / display with this mod? Like extending RscStandardDisplay ??

Share this post


Link to post
Share on other sites

Right for whatever reason it seems the TA2DST launcher causes problems for Arma2NET. When using a batch file to launch the server I had no need for the Arma2Net files to be duplicated in the Expansions\beta folder.

Share this post


Link to post
Share on other sites

Can anyone help me out? i get this error

Info: 21:19:21 - Arma2NETMySQL Plugin Started.
Info: 21:19:21 - Version number: 0.1.0.0
Info: 21:19:21 - Compiled against Arma2NET Version: 2.2.0.0
Info: 21:19:21 - Loading databases...
Info: 21:19:21 - Type: mysql Database: test IPAddress: 127.0.0.1 Port: 3306 Username: arma Password: NotShownForSecurityReasons
Error: 21:19:22 - The number and/or format of the arguments passed in doesn't match.

Share this post


Link to post
Share on other sites

That's wholly to do with the plugin. You'll have to refer to the PDB thread.

Share this post


Link to post
Share on other sites

Arma2NET has been updated to version 2.3 with the following changes:

- Added SetClipboardText <text> and GetClipboardText functions for manipulating the clipboard.

- Improved the startup time.

- Added AsyncActionAddIn and AsyncFuncAddIn for high performance asynchronous calls.

Download:

https://bitbucket.org/Scott_NZ/arma2net/downloads/Arma2NET-2.3.zip

or

https://bitbucket.org/Scott_NZ/arma2net/downloads/Arma2NET-2.3.msi

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×