Jump to content
Sign in to follow this  
Royal_Blackwatch

Addaction & Return Value of functions

Recommended Posts

Hi everyone

I'm currently playing around with ArmA's Magazine handling a bit but run into some trouble using the addaction.

Quote[/b] ]

_single = _plr addaction [_magnamesingle,"\data\script\test.sqf",_testvar,1,false]

My Question for now is how can I read the returnvalue of the function as there is no place for it in the addaction array.

What would the correct syntax be?

I think that I have seen something like this quite some time ago but I can't find it...

Anyone can help me out?

Share this post


Link to post
Share on other sites

Hi again

as it seems that there is no way to get the return value, here is my workaround for everyone who may be in the same situation...

The Problem was that in my case I needed to manipulate my local magazines array via action menu entry but needed to continue on the same script.

I found two ways of working around it:

1. Making the script calling itself in the action menu entry and make a check at start of script to see how it was entered and hand over the old variables (magazines array).

Problem is that you will most likely have the old (now obsolete) instance of the script running which will surely create trouble or at least cause performance issues over the time esp when its running several times parallel.

2. Create a flag variable indicating if the action menu entry is set, execute the first part of the other script containing the necessary changes (addmagazine in my case) and make a check on the primary script if the flag variable is changed AND there was a change in the external part (in my case if the players magazine amount has increased) then jump to a new destination, reset the flag variable and execute the second part of the 'other script' (in this case the manipulation to my Magazines Array) and return.

3rd Option would be to use global variables but this is bad programming imo...

Although the second option is surely not the best and may not work in some occasions it's still the best in my special case I think...

Ok now you can tear me apart tounge2.gif

if anyone has a more elegant solution let me know...

Greetz

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
Sign in to follow this  

×