Jump to content
Sign in to follow this  
CarlGustaffa

Have to be missing something

Recommended Posts

Okay, I'm pretty much going nuts about this one. When I call this script using nothing in the test=[] execVM..., I attempt to set i.e. _minimumfog=fog;

_resultfog=_minimumfog; (or =fog;, doesn't matter)

then hint format ["resultingfog :%1", _resultingfog] will return the scriptname, currently residing in the scripts directory. (edited)

Then a strange error message stating "Type script, expected number, array......."

However, after manipulating the _minimumfog value inside a while loop, th hint format starts giving me the correct numbers.

Can I not use such engine variables from inside scripts without them being in loops?

When I call with test=[fog] execVM... and initialize with

_minimumfog=this select 0;

_resultfog=_minimumfog; (edited)

both the hint formats will show what I want.

I fail to see how these two syntax'es could be any different, can someone please explain this to me?

Full "script" plaything attached below if it should matter.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

if(bWeatherIsChanging) then {

   hint "I will not change fogbyrain while weatherscript is running";

};

waitUntil { !bWeatherIsChanging };

player globalChat "Weatherscript appears to be finished, now updating fog automatically";

sleep 5;

_bhalt = false;

_squaredfactor = 1;

_minimumfog = fog;

_resultfog = fog;

sleep 0.1;

hint format ["Rain: %1\nMinimumFog: %2\nResultingFog: %3", rain, _minimumfog, _resultfog];

2 setRain 0.3;

sleep 2;

_bhalt=true;

while {_bhalt} do

{

_variablefactor=_squaredfactor+rain;

_squeezefactor=_rain*minimumfog;

_minimized=1 min squeezedfactor;

_squaredrain=sqrt(rain);

_squaredfactor=(_variablefactor*_squaredrain)+((1-_variablefactor)*rain);

_resultfog=((1-_minimumfog)*_squaredfactor)+_minimumfog;

0.001 setFog _resultfog;

sleep 0.009;

hint format ["Rain: %1\nMinimumFog: %2\nResultingFog: %3", rain, _minimumfog, _resultfog];

};

Oh, the bWeatherIsChanging is initialized to false on the player init in this test. The purpose of this snippet is to increase the fog based on the amount of rain (since I think the visibility impact is way too little by default), but not while any setFog based weatherscripts are running (since setFog and setOvercast will not cooperate properly).

Share this post


Link to post
Share on other sites

maybe you missed " here?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hint format ["resultingfog :%1", _resultingfog]

and maybe _resultfog var not _resultingfog?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hint format ["resultingfog :%1", _resultfog]

Share this post


Link to post
Share on other sites

Good thing I included the actual code. No, those mistakes are not present. I'll update my slightly faulty descriptive text. Thx for noting.

Hmm.. Actually, hint format ["fog is: %1", fog] will yield the full path and filename to the scriptfile, even when put in the mission directory? Ehh, huh? Rain and overcast gives the correct answer though.

(Previous edit on the addon disabling was faulty, I forgot to set back to fog. So, even with addons disabled (this is on porto map though), I'm still getting this...

Share this post


Link to post
Share on other sites

This is just plain embarrassing goodnight.gif

Somewhere along the lines, test=[] execVM... had become fog=[] execVM...

I'm missing the harakiri option in ArmA crazy_o.gif

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  

×