Jump to content
killzone_kid

[FEEDBACK] Do you use BIS_fnc_xxxxx functions? If you do....

Recommended Posts

 

* What functions need improvement?

 

BIS_fnc_fadeEffect, have an error, maybe this is not the thread but FeedTracker is closed and I can't start new Threats on Forum, new user :). Have two errors related with sleep command. First error, an if-else block where else block is only a sleep command, this cause a script error. The other is a script error too, sleep without const time (using a var to set time to sleep).

 

Could you provide and example?

Share this post


Link to post
Share on other sites

What's wrong with it?

 

At the time I tested that command, it was round about 14th of March, it returned odd values if smoke was in the line of sight. Odd means the values were always 0 or very Close to it even when there was just a very transparent smoke.

Additionally even if there was a clear line of sight that command returned often 0.

Share this post


Link to post
Share on other sites

At the time I tested that command, it was round about 14th of March, it returned odd values if smoke was in the line of sight. Odd means the values were always 0 or very Close to it even when there was just a very transparent smoke.

Additionally even if there was a clear line of sight that command returned often 0.

I haven't tested it thoroughly, but I remember trying it the first time last year, and didn't notice anything odd.

 

And at least now it seems to be working in the dev branch, (as far as I can tell)

  • Like 4

Share this post


Link to post
Share on other sites

I haven't tested it thoroughly, but I remember trying it the first time last year, and didn't notice anything odd.

 

And at least now it seems to be working in the dev branch, (as far as I can tell)

 

 

I did not test at dev branch...

 

edit:

your video is impressive. if it works as shown there it will be an immersive Progress.

  • Like 1

Share this post


Link to post
Share on other sites

I haven't tested it thoroughly, but I remember trying it the first time last year, and didn't notice anything odd.

 

And at least now it seems to be working in the dev branch, (as far as I can tell)

 

Do you happen to have this test pbo somewhere ?  I would love to give it a run myself

  • Like 1

Share this post


Link to post
Share on other sites

Do you happen to have this test pbo somewhere ?  I would love to give it a run myself

I think this may work:

marker1 = createVehicle ["Sign_Sphere25cm_F", [0,0,0], [], 0, "CAN_COLLIDE"];
marker1 setObjectTexture [0,"#(rgb,8,8,3)color(1,0,1,1)"];
onEachFrame {
    _pos1 =  positionCameraToWorld [0,0,0.5];
    _pos2 =  positionCameraToWorld [0,0,20]; // <- 20m away from the camera
    marker1 setpos _pos2;
    _visib = [marker1, "VIEW"] checkvisibility [agltoasl _pos1,agltoasl _pos2];
    _pos2 set [2,(_pos2 select 2)+1];
    drawIcon3D ["", [1,1,0,1], _pos2, 0, 0, 0, str ([_visib,2] call BIS_fnc_cutDecimals), 1, 0.07, "PuristaMedium"];
};
  • Like 3

Share this post


Link to post
Share on other sites

Does the fog density influences the checkVisibility command? I guess not, right?

Share this post


Link to post
Share on other sites

Just a small thing, BIS_fnc_taskSetDestination does not accept a marker (string) as second parameter whereas you can set one in BIS_fnc_taskCreate as task destination.

Share this post


Link to post
Share on other sites

Could you provide and example?

 

simply try 

[0] call BIS_fnc_fadeEffect -> Error line 66 |#| sleep _BIS_fadeDuration
[1] call BIS_fnc_fadeEffect -> Error line 130 |#| sleep 2; (else Block)
[] call BIS_fnc_fadeEffect -> Error line 130 (all default parameters)

Function BIS_fnc_fadeEffect:

 

sleep _bis_fadeduration at line 154 is another bug.

/*
	Author: Thomas Ryan

	Description:
	Easily carry out complex fading. Default values will be used if parameters aren't defined or set to nil.

	Parameter(s):
	_this select 0 (Optional): NUMBER - 0: fade out, 1: fade in
	_this select 1 (Optional): STRING - "BLACK": black fade, "WHITE": white fade
	_this select 2 (Optional): NUMBER - Duration of the fade in seconds
	_this select 3 (Optional): NUMBER - 1: blur while fading, 0: don't use blur
	_this select 4 (Optional): STRING - String of the music track you wish to play (will only work with fading in)
	_this select 5 (Optional): STRING - Ending you wish to use (will only work with fading out)
	_this select 6 (Optional): NUMBER - Use 0: failMission, 1: endMission

	Returns:
	Nothing.
*/

private ["_BIS_fadeInOrOut","_BIS_fadeColor","_BIS_fadeDuration","_BIS_blur","_BIS_music","_BIS_ending","_BIS_failMissionOrEndMission"];

