Jump to content
killzone_kid

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

Recommended Posts

* What functions do you use?

* What functions need improvement?

* What functions would benefit from dedicated scripting command?

 

Please leave your feedback below. Function names alone are ok, but it you want to go into details, please do. Your posts will be looked at and noted by BI developer. Plus you get extra good karma for yourself :)

  • Like 9

Share this post


Link to post
Share on other sites

One above all others comes to mind.

 

BIS_fnc_animalBehaviour

 

Author: Borivoj Hlava

 

It generally uses 4-8 threads at all times in SP and MP. It does its job I guess but leaves a lot to be desired.

 

It spawns very often, every time the player moves a few hundred meters, it spawns another 4-8 times.

 

Horribly Delicately optimized with big local functions being constantly defined.

 

And, we do not really have a choice, it runs whether we like it or not.

 

There should only be one local animal behavior thread running, to manage all the snakes and rabbits, rather than 1 thread for each.

{
      ...
} forEach _snakesandrabbits;

Just did a quick (copyToClipboard str diag_activeSQFScripts) in an empty editor, here is the output:

// 1.52
//copyToClipboard str diag_activeSQFScripts
[
     ["fn_animalBehaviour_mainLoop","A3\functions_f\ambient\fn_animalBehaviour.sqf",true,348],
     ["fn_animalBehaviour_mainLoop","A3\functions_f\ambient\fn_animalBehaviour.sqf",true,348],
     ["fn_animalBehaviour_mainLoop","A3\functions_f\ambient\fn_animalBehaviour.sqf",true,348],
     ["fn_animalBehaviour_mainLoop","A3\functions_f\ambient\fn_animalBehaviour.sqf",true,348],
     ["fn_animalBehaviour_mainLoop","A3\functions_f\ambient\fn_animalBehaviour.sqf",true,230]
]

If necessary, I would be willing to restructure BIS_fnc_animalBehaviour and submit to dearest Mr Hlava for review.

 

Can have as command:

 

  • BIS_fnc_dirTo   - (edit: DONE 1.56 replaced by getDir alternative syntax)
  • BIS_fnc_relPos - (edit: DONE 1.56 replaced by getPos alternative syntax)
  • BIS_fnc_arrayShuffle - (edit: DONE 1.56 has been optimized)
  • BIS_fnc_inString - (edit: DONE 1.56 has been optimized)

 

Needs improvement:

 

  • BIS_fnc_addRespawnInventory (Author: Karel Moricky)

                   Needs some integration with Arsenal and save-able loadouts, such as loadout you have when you are killed (BIS_fnc_saveInventory/BIS_fnc_loadInventory).

 

       edit: DONE 1.60 replaced by new Respawn setUnitLoadout/setUnitTrait system

  • BIS_fnc_establishingShot (Author: Thomas Ryan)

                   Has a few issues, only partially working.

  • BIS_fnc_groupIndicator (Author: ???)

                   Has a nasty script error on line 81 when the unit is not on foot. This function is the BIS version of ST HUD.

  • BIS_fnc_taskPatrol (Author: Lord Joris)

                  Could use some love. Occasionally waypoint positions are set to position [0,0,0], this should not be allowed. Look to CBA_fnc_taskPatrol for ideas to improve it.

 

Other frequently used BIS functions:

 

  • BIS_fnc_findSafePos (Author: Lord Joris)
  • BIS_fnc_randomPos (edit DONE 1.58 optimized with inArea command and replacement of internal bis_fnc_inTrigger call)
  • BIS_fnc_findOverwatch (Author: Dean Hall)
  • BIS_fnc_showNotification (Author: Karel Moricky)
  • BIS_fnc_timeToString (Authors: Peter Morrison (snYpir) & Philipp Pilhofer (raedor))
  • BIS_fnc_setUnitInsignia (Author: Karel Moricky)
  • BIS_fnc_addStackedEventHandler (edit: DONE 1.58 replaced by addMissionEventHandler events)
  • BIS_fnc_buildingPositions - (edit: DONE 1.56 replaced by buildingPos alternative syntax)
  • Like 2

Share this post


Link to post
Share on other sites

