Jump to content
Sign in to follow this  
Fortran

Action Toggle

Recommended Posts

Having a bit of a headache with this although I am sure it's quite simple.

I am trying to toggle between the two versions of the FLIR effect via the same action menu action ("Inverse"). Everything works fine and I have ON and OFF actions for the FLIR which works fine. The trouble is with the toggle for inverting the BW/WB version. I want to be able to use the same action menu action to switch between the two version.

If I use this:

if (ppInversion ppEffectEnable true) then

{
   ppInversion ppEffectEnable false
}

Then when I hit the "inverse" action it indeed inverts the FLIR. However obviously this only works just once.

I then tried what I thought should be correct...

if (ppInversion ppEffectEnable true) then

{
   ppInversion ppEffectEnable false
}

else
{
   if (ppInversion ppEffectEnable false) && (ppColor ppEffectEnable != false) then 
{
   ppInversion ppEffectEnable true
}
};

but that does not work. As soon as I add the "else" section it doesn't change any more. The original version I had was as follows:

if (ppInversion ppEffectEnable true) then

{
   ppInversion ppEffectEnable false
}

else
{
   if (ppInversion ppEffectEnable false) then 
{
   ppInversion ppEffectEnable true
}
};

This did not work either, however hitting the "inverse" action when FLIR was turned off still switched the ppInversion on, which gives a kind of psychedelic effect (basically inversed shading in the normal view) which I didn't want.

I added the != to try to say, if one of the other effects (ppColor) that makes up the FLIR was not turned off (ie. it was ON) then toggle, but if the ppColor effect was off (which occurs when I turn the FLIR off via my action) it would not invert.

Basically to cut a long story short, how can I say in code (when using my inverse action):

If ppInversion is ON (true) then turn it off (false)

But

If ppInversion is OFF (false) and only if ppColor is ON (true) then turn ppInversion ON (true).

Thanks to anybody that can help me in the right direction.

Edited by Fortran

Share this post


Link to post
Share on other sites

You're in the wrong forum i guess.

I'm not an expert for ArmA2 but for the script to work you need a return value which ppEffectEnable doesn't give you.

Taking a quick look into the ArmA2 comref, i think maybe ppEffectCommitted effect does the trick. Gives you BOOL as return value.

http://www.arma2.com/comref/full.html#ppEffectCommittedNumber

So to check the return value you'd do:

if (ppEffectCommitted ppInversion) {...}    

(Wild guess here) :)

Edited by ])rStrangelove

Share this post


Link to post
Share on other sites

Ah magic ok thanks mate will give that a go. Its techincally the right forum (I think) as I am test running it via sqf scripts in a mission at the moment. Will be moving it to vehicles after I get something decent going. Thanks again, will try your suggestion out mate.

Share this post


Link to post
Share on other sites

Oooh damn, sorry don't know how I managed to do that..posting at 8am in the morning i guess lol. Yes this should be in the A2 forums.

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  

×