_BIS_fadeInOrOut = _this param [0,1,[0,1]];
_BIS_fadeColor = _this param [1,"BLACK",["BLACK","WHITE"]];
_BIS_fadeDuration = _this param [2,3,[0]];
_BIS_blur = _this param [3,0,[0,1]];
_BIS_music = _this param [4,"",[""]];
_BIS_ending = _this param [5,"",[""]];
_BIS_failMissionOrEndMission = _this param [6,1,[0,1]];

switch (_BIS_fadeInOrOut) do
{
	case 0:
	{
		if (_BIS_music != "") then
		{
			["Music track ""%1"" defined for fading out.",_BIS_music] call BIS_fnc_error;
		};
		
		_BIS_fadeDuration fadeSound 0;
		_BIS_fadeDuration fadeMusic 0;
		_BIS_fadeDuration fadeSpeech 0;
		
		switch (_BIS_fadeColor) do
		{
			case "BLACK":
			{
				titleCut ["","BLACK OUT",_BIS_fadeDuration];
			};
			
			case "WHITE":
			{
				titleCut ["","WHITE OUT",_BIS_fadeDuration];
			};
		};
		
		if (_BIS_blur == 1) then
		{
			"DynamicBlur" ppEffectEnable true;
			"DynamicBlur" ppEffectAdjust [0];
			"DynamicBlur" ppEffectCommit 0;
			
			"DynamicBlur" ppEffectAdjust [5];
			"DynamicBlur" ppEffectCommit _BIS_fadeDuration;
		};
		
		sleep _BIS_fadeDuration;
		
		if (_BIS_blur == 1) then
		{
			"DynamicBlur" ppEffectEnable false;
		};
		
		if (_BIS_ending != "") then
		{	
			switch (_BIS_failMissionOrEndMission) do
			{
				case 0:
				{
					failMission _BIS_ending;
				};
				
				case 1:
				{
					endMission _BIS_ending;
				};
			};
		};
	};
	
	case 1:
	{
		if (_BIS_ending != "") then
		{
			["Ending ""%1"" defined for fading in.",_BIS_ending] call BIS_fnc_error;
		};
		
		0 fadeSound 0;
		0 fadeSpeech 0;
		
		switch (_BIS_fadeColor) do
		{
			case "BLACK":
			{
				titleCut ["","BLACK FADED",9999];
			};
			
			case "WHITE":
			{
				titleCut ["","WHITE IN",9999];
			};
		};
		
		if (_BIS_blur == 1) then
		{
			"DynamicBlur" ppEffectEnable true;
			"DynamicBlur" ppEffectAdjust [5];
			"DynamicBlur" ppEffectCommit 0;
		};
		
		if (_BIS_music != "") then
		{
			sleep 1;
			
			playMusic _BIS_music;
			
			sleep 1;
		}
		else
		{
			sleep 2;
		};
		
		_BIS_fadeDuration fadeSound 1;
		_BIS_fadeDuration fadeSpeech 1;
		
		switch (_BIS_fadeColor) do
		{
			case "BLACK":
			{
				titleCut ["","BLACK IN",_BIS_fadeDuration];
			};
			
			case "WHITE":
			{
				titleCut ["","WHITE IN",_BIS_fadeDuration];
			};
		};
		
		if (_BIS_blur == 1) then
		{
			"DynamicBlur" ppEffectAdjust [0];
			"DynamicBlur" ppEffectCommit _BIS_fadeDuration;
			
			sleep _BIS_fadeDuration;
			
			"DynamicBlur" ppEffectEnable false;
		};
	};
};

Share this post


Link to post
Share on other sites

 

simply try 

[0] call BIS_fnc_fadeEffect -> Error line 66 |#| sleep _BIS_fadeDuration
[1] call BIS_fnc_fadeEffect -> Error line 130 |#| sleep 2; (else Block)
[] call BIS_fnc_fadeEffect -> Error line 130 (all default parameters)

Function BIS_fnc_fadeEffect:

 

sleep _bis_fadeduration at line 154 is another bug.

 

.....

 

Do you execute the example code from console? If so, the problem is that the function contains sleep command, but such commands (waitUntil is another example) must not be called in non-scheduled environment. If you want to run such code from console, you need to spawn it. Try instead:

_handle = [0] spawn BIS_fnc_fadeEffect;

Share this post


Link to post
Share on other sites

Just a small thing, BIS_fnc_taskSetDestination does not accept a marker (string) as second parameter whereas you can set one in BIS_fnc_taskCreate as task destination.

 

Thanks for the info. I added support for marker to the function BIS_fnc_taskSetDestination.

Share this post


Link to post
Share on other sites

 

Do you execute the example code from console? If so, the problem is that the function contains sleep command, but such commands (waitUntil is another example) must not be called in non-scheduled environment. If you want to run such code from console, you need to spawn it. Try instead:

_handle = [0] spawn BIS_fnc_fadeEffect;

 

:wacko:  ups sorry. Thanks for the info  :D

Share this post


Link to post
Share on other sites

Line 35 in BIS_fnc_ambientFlyby could be improved:

_direction = [_start, _end] call BIS_fnc_dirTo; //0.0146ms

to

_direction = _start getDir _end; //0.0024ms

BIS_fnc_animalRandomization

 

Line 30,43,58,72,94-96, 111-113 & 131-133 could be replaced by selectRandom _array;

 

BIS_fnc_ambientPostprocess

 

Line 25

(typename _ppTypeDef == typename true) 

to

(_ppTypeDef isEqualType true)

BIS_fnc_arsenal

I've already mentioned that in the other post. This function quite performance heavy and there are tons of obsolete functions used like:

 

BIS_fnc_saveInventory

BIS_fnc_loadInventory (Given those are brand new)

BIS_fnc_distance2D

BIS_fnc_dirTo

BIS_fnc_param

 

BIS_fnc_setRank

Line 20 (typename _rankID == typename "")

 

 

 

That's all for now. I admit those a minor things, but I've found them within 10 minutes looking through some functions I've recently used. I am sure there's quite some potential
 

 

Edit: BIS_fnc_version does nothing in Arma3 and could be removed.

  • Like 1

Share this post


Link to post
Share on other sites

Line 35 in BIS_fnc_ambientFlyby could be improved:

_direction = [_start, _end] call BIS_fnc_dirTo; //0.0146ms

to

_direction = _start getDir _end; //0.0024ms

BIS_fnc_animalRandomization

 

Line 30,43,58,72,94-96, 111-113 & 131-133 could be replaced by selectRandom _array;

 

BIS_fnc_ambientPostprocess

 

Line 25

(typename _ppTypeDef == typename true) 

to

(_ppTypeDef isEqualType true)

BIS_fnc_arsenal

I've already mentioned that in the other post. This function quite performance heavy and there are tons of obsolete functions used like:

 

BIS_fnc_saveInventory

BIS_fnc_loadInventory (Given those are brand new)

BIS_fnc_distance2D

BIS_fnc_dirTo

BIS_fnc_param

 

BIS_fnc_setRank

Line 20 (typename _rankID == typename "")

 

 

 

That's all for now. I admit those a minor things, but I've found them within 10 minutes looking through some functions I've recently used. I am sure there's quite some potential

 

 

 

its just not commercially viable to spend time going through all those things for such little gain :) maybe to liase with KK to make it a community project to optimize the BIS functions

Share this post


Link to post
Share on other sites

its just not commercially viable to spend time going through all those things for such little gain :)

 

Well, we have to start somewhere and I am pretty sure 90% of those functions will make it into "Arma 4", so the benefit might even be bigger than one expects.

  • Like 3

Share this post


Link to post
Share on other sites

A thought I had the other day, it would be nice if there was a unary version of both

max/min
which gave the max/min value within an array

Share this post


Link to post
Share on other sites

A thought I had the other day, it would be nice if there was a unary version of both

max/min
which gave the max/min value within an array

 

is that only for numerical values or would it do a sort for strings also?

strings that begin with 'A' being min and 'Z' being max?

Share this post


Link to post
Share on other sites

thanks @R3vo we will take look on those ...

  • Like 1

Share this post


Link to post
Share on other sites

Well, we have to start somewhere and I am pretty sure 90% of those functions will make it into "Arma 4", so the benefit might even be bigger than one expects.

 

I agree, I just think the community is more than capable of updating the BI SQF functions library, and personally I'd rather they focus the time elsewhere. Some sort of submissions and review process is really all that's necessary.

 

Of course exceptions for heavily used functions I think should be kept up to date, and they have been for the most part.

  • Like 1

Share this post


Link to post
Share on other sites

BIS_fnc_dynamicText uses alot of typeName x == typeName y, however the main issues seems that the position doesn't properly work for different resolutions and interface sizes. Could that be fixed with the new commands pixelGrid, pixelW & pixelH? Otherwise there is no way for a mission creator to ensure it works for all players.

 

Some more infos here: https://forums.bistudio.com/topic/191155-bis-fnc-dynamictext-position-not-synced-on-screens/

Share this post


Link to post
Share on other sites

I'm new to scripting and slowly learning.

Ive been trying to get the bis_fnc_ambientPlane.fsm to work and it keeps giving me an error at Line 16. The error reports invalid code. I'll post a pic when I get home. I'd love some ambient planes in a mission. I r already got ambient helos via scripting.

Thanks

Share this post


Link to post
Share on other sites

bis_fnc_ambientPlane.fsm

 

Rather than trying to use the fsm directly, why not use a function such as BIS_fns_ambientFlyBy?

ambFlyby = [getmarkerpos "startMarker", getmarkerpos "stopMarker", 100, "FULL", "B_Plane_CAS_01_F", WEST] call BIS_fnc_ambientFlyBy;

Share this post


Link to post
Share on other sites

BIS_fnc_unitplay, works great till a dedicated server is involved.

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

×