Well I keep using :

        [0, {_this enableSimulationGlobal false;}, _x] call CBA_fnc_globalExecute;
        [0, {_this hideObjectGlobal true;}, _x] call CBA_fnc_globalExecute;
 

 

...For caching units playing multiplayer with a HC. maybe an easier way of "enableSimulationGlobal" and "hideObjectGlobal"

 

I hope this fits the topic

Share this post


Link to post
Share on other sites

Only suggestion I would have is to rework some of the nomenclature of some of the functions, i.e. inTrigger works for both triggers and markers, but in a search for function that would handle finding a position within a marker area, I wouldn't initially assume that inTrigger would also work for a marker.

Share this post


Link to post
Share on other sites

* What functions do you use?

* What functions need improvement?

* What functions would benefit from dedicated scripting command?

 

Please leave your feedback below. Function names alone are ok, but it you want to go into details, please do. Your posts will be looked at and noted by BI developer. Plus you get extra good karma for yourself :)

 

BIS_fnc_vectorRotate2D

You can also do 3D vectors if you don't need to alter the third parameter. It would be really nice to have additional 2D/3D vector rotation commands in addition to the recently added vector manipulation ones.

 

BIS_fnc_ambientAnim / BIS_fnc_ambientAnimCombat 

They're great utility and used widely, but they should both be encompassed in a single more generic function which in addition to the current mode of picking a collection with a stringstring, could take an array of anims to random through.

Exit on combat should be a parameter.

All anims should be allowed to exit on combat with a default animation if one wasn't preset.

Author should be able to manually override the exit animation.

 

Additionally, when using the combat variant, _gear param is verified twice needlessly. Once in the Combat, then it's passed to ambientAnim which also evaluates it.

 

BIS_fnc_findInPairs / BIS_fnc_addToPairs / BIS_fnc_getFromPairs / BIS_fnc_setToPairs

These should really be a set of commands. There is currently no good way to have key -> value type of arrays. Maybe a new data type.

 

BIS_fnc_selectRandom

Should be a command. _x = arrayRandom [1,2,3,4,5];

  • Like 1

Share this post


Link to post
Share on other sites
  • What functions do you use?
    • BIS_fnc_dirTo
    • BIS_fnc_relPos
    • BIS_fnc_rotateVector2D
    • BIS_fnc_setPitchBank
    • BIS_fnc_arrayPop
    • BIS_fnc_parseNumber
    • BIS_fnc_classMagazine
    • BIS_fnc_classWeapon
  • What functions need improvement?
    • -
  • What functions would benefit from dedicated scripting command?
    • BIS_fnc_dirTo
    • BIS_fnc_relPos
    • BIS_fnc_setPitchBank
    • BIS_fnc_rotateVector2D
    • BIS_fnc_arrayPop
    • BIS_fnc_parseNumber

That's pretty much what I currently use (did a quick search with grep). Personally I make excessive use of dirTo, relPos and arrayPop (we got pushBack already, so an atomic pop might be nice to have too). So if these three guys could be (a bit faster) commands, I'd take it. ;)

  • Like 1

Share this post


Link to post
Share on other sites

Apart from the now overhauled BIS_fnc_MP and BIS_fnc_param and, of course, addStackedEventHandler, I'm a heavy dirTo and advHint user. Since this last one is mainly ornamental and since I can't recall any possible improvements to suggest, all I can ask for the moment is maintenance of backwards compatibility!

 

I can sense this thread becoming very popular :)

Share this post


Link to post
Share on other sites

Quickly of the top of my head but will add too later.

 

Top 50 used BIS_fnc

In descending order from a grep of all folders of nearly everything ive ever written since alpha including examples i have written for the forum.

Im not sure how relevant this list really is as there are function that are potentially used more frequently but are either contained in a loops or written inside another function call.

