Jump to content

Recommended Posts

Can you give an example of the exact input strings that you're trying in both cases? I would not suggest mixing single and double quotes, that will probably yield bad results. Also, note that " (double quote) is different than '' (two single quotes next to one another, this would probably be interpreted as a single parameter).

I have a quick question about empty strings. I've noticed that when processing inputs a single double quote stays a single double quote but two double quotes adjacent (an empty string) becomes a single double quote resulting in arrays looking like this ["weapon",",",","stuff"]; instead of ["weapon,"","","","stuff"];

Share this post


Link to post
Share on other sites

The examples I provided in my previous post are very similar to ones I've been trying. I'm not mixing single and double quotes, I'm only using double quotes. The issue I'm having it with TWO double quotes adjacent to each other. It's pretty fundamental to be able to have empty strings in an array or by themselves (empty weapon slots, etc) and empty strings are two double quotes.

SQF Original

["U_C_Poloshirt_stripped","","","H_StrawHat_dark","",["ItemMap","ItemCompass","ItemWatch"],[],[],[]]

Once passed through A2Net and outputted in explorer/game/etc

["U_C_Poloshirt_stripped",",","H_StrawHat_dark",",["ItemMap","ItemCompass","ItemWatch"],[],[],[]]

The empty strings "" are now single double quotes ". I've found that if I manually escape the empty strings before passing them to A2Net like this "\" then it's absolutely fine and "\" becomes "" but having to process every string and array on the server before passing it to A2Net isn't exactly ideal. I mean I'll do it if I absolutely have to but I thought you may know an easier way.

Some testing...

["] (1) becomes ["] (1)

[""] (2) becomes ["] (1)

["""] (3) becomes [""] (2)

[""""] (4) becomes [""] (2)

["""""] (5) becomes ["""] (3)

[""""""] (6) becomes ["""] (3)

Edited by Polaris

Share this post


Link to post
Share on other sites

Hmm, I'm not sure how else to get around it. I guess I would recommend doing the processing through the plugin because of the speed. Are you using the Format class from Arma2NET in your plugin to format the results on return?

The examples I provided in my previous post are very similar to ones I've been trying. I'm not mixing single and double quotes, I'm only using double quotes. The issue I'm having it with TWO double quotes adjacent to each other. It's pretty fundamental to be able to have empty strings in an array or by themselves (empty weapon slots, etc) and empty strings are two double quotes.

SQF Original

["U_C_Poloshirt_stripped","","","H_StrawHat_dark","",["ItemMap","ItemCompass","ItemWatch"],[],[],[]]

Once passed through A2Net and outputted in explorer/game/etc

["U_C_Poloshirt_stripped",",","H_StrawHat_dark",",["ItemMap","ItemCompass","ItemWatch"],[],[],[]]

The empty strings "" are now single double quotes ". I've found that if I manually escape the empty strings before passing them to A2Net like this "\" then it's absolutely fine and "\" becomes "" but having to process every string and array on the server before passing it to A2Net isn't exactly ideal. I mean I'll do it if I absolutely have to but I thought you may know an easier way.

Some testing...

["] (1) becomes ["] (1)

[""] (2) becomes ["] (1)

["""] (3) becomes [""] (2)

[""""] (4) becomes [""] (2)

["""""] (5) becomes ["""] (3)

[""""""] (6) becomes ["""] (3)

Share this post


Link to post
Share on other sites

I would prefer to process it in the plugin as well. The issue I'm having though is that the input seems to have the issue by the time it reaches the C# stage. I know it's definitely not an issue with the SQF and the C# is definitely not attempting any formatting (I sent you the exact method I'm using) so I can only assume something is being done/happening to it in Arma2Net. It doesn't appear to happen when reading into A3 though for some reason, only when passing it the other way (from A3 or the explorer). I've read arrays and strings into A3 like the ones I've posted and they're absolutely fine. I'm using "Unmanaged" and not formatting them in any way. Simply passing them back and forward from the DB.

I've made a recursive function that will set any empty string into "\", even in a compounded array, so I've got a workaround if this fails but I hope I can find a way to do it through A2Net/C# (because of the speed advantage you mentioned).

Edited by Polaris

Share this post


Link to post
Share on other sites

Do you have any ideas/suggestions or shall I simply implement the function I created to escape all empty strings before passing them?

Share this post


Link to post
Share on other sites

Sorry, I'm afraid I don't have any other ideas. Perhaps Scott or someone else has a suggestion?

Do you have any ideas/suggestions or shall I simply implement the function I created to escape all empty strings before passing them?

Share this post


Link to post
Share on other sites

Simply for peace of mind do you have the same issue if you simply create a plugin to return the input?

Share this post


Link to post
Share on other sites

I can try it. What version of Arma2NET are you using? The new "beta" version from Github or the older stable release from Bitbucket?

Simply for peace of mind do you have the same issue if you simply create a plugin to return the input?

Share this post


Link to post
Share on other sites

Hi guys, please could somebody tell, if it is possible to call the extension with parameter containing for example state of fuel of some vehicle ?

something like

_params = "Arma2_GOT_Dri [AddLogInf, DATA]";

"Arma2Net.Unmanaged" callExtension _params;

or

_params = "Arma2_GOT_Dri [AddLogInf," + (str (fuel _veh)) + "]";

"Arma2Net.Unmanaged" callExtension _params;

or something similiar except 1000 ways i tried before.

After whole day fighting with this, i am afraid i will go sleep defeated.

Thanks for all your help guys.

Share this post


Link to post
Share on other sites

Maybe try something like this?

https://community.bistudio.com/wiki/fuel

_fuel = fuel _vehicle;
_fuelReturn = "Arma2Net.Unmanaged" callExtension format ["Arma2_GOT_Dri ['%1']", _fuel];

I'm assuming "Arma2_GOT_Dri" is your plugin.

You may have to turn _fuel into a string type, not sure.

Hi guys, please could somebody tell, if it is possible to call the extension with parameter containing for example state of fuel of some vehicle ?

something like

_params = "Arma2_GOT_Dri [AddLogInf, DATA]";

"Arma2Net.Unmanaged" callExtension _params;

or

_params = "Arma2_GOT_Dri [AddLogInf," + (str (fuel _veh)) + "]";

"Arma2Net.Unmanaged" callExtension _params;

or something similiar except 1000 ways i tried before.

After whole day fighting with this, i am afraid i will go sleep defeated.

Thanks for all your help guys.

Share this post


Link to post
Share on other sites

I believe I'm using version 2.3 from Bitbucket. I wasn't even aware there was a beta or Github actually! Do you have Skype by the way or Steam? I'd really like to have a brief chat with you about Arma2Net and MySQL related plugins if you wouldn't mind?

Edited by Polaris

Share this post


Link to post
Share on other sites

@firefly2442 Dude thanks so much !

I´v tried several ways but i´ve never put %1 in quotes.

Thank you thank you thank you !

Share this post


Link to post
Share on other sites

Is there a reason Arma2Net is reporting the output buffer size to be 4096 bytes when it should be 10240 bytes?

You're not hardcoding the buffer size are you?

This is on 2.3 with Arma 3.

Also before you say maybe the buffer is 4096, it's not. It is indeed 10240.

Share this post


Link to post
Share on other sites

https://github.com/ScottNZ/Arma2NET

This is the "new/beta" version. I don't think Scott has made any (or perhaps only a few) posts about it. You'll have to compile it yourself (make sure to use the new Visual Studio).

I believe I'm using version 2.3 from Bitbucket. I wasn't even aware there was a beta or Github actually! Do you have Skype by the way or Steam? I'd really like to have a brief chat with you about Arma2Net and MySQL related plugins if you wouldn't mind?

Share this post


Link to post
Share on other sites

Thank you for the link, I appreciate it! I'll try the beta version tomorrow.

Did you have a chance to test the issue? Would you mind possibly testing it 2.3 and the beta just to see if there's any difference?

Share this post


Link to post
Share on other sites

I don't think it's hardcoded. IIRC, they've been making changes to the size/length in Arma3 (lowering it, not sure why).

Is there a reason Arma2Net is reporting the output buffer size to be 4096 bytes when it should be 10240 bytes?

You're not hardcoding the buffer size are you?

This is on 2.3 with Arma 3.

Also before you say maybe the buffer is 4096, it's not. It is indeed 10240.

Share this post


Link to post
Share on other sites
I don't think it's hardcoded. IIRC, they've been making changes to the size/length in Arma3 (lowering it, not sure why).

I've switched to the new GitHub build and I don't seem to have the problem anymore. Returns 10KB now, which is good.

Still wish BIS would up the output size, I don't understand why it has to be so low.

Share this post


Link to post
Share on other sites

It's missing a few things like the Format class (can still borrow it from the old A2N if you need it atm) but if people are happy with this I could go ahead and prepare it for a proper release. I also noticed that some people have forked A2N and made their own additions. If they want to get them pushed back upstream that would be awesome too.

Share this post


Link to post
Share on other sites

Scott_NZ, I was wondering if you wouldn't mind quickly explaining how your AsyncAddinInvocationMethod actually functions and what the SQF calling it would roughly look like? I'm simply trying to get my head around actually using it (I understand what it's intended to avoid occurring). Also if you wouldn't mind commenting on the empty string issue I was having a page or so ago ("" becoming ").

Share this post


Link to post
Share on other sites

Probably something like:

"Arma2Net" callExtension "Foo"

where Foo is an addin that uses AsyncAddinInvocationMethod. It's invoked asynchronously, and the result is added to a queue when it's finished. You can then use

"Arma2Net" callExtension "Foo getresult"

to get a result at the front of the queue. It's also removed from the queue at that stage.

I also recently added an option for just throwing away results instead of queueing them, and an option for clearing all the results.

Share this post


Link to post
Share on other sites

I'm slightly confused as to how the appropriate result gets returned to it's parent call though? As in there doesn't seem to be any unique identifier for a call. So if 10 "Arma2Net" callExtension "Foo" have been spawned then you use "Arma2Net" callExtension "Foo getresult" how does it return the result appropriately to each of the 10 original calls?

Say for example you have an addin function reading data from a DB which is most likely going to be spawned multiple times simultaneously. How does the appropriate result get returned to the appropriate call?

Edited by Polaris

Share this post


Link to post
Share on other sites

You can easily assign an integer identifier yourself when calling and return it later as part of a result string.

Share this post


Link to post
Share on other sites

Alright, that's fine. I was simply wondering if this was done within the function already or not. Thank you for the explanation and clarification!

Edit: Sorry one last question. If I have several functions in an Addin are the results from each function simply added to the results queue for the whole Addin? So if I have readPosition and writePosition within the addin ReadWrite will I access results from either using

"Arma2Net" callExtension "ReadWrite [readPosotion, [uid]]"

"Arma2Net" callExtension "ReadWrite [writePosition, [pos]]"

"Arma2Net" callExtension "ReadWrite getresult"

Edited by Polaris

Share this post


Link to post
Share on other sites

Yes. You can export multiple addins from the same assembly if you need more granularity, or have a look at the source for AsyncAddinInvocationMethod and adapt it to your needs.

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

×