From 1e404cf85b2af8ad575c5f053fe0205e9ffa2470 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Sun, 4 Feb 2024 11:50:24 -0600 Subject: [PATCH] General - SQF Improvements (#9698) Co-authored-by: Dystopian Co-authored-by: PabstMirror Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- .../fnc_initializeTerrainExtension.sqf | 2 +- .../functions/fnc_readWeaponDataFromConfig.sqf | 2 +- .../functions/fnc_droneSetWaypoint.sqf | 5 ++++- addons/arsenal/functions/fnc_addStat.sqf | 7 +++---- .../arsenal/functions/fnc_fillRightPanel.sqf | 2 +- addons/arsenal/functions/fnc_onKeyDown.sqf | 2 +- .../fnc_statTextStatement_illuminators.sqf | 6 +++--- addons/arsenal/functions/fnc_verifyLoadout.sqf | 6 +----- .../functions/fnc_rangeTableOpen.sqf | 2 +- addons/atragmx/functions/fnc_update_result.sqf | 6 +++--- addons/common/XEH_postInit.sqf | 2 +- .../common/functions/fnc_disableUserInput.sqf | 2 +- addons/common/functions/fnc_receiveRequest.sqf | 2 +- addons/dagr/functions/fnc_menuInit.sqf | 2 +- addons/dagr/functions/fnc_outputData.sqf | 10 +++++----- addons/dagr/functions/fnc_outputVector.sqf | 10 +++++----- addons/dagr/functions/fnc_outputWP.sqf | 10 +++++----- .../functions/fnc_showItemsInListbox.sqf | 2 +- .../functions/fnc_createObjectMarker.sqf | 2 +- addons/hearing/functions/fnc_addEarPlugs.sqf | 2 +- addons/hearing/functions/fnc_firedNear.sqf | 6 ++++-- .../functions/fnc_getAttackProfileSettings.sqf | 9 ++++----- addons/huntir/functions/fnc_cam.sqf | 2 +- .../functions/fnc_createAction.sqf | 2 +- .../functions/fnc_createVehiclesActions.sqf | 2 +- .../interact_menu/functions/fnc_renderMenu.sqf | 2 +- addons/interaction/XEH_postInit.sqf | 2 +- .../functions/fnc_addPassengersActions.sqf | 2 +- addons/interaction/functions/fnc_openDoor.sqf | 2 +- .../functions/fnc_generateOutputData.sqf | 2 +- .../functions/fnc_cutDownFence.sqf | 5 ++++- addons/medical/dev/watchVariable.sqf | 10 +++++----- addons/medical_ai/XEH_preStart.sqf | 2 +- .../functions/fnc_countTreatmentItems.sqf | 2 +- .../medical_gui/functions/fnc_handleToggle.sqf | 11 +++++------ .../functions/fnc_checkPulseLocal.sqf | 2 +- addons/microdagr/functions/fnc_mapOnDrawEH.sqf | 2 +- addons/optics/functions/fnc_onDrawScope2D.sqf | 4 ++-- .../parachute/functions/fnc_showAltimeter.sqf | 4 ++-- .../functions/fnc_updateRangeCard.sqf | 8 ++++---- .../rearm/functions/fnc_rearmSuccessLocal.sqf | 2 +- addons/repair/functions/fnc_isEngineer.sqf | 2 +- .../functions/fnc_handlePlayerChanged.sqf | 12 ++++++------ .../respawn/functions/fnc_initRallypoint.sqf | 2 +- .../tacticalladder/functions/fnc_deployTL.sqf | 2 +- .../towing/functions/fnc_addRopeToVehicle.sqf | 4 ++-- .../functions/fnc_blockTrench_place.sqf | 4 ++-- addons/ui/functions/fnc_setAdvancedElement.sqf | 2 +- .../functions/fnc_getApproximateAirTemp.sqf | 2 +- addons/xm157/functions/fnc_weaponInfo_draw.sqf | 4 ++-- addons/zeus/functions/fnc_bi_moduleCurator.sqf | 2 +- .../functions/fnc_bi_moduleRemoteControl.sqf | 2 +- .../zeus/functions/fnc_ui_toggleFlashlight.sqf | 2 +- addons/zeus/functions/fnc_ui_toggleNvg.sqf | 2 +- .../ui/displays/RscDisplayAttributes.sqf | 18 +++++++++--------- 55 files changed, 114 insertions(+), 113 deletions(-) diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 6af9efca24..4c01043875 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -53,7 +53,7 @@ INFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldNa private _gridCenter = [_x + 25, _y + 25]; private _gridHeight = round(getTerrainHeightASL _gridCenter); private _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]); - private _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0}; + private _gridSurfaceIsWater = parseNumber (surfaceIsWater _gridCenter); "ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater]; GVAR(currentGrid) = GVAR(currentGrid) + 1; if (GVAR(currentGrid) >= _gridCells) exitWith {}; diff --git a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf index bf0e23f97c..c79aeaf2ea 100644 --- a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf @@ -21,7 +21,7 @@ private _weaponConfig = (configFile >> "CfgWeapons" >> _this); private _barrelTwist = 0 max getNumber(_weaponConfig >> "ACE_barrelTwist"); -private _twistDirection = [0, 1] select (_barrelTwist != 0); +private _twistDirection = parseNumber (_barrelTwist != 0); if (isNumber (_weaponConfig >> "ACE_twistDirection")) then { _twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection"); if !(_twistDirection in [-1, 0, 1]) then { diff --git a/addons/aircraft/functions/fnc_droneSetWaypoint.sqf b/addons/aircraft/functions/fnc_droneSetWaypoint.sqf index 5c919564ce..5ffbbae825 100644 --- a/addons/aircraft/functions/fnc_droneSetWaypoint.sqf +++ b/addons/aircraft/functions/fnc_droneSetWaypoint.sqf @@ -29,7 +29,10 @@ private _currentLoiterRadius = waypointLoiterRadius _waypoint; private _currentLoiterType = waypointLoiterType _waypoint; // Set pos to ATL -_pos set [2, if (_currentHeight >= 50) then { _currentHeight } else { 0 }]; +_pos set [ + 2, + [0, _currentHeight] select (_currentHeight >= 50) +]; // [_group] call CBA_fnc_clearWaypoints; _waypoint = _group addWaypoint [_pos, 0]; diff --git a/addons/arsenal/functions/fnc_addStat.sqf b/addons/arsenal/functions/fnc_addStat.sqf index 98dfe45213..40530262d7 100644 --- a/addons/arsenal/functions/fnc_addStat.sqf +++ b/addons/arsenal/functions/fnc_addStat.sqf @@ -109,11 +109,10 @@ private _tabToChange = []; { _x params ["_tab", "_tabSide"]; - _tabToChange = if (_tabSide == "R") then { + _tabToChange = [ + GVAR(statsListLeftPanel), GVAR(statsListRightPanel) - } else { - GVAR(statsListLeftPanel) - }; + ] select (_tabSide == "R"); _stats = _tabToChange select _tab; diff --git a/addons/arsenal/functions/fnc_fillRightPanel.sqf b/addons/arsenal/functions/fnc_fillRightPanel.sqf index 346e07fa59..09f986708d 100644 --- a/addons/arsenal/functions/fnc_fillRightPanel.sqf +++ b/addons/arsenal/functions/fnc_fillRightPanel.sqf @@ -87,7 +87,7 @@ private _fnc_fillRightContainer = { _ctrlPanel lnbSetText [[_lbAdd, 1], _displayName]; _ctrlPanel lnbSetData [[_lbAdd, 0], _className]; _ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture]; - _ctrlPanel lnbSetValue [[_lbAdd, 2], [0, 1] select _isUnique]; + _ctrlPanel lnbSetValue [[_lbAdd, 2], parseNumber _isUnique]; _ctrlPanel lnbSetTooltip [[_lbAdd, 0], format ["%1\n%2", _displayName, _className]]; if ((toLower _className) in GVAR(favorites)) then { _ctrlPanel lnbSetColor [[_lbAdd, 1], FAVORITES_COLOR]; diff --git a/addons/arsenal/functions/fnc_onKeyDown.sqf b/addons/arsenal/functions/fnc_onKeyDown.sqf index 24fbd624f6..4d62075f78 100644 --- a/addons/arsenal/functions/fnc_onKeyDown.sqf +++ b/addons/arsenal/functions/fnc_onKeyDown.sqf @@ -147,7 +147,7 @@ if (!isNull _loadoutsDisplay) then { // Right panel lnb + and - buttons case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): { if (GVAR(rightTabLnBFocus)) then { - [_display, [1, 0] select (_keyPressed == DIK_LEFT)] call FUNC(buttonCargo); + [_display, parseNumber (_keyPressed != DIK_LEFT)] call FUNC(buttonCargo); }; }; }; diff --git a/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf b/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf index b677ec8210..3f982f575c 100644 --- a/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf +++ b/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf @@ -31,9 +31,9 @@ if (_allItems isEqualTo []) then { _allItems = [configName _config] }; || {_illum && {([_xCfg >> "Flashlight" >> "irLight", "NUMBER", 0] call CBA_fnc_getConfigEntry) == 1}}; private _text = switch (true) do { // shorthand roughly based on PEQ-15 - case (_laser && _illum): { if (_isIR) then { "IR-DUAL" } else { "VIS-DUAL" } }; - case (_laser): { if (_isIR) then { "IR-AIM" } else { "VIS-AIM" } }; // AIM - case (_illum): { if (_isIR) then { "IR-ILM" } else { "VIS-ILM" } }; // ILLUMIATION + case (_laser && _illum): { ["VIS-DUAL", "IR-DUAL"] select _isIR }; // DUAL + case (_laser): { ["VIS-AIM", "IR-AIM"] select _isIR }; // AIM + case (_illum): { ["VIS-ILM", "IR-ILM"] select _isIR }; // ILLUMIATION default { "_" }; // there are some purely cosmetic attachements }; _allModes pushBackUnique _text; diff --git a/addons/arsenal/functions/fnc_verifyLoadout.sqf b/addons/arsenal/functions/fnc_verifyLoadout.sqf index b5425c2117..adc76f391a 100644 --- a/addons/arsenal/functions/fnc_verifyLoadout.sqf +++ b/addons/arsenal/functions/fnc_verifyLoadout.sqf @@ -46,11 +46,7 @@ private _fnc_toConfigCase = { // If item doesn't exist in config, "" is returned // Just return unaltered item name in that case, so it can be documented as being unavailable - if (_name != "") then { - _name - } else { - _x - }; + [_x, _name] select (_name != ""); } else { _x }; diff --git a/addons/artillerytables/functions/fnc_rangeTableOpen.sqf b/addons/artillerytables/functions/fnc_rangeTableOpen.sqf index 97c8dfe435..327a2903a0 100644 --- a/addons/artillerytables/functions/fnc_rangeTableOpen.sqf +++ b/addons/artillerytables/functions/fnc_rangeTableOpen.sqf @@ -65,7 +65,7 @@ GVAR(magModeData) = []; { _x params ["_xDisplayNameShort", "_xDisplayName", "_xInitSpeed", "_xAirFriction"]; if (_allSameCharge) then { - _ctrlChargeList lbAdd format ["%1", _xDisplayNameShort]; + _ctrlChargeList lbAdd _xDisplayNameShort; _ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1\n%2 m/s\n%3", _xDisplayName, _xInitSpeed toFixed 1, _xAirFriction]]; GVAR(magModeData) pushBack [_xInitSpeed, _xAirFriction]; } else { diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index 4def2f87a6..cfd8f460a9 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -90,7 +90,7 @@ if (GVAR(showWind2)) then { _elevationAbs = Round(_elevationAbs * 100) / 100; if (_elevationAbs > 0) then { - ctrlSetText [400, format["%1", abs(_elevationAbs)]]; + ctrlSetText [400, str abs _elevationAbs]; } else { if (_elevationAbs < 0) then { ctrlSetText [400, format["%1D", abs(_elevationAbs)]]; @@ -100,7 +100,7 @@ if (_elevationAbs > 0) then { }; _elevationRel = Round(_elevationRel * 100) / 100; if (_elevationRel > 0) then { - ctrlSetText [401, format["%1", abs(_elevationRel)]]; + ctrlSetText [401, str abs _elevationRel]; } else { if (_elevationRel < 0) then { ctrlSetText [401, format["%1D", abs(_elevationRel)]]; @@ -110,7 +110,7 @@ if (_elevationRel > 0) then { }; _elevationCur = Round(_elevationCur * 100) / 100; if (_elevationCur > 0) then { - ctrlSetText [402, format["%1", abs(_elevationCur)]]; + ctrlSetText [402, str abs _elevationCur]; } else { if (_elevationCur < 0) then { ctrlSetText [402, format["%1D", abs(_elevationCur)]]; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index c703591344..4c98e813b1 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -96,7 +96,7 @@ _object setVariable ["acre_sys_core_isDisabled", _set > 0, true]; }; if (["task_force_radio"] call FUNC(isModLoaded)) then { - _object setVariable ["tf_voiceVolume", [1, 0] select (_set > 0), true]; + _object setVariable ["tf_voiceVolume", parseNumber (_set == 0), true]; }; }] call CBA_fnc_addEventHandler; diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf index 6c58954b13..bb572e7286 100644 --- a/addons/common/functions/fnc_disableUserInput.sqf +++ b/addons/common/functions/fnc_disableUserInput.sqf @@ -219,7 +219,7 @@ if (_state) then { _keyPressedInfo set [1, ((_keyPressedInfo select 1) - 1) max 0]; if (_keyPressedInfo isEqualTo [false, 0]) then { - GVAR(keyboardInputMain) deleteAt _key, + GVAR(keyboardInputMain) deleteAt _key }; }, _key, 0.5] call CBA_fnc_waitAndExecute; }]; diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf index 6c45fb8966..02a9379e6c 100644 --- a/addons/common/functions/fnc_receiveRequest.sqf +++ b/addons/common/functions/fnc_receiveRequest.sqf @@ -31,7 +31,7 @@ if (isLocalized _requestMessage) then { _requestMessage = format [_requestMessage, [_caller, false, true] call FUNC(getName)]; }; -hint format ["%1", _requestMessage]; // @todo ? +hint str _requestMessage; // @todo ? if (!isNil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then { terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT); diff --git a/addons/dagr/functions/fnc_menuInit.sqf b/addons/dagr/functions/fnc_menuInit.sqf index 5bc757e295..fc05185638 100644 --- a/addons/dagr/functions/fnc_menuInit.sqf +++ b/addons/dagr/functions/fnc_menuInit.sqf @@ -541,7 +541,7 @@ GVAR(menuRun) = true; }; case "options": { (__dsp displayCtrl __Option0) ctrlSetText "Signal Delay"; - (__dsp displayCtrl __Option1) ctrlSetText (if (GVAR(useDegrees)) then { "Direction: Deg" } else { "Direction: MIL" }); + (__dsp displayCtrl __Option1) ctrlSetText (["Direction: MIL", "Direction: Deg"] select GVAR(useDegrees)); (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa); if (GVAR(SEL)) then { GVAR(vectorConnected) = false; diff --git a/addons/dagr/functions/fnc_outputData.sqf b/addons/dagr/functions/fnc_outputData.sqf index 21e19ff023..b7064ce248 100644 --- a/addons/dagr/functions/fnc_outputData.sqf +++ b/addons/dagr/functions/fnc_outputData.sqf @@ -65,10 +65,10 @@ GVAR(outputPFH) = [{ private _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString; // Output - __gridControl ctrlSetText format ["%1", _dagrGrid]; - __speedControl ctrlSetText format ["%1", _dagrSpeed]; - __elevationControl ctrlSetText format ["%1", _dagrElevation]; - __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 �", _dagrHeading] }); - __timeControl ctrlSetText format ["%1", _dagrTime]; + __gridControl ctrlSetText _dagrGrid; + __speedControl ctrlSetText _dagrSpeed; + __elevationControl ctrlSetText _dagrElevation; + __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _dagrHeading } else { format ["%1 �", _dagrHeading] }); + __timeControl ctrlSetText _dagrTime; }, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dagr/functions/fnc_outputVector.sqf b/addons/dagr/functions/fnc_outputVector.sqf index 5eb1b9bffa..e9bd0ea6c3 100644 --- a/addons/dagr/functions/fnc_outputVector.sqf +++ b/addons/dagr/functions/fnc_outputVector.sqf @@ -89,8 +89,8 @@ private _dagrDist = str GVAR(LAZDIST) + "m"; GVAR(vectorGrid) = _dagrGrid; // OUTPUT -__gridControl ctrlSetText format ["%1", _dagrGrid]; -__speedControl ctrlSetText format ["%1", _dagrDist]; -__elevationControl ctrlSetText format ["%1", _dagrElevation]; -__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] }); -__timeControl ctrlSetText format ["%1", _dagrTime]; +__gridControl ctrlSetText _dagrGrid; +__speedControl ctrlSetText _dagrDist; +__elevationControl ctrlSetText _dagrElevation; +__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _bearing } else { format ["%1°", _bearing] }); +__timeControl ctrlSetText _dagrTime; diff --git a/addons/dagr/functions/fnc_outputWP.sqf b/addons/dagr/functions/fnc_outputWP.sqf index 2e0588ccc4..27944f0bb9 100644 --- a/addons/dagr/functions/fnc_outputWP.sqf +++ b/addons/dagr/functions/fnc_outputWP.sqf @@ -85,10 +85,10 @@ GVAR(outputPFH) = [{ }); // Output - __gridControl ctrlSetText format ["%1", _dagrGrid]; - __speedControl ctrlSetText format ["%1", _bearing]; - __elevationControl ctrlSetText format ["%1", _dagrGrid2]; - __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] }); - __timeControl ctrlSetText format ["%1", _dagrDistance]; + __gridControl ctrlSetText _dagrGrid; + __speedControl ctrlSetText str _bearing; + __elevationControl ctrlSetText _dagrGrid2; + __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _dagrHeading } else { format ["%1°", _dagrHeading] }); + __timeControl ctrlSetText _dagrDistance; }, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/disarming/functions/fnc_showItemsInListbox.sqf b/addons/disarming/functions/fnc_showItemsInListbox.sqf index e05e27c87e..11d7bd470b 100644 --- a/addons/disarming/functions/fnc_showItemsInListbox.sqf +++ b/addons/disarming/functions/fnc_showItemsInListbox.sqf @@ -55,7 +55,7 @@ params ["_listBoxCtrl", "_itemsCountArray"]; }; }; - _listBoxCtrl lbAdd format ["%1", _displayName]; + _listBoxCtrl lbAdd _displayName; _listBoxCtrl lbSetData [((lbSize _listBoxCtrl) - 1), _classname]; _listBoxCtrl lbSetPicture [((lbSize _listBoxCtrl) - 1), _picture]; _listBoxCtrl lbSetTextRight [((lbSize _listBoxCtrl) - 1), str _count]; diff --git a/addons/fortify/functions/fnc_createObjectMarker.sqf b/addons/fortify/functions/fnc_createObjectMarker.sqf index 185ae640eb..ce6fd279b0 100644 --- a/addons/fortify/functions/fnc_createObjectMarker.sqf +++ b/addons/fortify/functions/fnc_createObjectMarker.sqf @@ -29,7 +29,7 @@ private _direction = getDir _object; // Marker name unique to this object private _markerNameStr = format [QGVAR(marker_%1), hashValue _object]; -private _channel = if (GVAR(markObjectsOnMap) == 2) then { 0 } else { 1 }; +private _channel = parseNumber (GVAR(markObjectsOnMap) != 2); private _marker = createMarkerLocal [_markerNameStr, _object, _channel, _unit]; TRACE_2("created",_marker,_channel); diff --git a/addons/hearing/functions/fnc_addEarPlugs.sqf b/addons/hearing/functions/fnc_addEarPlugs.sqf index b73c94bf01..f467352410 100644 --- a/addons/hearing/functions/fnc_addEarPlugs.sqf +++ b/addons/hearing/functions/fnc_addEarPlugs.sqf @@ -48,7 +48,7 @@ _caliber = call { if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; - if (_caliber <= 0) then { 6.5 } else { _caliber }; + [_caliber, 6.5] select (_caliber <= 0); }; private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5; diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index 98ee093381..0d8596f53b 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -27,7 +27,9 @@ params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"]; if (_weapon in ["Throw", "Put"]) exitWith {}; if (_distance > 50) exitWith {}; -private _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; +private _vehAttenuation = [GVAR(playerVehAttenuation), 1] select ( + (ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player} +); private _distance = 1 max _distance; private _silencer = switch (_weapon) do { @@ -78,7 +80,7 @@ if (isNil "_loudness") then { if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; - if (_caliber <= 0) then { 6.5 } else { _caliber }; + [_caliber, 6.5] select (_caliber <= 0) }; _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5; diff --git a/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf b/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf index fb12cad00f..48219da6fb 100644 --- a/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf +++ b/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf @@ -31,11 +31,10 @@ private _configLaunchHeightClear = getNumber (_attackConfig >> QGVAR(launchHeigh private _startingStage = if (_configLaunchHeightClear > 0) then { STAGE_LAUNCH; // LOAL-HI / LO } else { - if (_seekerTargetPos isEqualTo [0,0,0]) then { - STAGE_SEEK_CRUISE; // LOAL-DIR - } else { - STAGE_ATTACK_CRUISE // LOBL - }; + [ + STAGE_ATTACK_CRUISE, + STAGE_SEEK_CRUISE, + ] select (_seekerTargetPos isEqualTo [0,0,0]); }; // Set data in param array diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index 54b6516fff..c306595fc7 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -145,7 +145,7 @@ GVAR(no_cams) sort true; GVAR(cam) camCommit 0; ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]]; - ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]]; + ctrlSetText [2, str (GVAR(cur_cam) + 1)]; private _cam_time = CBA_missionTime - (GVAR(huntIR) getVariable [QGVAR(startTime), CBA_missionTime]); ctrlSetText [3, format["%1 s", round(_cam_time)]]; private _cam_pos = getPosVisual GVAR(huntIR); diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index d920922ddb..ae00f4fb82 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -49,7 +49,7 @@ _position = if (_position isEqualType "") then { } else { if (_position isEqualType []) then { // If the action is set to a array position, create the suitable code - compile format ["%1", _position]; + compile str _position; } else { _position; }; diff --git a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf index 54f92967c2..3aef7b4552 100644 --- a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf +++ b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf @@ -30,6 +30,6 @@ _vehicles apply { _name = format ["%1 (%2m)", _name, _distanceStr]; }; private _icon = [_x] call EFUNC(common,getVehicleIcon); - private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); + private _action = [str _x, _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); [_action, [], _target] } diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index e7bb42b4cf..3aa8a05ab3 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -95,7 +95,7 @@ if (_useListMenu) then { _scaleX = _textSize * 0.17 * 1.1; _scaleY = 0.17 * 0.30 * 4/3; } else { - private _textSize = if (GVAR(textSize) > 2) then {1.3} else {1}; + private _textSIze = [1, 1.3] select (GVAR(textSize) > 2); _scaleX = _textSize * 0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); _scaleY = _textSize * 0.17 * 4/3 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); }; diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 75e92c02c9..a5f7170588 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -136,7 +136,7 @@ GVAR(isOpeningDoor) = false; if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false}; //Tap whichever shoulder is closest - private _shoulderNum = [0, 1] select (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180); + private _shoulderNum = parseNumber (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180); // Statement [ACE_player, cursorTarget, _shoulderNum] call FUNC(tapShoulder); diff --git a/addons/interaction/functions/fnc_addPassengersActions.sqf b/addons/interaction/functions/fnc_addPassengersActions.sqf index 40ba9672ef..50b0d98a21 100644 --- a/addons/interaction/functions/fnc_addPassengersActions.sqf +++ b/addons/interaction/functions/fnc_addPassengersActions.sqf @@ -43,7 +43,7 @@ private _icon = ""; _actions pushBack [ [ - format ["%1", _unit], + str _unit, [_unit, true] call EFUNC(common,getName), [_icon, "#FFFFFF"], { diff --git a/addons/interaction/functions/fnc_openDoor.sqf b/addons/interaction/functions/fnc_openDoor.sqf index a03ca26c04..540712ef41 100644 --- a/addons/interaction/functions/fnc_openDoor.sqf +++ b/addons/interaction/functions/fnc_openDoor.sqf @@ -71,7 +71,7 @@ GVAR(usedScrollWheel) = false; // didn't use incremental opening. Just do animation normally. if !(GVAR(usedScrollWheel)) then { - private _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5); + private _phase = parseNumber (_house animationPhase (_animations select 0) < 0.5); {_house animate [_x, _phase]; false} count _animations; }; diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index 2143904f80..59bb3056dd 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -93,7 +93,7 @@ if (GVAR(referenceHeadingMenu) == 0) then { }; case 1: { // Direction if (!GVAR(MinAvgMax)) then { - _textCenterBig = format["%1", format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]]; + _textCenterBig = format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]; } else { _textCenterLine1Left = "Min"; _textCenterLine2Left = "Avg"; diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf index 46e38acb90..2176793aed 100644 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -22,7 +22,10 @@ TRACE_2("Fence cutting started",_unit,_fence); if (_unit != ACE_player) exitWith {}; // Get cut time based on if unit is a engineer -private _cutTime = if (_unit call EFUNC(common,isEngineer)) then {CUT_TIME_ENGINEER} else {CUT_TIME_DEFAULT}; +private _cutTime = [ + CUT_TIME_DEFAULT, + CUT_TIME_ENGINEER +] select (_unit call EFUNC(common,isEngineer)); if !(_unit call EFUNC(common,isSwimming)) then { [_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf index 0eb191e8dd..05cb094ba8 100644 --- a/addons/medical/dev/watchVariable.sqf +++ b/addons/medical/dev/watchVariable.sqf @@ -28,7 +28,7 @@ GVAR(dev_watchVariableRunning) = true; _return pushBack format ["State: %2", _color, _targetState]; private _hasStableVitals = ["N", "Y"] select ([_unit] call EFUNC(medical_status,hasStableVitals)); private _hasStableCondition = ["N", "Y"] select ([_unit] call EFUNC(medical_status,isInStableCondition)); - private _unconcFlag = if IS_UNCONSCIOUS(_unit) then {"[U]"} else {""}; + private _unconcFlag = ["", "[U]"] select IS_UNCONSCIOUS(_unit); private _timeLeft = _unit getVariable [QEGVAR(medical_statemachine,cardiacArrestTimeLeft), -1]; private _cardiactArrestFlag = if IN_CRDC_ARRST(_unit) then {format ["[CA %1]", _timeLeft toFixed 1]} else {""}; _return pushBack format ["[StableVitals: %1] [StableCon: %2] %3 %4", _hasStableVitals, _hasStableCondition, _unconcFlag, _cardiactArrestFlag]; @@ -38,7 +38,7 @@ GVAR(dev_watchVariableRunning) = true; private _woundBleeding = GET_WOUND_BLEEDING(_unit); private _bloodLoss = GET_BLOOD_LOSS(_unit); private _hemorrhage = GET_HEMORRHAGE(_unit); - private _isBleeding = if (IS_BLEEDING(_unit)) then {"Bleeding"} else {""}; + private _isBleeding = ["", "[Bleeding]"] select IS_BLEEDING(_unit); private _secondsToHeartstop = if (_bloodLoss != 0) then {format ["[Time Left: %1 sec]", (((_bloodVolume - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) max 0) / _bloodLoss) toFixed 0]} else {""}; _return pushBack format ["Blood: %1 [Hemorrhage: %2] %3", _bloodVolume toFixed 3, _hemorrhage, _isBleeding]; _return pushBack format [" - [W: %1 T: %2] %3", _woundBleeding toFixed 4, _bloodLoss toFixed 4, _secondsToHeartstop]; @@ -60,7 +60,7 @@ GVAR(dev_watchVariableRunning) = true; // Damage: private _damage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]; - private _limping = if (_unit getVariable [QEGVAR(medical,isLimping), false]) then {"[ Limping ]"} else {""}; + private _limping = ["", "[ Limping ]"] select (_unit getVariable [QEGVAR(medical,isLimping), false]); _return pushBack format ["BodyPartDamage: [H: %1] [B: %2]", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2]; _return pushBack format ["[LA:%1] [RA: %2] [LL:%3] [RL: %4]", (_damage select 2) toFixed 2, (_damage select 3) toFixed 2, (_damage select 4) toFixed 2, (_damage select 5) toFixed 2]; @@ -68,8 +68,8 @@ GVAR(dev_watchVariableRunning) = true; _return pushBack format ["[HHnd:%1] [HLeg: %2] %3", (_unit getHitPointDamage "HitHands") toFixed 2, (_unit getHitPointDamage "HitLegs") toFixed 2, _limping]; private _fractures = GET_FRACTURES(_unit); - private _canSprint = if (isSprintAllowed _unit) then {""} else {"[Sprint Blocked]"}; - private _forceWalk = if (isForcedWalk _unit) then {"[Forced Walking]"} else {""}; + private _canSprint = ["[Sprint Blocked]", ""] select (isSprintAllowed _unit); + private _forceWalk = ["", "[Forced Walking]"] select (isForcedWalk _unit); _return pushBack format ["Fractures: %1 %2%3", _fractures, _canSprint, _forceWalk]; diff --git a/addons/medical_ai/XEH_preStart.sqf b/addons/medical_ai/XEH_preStart.sqf index 52e3374924..b4d795cbbf 100644 --- a/addons/medical_ai/XEH_preStart.sqf +++ b/addons/medical_ai/XEH_preStart.sqf @@ -13,7 +13,7 @@ private _itemHash = createHashMap; private _items = getArray (configFile >> "ace_medical_treatment_actions" >> _x >> "items"); if (_items isEqualTo []) then { ERROR_1("bad action %1",_x); }; private _itemClassname = configName (configFile >> "CfgWeapons" >> _items # 0); - private _treatment = if ((count _treatments) > 1) then { _x } else { "" }; + private _treatment = ["", _x] select ((count _treatments) > 1); _typeHash set [_itemClassname, _treatment]; } forEach _treatments; _itemHash set [_itemType, _typeHash]; diff --git a/addons/medical_gui/functions/fnc_countTreatmentItems.sqf b/addons/medical_gui/functions/fnc_countTreatmentItems.sqf index 102d996bb3..6e8394c82f 100644 --- a/addons/medical_gui/functions/fnc_countTreatmentItems.sqf +++ b/addons/medical_gui/functions/fnc_countTreatmentItems.sqf @@ -38,7 +38,7 @@ if (ACE_player != GVAR(target)) then { // Vehicle private _medicVehicle = objectParent ACE_player; private _patientVehicle = objectParent GVAR(target); -private _vehicle = if (!isNull _medicVehicle) then {_medicVehicle} else {_patientVehicle}; +private _vehicle = [_patientVehicle, _medicVehicle] select (!isNull _medicVehicle); if (!isNull _vehicle) then { _vehicleCount = 0; diff --git a/addons/medical_gui/functions/fnc_handleToggle.sqf b/addons/medical_gui/functions/fnc_handleToggle.sqf index f0448fc3a3..48232790c1 100644 --- a/addons/medical_gui/functions/fnc_handleToggle.sqf +++ b/addons/medical_gui/functions/fnc_handleToggle.sqf @@ -19,15 +19,14 @@ if (!isNull findDisplay 312) exitWith {}; // Find new target to switch to -private _target = if ( +private _target = [ + ACE_player, + GVAR(previousTarget) +] select ( GVAR(target) == ACE_player && {[ACE_player, GVAR(previousTarget)] call EFUNC(common,canInteractWith)} && {[ACE_player, GVAR(previousTarget)] call FUNC(canOpenMenu)} -) then { - GVAR(previousTarget); -} else { - ACE_player; -}; +); // Exit if new target is same as old if (GVAR(target) == _target) exitWith {}; diff --git a/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf b/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf index 91c6bf038c..3798e64eb4 100644 --- a/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf +++ b/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf @@ -39,7 +39,7 @@ private _logOutput = LSTRING(Check_Pulse_None); if (_heartRate > 1) then { if (_medic call FUNC(isMedic)) then { _heartRateOutput = LSTRING(Check_Pulse_Output_1); - _logOutput = format ["%1", round _heartRate]; + _logOutput = str round _heartRate; } else { _heartRateOutput = LSTRING(Check_Pulse_Output_2); _logOutput = LSTRING(Check_Pulse_Weak); diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf index 30a0c6ad6e..86415a1914 100644 --- a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf +++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf @@ -60,7 +60,7 @@ if (GVAR(currentApplicationPage) == 1) then { _size = 32 * _mapSize; { _x params ["_wpName", "_wpPos"]; - private _alpha = if (_forEachIndex == GVAR(currentWaypoint)) then {1} else {0.5}; + private _alpha = [0.5, 1] select (_forEachIndex == GVAR(currentWaypoint)); _theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ]; } forEach _waypoints; }; diff --git a/addons/optics/functions/fnc_onDrawScope2D.sqf b/addons/optics/functions/fnc_onDrawScope2D.sqf index df431407da..c7fb19c9c1 100644 --- a/addons/optics/functions/fnc_onDrawScope2D.sqf +++ b/addons/optics/functions/fnc_onDrawScope2D.sqf @@ -80,11 +80,11 @@ if (_isPIP) then { // Calculate lighting private _dayOpacity = call EFUNC(common,ambientBrightness); -private _nightOpacity = [1, 0] select (_dayOpacity == 1); +private _nightOpacity = parseNumber (_dayOpacity == 1); // Apply lighting and make layers visible (_display displayCtrl 1713001) ctrlSetTextColor [1, 1, 1, 1]; -(_display displayCtrl 1713002) ctrlSetTextColor [1, 1, 1, [0, 1] select (_dayOpacity < 0.5)]; +(_display displayCtrl 1713002) ctrlSetTextColor [1, 1, 1, parseNumber (_dayOpacity < 0.5)]; (_display displayCtrl 1713005) ctrlSetTextColor [1, 1, 1, _dayOpacity]; (_display displayCtrl 1713006) ctrlSetTextColor [1, 1, 1, _nightOpacity]; diff --git a/addons/parachute/functions/fnc_showAltimeter.sqf b/addons/parachute/functions/fnc_showAltimeter.sqf index 47b014f4ab..d4533a7a6b 100644 --- a/addons/parachute/functions/fnc_showAltimeter.sqf +++ b/addons/parachute/functions/fnc_showAltimeter.sqf @@ -53,8 +53,8 @@ private _TimeText = _display displayCtrl 1001; }; _TimeText ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]); - _HeightText ctrlSetText (format ["%1", floor _height]); - _DecendRate ctrlSetText (format ["%1", _descentRate max 0]); + _HeightText ctrlSetText str floor _height; + _DecendRate ctrlSetText str (_descentRate max 0); (_this select 0) set [1, _height]; (_this select 0) set [2, _curTime]; diff --git a/addons/rangecard/functions/fnc_updateRangeCard.sqf b/addons/rangecard/functions/fnc_updateRangeCard.sqf index e8fb0f9c6c..999dfc5a2e 100644 --- a/addons/rangecard/functions/fnc_updateRangeCard.sqf +++ b/addons/rangecard/functions/fnc_updateRangeCard.sqf @@ -33,7 +33,7 @@ if (_ammoClass == "" || _magazineClass == "" || _weaponClass == "") exitWith {}; GVAR(controls) = []; for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 790000 + _row]); _control ctrlSetPosition [safeZoneX + 0.183, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.062, 0.025]; if (_row in [0, 8, 18, 28, 38, 48]) then { @@ -47,7 +47,7 @@ for "_row" from 0 to 49 do { }; for "_column" from 0 to 8 do { for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + _column * 100 + _row]); _control ctrlSetPosition [safeZoneX + 0.249 + _column * 0.055, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.052, 0.025]; _control ctrlCommit 0; @@ -57,7 +57,7 @@ for "_column" from 0 to 8 do { }; for "_column" from 0 to 2 do { for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + (9 +_column) * 100 + _row]); _control ctrlSetPosition [safeZoneX + 0.743 + _column * 0.049, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.047, 0.025]; _control ctrlCommit 0; @@ -67,7 +67,7 @@ for "_column" from 0 to 2 do { }; for "_column" from 0 to 2 do { for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + (12 +_column) * 100 + _row]); _control ctrlSetPosition [safeZoneX + 0.892 + _column * 0.049, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.047, 0.025]; _control ctrlCommit 0; diff --git a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf index 71802451b7..f41dff6ea9 100644 --- a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf +++ b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf @@ -54,7 +54,7 @@ private _maxMagazines = [_vehicle, _turretPath, _magazineClass] call FUNC(getMax private _ammoCounts = [_vehicle, _turretPath, _magazineClass] call FUNC(getTurretMagazineAmmo); TRACE_3("start",_magazineClass,_maxMagazines,_ammoCounts); -private _ammoToAdd = if (GVAR(level) == 2) then {_numRounds} else {_rounds}; +private _ammoToAdd = [_rounds, _numRounds] select (GVAR(level) == 2); private _ammoAdded = 0; private _arrayModified = false; // skip needing to remove and re-add mags, if we are only adding new ones diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf index 2a013bccda..2962e4f8ad 100644 --- a/addons/repair/functions/fnc_isEngineer.sqf +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -22,7 +22,7 @@ private _class = _unit getVariable ["ACE_IsEngineer", _unit getUnitTrait "engine // This if statement is here for copmatability with the common variant of isEngineer, which requires a bool. // We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. -if (_class isEqualType false) then {_class = [0, 1] select _class}; +if (_class isEqualType false) then {_class = parseNumber _class}; TRACE_3("isEngineer",_unit,_engineerN,_class); if (_class >= _engineerN) exitWith {true}; diff --git a/addons/respawn/functions/fnc_handlePlayerChanged.sqf b/addons/respawn/functions/fnc_handlePlayerChanged.sqf index f94e14d644..81dd5eb9a9 100644 --- a/addons/respawn/functions/fnc_handlePlayerChanged.sqf +++ b/addons/respawn/functions/fnc_handlePlayerChanged.sqf @@ -19,9 +19,9 @@ params ["_newUnit"]; private _side = side group _newUnit; -((GETMVAR(ACE_Rallypoint_West, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west)); -((GETMVAR(ACE_Rallypoint_West_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west)); -((GETMVAR(ACE_Rallypoint_East, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east)); -((GETMVAR(ACE_Rallypoint_East_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east)); -((GETMVAR(ACE_Rallypoint_Independent, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent)); -((GETMVAR(ACE_Rallypoint_Independent_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent)); +((GETMVAR(ACE_Rallypoint_West, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == west)); +((GETMVAR(ACE_Rallypoint_West_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == west)); +((GETMVAR(ACE_Rallypoint_East, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == east)); +((GETMVAR(ACE_Rallypoint_East_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == east)); +((GETMVAR(ACE_Rallypoint_Independent, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == independent)); +((GETMVAR(ACE_Rallypoint_Independent_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == independent)); diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index 50931a87f4..7e4651e1e9 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -53,7 +53,7 @@ if (hasInterface) then { private _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == ""); _marker setMarkerTypeLocal _type; - _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init + _marker setMarkerAlphaLocal (parseNumber (_side == playerSide)); // playerSide to guarantee init private _date = _rallypoint getVariable [QGVAR(markerDate), ""]; diff --git a/addons/tacticalladder/functions/fnc_deployTL.sqf b/addons/tacticalladder/functions/fnc_deployTL.sqf index 85804e091f..0f399536f4 100644 --- a/addons/tacticalladder/functions/fnc_deployTL.sqf +++ b/addons/tacticalladder/functions/fnc_deployTL.sqf @@ -23,7 +23,7 @@ removeBackpack _unit; private _pos = _unit modelToWorld [0,0,0]; -private _offset = if ((_unit call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8}; +private _offset = [0.8, 1] select (_unit call CBA_fnc_getUnitAnim select 0 == "prone"); _pos set [0, (_pos select 0) + (sin getDir _unit) * _offset]; _pos set [1, (_pos select 1) + (cos getDir _unit) * _offset]; diff --git a/addons/towing/functions/fnc_addRopeToVehicle.sqf b/addons/towing/functions/fnc_addRopeToVehicle.sqf index 4ff0fce62d..9dec1257d0 100644 --- a/addons/towing/functions/fnc_addRopeToVehicle.sqf +++ b/addons/towing/functions/fnc_addRopeToVehicle.sqf @@ -20,8 +20,8 @@ params ["_vehicle"]; if (0 == getNumber (configOf _vehicle >> QEGVAR(cargo,hasCargo))) exitWith {}; -private _ropeType = if ( +private _ropeType = ["ACE_rope6", "ACE_rope12"] select ( -1 < ["Tank", "Wheeled_APC_F", "Truck_F"] findIf {_vehicle isKindOf _x} -) then {"ACE_rope12"} else {"ACE_rope6"}; +); _vehicle addItemCargoGlobal [_ropeType, 1]; diff --git a/addons/trenches/functions/fnc_blockTrench_place.sqf b/addons/trenches/functions/fnc_blockTrench_place.sqf index f602a871e0..4c0a218307 100644 --- a/addons/trenches/functions/fnc_blockTrench_place.sqf +++ b/addons/trenches/functions/fnc_blockTrench_place.sqf @@ -63,10 +63,10 @@ private _east = (abs (_ax - _bx)) >= (abs (_ay - _by)); private _origin2D = []; private _length = 0; if (_east) then { - _origin2D = if (_ax < _bx) then { _start2d } else { _end2d }; + _origin2D = [_end2d, _start2d] select (_ax < _bx); _length = (abs (_ax - _bx)) / _cellsize; } else { - _origin2D = if (_ay < _by) then { _start2d } else { _end2d }; + _origin2D = [_end2d, _start2d] select (_ay < _by); _length = (abs (_ay - _by)) / _cellsize; }; TRACE_3("",_east,_origin2D,_length); diff --git a/addons/ui/functions/fnc_setAdvancedElement.sqf b/addons/ui/functions/fnc_setAdvancedElement.sqf index 3771bf840b..6751d9700c 100644 --- a/addons/ui/functions/fnc_setAdvancedElement.sqf +++ b/addons/ui/functions/fnc_setAdvancedElement.sqf @@ -68,7 +68,7 @@ if (!_force) then { }; private _displays = ((uiNamespace getVariable "IGUI_displays") + [findDisplay IDD_MISSION]) select {_idd == ctrlIDD _x}; -private _fade = [1, 0] select _show; +private _fade = parseNumber !_show; // Disable/Enable elements private _success = false; diff --git a/addons/weather/functions/fnc_getApproximateAirTemp.sqf b/addons/weather/functions/fnc_getApproximateAirTemp.sqf index 33227907a3..91b8af3fcc 100644 --- a/addons/weather/functions/fnc_getApproximateAirTemp.sqf +++ b/addons/weather/functions/fnc_getApproximateAirTemp.sqf @@ -18,7 +18,7 @@ params ["_unit"]; TRACE_1("params",_unit); -if (isNil (format ["%1", _unit getVariable "ACE_airTemperatureBias"])) then { +if (isNil {_unit getVariable "ACE_airTemperatureBias"}) then { _unit setVariable ["ACE_airTemperatureBias", [-(random(3) + 1), random(3) + 1]]; }; diff --git a/addons/xm157/functions/fnc_weaponInfo_draw.sqf b/addons/xm157/functions/fnc_weaponInfo_draw.sqf index ef9fd1d528..c03b575f4e 100644 --- a/addons/xm157/functions/fnc_weaponInfo_draw.sqf +++ b/addons/xm157/functions/fnc_weaponInfo_draw.sqf @@ -86,7 +86,7 @@ if (_retTex != ctrlText _ctrlScopeReticle) then { _ctrlScopeReticle ctrlSetText private _rangeInfo = _range call { if (_range == 0) exitWith { "" }; if (_range < 0) exitWith { // range error - blink if recent - if ((_timeSinceLastInput < 3) && {(floor (4*_timeSinceLastInput)) % 2 == 1}) then { "----" } else { "" }; + ["", "----"] select ((_timeSinceLastInput < 3) && {(floor (4*_timeSinceLastInput)) % 2 == 1}); }; format ["%1 m", _range toFixed 0] }; @@ -98,7 +98,7 @@ _ctrl ctrlSetText _rangeInfo; private _bearingInfo = call { private _bearingSetting = GVAR(data) getOrDefault ["bearing_show", 0]; if ((_bearingSetting == 2) && {_timeSinceLastInput > 2}) exitWith { "" }; - if ((_bearingSetting == 1)) exitWith { format ["%1", floor (17.777777 * _weaponDir)]; }; // (6400 Mils, not MRAD) + if ((_bearingSetting == 1)) exitWith { str floor (17.777777 * _weaponDir); }; // (6400 Mils, not MRAD) format ["%1°", floor _weaponDir]; }; private _ctrl = _display displayCtrl IDC_SCREEN_TEXT_UPPER_LEFT; diff --git a/addons/zeus/functions/fnc_bi_moduleCurator.sqf b/addons/zeus/functions/fnc_bi_moduleCurator.sqf index c597955a23..ec04a12d24 100644 --- a/addons/zeus/functions/fnc_bi_moduleCurator.sqf +++ b/addons/zeus/functions/fnc_bi_moduleCurator.sqf @@ -257,7 +257,7 @@ if (_activated) then { //--- Player if (hasinterface) then { waituntil {local player}; - _serverCommand = if (_ownerVar == "#adminLogged") then {"#shutdown"} else {"#kick"}; + _serverCommand = ["#kick", "#shutdown"] select (_ownerVar == "#adminLogged"); //--- Black effect until the interface is open _forced = _logic getvariable ["forced",0] > 0; diff --git a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf index b2288be91c..2aa438be53 100644 --- a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf +++ b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf @@ -30,7 +30,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { //--- Get unit under cursor _unit = objnull; _mouseOver = missionnamespace getvariable ["bis_fnc_curatorObjectPlaced_mouseOver",[""]]; - if ((_mouseOver select 0) == typename objnull) then {_unit = _mouseOver select 1;}; + if ((_mouseOver select 0) == "OBJECT") then {_unit = _mouseOver select 1;}; _unit = effectivecommander _unit; //--- Temp owner diff --git a/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf b/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf index 9c34bc8f65..5c9a220615 100644 --- a/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf +++ b/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf @@ -53,7 +53,7 @@ if !(isNull _unit) then { if (isNull _unit) then { (_display displayCtrl 56220) lbDelete 0; } else { - (_display displayCtrl 56218) lbSetCurSel ([0, 1] select (_unit isFlashlightOn currentWeapon _unit)); + (_display displayCtrl 56218) lbSetCurSel (parseNumber (_unit isFlashlightOn currentWeapon _unit)); }; private _fnc_onUnload = { diff --git a/addons/zeus/functions/fnc_ui_toggleNvg.sqf b/addons/zeus/functions/fnc_ui_toggleNvg.sqf index 1e60a777ea..5d5747c7ca 100644 --- a/addons/zeus/functions/fnc_ui_toggleNvg.sqf +++ b/addons/zeus/functions/fnc_ui_toggleNvg.sqf @@ -53,7 +53,7 @@ if !(isNull _unit) then { if (isNull _unit) then { (_display displayCtrl 92856) lbDelete 0; } else { - (_display displayCtrl 92855) lbSetCurSel ([0, 1] select (hmd _unit isNotEqualTo "")); + (_display displayCtrl 92855) lbSetCurSel (parseNumber (hmd _unit isNotEqualTo "")); }; private _fnc_onUnload = { diff --git a/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf b/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf index be5a9adb3e..09aba83b06 100644 --- a/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf +++ b/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf @@ -54,7 +54,7 @@ switch _mode do { _control = _display displayctrl _idc; //--- Admin specific attribute - _show = if (getnumber (_cfgControl >> "adminOnly") > 0) then {_enableAdmin} else {true}; + _show = [true, _enableAdmin] select (getnumber (_cfgControl >> "adminOnly") > 0); if ((_allAttributes || {_x == configname _cfgControl} count _attributes > 0) && _show) then { _controlPos = ctrlposition _control; @@ -75,10 +75,10 @@ switch _mode do { _target = missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target",objnull]; _name = switch (typename _target) do { - case (typename objnull): {gettext (configfile >> "cfgvehicles" >> typeof _target >> "displayname")}; - case (typename grpnull): {groupid _target}; - case (typename []): {format ["%1: %3 #%2",groupid (_target select 0),_target select 1,localize "str_a3_cfgmarkers_waypoint_0"]}; - case (typename ""): {markertext _target}; + case ("OBJECT"): {gettext (configfile >> "cfgvehicles" >> typeof _target >> "displayname")}; + case ("GROUP"): {groupid _target}; + case ("ARRAY"): {format ["%1: %3 #%2",groupid (_target select 0),_target select 1,localize "str_a3_cfgmarkers_waypoint_0"]}; + case ("STRING"): {markertext _target}; }; _ctrlTitle ctrlsettext format [ctrltext _ctrlTitle,toupper _name]; @@ -115,19 +115,19 @@ switch _mode do { _display = _this select 0; _target = missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target",objnull]; switch (typename _target) do { - case (typename objnull): { + case ("OBJECT"): { _isAlive = alive _target; waituntil {isnull _display || (_isAlive && !alive _target)}; }; - case (typename grpnull): { + case ("GROUP"): { waituntil {isnull _display || isnull _target}; }; - case (typename []): { + case ("ARRAY"): { _grp = _target select 0; _wpCount = count waypoints _grp; waituntil {isnull _display || (count waypoints _grp != _wpCount)}; }; - case (typename ""): { + case ("STRING"): { waituntil {isnull _display || markertype _target == ""}; }; };