BIS_fnc_param
BIS_fnc_MP
BIS_fnc_relPos
BIS_fnc_error
BIS_fnc_selectRandom
BIS_fnc_endMission
BIS_fnc_addRespawnPosition
BIS_fnc_ambientAnim
BIS_fnc_inTrigger
BIS_fnc_addStackedEventHandler
BIS_fnc_itemType
BIS_fnc_showNotification
BIS_fnc_sideID
BIS_fnc_dirTo
BIS_fnc_dynamicText
BIS_fnc_sideType
BIS_fnc_spawnGroup
BIS_fnc_addRespawnInventory
BIS_fnc_codePerformance
BIS_fnc_rscLayer
BIS_fnc_sortBy
BIS_fnc_taskCreate
BIS_fnc_taskSetState
BIS_fnc_objectVar
BIS_fnc_rotateVector2D
BIS_fnc_arsenal
BIS_fnc_arrayCompare
BIS_fnc_relativeDirTo
BIS_fnc_removeStackedEventHandler
BIS_fnc_removeRespawnPosition
BIS_fnc_loadInventory
BIS_fnc_addSupportLink
BIS_fnc_establishingShot
BIS_fnc_findSafePos
BIS_fnc_spawn
BIS_fnc_spawnCrew
BIS_fnc_sideColor
BIS_fnc_respawnMenuPosition
BIS_fnc_inString
BIS_fnc_distance2D
BIS_fnc_addScriptedEventHandler
BIS_fnc_returnParents
BIS_fnc_objectSide
BIS_fnc_addVirtualItemCargo
BIS_fnc_infoText
BIS_fnc_areEqual
BIS_fnc_addVirtualMagazineCargo
BIS_fnc_errorMsg
BIS_fnc_baseWeapon
BIS_fnc_arrayShuffle

 

Need fixing
BIS_fnc_inTrigger is currently broken for markers if axisB > axisA. There is also the potential for errors in the square area equation if an axis difference is 0.
 
Need engine support
BIS_fnc_addStackedEventHandler definitely needs an engine side solution and one that does not allow the old on# commands to override/cancel them out.

Always thought BIS_fnc_addScriptedEventHandler would of been a good one to take internally and add some remote functionality too.

namespace/Object/Group/Side/Location addScriptedEvent [ NAME, function, _targets];

namespace/Object/Group/Side/Location callScriptedEvent [ NAME, [Arguments], _targets];

Location of event (namespace/Object/Group/Side/Location) also being passed to the code on call.

Although my stance is that the command base is fractured enough as it is with a hundred different ways to do the same thing i always felt Events/Actions/Delegate of some sort was missing.

  • Like 2

Share this post


Link to post
Share on other sites

A nice thing to improve would be to ensure all BIS functions have some useable self-documentation, especially since for lack of anything else this stuff goes into the BI wiki.

 

Example of good documentation: BIS_fnc_addWeapon

/*
File: addWeapon.sqf
Author: Mika Hannola
 
Description:
Add a weapon to a unit with the right magazines. Magazine class is fetched from the weapon's config.
 
Parameter(s):
_this select 0: <object> unit that is issued new equipment
_this select 1: <string> weapon classname
_this select 2: <scalar> number of magazines
_this select 3 (Optional): <scalar> index of magazine class in weapon's config (default 0) OR <string> magazine classname
 
Returns:
Primary muzzle name for a followup selectWeapon.
 
How to use:
_muzzle = [player, "arifle_SDAR_F", 6] call BIS_fnc_addWeapon;
Equips the player with an underwater rifle and six dual purpose magazines.
 
_muzzle = [player, "arifle_SDAR_F", 6, 1] call BIS_fnc_addWeapon;
OR
_muzzle = [player, "arifle_SDAR_F", 6, "30Rnd_556x45_Stanag"] call BIS_fnc_addWeapon;
Equips the player with an underwater rifle and six normal magazines.
*/
 
private ["_unit", "_weapon", "_magazineCount", "_magazineClass", "_weaponExists", "_magazines", "_i", "_muzzles", "_muzzle"];
 
_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_weapon = [_this, 1, "", [""]] call BIS_fnc_param;
_magazineCount = [_this, 2, 0, [0]] call BIS_fnc_param;
_magazineClass = [_this, 3, 0, [0, ""]] call BIS_fnc_param;
_weaponExists = isClass (configFile / "CfgWeapons" / _weapon);
 
//Add magazines
if (_magazineCount > 0) then
{
if (typeName _magazineClass == typeName 0) then
{
_magazines = getArray (configFile / "CfgWeapons" / _weapon / "magazines");
if (count _magazines > 0 && _weaponExists) then
{
_magazineClass = _magazines select (_magazineClass min (count _magazines - 1));
}
else
{
_magazineClass = "";
};
};
if (isClass (configFile / "CfgMagazines" / _magazineClass)) then
{
for "_i" from 1 to _magazineCount do
{
_unit addMagazine _magazineClass;
};
};
};
 
_muzzle = "";
if (_weaponExists) then
{
//Add weapon if unit doesn't have it yet
if !(_weapon in weapons _unit) then
{
_unit addWeapon _weapon;
};
//Determine right muzzle name
_muzzles = getArray (configFile / "CfgWeapons" / _weapon / "muzzles");
_muzzle = if (_muzzles select 0 == "this") then {_weapon;} else {_muzzles select 0;};
};
 
_muzzle;

 

Example with bad documentation: BIS_fnc_curatorChallengeDestroyVehicle

private ["_mode"];
//_mode = [_this,0,"",[""]] call bis_fnc_param;
_mode = _this select 0;
 
switch _mode do {
case "condition": {
private ["_object","_objectArray"];
_object = _this select 1;
_objectArray = _object call bis_fnc_objecttype;
(_objectArray select 0) == "Vehicle" && {(_objectArray select 1) == _x} count ["StaticWeapon"] == 0
};
case "object": {
private ["_object","_objectArray","_objectCategory","_objectType"];
_object = _this select 1;
_objectArray = _object call bis_fnc_objecttype;
_objectCategory = _objectArray select 0;
_objectType = _objectArray select 1;
if (_objectCategory == "Vehicle" && {_objectType == _x} count ["StaticWeapon"] == 0) then {[_objectType]} else {[]}
};
case "title": {
[localize ("STR_A3_BIS_fnc_curatorChallengeDestroyVehicle_" + (_this select 1))]
};
case "exec": {
_curator = _this select 1;
_curator addeventhandler [
"curatorObjectPlaced",
{
["handler",_this select 1] call bis_fnc_curatorchallengedestroyvehicle;
}
];
{
["handler",_x] call bis_fnc_curatorchallengedestroyvehicle;
} foreach (curatoreditableobjects _curator);
};
case "handler": {
_vehicle = _this select 1;
_handler = _vehicle getvariable "bis_fnc_curatorchallengedestroyvehicle_handler";
if (isnil "_handler") then {
_handler = _vehicle addmpeventhandler [
"mpkilled",
{
_vehicle = _this select 0;
_unit = _this select 1;
if (local _vehicle && isplayer _unit) then {
{
_curator = _x;
_vehicleTypes = _curator getvariable "DestroyVehicle";
if !(isnil "_vehicleTypes") then {
_vehicleArray = (typeof _vehicle) call bis_fnc_objecttype;
_vehicleType = _vehicleArray select 1;
{
if (_vehicleType == (_x select 0)) then {
[_curator,["DestroyVehicle",_x]] spawn  bis_fnc_finishcuratorchallenge;
};
} foreach _vehicleTypes;
};
} foreach (objectcurators _unit);
};
}
];
_vehicle setvariable ["bis_fnc_curatorchallengedestroyvehicle_handler",_handler];
};
};
};

  • Like 1

Share this post


Link to post
Share on other sites

What functions do you use?


There not many that I don't use :) 


 


What functions need improvement?


BIS_fnc_inTrigger - doesn't work with some axis values


BIS_fnc_animalBehaviour - runs at least four threads at the same time (would like this to have the option to toggle on off)


 


What functions would benefit from dedicated scripting command?


BIS_fnc_relPos -> position = relPos [position, direction, distance]


BIS_fnc_position -> positionArray = parsePosition String/Object/Array


BIS_fnc_addStackedEventHandler -> id = addStackedEventHandler [handlerName, execute, function]


BIS_fnc_returnChildren -> configArray = configChildren [config, depth, lastTier]


BIS_fnc_returnConfigEntry -> value = config configEntry [attribute,defaultValue]


BIS_fnc_configPath -> return = config configPath dataType


BIS_fnc_secondToString -> timeString = secondToString [time, format] (format e.g. "HH:MM:SS.MS")


BIS_fnc_colorRGBAtoHTML -> colorString = colorRBGAtoHTML colorArray


BIS_fnc_colorRGBAtoTexture -> colorString = colorRBGAtoTexure colorArray


BIS_fnc_colorRGBtoHTML -> colorString = colorRBGtoHTML colorArray


Share this post


Link to post
Share on other sites

What bugs me about the functions is working out the correct way to call them, there seems to be two or three methods.

Even when people post there own functions they leave out the method of calling them.

Share this post


Link to post
Share on other sites

BIS_fnc_listPlayers is obsolete since command allPlayers. BIS_fnc_param and BIS_fnc_MP are already mentioned.
 
Since you can use find toLower _someString to search if something exists in a string, I consider BIS_fnc_inString obsolete, too.

 

But speaking of strings, I'd even like to have a command like findLast which finds the last occurance of a "needle" in a "hay stack".
 
For those who follow proper naming conventions, this can simplify a lot of stuff with simple one line string sub selection. I had to write a custom function for that. Not a big deal, but it's pretty essential to all my larger projects and sometimes very intensively used, so speaking performance here, a scripting command could improve that to some extent.
 

* What functions would benefit from dedicated scripting command?

- BIS_fnc_relPos

- BIS_fnc_dirTo

- all stacked event handler functions

 

At least I am using latter fairly heavily, often even adding one on key down and removing it on key up again.
Since we all know that "EH" is an abbreviation for "event handler", wouldn't it be sufficient to shorten a potential future scripting command to "addStackedEH"?

Share this post


Link to post
Share on other sites

Basically using mostly the same as ruebe said.

Those recently added scripting commands are very delicious and make scripting more comfortable than ever (param, params, I'm looking at you).

 

Cheers

Share this post


Link to post
Share on other sites

Bis_fnc_prepareAO

 

Documentation could do with an update-just to clarify that by "trigger name"-they appear to mean the TEXT: field, not the name of the trigger itself.

Ideally we would be able to define our own pools of groups, cars, tanks etc.

Needs an update to include the fact that the Kuma is now a tank on the AAF side-the function must have been introduced before the tank and not updated.

 

Other than that I basically agree with what other people have said.

Share this post


Link to post
Share on other sites

 

 

Can have as command:

 

  • BIS_fnc_inString

 

 

What about 

 

"1234" find "34" > -1

Any good?

  • Like 1

Share this post


Link to post
Share on other sites

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

 

It would be great if you could feed this one an array of things you want to draw.  Now if we have to draw multiple things we need this method in a loop.  If we can let the engine draw multiple stuff performance would hopefully improve.  Then drawing more then 10 things on screen wouldn't drop fps from 30 to 17.  This would be a huge improvement

Share this post


Link to post
Share on other sites
What functions would benefit from dedicated scripting command?

My wishlist from the ft

http://feedback.arma3.com/view.php?id=25300

 

Not by any means the only one's I use, just the ones that seemed the most possible to be made as such..

Share this post


Link to post
Share on other sites

What functions do you use?

- Too many

 

What functions need improvement?

- none that I use frequently

 

 

What functions would benefit from dedicated scripting command?

- BIS_fnc_selectRandom

- BIS_fnc_randomNum

- BIS_fnc_randomInt

- BIS_fnc_relPos

- BIS_fnc_cutDecimals -> maybe integrated into the round, ceil and floor command eg. round [_number,_decimalPlace]

- BIS_fnc_magnitude

 

 

That's all for now ;)

 

 

Those recently added scripting commands are very delicious and make scripting more comfortable than ever (param, params, I'm looking at you).

 

 

Interesting is, even though those command are faster, it seems that many of the 3den scripts still use BIS_fnc_param

Share this post


Link to post
Share on other sites

What functions do I use.

Very few, i'm kind of long in the tooth here and am so fed up with BI breaking stuff that I write everything myself so that they have less chance of causing my code issues in the future.

(This is just me being anal, I wouldn't suggest for 1 second anyone follows me in this practice and I have not posted this information to cause a debate)

If I find a BI function I want to use, i make my own version of it.

 

The most common function that i use which are copies of BI functions are the

BIS_fnc_selectRandom
BIS_fnc_relPos
 
I agree with Sniperwolf572's comment about BIS_fnc_selectRandom
Should be a command. _x = arrayRandom [1,2,3,4,5];
 
The one function I use that may be worth an entry here is this............
I changed the internal function call to a BIS function to make it easier to understand.
 

// Called using : [_unit] call Txu_fget_UnitNumber
// Description : Returns the Unit's group number as seen in the command gui
// removes the first 2 elements from that array and then recompiles as a string
/////////////////////////////////////////////////////
///// PRELIMS /////
/////////////////////////////////////////////////////
 
 parseNumber(([[str player, count(toArray(str group player))+1] call BIS_fnc_trimString, " "] call BIS_fnc_splitString) select 0)
 
There are loads more but have a more specific use than this so probably shouldn't be included for general useage
 
 
Most MILSIM frameworks, coop missions etc also set the following for playable units, so maybe a function to setup the player in one call may be a good idea.
 
These elements are
 
Players group
Players callsign
GroupIcon
Fireteam
Vehicle position or stance
CustomLoadout
 
so maybe something like
 
[     
     this,
     "WA",     // Group VAR As a string so can be Isnil checked first then compiled to a group later if not already defined
     "ALPHA",
     [
          "b_inf",     // Group icon type
          "group_1"     // Group size
          "colorBlue"     // marker colour
          0.7,     // marker size
     ],
     "RED",     // red fireteam
     [
          "CARGO",     /// stance or position, "UP", "DOWN", "MIDDLE", "GUNNER", "COMMANDER", "DRIVER"
          "VehicleName"     // As a string so can be Isnil checked first then compiled to an object later
     ],
     "[ 'SQUADLEADER', 'BLUFOR'] call MyFNC_CustomLoadout"     // // As a string so can then be compiled to execute as a call, spawn, execvm
] call BIS_fnc_SetupPlayer;
 
  • Like 1

Share this post


Link to post
Share on other sites

Just a quickie here: http://feedback.arma3.com/view.php?id=25091
Easy bis_fnc_returnChildren optimization and 3rd parameter, "true to return only the last tier, false to return all classes leading to it" is reverse.

Would it benefit from a dedicated scripting command? hell yeah!

Share this post


Link to post
Share on other sites

I'm always hoping for a working BIS_fnc_findCover and BIS_fnc_setHideBehind.

Share this post


Link to post
Share on other sites

What functions do you use?
Many
 
What functions need improvement?
 
BIS_fnc_taskDefend

  • Radius of area to defend
  • Mount static weapons (Boolean)
  • Mount vehicle turrets (Boolean)
  • Garrison in building with LOS (e.g. window) Edit: unit should look out of window and not face the wall
  • Garrison at building Rooftops (Boolean)
  • Units that are not garrisoned go on patrol (same radius, 4 wp's)

BIS_fnc_taskPatrol

  • Number of waypoints
  • Radius instead of distance between waypoints
  • Road waypoints (Boolean)
  • Water waypoints (Boolean)
  • WP timeout
  • Search buildings (Boolean)

What functions would benefit from dedicated scripting command?

  • BIS_fnc_addStackedEventHandler
  • BIS_fnc_selectRandom
  • BIS fnc findSafePos
  • BIS_fnc_nearestRoad
  • BIS_fnc_spawnGroup > seems to be quite an expensive function. Especially when creating/populating an AO

 

Terox >> "BIS_fnc_SetupPlayer" >> :clap:  

 

Perhaps a wishlist of most wanted functions?

Share this post


Link to post
Share on other sites

Hi!

 

I think spawnGroup should have implemented some delay and be spawned, as it freezes the game for a sec everytime you use it.

 

Very used functions (among others, I use a lot):

 

selectRandom (someone said it should be a command and I agree if it adds performance) 

dirTo

arrayShuffle

relPos

MP

spawnVehicle (dont ask me why, vehicles respond better to WPs than just creating vehicles and units)

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

×