#arma3_scripting

1 messages ยท Page 270 of 1

tough abyss
#

See it if it actually evaluates the code.

#

Also I don't think opfor is a valid entry.

#

It's east thats valid

#

Not opfor.

#

To check just type side into the watch field

rotund cypress
#

oh yeah

#

but

tough abyss
#

It will return values.

rotund cypress
#

west didnt work either

#

and this used to work

tough abyss
#

Code didn't even run?

rotund cypress
#

now it doesnt

#

i tried but then i changed something which led it to stop working

tough abyss
#

Are you working with the current file?

rotund cypress
#

yes

tough abyss
#

Does the control exist?

rotund cypress
#

yes

#

private _sideColour = _display displayCtrl 12454;

tough abyss
#

diag_log format ["%1",_sideColour];

#

See if it exists.

rotund cypress
#

((uiNameSpace getVariable "RscMetaGame") displayCtrl 12454)

tough abyss
#

Exists?

rotund cypress
#

yes

tough abyss
#

Whats the rest of the code?

rotund cypress
#

what code?

tough abyss
#

The stuff that actually invokes the GUI?

rotund cypress
#

private _display = uiNameSpace getVariable "RscMetaGame";

#

private _sideColour = _display displayCtrl 12454;

#
switch (_playerSide) do {

    case west: {

        _sideColour ctrlSetBackgroundColor [0, 0.3, 0.6, 1];

    };

    case independent: {

        _sideColour ctrlSetBackgroundColor [0, 0.5, 0, 1];

    };

    case civilian: {

        _sideColour ctrlSetBackgroundColor [0.4, 0, 0.5, 1];

    };

    case east: {

        _sideColour ctrlSetBackgroundColor [0.5, 0, 0, 1];

    };

};```
tough abyss
#

Is this called or spawn'd?

rotund cypress
#

spawn'd

tough abyss
#

disableSerialization

#

Try that.

rotund cypress
#

already have it

tough abyss
#

at the top?

rotund cypress
#

yep

tough abyss
#

Okay so what value is target?

rotund cypress
#

private _target = cursorObject;

#

ive set other values with like ctrlsettext and that works

#

its just the background that is not setting

tough abyss
#

Wonder if thats related.

rotund cypress
#

that is rscbutton

#

im using RscText

#

and it worked

#

before

#

now its not working anymore

tough abyss
#

What did you change?

rotund cypress
#

i dont know

#

I think nothing

tame portal
#

If it's not working anymore you changed something 100%

rotund cypress
#

i know but i dont know what

tough abyss
#

^

#

This is why you use BitBucket

#

or Github

rotund cypress
#

I use git

#

BUT

tough abyss
#

Use a previous snapshot?

rotund cypress
#

I dont commit until im done

tough abyss
#

...

#

Comment everything...

#

This is why...

#

When stuff breaks you know what happened.

rotund cypress
#

But I cant commit for each line of code I write

tough abyss
#

Self-documenting vars?

#

etc?

#

Also

#

Who thinks this is dirty code

#

This is froma community I hate.

dusk sage
#

So what's the current error @rotund cypress ?

rotund cypress
#

No errors

tough abyss
#
/*
    File: fn_keyInfo.sqf
    Author: Redacted

    Desc:
    Displays info for the selected key's vehicle in the key menu dialog
*/

private ["_selection","_distance","_display","_displayDistance"];
disableSerialization;

_selection = _this select 0 select 1;
_distance = round(player distance (life_ogVehicles select _selection));

if (_distance >= 100000000) then {_distance = 0};

waitUntil {!isNull (findDisplay 2700)};
_display = findDisplay 2700;
_displayDistance = _display displayCtrl 228804;

_displayDistance ctrlSetText format["Distance: %1m",[_distance] call life_fnc_numberText];

/* ---------- END OF SCRIPT ---------- */
rotund cypress
#

Background is not setting @dusk sage

buoyant heath
#

If you use self documenting vars, think of how easy it will be for other sneaky servers to snag your code!

tough abyss
#

^

#

I spewed chips when I saw that disgusting function

dusk sage
#

Perhaps it's not their intent to make the code readable to a third party?

buoyant heath
#

If it mostly works, they're usually happy enough

tough abyss
#

No their dev team is full of retards

dusk sage
#

Code makes sense to me

#

@rotund cypress Full snippet?

tough abyss
#

They have no idea about computational feasibility.

#

It's all bastardised stuff too.

#

From other communities.

dusk sage
#

They have no idea about computational feasibility.

#

What's the point in saying that?

tough abyss
#

Give you another example.

#
private["_allVeh","_pUID"];

sleep 5;
 
_allVeh = allMissionObjects "Car" + allMissionObjects "Air" + allMissionObjects "Ship";
_name = profileName;
    
{
    _owners = _x getVariable ["vehicle_info_owners",[]];
    _index = [_name,_owners] call fnc_index;
    if(!(_index == -1)) then {
        life_ogVehicles set[count life_ogVehicles, _x];
    };    
} foreach _allVeh;
#

Lets iteratively search the entire map for all objects.

#

...

buoyant heath
#

Ehh, that all's already tracked by the engine.

dusk sage
#

There isn't 1000000 vehicles

buoyant heath
#

If they were using nearestObjects I'd be really worried

tough abyss
#

And concatonate them into a giant array.

#

It's a 135 player server.

dusk sage
#

So what

tough abyss
#

There is a lot of traffic.

dusk sage
#

you have like 200-300 vehicles?

#

Which run unscheduled would take milliseconds

tough abyss
#

"miliseconds"

#

It's running scheduled

#

sleep 5;

#

At the top.

buoyant heath
#

Shouldn't be much traffic. They're not public'ing it in there. Not sure why they're waiting before checking.

dusk sage
#

so it waits before running

#

even scheduled it'll take little to no time

tough abyss
#

life_ogVehicles set[count life_ogVehicles, _x]; <--- Pushback?

buoyant heath
#

aye

dusk sage
#

sure

#

How old is the code?

tough abyss
#

And they claim to have a "framework"

#

They have NOTHING.

dusk sage
#

Why are you being so salty about it

#

The code you posted of one of your first projects was a thousand times worse

#

You seem to think that code is the scum of the earth

#

It's not perfect

#

But it's not going to crash their server

tough abyss
#

I plan on becoming a computer scientist / nanotechnologist?

dusk sage
#

huh?

tough abyss
#

So salty isn't the right word.

#

Also I have the hacker ethic.

#

Make elegent, efficient code.

#

Not a butchered mess.

dusk sage
#

They have NOTHING.

tough abyss
#

It's why I changed the EH handled mission code.

dusk sage
#

Seems pretty salt to me

#

Sure, so you've gone from awful code to code that could be good?

#

And you're slamming this, because it doesn't appeal to you?

tough abyss
#

Comparing it to ACE3 / CBA?

#

It's disgusting.

#

Also "calling themselves devs" is what really erk'd me.

dusk sage
tough abyss
#

Agreed.

rancid ruin
#

can i get a hacker ethic too please?

dusk sage
#

teach me senpai

rancid ruin
#

i don't care if that's bad scripting or not, but it seems very bad manners to berate them in public

#

there's a lot of people in this discord, some of which could be from this community you have a vendetta against

dusk sage
#

๐Ÿ‘€

#

I guess you found the answer ๐Ÿ˜„ ?

meager granite
#

Yep, as usual as soon as I ask I find the answer myself right away

dusk sage
#

What was it?

meager granite
#

Check if entity is backpack apart from isKindOf Bag_Base, there is isbackpack value in config that defines it

dusk sage
#

oh ๐Ÿคฆ

meager granite
#

I wonder what "reversed" in config is

dusk sage
#

I'm going to take a stab at it being a class thing

#

๐Ÿคฆ

#

This overrides the default

#

Reverse the reverse?

#

Kind of doesn't make sense

meager granite
#

Yeah, that's why I'm wondering

tough abyss
#

@rotund cypress Solve your problem?

dusk sage
#

He did

meager granite
#

So InventoryOpened is not fully fixed ๐Ÿ™„

#

If you open body with crate nearby, EH only reports the body but not crate while both are available in the inventory menu

rancid ruin
#

have they made the arma team significantly smaller?

open vigil
#

But have they actually? The same was said during A2, but it was regarding QA (and players wondering why BI were releasing employees to other projects) and the employees that had moved on to another project were artists (iirc).

bright coral
#

The destroyed vehicle problem is really annoying

#

The sound sticks on one side till the vehicle gets deleted, doesn't matter where you are, the sound is always there

#

Yes

#

Yes

#

120,887 people who own a free project are now more important than 2,782,910 people who own a product which people still buy ๐Ÿ˜ƒ

#

Btw, setShotsParents works perfectly fine, am using it since it is available

#

There is no secret, just use it as it is described in the wiki

#

setShotsParents [vehicle _unit, _unit]

#

not vice versa

thick lintel
#

Is the facewear bug new? Any units that enter water, even if ankle deep, their face wear disappears. Only just noticed it this morning.

bright coral
#

Yes, still server. I'm creating a CAS plane with an AI on the server and the player who called the CAS plane gets the points of the AI kills (just one example, doing the same with arty)

#
_plane setVariable ["d_who_fired", _caller];
_plane addEventhandler ["fired", {
    params ["_vec"];
    private _whof = _vec getVariable "d_who_fired";
    if (!isNil "_whof") then {
        private _aop = missionNamespace getVariable _whof;
        if (!isNil "_aop" && {!isNull _aop}) then {
            _this select 6 setShotParents [_vec, _aop];
        };
    };
}];
#

Code tags?

#

I'm using the variable name and reading the unit from mission namespace

rancid ruin
#

is mouseButtonClick eventhandler broken? worth reporting it as a bug?

#
    disableSerialization; 
    private _parentDisplay = (findDisplay 12); 
    waitUntil { !(isNull _parentDisplay) }; 
    _ctrl = _parentDisplay ctrlCreate ["RscButton", 6557]; 
    _ctrl ctrlSetPosition [SafeZoneX + (15 / 1920) * SafeZoneW, SafeZoneY + (795.25 / 1080) * SafeZoneH];  
    _ctrl ctrlSetText "default"; 
    _ctrl ctrlAddEventHandler ["MouseButtonDown", {_this select 0 ctrlSetText "down" }];
    _ctrl ctrlAddEventHandler ["MouseButtonUp", {_this select 0 ctrlSetText "up" }];
    _ctrl ctrlAddEventHandler ["MouseButtonClick", {_this select 0 ctrlSetText "clicked" }];
    _ctrl ctrlCommit 0;
};```
#

surely it should fire on mouse down + mouse up over ctrl, rather than after a second or so of mousedown?

#

^ can test by running that, opening map, clicking button

austere granite
#

i think its because there's a seperate one for double click, so it waits if you don't do a double click

#

not 100% sure on it, but that's what i think it was

pliant stream
#

anyone ever succesfully use an X macro in arma?

worldly kernel
#

when you go to properties on your arma 3 dedicated box to change the target or command line, you cannot fully enter it as it will cut off towards the end

little eagle
#

@thick lintel Facewear disappearing in water is intentional

#

@rancid ruin your code is nonsensical

#

if #12 is null, the waitUntil loop is infinite

#

even if #12 appears later, you stored a null display in your variable

tender root
#

Hey all, just little question: Are the MissionEHs Local or Global, so do I have to add them for each client ? Thanks in advance ๐Ÿ˜ƒ

little eagle
#

they are only executed on the machine they were attached on

#

you have to use addMissionEventHandler on every machine

tender root
#

@little eagle cool thanks ๐Ÿ˜ƒ

vague hull
#

is there something like "ctrlFocused"? or any other way to detect whether a certain active text is selected?

little eagle
#

no

vague hull
#

damn, yet thanks :)

rotund cypress
#

will this most likely lag out the server?

while { true } do {
if ( visibleMap && { "ItemGPS" in (assignedItems player) } || { "B_UavTerminal" in (assignedItems player) } ) then {

};

sleep 2;

};```
vague hull
#

not really, but its not optimal anyway

#

why would you run that on the server?

rotund cypress
#

I just want to do stuff when those equals true

vague hull
#

is it run on client or server? if on client, then it should be ok

#

you can also use this then:

rotund cypress
#

its run on client init

#

oh I guess I could

#

So then when each user is opening map it will spawn for example if i spawn within that eventhandler?

#

@vague hull

vague hull
#

only for that certain user who opened it but yeah

#

it will call that code you assigned

wispy cosmos
#

Any ideas why this isn't working?

#

["Initialize", [selectRandom (call Tactics_Core_GetPlayersInArena), [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;

#

Tactics_Core_GetPlayersInArena returns all units in the arena

#

those units are AI which are remote controlled by players

#

This works, but isn't what I want: ["Initialize", [player, [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;

tough abyss
#

What does call Tactics_core_getPlayeresInArena return?

little eagle
#

Probably an array of playable units in an area

#

if the function name means anything

wispy cosmos
#

^

#

Tactics_Core_GetPlayersInArena =
{
(call Tactics_Core_GetPlayers) inAreaArray Tactics_Core_ArenaVolume;
};

#

Tactics_Core_GetPlayers =
{
allUnits select { alive _x && isPlayer(_x getVariable ["Tactics_Player", objNull]) };
};

#

The functions do return the correct units as expected

#

but it looks like BIS' spectator system doesn't like those units for some reason and won't initialize

tough abyss
#

It does return players yes?

wispy cosmos
#

_x getVariable ["Tactics_Player", objNull] <----- should point to the player who controls the unit

tough abyss
#

okay nvm.

#

Does it actually return anything?

wispy cosmos
#

yes

tough abyss
#

Tactics_Player ?

wispy cosmos
#

everything on my end works

tough abyss
#

Have you looked at the functions viewer?

wispy cosmos
#

it's BI's spectator system that isn't working as I expect

#

What am I looking for in the functions viewer?

#

I took a quick glance at the EGSpectator function

tough abyss
#

EGSpector?

#

Wheres it located?

wispy cosmos
#

I don't plan on taking it apart and repurposing it.

#

configFile >> All >> Spectator

tough abyss
#

Not take it apart.

wispy cosmos
#

I am hoping that there is a way to just position the spectator camera to where I want, instead of requiring that I pass in a unit to focus on

#

but I didn't see anything on who to do that

#

@tough abyss A3\functions_f_exp_a\EGSpectator\fn_EGSpectator.sqf

#

that's the path

tough abyss
#

Do you have ArmA 3 Addons dev environment setup?

wispy cosmos
#

yes

#

the work drive?

#

"ArmA 3 Tools"

tough abyss
#

/*
Author:
Nelson Duarte

Description:
Spectator instance

Returns:
Multiple values / none

Examples:
["Initialize", [player]] call BIS_fnc_EGSpectator;     // Initializes spectator for given player
["Terminate"] call BIS_fnc_EGSpectator;             // Terminates spectator for given player
#

Wrong params?

#

Thats it.

wispy cosmos
#

there are optional params

tough abyss
#

ah nvm I see.

wispy cosmos
#

I'm not opposed to using a third-party spectator script as long as I can specify the units available to spectate, as well as being able to terminate the spectator mode at ease.

#

I just prefer the fluidity of BI's spectator mode

#

or if you want to say, "splendidness" lol

tough abyss
#

I actually have another communities framework

#

Where they've hooked into this.

#

I don't steal stuff by the way.

#

I told them what I wanted it for, they said sure.

#

Anyones code I use to learn from new stuff.

#

[] call bis_fnc_respawnspectator;

#

Thats all I can see they used.

#

Have you tried to directly call the code?

#

["Initialize", [player, [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;

#

?

#

Old programming addage is if you can't solve something with complex code.

#

Simplify it.

#

See if that works @wispy cosmos

wispy cosmos
#

just tried [] call bis_fnc_respawnspectator;

#

it doesn't allow me to spectate my AI units

#

some background with how my mission works

tough abyss
#

Try the other one.

#

The full initization code.

wispy cosmos
#

when a player joins, it creates an AI unit which they switch in and out of using remoteControl

#

I want to only spectate those AI units

#

["Initialize", [player, [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator; <-- this worked before, but it won't let me spectate AI units

#

it focuses on the dummy player unit but won't accept the remote-controllable AI units

tough abyss
#

does remoteControl, change locality?

wispy cosmos
#

if you want, you can join my server and tinker around with it

#

I have the debug console enabled in the mission

tough abyss
#

Sure.

wispy cosmos
tough abyss
#

I am wonder if it's locality realted.

little eagle
#

does remoteControl, change locality?
Yes

tough abyss
#

Yeah thought so.

#

Server or client?

little eagle
#

except for gunners in those drones I guess. where only the turret becomes local when someone else is driving

tough abyss
little eagle
#

Server or client?
machine that is remote controling

#

yeah. the wiiki says it all

wispy cosmos
#

here's my two functions which allow the player to control and revoke control of the unit

#

Tactics_Client_GainControl =
{
if(Tactics_Core_IsHardcoreMode) then
{
cutText ["", "BLACK IN", 0.1];
}
else
{
cutText [format ["Turn %1: It's your turn.", Tactics_Core_CurrentTurn],"PLAIN", 0.25];
playSound "defaultNotification";
};
["Terminate"] call BIS_fnc_EGSpectator;
switchCamera Tactics_Client_ControlledUnit;
player remoteControl Tactics_Client_ControlledUnit;
};

#

Tactics_Client_RemoveControl =
{
if(alive Tactics_Client_ControlledUnit && Tactics_Client_ControlledUnit call Tactics_Core_IsInArena || Tactics_Core_IsGameOver) then
{
if(Tactics_Core_IsHardcoreMode) then
{
cutText [format ["Turn %1: Please wait...", Tactics_Core_CurrentTurn],"BLACK OUT", 0.25];
}
else
{
cutText [format ["Turn %1: Please wait...", Tactics_Core_CurrentTurn],"PLAIN", 0.25];
};
[] spawn
{
_position = getPosASL Tactics_Client_ControlledUnit;
_tick = diag_tickTime;
disableUserInput true;
waitUntil { diag_tickTime != _tick };
objNull remoteControl Tactics_Client_ControlledUnit;
if(Tactics_Core_IsHardcoreMode) then
{
switchCamera Tactics_Client_HardcoreCameraGameLogic;
}
else
{
switchCamera Tactics_Client_ControlledUnit;
};
Tactics_Client_ControlledUnit disableAI "ALL";
Tactics_Client_ControlledUnit setPosASL _position;
disableUserInput false;
};
}
else
{
cutText [format ["Turn %1", Tactics_Core_CurrentTurn], "PLAIN DOWN", 0.25];
};
};

little eagle
#

```

#

at the start and end for code blocks

wispy cosmos
#

I wasn't sure how to do code formatting on here

tough abyss
#

back ticks

#
code here 
wispy cosmos
#

<test>

#

<<test

#

back ticks?

tough abyss
#

No back ticks

#

Left hand side of your keyboard

#

Where the ~ key is

wispy cosmos
#

`test

#

~ts

tough abyss
#

3

#

at the beginning and end

wispy cosmos
#

~test~

#

test

#

oh

tough abyss
#

yeah that.

#

You know I'll make your life even easier.

little eagle
#

that's not a block, but a line

tough abyss
#

2 seconds

wispy cosmos
#

Tactics_Client_GainControl = { if(Tactics_Core_IsHardcoreMode) then { cutText ["", "BLACK IN", 0.1]; } else { cutText [format ["Turn %1: It's your turn.", Tactics_Core_CurrentTurn],"PLAIN", 0.25]; playSound "defaultNotification"; }; ["Terminate"] call BIS_fnc_EGSpectator; switchCamera Tactics_Client_ControlledUnit; player remoteControl Tactics_Client_ControlledUnit; }; Tactics_Client_RemoveControl = { if(alive Tactics_Client_ControlledUnit && Tactics_Client_ControlledUnit call Tactics_Core_IsInArena || Tactics_Core_IsGameOver) then { if(Tactics_Core_IsHardcoreMode) then { cutText [format ["Turn %1: Please wait...", Tactics_Core_CurrentTurn],"BLACK OUT", 0.25]; } else { cutText [format ["Turn %1: Please wait...", Tactics_Core_CurrentTurn],"PLAIN", 0.25]; }; [] spawn { _position = getPosASL Tactics_Client_ControlledUnit; _tick = diag_tickTime; disableUserInput true; waitUntil { diag_tickTime != _tick }; objNull remoteControl Tactics_Client_ControlledUnit; if(Tactics_Core_IsHardcoreMode) then { switchCamera Tactics_Client_HardcoreCameraGameLogic; } else { switchCamera Tactics_Client_ControlledUnit; }; Tactics_Client_ControlledUnit disableAI "ALL"; Tactics_Client_ControlledUnit setPosASL _position; disableUserInput false; }; } else { cutText [format ["Turn %1", Tactics_Core_CurrentTurn], "PLAIN DOWN", 0.25]; }; };

#

there..

little eagle
#

nah

#

three of them

#

times 2

wispy cosmos
#
{
    if(Tactics_Core_IsHardcoreMode) then
    {
        cutText ["", "BLACK IN", 0.1];
    }
    else
    {
        cutText [format ["Turn %1: It's your turn.", Tactics_Core_CurrentTurn],"PLAIN", 0.25];
        playSound "defaultNotification";
    };
    ["Terminate"] call BIS_fnc_EGSpectator;
    switchCamera Tactics_Client_ControlledUnit;
    player remoteControl Tactics_Client_ControlledUnit;
};
Tactics_Client_RemoveControl =
{
    if(alive Tactics_Client_ControlledUnit && Tactics_Client_ControlledUnit call Tactics_Core_IsInArena || Tactics_Core_IsGameOver) then
    {
        if(Tactics_Core_IsHardcoreMode) then
        {
            cutText [format ["Turn %1: Please wait...", Tactics_Core_CurrentTurn],"BLACK OUT", 0.25];
        }
        else
        {
            cutText [format ["Turn %1: Please wait...", Tactics_Core_CurrentTurn],"PLAIN", 0.25];
        };
        [] spawn
        {
            _position = getPosASL Tactics_Client_ControlledUnit;
            _tick = diag_tickTime;
            disableUserInput true;
            waitUntil { diag_tickTime != _tick };
            objNull remoteControl Tactics_Client_ControlledUnit;
            if(Tactics_Core_IsHardcoreMode) then
            {
                switchCamera Tactics_Client_HardcoreCameraGameLogic;
            }
            else
            {
                switchCamera Tactics_Client_ControlledUnit;
            };
            Tactics_Client_ControlledUnit disableAI "ALL";
            Tactics_Client_ControlledUnit setPosASL _position;
            disableUserInput false;
        };
    }
    else
    {
        cutText [format ["Turn %1", Tactics_Core_CurrentTurn], "PLAIN DOWN", 0.25];
    };
};```
#

got it

#

thanks

tough abyss
#

Just to help more

#

Thats all of markdown

wispy cosmos
#

this is also relevant:

#
{
    _side = param [0];
    _unit = Tactics_Client_DummyGroup createUnit ["C_man_1", [0, 0, 0], [], 0, "FORM"];
    [_unit] joinSilent Tactics_Client_DummyGroup;
    [_unit] joinSilent grpNull;
    if(_side == west) then
    {
        _unit call Tactics_Client_LoadSWATLoadout;
    }
    else
    {
        _unit call Tactics_Client_LoadTerroristLoadout;
    };
    _unit setVariable ["Tactics_Player", player, true];
    _unit disableAI "ALL";
    _unit addEventHandler ["HandleDamage",
    {
        _unit = _this select 0;
        _damage = _this select 2;
        _source = _this select 3;
        if(_source != objNull) then
        {
            _damage = _damage * Tactics_Core_DamageModifier;
        };
        (damage _unit) + _damage;
    }];
    _unit addEventHandler ["Killed",
    {
        ["Initialize", [selectRandom (call Tactics_Core_GetPlayersInArena), [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;
    }];

    if(!isNull Tactics_Client_ControlledUnit) then
    {
        deleteVehicle Tactics_Client_ControlledUnit;
    };
    Tactics_Client_ControlledUnit = _unit;
};```
tough abyss
#

Thats me Zooloo75

wispy cosmos
#

?

tough abyss
#

I sent a friend request

#

on Steam

wispy cosmos
#

oh

#

no mods

tough abyss
#

You should use CBA_A3

#

For development allows you to go backwards

#

in the code you've executed

#

And select previous code you executed

#

Just make sure you remove the CBA_A3 addon reference when your done.

wispy cosmos
#

?

#

like a call stack?

#

not sure what you mean

tough abyss
#

Similar yes.

wispy cosmos
#

How do you do that in CBA? I've never noticed anything like that.

tough abyss
#

One sec.

#

Uploading a screen

#

See @wispy cosmos

wispy cosmos
#

oh

#

you mean the debug console

#

I thought you were talking about CBA magically tracking everything that gets executed

tough abyss
#

It does.

#

Those previous execute buttons?

#

and next?

#

Allow you to select previous code to execute

wispy cosmos
#

it's just a history feature

#

not a call stack

#

don't even see how the latter would be possible

little eagle
#

debug console has a history with CBA

wispy cosmos
#

yea

little eagle
#

and in ACE we have call stacks

wispy cosmos
#

I know that

little eagle
#

powered by CBA

tough abyss
#

Still makes it easier.

#

^

little eagle
#

but you have to set up all your functions in a way to support it

wispy cosmos
#

welp

little eagle
#

magically it won't work

wispy cosmos
#

Of course

#

I'd imagine you could feed in the text from a script and programatically inject a variable that tracks the progress after each statement

little eagle
#

needs to use PREP() macro to define those functions

wispy cosmos
#

then have a pseudo-call stack

little eagle
#

no it's just a function header that can be added by enabling debug mode

wispy cosmos
#

cool

#

anyways, back to this spectator camera issue

#

๐Ÿ˜›

little eagle
#

i don't know anything about that

#

just wanted to correct when I saw CBA/ACE

wispy cosmos
#

don't even know why that was brought up

little eagle
#

shrug

wispy cosmos
#

just trying to figure out why BI's spectator system doesn't want to spectate certain units

tough abyss
#

It was brought up because I've found CBA_A3's history feature to be really helpful.

wispy cosmos
#

yea, it's useful

little eagle
#

why BI's spectator system doesn't want to spectate certain units

#

maybe

#

just maybe

#

it's broken

#

ยฏ_(ใƒ„)_/ยฏ

wispy cosmos
#

kinda figured

little eagle
#

wouldn't be the first time

wispy cosmos
#

going to do an isolated test to narrow down the possible issues

little eagle
#

good. simple repros

wispy cosmos
#

could be because I'm a player who is remoteControl'ing into the AI unit which is created on my client system

#

idk

#

locality issues?

#

there's bound to be something preventing these units from being used by the spectator system

#

some illogical filter...

tough abyss
#

Test it easily Zooloo75

#

Use local

#

local unit

wispy cosmos
#

well, I know the AI units are local

#

they're created on the client system

#

and they're grouped to a dummy group created on the client system

#

gonna just try someone else's spectator system and see how that goes

tough abyss
#

Tried directly calling the unit spawn'd?

#

in the EGSpector function to see what happens?

wispy cosmos
#

already tried

#
    {
        ["Initialize", [selectRandom (call Tactics_Core_GetPlayersInArena), [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;
    }];```
#

this is where the spectator system is supposed to start up

tough abyss
#

Lets stick this in watch field

wispy cosmos
#

when the remote controlled unit dies, it goes into spectator

#

or it should...

tough abyss
#

and do an exhaustive test.

#

selectRandom (call Tactics_Core_GetPlayersInArena)

#

See if it through someting wrong.

wispy cosmos
#

already did that

#

all my functions work correctly

#

something is happening in the EG Spectator system which doesn't accept my arguments

tough abyss
#

Thats what I'm thinking

#

checked out the INC data?

wispy cosmos
#

I haven't

tough abyss
#

the INC contains all the macros

meager granite
#

What happens over network when you add magazine with addMagazineCargo (not global) to say your uniform container and then drop it on the ground? Will magazines somehow sync to everyone since it was active player uniform?

tough abyss
#

To the code.

meager granite
#

Or same question from the other side, does calling addMagazine and have it added to your uniform broadcast it over network right away? (or even registers in BE's addmagazinecargo log)

wispy cosmos
#

@meager granite I'd figure that it would create a global weapon container in the world

#

and place the appropriate gear into it

#

just a guess

#

can't give a definite answer on that though

little eagle
#

define "right away"

tough abyss
#

@Zooloo did you add a side whitelist?

wispy cosmos
#

@tough abyss no

tough abyss
#

Try that.

wispy cosmos
#

ok

#

didn't do anything

meager granite
#

Right away, synced to other clients right away

little eagle
#

it is synched as long as it was used on a local unit

meager granite
#

Or maybe delayed sync somehow, I'm not exactly sure how it works for player-worn containers, maybe there is special behavior

tough abyss
#

Oh this is interesting

#
        // Make sure call was not done by a dedicated server or headless client
        if (!hasInterface) exitWith {};

        // Make sure local player is fully initialized
        waitUntil { !isNil { player } && { !isNull player } };

        // Whether spectator systems are already initialized
        private _bIsInitialized    = ["IsInitialized"] call SPEC;

        // Whether given unit is also local player
        private _isPlayer = _spectator == player;

        // Make sure that:
        // * Spectator was not initialized already
        // * We only execute spectator for local player if controlling unit
        if (!_bIsInitialized && _isPlayer) then
little eagle
#

you don't add to containers with addMagazine directly

#

but same thing

wispy cosmos
#

ohhhhhh

little eagle
#

!isNil { player }

wispy cosmos
#

good find @tough abyss

little eagle
#

this does nothing

wispy cosmos
#

_isPlayer should be false in this case

meager granite
#

Basically I want to add lots of magazines into three different containers (uniform, vest, backpack) without using addMagazineCargoGlobal to avoid BE getting lots of addmagazinecargo log messages (and possible mags/second kick)

wispy cosmos
#

since the AI is not a player

#

but remote controlled by a player

tough abyss
#

When in doubt check. As I said assume nothing when it comes to programming

meager granite
#

And order of addition is important so I can't use addMagazine

tough abyss
#

It will often wind you up in hot-water.

wispy cosmos
#

what's odd about the comment for that code is that...

little eagle
#

I don't see the problem, Sa-Matra

wispy cosmos
#

// Make sure that:
// * Spectator was not initialized already
// * We only execute spectator for local player if controlling unit
if (!_bIsInitialized && _isPlayer) then
{

#

"local player if controlling unit"

meager granite
#

So I was thinking if I can add magazines locally with addMagazineCargo and make sure that if player drops their uniform moments later everyone will see magazines in it

wispy cosmos
#

the local player is controlling the unit

little eagle
#

as long as you use the commands on the machine of the unit, it will be synched correctly

tough abyss
#

#define SPEC { _this call (missionNamespace getVariable ["BIS_fnc_EGSpectator", {}]) }

wispy cosmos
#

but they use isPlayer to do the check

tough abyss
#

Thats the macro declaration that points to _bisInitialized

wispy cosmos
#

isPlayer doesn't check if the remote controlled unit is controlled by a player

meager granite
#

Actually could answer this through simple test

tough abyss
#

private _bIsInitialized = ["IsInitialized"] call SPEC;

meager granite
#

Noone is around to test with me though

wispy cosmos
#

welp

#

I guess I could modify the EG spectator system to change this one condition

#

I mean fix this condition

meager granite
#

Actually there are dedicated addItemTo* commands, maybe I can use these

wispy cosmos
#

thanks @tough abyss

#

gonna try modifying a copy of the script

tough abyss
#

np.

#

Trying to recreate ArmA Tactics in ArmA 3?

#

๐Ÿ˜›

wispy cosmos
#

nah

#

think of it like a turn based counter strike

tough abyss
#

Would be interesting to implement ArmA Tactics into ArmA 3

wispy cosmos
#

Is ArmA Tactics anything like XCOM?

tough abyss
#

I haven't had much experience with it.

#

I played it a bit.

#

The free lite version.

#

Controls are kind as esoteric as arma 3's

#

Particularly for newbies

wispy cosmos
#

Is there a way to remove the "Release UAV Controls" action when using the remoteControl command?

tough abyss
#

Hi banana split comrades!

wispy cosmos
#

hey

tough abyss
#

_nul = NPC1 remoteExec [ "RemoveAllActions", 0, true ];

#

pass the AI you want into the removeAllActions

#

That will execute all of them.

#

The 2017 mod map will be released?

tough abyss
#

where can I hire a scripter to help me with my arma 3 servers

#

Will you pay per scripts, per month?

#

(sorry if i get the "hire" word wrong)

#

I was hoping to hire them onto my community as a scripter most likely paid every month or bi-weekly depending on the arrangement we come to.

#

but it would not be a lot of money sadly i do have a job but i only make so much

#

@tough abyss your community have a site or something on the internet so i can know more about? I'm not interested in a job but i'm a scripter and i'm interested in join a community.

#

Thankyou for the link.

#

and we do have a teamspeak

rancid ruin
#

@little eagle ok my code is shit, but the real question is, is MouseButtonClick EH functioning as it should do?

wispy cosmos
#

I don't know why, but DrawIcon3D is not showing anything when I'm viewing through another camera such as Tactics_Client_SpectatorCamera = "camconstruct" camCreate (position Tactics_Core_ArenaVolume); Tactics_Client_SpectatorCamera cameraEffect ["INTERNAL", "BACK"]; switchCamera Tactics_Client_SpectatorCamera;

#

the draw script addMissionEventHandler ["Draw3D", { if(!isNull Tactics_Client_SpectatorCamera) then { { _player = _x getVariable ["Tactics_Player", objNull]; _position = getPosWorld _x; if(side _x == west) then { drawIcon3D ["", [0.10, 0.34, 0.50, 1], _position, 0, 0, 0, name _player, 1]; } else { drawIcon3D ["", [0.38, 0.49, 0.11, 1], _position, 0, 0, 0, name _player, 1]; }; } foreach (call Tactics_Core_GetPlayersInArena); }; }];

#

I did confirm that the drawing did work in a normal view of the unit (with the condition removed of course from the above code)

#

but the idea is that I want a freecam that shows the names of the players on screen

#

I can also confirm that the draw3d event handler is firing every frame while in camera by doing addMissionEventHandler ["Draw3D", { player globalChat str(diag_ticktime) }];

#

and seeing that the ticks are being printed to the chat

wispy cosmos
#

@tough abyss how so?

thick lintel
#

@wispy cosmos "I don't know why, but DrawIcon3D is not showing anything when I'm viewing through another camera such as " Remove the switchCamera line, cameraEffect already swaps the camera for you. Then you need to enable the HUD for Draw3D to be visible. Slightly modified so i could test from the debugConsole... ```Tactics_Core_ArenaVolume = player;
Tactics_Client_SpectatorCamera = "camconstruct" camCreate (position Tactics_Core_ArenaVolume);
Tactics_Client_SpectatorCamera cameraEffect ["INTERNAL", "BACK"];

cameraEffectEnableHUD true;
showHUD [true, false, false, false, false, false, false, true];

addMissionEventHandler ["Draw3D",
{
if(!isNull Tactics_Client_SpectatorCamera) then
{
{
_player = _x getVariable ["Tactics_Player", player];
_position = getPosWorld _x;
if(side _x == west) then
{
drawIcon3D ["", [0.10, 0.34, 0.50, 1], _position, 0, 0, 0, name _player, 1];
}
else
{
drawIcon3D ["", [0.38, 0.49, 0.11, 1], _position, 0, 0, 0, name _player, 1];
};
} foreach [ player ];
};
}];```

wispy cosmos
#

Awesome @thick lintel! I'll give this a try!

#

@tough abyss I've ended up just embracing the "Release UAV Controls" action as a feature for my turn based game mode. I check if the camera position is closer to the remote controlled unit, or the player. If it's closer to the player, I assume that the player has released control, and so I end his turn.

wispy cosmos
#

@thick lintel That did the trick! Thanks a ton!!

thick lintel
#

@wispy cosmos Your other problem from further back

{
    ["Initialize", [selectRandom (call Tactics_Core_GetPlayersInArena), [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;
}];```
I presume Tactics_Core_GetPlayersInArena returns players remote controlled units?
I notice in the previous code i posted you have
```_x getVariable ["Tactics_Player", objNull];```
Is this not a reference to the actual player? could you not use this to pass to BIs EGSpectator to get around the _isPlayer and then swap the current spectated target to the actual controlled unit.
```_unit addEventHandler ["Killed",
{
    params[ "_killed" ];
    
    ["Initialize", [ _killed getVariable [ "Tactics_Player", objNull ] , [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;
    _nul = [ selectRandom (call Tactics_Core_GetPlayersInArena) ] spawn {
        waitUntil { !isNull ( uiNamespace getVariable [ "RscDisplayEGSpectator", displayNull ] ) };
        [ _this ] call BIS_fnc_EGSpectatorCameraPrepareTarget; //BIS_fnc_EGSpectatorCameraSetTarget
    };
}];```I presume this is the effect your going for, controlled unit dies, player whom controlled ends up spectating another players controlled unit?
little eagle
#

Is my X working as it should do?

#

Why don't you try it? What's the point of asking here if only the game (reality) can judge

jade abyss
#

I guess, they want/expect a pat on the shoulder...

rancid ruin
#

is that aimed at me? cos I of course did try it before posting, and as far as I can tell the EH is not functioning as it is supposed to

little eagle
#

at everyone really

#

and as far as I can tell the EH is not functioning as it is supposed to
then why not ask: "Why does this do nothing?" After checking the RPT for errors of course

jade abyss
#

Or just use Diag_log everywhere. Starting from "the part where it gets attached"

rancid ruin
#

it doesn't do nothing, it fires, but not as expected

#

my own logic & the wiki would expect MouseButtonClick to fire after mouse down + mouse up on the ctrl

#

but it really fires after mouse down

little eagle
#

Yeah. diag_log and systemChat. debug it yourself and see where it goes haywire

jade abyss
#

You don't wanna know, how often i added a diag_log after every codeline just to find the source of evil

little eagle
#

TRACE_X macro โค

little eagle
#

the only difference between ASL and World is the models offset

#

so to convert you need a model

#

can do some math on the z component of getposASL and getPosWOrld on that object

wispy cosmos
#

@thick lintel I decided to abandon using BI's spectator system and just went with a freecam mode with player name's overlayed on-screen.

#

@thick lintel Thanks for helping

halcyon crypt
#

when the RPT is reporting an error in expression without a filename, is it safe to assume that it's originating from a spawn {} and/or FSM?

little eagle
#

no

#

it means that it's probably from a config file

halcyon crypt
#

hmm well in my case it did originate from a FSM

wispy cosmos
#

this looks promising, thanks for sharing!

#

That did the trick @tough abyss!! Thanks again!

rotund cypress
#

Is there any directory for default arma 3 sounds name?

halcyon crypt
#

is there a list of all displays (ids) available in A3?

rancid ruin
#

gotta dig through the config and pull your hair out afaik

meager granite
#

defineResincl.inc in ui_f.pbo

tough abyss
#

A question

#

Can you use INC in missions?

#

or will arma 3 complain?

#

myRscInc.inc ?

meager granite
#

#include "\A3\ui_f\hpp\defineResincl.inc"

#

Let me check if it works

#

Yes it works

meager granite
#

Anyone remember config location of maximum unit load?

#

The number is 1000, I'd like to know where it is defined though

#

CfgInventoryGlobalVariable >> maxSoldierLoad

#

And I instantly found it right after I asked the question

wispy cosmos
#

gg

opaque topaz
#

I'm having issues retrieving a variable in a location object using getVariable. I have created a location but can't use getVariable on the location object. Any ideas?

jade abyss
#

_Obj setVariable["VarName","Data",(if MP:) TRUE]; <- ?

opaque topaz
#

I'm not in MP environment though

#

I shouldn't even need to worry about MP right now as I'm in the editor. Also when in MP environment, the script will be be ran on the server so no need to broadcast the variable to clients.

#

Keep in mind though the effects of createLocation are local

#

I think I might have figured it out give me one sec

#

with locations and getvariable you can't do this _loc getVariable ["bool", false];

#

it has to be this syntax _loc getVariable "bool"

meager granite
#

yeah there is no <location> getVariable <array>

#

Also locations are local by definition

split coral
#

btw, does the active channel determine who sees the ping?

little eagle
#

@opaque topaz This is a known and stupid limitation. Work around is this:
[_location getVariable _varName] param [0, _default];

rotund cypress
#

Is there any list of current default ArmA 3 sounds?

little eagle
#

ingame confg viewer

gilded rover
#

Could anyone explain to me why my custom .RVMAT (s) for the default AAF uniform doesnt want to load and instead the uniform ends with only the base texture and no normal map as well as specular map??????

young current
#

where are you loading them from? paths right? error in rvmat?

chrome nebula
#

Currently getting this error in my modpack when I try to launch it. I have a feeling it's causing my server to loop. any idea?

"15:20:18 [XEH]: Usage of deprecated Extended Event Handler "fired". Use "firedBIS" instead. Path: @OZZYLIFE\bin\config.bin\Extended_Fired_EventHandlers\All."
Also, I can't find "bin" anywhere.

gilded rover
#

Loading from my mod , just chaged the normal map in the rvmat coding to the new normal map i made , but as far as i know paths are correct , and the game does not give me any error with the RVMAT so i dont know

#

that said my camouflage faces give a pop up error saying rvmats are errors yet they work

frozen obsidian
#

guys i want to check how snow storm script will look on my map is there a way to enable it from editor ?

little eagle
#

@chrome nebula Is OZZYLIFE your mod?

chrome nebula
#

No, it's from a Youtube video.

opaque topaz
#

@little eagle I had to look really closely at the wiki and figured out the limitation. Although, didn't think of your solution to get the same effect. Thx

chrome nebula
#

@little eagle no it's from a Youtube Video...

little eagle
#

?

chrome nebula
#

OZZYLIFE

little eagle
#

You're not the author?

chrome nebula
#

Nope

little eagle
#

Then don't worry about it

chrome nebula
#

What's up?

little eagle
#

about this:

Currently getting this error in my modpack when I try to launch it. I have a feeling it's causing my server to loop. any idea? 

"15:20:18 [XEH]: Usage of deprecated Extended Event Handler "fired". Use "firedBIS" instead. Path: @OZZYLIFE\bin\config.bin\Extended_Fired_EventHandlers\All."
Also, I can't find "bin" anywhere.
opaque topaz
#

What text editor and plugins do you guys use for editing anything Arma related?

#

I use atom with language-arma-atom plugin. I also use atom for web development

little eagle
opaque topaz
#

I've never used Sublime. I always hear about it so maybe I will give it a chance and finally give in to it.

little eagle
#

I usually just stick with the first thing that work for me. There is nothing special about ST as far as I can tell. It just works for me.

opaque topaz
#

Ok well maybe I will just stick with Atom because it works for me ๐Ÿ™‚

buoyant heath
#

If only atom could handle large RPTs

opaque topaz
#

Yeah I had that problem last night lol. RPT was 16K lines long and opened up in Atom and it crashed it lol

bitter magnet
#

I'd love to find good open source text editor, but there is (unfortunately) no substitute for EditPadPro.

buoyant heath
#

I keep notepad++ around for those RPTs

split coral
#

Poseidon. And notepad++ for opening +500,000 line config/script dumps.

#

It doesn't even flinch when you open those

earnest coral
#

Hey everyone, im looking for at file called "h.sqf", anyone knows how to locate this file

dusk sage
#

๐Ÿ˜ฎ

rotund cypress
#

thanks @little eagle

#

@opaque topaz Atom with ACEs' syntax highlighting, file-header, file-icons and some other little handy plugins

#

The file-icons plugin is really handy for seeing different icons for the different languages

opaque topaz
#

@buoyant heath yeah I'm thinking of just reinstalling notepad++ for the huge RPT files. It was amazing to me until I found Atom. Since then, Atom has been my go to for everything.

weary turret
#

got a question: I should be using remoteExec instead of using BIS function because it's way faster processing correct? example of use old way [[0],"btc_fnc_show_hint"] spawn BIS_fnc_MP;

weary turret
#

Thanks for answering Quiksilver

opaque topaz
#
['"string" remoteExec ["hint",player];',[],100] call BIS_fnc_codePerformance; //Result ~0.1ms
['["string","hint",player ] call BIS_fnc_MP;',[],100] call BIS_fnc_codePerformance; //Result ~0.6ms```
 - VariatoX https://community.bistudio.com/wiki/remoteExec
weary turret
#

so something like [] remoteExec["btc_fnc_showhint",0];

wary musk
#

Hello Guys. Will someone be able to assist me with a script for an auto save function in altis life?

cerulean whale
#

Just take the saving script and run it in a 10 minute loop?

#

while {true} do { sleep 600; [] call autoSaveScriptName; }; ??

tough abyss
#

So many times I see while {true} do {} it is evil and should be avoided

cerulean whale
#

I know, but if he wants something basic xD

#

Someone I know did it with a lightbar script and it destroyed my performance

#

xD

wary musk
#

will that cause my server to crash

cerulean whale
#

no

#

because of the sleep statement

#

while {true} do { _handle = [] call autoSaveFunctionName; waitUntil {scriptDone _handle; }; sleep 600; };

wary musk
#

cool cool tnx i will try it. prob is i know nothing of scripting. i am more the hardware type of person

cerulean whale
#

There is definitely better ways to do it but that will work just fine

wary musk
#

the easy way is fine for now till i get a better understanding of scripting

thick lintel
#

while {true} do { _handle = [] call autoSaveFunctionName; waitUntil {scriptDone _handle; }; sleep 600; }; That will never work as call does not return a scriptHandle.

cerulean whale
#

@thick lintel Explains why it works ๐Ÿ˜ƒ

tough abyss
#

only spawn'd and execvm'd functions

#

return a script handle

#

Beware this is the scheduled environment so the possibility of the function executing in a timely manner is dependent on the current scheduler load.

cerulean whale
#

Correction lol... I meant to put spawn. ๐Ÿ˜ƒ

tough abyss
#

Is it originated from scheduled or unscheduled?

cerulean whale
#

scheduled

tough abyss
#

Whats it not doing?

cerulean whale
#

It's not related to this anyway. I just had that system working in a script I used awhile ago

tough abyss
#

{true} is okay... but I still find it dirty and have to wash myself everytime I use it.

#

Got the entire script source?

meager granite
#

What if there is thread handle returned by autoSaveFunctionName? Kappa

cerulean whale
#

xD I remember when I first came into ArmA and saw everyone using {true} it kinda made no sense to me at the time ๐Ÿ˜›

tough abyss
#

I've replaced many while {true} do stuff with EVH's

cerulean whale
#

the other thing that killed me was constant loops without waitUntil statements in modside scripts.... that pissed me off many times

#

They can just trash the performance of their players because they can't script anything

tough abyss
#

Half the time I don't know why the engine doesn't have enough sense, to suspend if something isn't in sync with another...

thick lintel
#

@meager granite "What if there is thread handle returned by autoSaveFunctionName? " I think we both know that was not the point of the example ๐Ÿ˜‹

tough abyss
#

Instead waitUntil feels like I am writing another scheduler within a scheduler.

cerulean whale
#

๐Ÿ˜›

#

@tough abyss Yeah but it can be very useful in the context of siren scripts

tough abyss
#

I know some code takes faster or slower and waitUntil's ensure you don't end up with mismatched data.

#

Which is down right screwy in itself.

#

@tough abyssLogic

#

Maybe I should just write a scheduler script.

cerulean whale
#

^^ Pretty accurate description

tough abyss
#

Call it use the code inside a [] spawn { };

#

and using waitUntil {scriptDone _thisScript};

cerulean whale
#

๐Ÿ˜ƒ Anyway, I need to head off and have a shower. ๐Ÿ˜›

tough abyss
#

It would work wouldn't it @meager granite ?

#
params [["_code",{}],["_delayTime",0]];
    _localHandle = [_delayTime] spawn  {
    _code
    sleep _delaytime;
};
waitUntil {scriptDone _localHandle}; 
#

Then I've only got a temporary scheduled piece of code

#

that when finished will close.

#

and it can be called ๐Ÿ˜„

meager granite
#

Did you mean spawn _code instead?

#

What's the point of this anyway?

#

It wouldn't work, no

tough abyss
#

Eh I'll fingure it out.

meager granite
#
call _code;
sleep _delaytime;
#
  • params before all that
tough abyss
#

And spawn it?

meager granite
#

Why do you even need spawn here?

#

why create another thread if rest of original one does nothing but waits for new one to end

tough abyss
#

Not sure I am for-ever typing {waitUntil} crap

#

I just thought wrapping into a function might make it less painful

meager granite
#

What's your goal again? You need to execute something and wait some time?

#

Why even wrap it, its like 2 lines of script

#

Unless you need to wait until your wrapper is done somewhere else

tough abyss
#

The idea is to be able to suspend code universally.

#

It's an idea.

#

It might look useless but hey? Who cares?

meager granite
#

Code above makes no sense, I have no idea what you're trying to achieve

tough abyss
#

Some of the stupidest of ideas can sometimes be useful.

meager granite
#

If you can give me somewhat close to real world example I can help you

#
_handle = 0 spawn {
    call myFunction;
    sleep 5;
};
waitUntil {scriptDone _handle;};
// Something else here

is identical functionality-wise to

_handle = 0 spawn myFunction;
waitUntil {scriptDone _handle;};
sleep 5;
// Something else here

and

call myFunction;
sleep 5;
// Something else here
tough abyss
#

I want to call the function and put the sleep inside with the waitUntil

#

So if I pass say 0 as the delay time

#

It will just evaluate the waitUntil only

meager granite
#

Why not just call your function and then do sleep, it will be the same thing

tough abyss
#

By the way @meager granite Do you even maintain KoTH anymore?

meager granite
#

Yes

tough abyss
#

You can't use call MyFunction then sleep after it

#

If it originates from unscheduled

#

?

meager granite
#

Your waitUntil assumes it is scheduled

tough abyss
#

I avoid the scheduled environment. For example this code.

#

params [
    ["_object",objNull],
    ["_state",false]
];
missionNameSpace setVariable ["towerDestroyed",false,true];
diag_log format ["_object: %1",_object];
_HandlerID = _object addEventHandler ["killed",{ 
    diag_log "EH Fired";
    missionNameSpace setVariable ["towerDestroyed",true,true];
    diag_log format ["towerDestroyed: %1",towerDestroyed];
    _handle = [] spawn {
            //Mission needs to end when the groups count threshold is less than or equal to the east countside
            waitUntil {towerDestroyed && (east countSide (enemiesInfs)) <= PARAMS_EnemyGroupLeftThreshold};                
            private _MarkersClean = AOMarker_IDs call MM_fnc_deleteMissionMarkers;
            enemiesInfs call QS_fnc_AOdelete;
            enemiesVehs call QS_fnc_AOdelete;
            "Main Mission complete, give us 60 seconds and we will start the next" remoteExec ["hint",0,false];
            };

}];        
#

EH driven mission flow.

#

I didn't need the entire function to have all spawn'

#

Used it only where needed.

#

Keeps the speed of unscheduled and only switching to scheduled if necessary.

#

This is crude rudimentary code.

#

It's been chopped and changed a lot.

meager granite
#

You can't waitUntil in unscheduled script environment

tough abyss
#

if it becomes spawn'd it does.

#

The code works.

meager granite
#

spawn creates separate scheduled thread

tough abyss
#

yes

#

Trust me that code above

#

Is atleast 10x faster than the old method.

#

EH is removed after used

#

New one created for next objective.

#

Got rid of triggers too

#

With that method.

meager granite
#

There is no difference between creating a thread from scheduled or non-scheduled script environment

#

My point was that your original code piece already in scheduled, its pointless to create another thread and have original thread wait like in your example

tough abyss
#

I thought when a thread was created "VM thread" it switches an unscheduled piece of code

#

to scheduled

#

as a result able to sleep or use waitUntil inside it?

#

@meager granite

#

Or is that not the case?

#

And this is the most detailed piece of information I've found on the scheduler

#

So in thoery creating a function called

#

with a waitUntil should halt at that piece of code correct?

#

if it contains a [] spawn {} ?

meager granite
#

Any spawn or execVM creates scheduled thread, no matter where you call it

thin pine
#

^ no exceptions to that rule afaik

tough abyss
#

Yeah I know that, but I avoid going to scheduled unless I need to.

thick lintel
#

I thought when a thread was created "VM thread" it switches an unscheduled piece of code to scheduled
Yes it is the case but I think @meager granite is talking about this

_localHandle = [_delayTime] spawn  { //This is unnecessary thread. Why spawn when vv
    _code
    sleep _delaytime;
};
waitUntil {scriptDone _localHandle}; //<< Must already be scheduled scope to be able to do this```

Whats the point of spawning a thread when you are already in scheduled as you have waitUntil so you must be.
Might aswell be
```params [["_code",{}],["_delayTime",0]];
call _code
sleep _delayTime```

if you want to be extra vigilant about the the scope then
```params [["_code",{}],["_delayTime",0]];
if !( canSuspend ) exitWith {
    _nul = _this spawn ( missionNamespace getVariable _fnc_scriptName ) //<<Only works if defined by functions library else replace with function name.
};
call _code
sleep _delayTime```
tough abyss
#

Yeah most of my code is functions library

#

It's apart of a framework.

#

I need to create a tiny GUI on the ledt hand side that displays server FPS and client FPS

#

left*

#

Didn't notice stutters so far.

#

I can generalise that objective code even more.

#

And make it accept any objective variable state.

rigid plover
#

Anyone know how to use UnitCapture / Play?

tough abyss
#
params [
    ["_object",objNull],
    ["_variableName",""],
    ["_state",false],
    ["_isPublic",false]
];
missionNameSpace setVariable [format ["%1",_variableName],_state,_isPublic];
diag_log format ["_object: %1",_object];
_HandlerID = _object addEventHandler ["killed",{ 
    diag_log "EH Fired";
    missionNameSpace setVariable [format ["%1",_variableName],_state,_isPublic];
    _handle = [] spawn {
            "Main Mission complete, give us 60 seconds and we will start the next" remoteExec ["hint",0,false];
            };

}];        
#

Super-generalised function

#

Now I can be blowing objectives up to my hearts content.

thin pine
#

Friend of mine did this too - why format ["%1",_variableName] if _variableName is already a string? If you do it for security purposes, you can make sure _variableName is of type string in params

#

I guess it depends on how you expect to be calling this function, aye?

tough abyss
#

It's for a community

#

That does Ops

#

Not a life server.

#

Even so this code executed SS anyway.

#

I use format over str

#

because str is slower @thin pine

#

I can plugin any kind of blow up objective into that code above. now.

#

๐Ÿ˜„

thick lintel
#

Except all the variables are out of scope (undefined) within the EH

tough abyss
#

Noticed...

#

:/

halcyon crypt
#

@tough abyss I think you misunderstood @thin pine, he meant that _variableName is supposedly already of type string so the format is redundant

thin pine
#

that is what I meant yeah but I'm now under the assumption he's feeding non-stringed variable names to his function so I get it - although..

#

you know what I'm done trying to think about this xD whatever works for him

halcyon crypt
#

lol ๐Ÿ˜›

tough abyss
#

๐Ÿคฆ

#

Thanks guys.

#

A local var declared at the beginning of a script

#

and the local var used inside of an EH?

#

The scope of the local variables value inside of the EH will not carry into the EH correct? so I'd have to make a TempGlobal variable

thick lintel
#

Correct

#

Or format the variables into the EH

tough abyss
#

How would I format them into the EH?

#

Put Params inside the EH?

thick lintel
#
    ["_object",objNull],
    ["_variableName","", [""] ],
    ["_state",false],
    ["_isPublic",false]
];

missionNamespace setVariable [ _variableName, _state, _isPublic ];

diag_log format [ "_object: %1", _object ];

_HandlerID = _object addEventHandler [ "killed", format[ "
    diag_log 'EH Fired';
    missionNamespace setVariable [ %1, %2, %3 ];
    'Main Mission complete, give us 60 seconds and we will start the next' remoteExec ['hint',0,false];
", str _variableName, !_state, _public ]];```
tough abyss
#

Oh...

#

That syntax.

tough abyss
#

@thick lintel Do you know where the soldier FSM's are located?

thick lintel
#

What the danger and formation FSMs? \a3\characters_f\scripts

tough abyss
#

Wow....

#

This is what controls the AI???

#

Their brains?

thick lintel
#

No, most of it is engine side I believe and their just external resources.

tough abyss
#

Why is the grouping not handled by the engine???

#

This is shocking...

#

and not shocking at the same time...

#

All the AI grouping potatoism is being handled by SQF / FSM scripts.....

#

๐Ÿ˜ข

#

I have seen the darkside now I cannot unsee it.

#

has died a little inside now

thick lintel
#

I think only civilian AI use external behavior fsm Their config value is definately set for this. All soldier units are set to "FORMATION" rather than an fsm, not sure what this denotes unless its a flag for the engine to use an internal system.

#

Ah its probably a link to CfgFSMs class

rotund cypress
#

@tough abyss Is there really any good EVH's for an auto save script really? I mean, there is eachFrame and that is basically the same.

thick lintel
#

Depends what your saving, players gear - InventoryClosed, Take, Put, SEH arsenalClosed for example.

rotund cypress
#

Oh yeah course

#

But I don't really see a problem in an while loop with a 10 minute sleep timer

winged thistle
#

^

#

Was just gonna say the same thing

thick lintel
#

No not particularly a problem, just keep in mind when building a mission frame work of how many of these little scheduled loops you have started and not to fill up the scheduler with lots of them I suppose.

winged thistle
#

As long as you don't have 100 loops running simultaneously throughout the mission, you should be fine. Explicitly defining the behavior you want is a lot better than relying on an event handler as you leave less room for error or accidental execution.

rotund cypress
#

^^

#

I mean

#

Especially for saving

#

You want it to ALWAYS save

winged thistle
#

Pretty much. Better to be explicit there.

#

Side question: does anyone still code Arma missions anymore?

rotund cypress
#

Yes

#

Why wouldnt people be?

winged thistle
#

I was 99% joking.

rotund cypress
#

Well I get a lot of people saying that

#

And that ArmA is dead

winged thistle
#

Nah

#

A game is only as dead as its community

rotund cypress
#

Which is complete bullshit

winged thistle
#

There's clearly an active community here.

rotund cypress
#

Yes

#

Exactly

thick lintel
#

For gear it depends where your saving. Saving to profileNamespace can be a little rough. I personnaly always find it better to handle it only when needed e,g leaving inventory screen or closing an arsenal etc, rather than have it happen at any time.

winged thistle
#

My discord won't stfu ๐Ÿ˜›

rotund cypress
#

And all those other 1000+ communities

#

I was more thinking of DB saving @left helm

winged thistle
#

My mission has one more item in this current sprint. After that, we're moving to saving loadouts, scores, etc. to database ๐Ÿ˜„

thick lintel
#

What like mission objects and positional stuff?

winged thistle
#

While loops are just fine as long as they are used appropriately and sparingly.

rotund cypress
#

Exactly

thick lintel
#

I agree

rotund cypress
#

I mean

#

In the first place

#

Theyre there for a reason

#

Then of course if you're a complete moron while using them

winged thistle
#

My module wouldn't work without one

rotund cypress
#

Like not sleeping or somth

winged thistle
#

I'd hate to calculate differences in serverTime just to get a heartbeat

rotund cypress
#

Lol ๐Ÿ˜„

winged thistle
#

I'm sure at one point someone put a while loop in a while loop with a remote exec to a while loop.

#

From then on, while loops were shunned.

rotund cypress
#

๐Ÿคฃ

#

per-frame handlers?

#

eachFrame?

#

so would _evh = addMissionEventHandler ["EachFrame",{hint "sup"; sleep 3; };]; work?

#

But then

#

Im rofl here

thick lintel
#

Armaology

winged thistle
#

lol

#

"can't suspend in eachframe expression"

rotund cypress
#

so a while {true} do {sleep 3; hint "ye";}; is worse than an eachframe?

winged thistle
#

Why? Because they've never heard of a flag?

rotund cypress
#

Then eachFrame would run all the time

#

Which will make lag even worse ๐Ÿคฃ

#

So then you would have to use while loop anyways if you wanna suspend

winged thistle
#

just have a flag surrounding the loop contents

#

if (flagIsTrue) {...}

#

won't execute if your global flag is false

#

skip contents until you flag it to turn back on

rotund cypress
#

You mean variable?

winged thistle
#

It's a flag

#

If someone isn't waving it, it's not ok to execute

#

Wave that flag, then it's ok

#

๐Ÿ˜›

rotund cypress
#

Oh lol ๐Ÿ˜„

winged thistle
#

So you aren't really suspending the loop so much as the execution of the contents

#

Yeah

rotund cypress
#

So ๐Ÿคฃ

#

Dank

#

Memes

winged thistle
#

You could add an event handler that listens for that variable to change

#

reduce overhead

#

I think I really only use onEachFrame for my HUD shit

rotund cypress
#

Cant you just use Draw3d eventhandler?

winged thistle
#

Exactly. Outside of that, there's a better way.

#

I'd say, "cuz noobs" but that's probably just me being ignorant.

#

I didn't even play Arma a couple years ago. Picked it up for a project, learned it by trying to redo someone else's mission for Arma 2 for a guy. Flopped. Moved to Arma 3. Made another small mission. Flopped. And now Benargee and I are working on our big mission.

#

Hopefully third time's the charm ๐Ÿ˜›

#

So I'm sure I'm still an Arma noob, but I've seen so much garbage coding in Arma missions.

#

Lots of copy/paste

#

I know there are great programmers in the community, and I appreciate all of them, even if they are @queen cargo

#

๐Ÿ˜›

rancid ruin
#

wasn't he banned

winged thistle
#

Erm...

#

Forever?

#

He appears to be here.

#

He's helped me a couple of times in the past, as well as a few others.

rancid ruin
#

well shiver me timbers

#

i'd only ever seen him in the trolls group

winged thistle
#

There's a difference between a troll and an asshole ๐Ÿ˜›

#

Because it just does it vs checking to see if it should do it

#

Oh man, wtf was I doing earlier?

#

Wait no, I was right.

#

If you use the flag in the evaluation itself, you can break the loop after the variable changes to false for the first time

#

You need the loop the keep checking it if you're trying to evaluate a value on the fly throughout the missiono

queen cargo
#

@rancid ruin no i was not

winged thistle
#

๐Ÿ˜›

queen cargo
#

you mean "a wild X39 appears" @tough abyss ๐Ÿ˜‹

winged thistle
#

So good

rancid ruin
#

oh, i thought dwarden said he banned you for a bit

little eagle
#

Quiksilver you're full of shit

tame portal
#

@little eagle Whats going on what did I miss

rotund cypress
#

If i want to loop a sound, but not stop the script from continuing how can I do that?

winged thistle
#

There are event handlers for sounds

rotund cypress
#

What kind?

winged thistle
#

You'd have to look. I don't recall off the top of my head, I just know they exist.

rotund cypress
#

I dont see any eventhandler for that

#

But if I put a while true with a sleep timer of 3 seconds

#

before an for loop

#

It stops the script?

winged thistle
#

Hold on

#

Let me get into solar orbit and I'll come help you

rotund cypress
#

Thanks ๐Ÿ˜„

winged thistle
#

Alright, orbit achieved

#

What exactly are you trying to do?

rotund cypress
#

right now I have a for loop

#

In the script

#

Which has a sleep of 0.27

#

When i add a sound

#

Its all f-ed up

#

SO I want to add a while loop

#

with a 3 second sleep

#

But it will just hold on on that while loop and not do the for if im not mistaken?

winged thistle
#

Just spawn the sound instead of playing it directly?

#

Will allow the loop to continue and still plays your sound

#

Yeah?

rotund cypress
#

This actually is already doing [ _curTarget, "alarmcar" ] remoteExec [ "FROG_fnc_playSound", 0 ];

torn jungle
#

Im looking to make an object move from one place to another and then back and then again. constantly. i want to use it as obstacles that would push players off the track. in a race. What command would i use for this?

winged thistle
#

Oh man, I was afk for a bit there

#

@rotund cypress is that what you wanted it to do?

rotund cypress
#

I dont see what you mean

winged thistle
#

@torn jungle you'd want to make a loop to move that object's position

#

So, you have a for loop, right?

rotund cypress
#

Yes

winged thistle
#

K, so

for {{_i=0}, {_i<10}, {_i=_i+1}} do {
    if (flagIsTrue) then {
        _curTarget spawn { params[_curTarget]; [ _curTarget, "alarmcar" ] remoteExec [ "FROG_fnc_playSound", 0 ]; };
    };
};
meager granite
#

@torn jungle Pushing will be a biggest issue here because you'll have to manually move players through script

winged thistle
#

Something like that, I think

#

So your loop iterates

#

then if the flag is true, also spawns a function that plays the sound

#

You can alter the spawn section to include a while loop.

#

Not recommended, but you can do it

#

@meager granite you don't like redrawing collision each frame?

#

๐Ÿ˜›

rotund cypress
#

Ah ok thanks

dusk sage
#

That loop is going to run through pretty quick

#

Is that intended?

winged thistle
#

I'm demoing syntax

#

Not for use in production

dusk sage
#

Also, that syntax of for is not preferable to for "_i" from 0 to 10 do {

winged thistle
#

I literally copy pasted from the wiki because I was lazy

dusk sage
#

๐Ÿ˜‰

winged thistle
#

So go fix the wiki ๐Ÿ˜›

dusk sage
#

Wiki states it fine

winged thistle
#

I was just trying to show how to use a flag in a loop for selective execution

#

flag, aka boolean

dusk sage
#

Don't comment on the perf, sigh

winged thistle
#

Yeah, it was brought up earlier that checking a condition for a while loop is slower than just iterating through a for loop

#

Which makes sense when you think about it

dusk sage
#

Usually in relation to an infinite loop

winged thistle
#

I love getting drunk and coming on here to pretend I know how to code with you guys ๐Ÿ˜„

wispy cosmos
#

It's annoying to see people who don't know what they're talking about, push false information on to others like it's fact.

#

I just read all that PFEH, while loops, etc @tough abyss

#

It all comes down to what you need to do. Essentially one's best judgement.

#

There's nothing wrong with using a while loop. It's just a control structure. It's going to give you the results the fastest (since it executes as fast as your CPU allows, and isn't tied to your framerate IIRC).

#

Sometimes you may want that, sometimes you won't.

#

It's also a matter of programming style.

#

There are too many factors for one to state as fact that one way is better than the other.

#
{
    while {true} do
    {
        waitUntil { count (call Tactics_Core_GetSWAT) > 0 &&  count (call Tactics_Core_GetTerrorists) > 0 };
        call Tactics_Server_Init;
        while {!(call Tactics_Core_IsGameOver)} do
        {
            call Tactics_Server_UpdateTurn;
            for[{Tactics_Core_CurrentTurnTime = Tactics_Core_TurnDuration}, {Tactics_Core_CurrentTurnTime >= 0}, {Tactics_Core_CurrentTurnTime = Tactics_Core_CurrentTurnTime - 1}] do
            {
                publicVariable "Tactics_Core_CurrentTurnTime";
                uiSleep 1;
            };
        };
        Tactics_Core_IsServerReady = false;
        publicVariable "Tactics_Core_IsServerReady";
        sleep Tactics_Core_EndRoundCooldownDuration;
    };
};```
#

Above is a game loop for a mission I'm working on.

#

It's just spawned in a schedule environment.

#

No big deal.

#

It's a small mission and hardly a hit on performance in the big picture.

#

There comes a point where you as a programmer have to strike a balance between practice and practicality.

wispy patio
#

Anyone here have a clue as to how I could spawn in the RHS paradrop waypoint?

dusk sage
#

@wispy cosmos You just said you don't like people pushing false information, then made a statement as if it were a fact

#

There's nothing wrong with using a while loop. It's just a control structure. It's going to give you the results the fastest (since it executes as fast as your CPU allows, and isn't tied to your framerate IIRC).

carmine galleon
#

Hey guys

#

Using RscXListBox, when trying to get curent selection with lbCurSel (1210) it returns -1, any idea ?

#

Nervermind, fixed

wispy cosmos
#

@dusk sage Please correct me if I'm wrong then.

#

@dusk sage Do note the "IIRC"

#

It is in fact a control structure though.

#

IIRC it executes independent of framerate

#

I guess depending on circumstances of course.

#

Just because it's a while loop doesn't mean it's going to magically kill performance....

#

In attempt to correct what I said, it's going to alter the flow of execution in whatever environment it's running in.

#

If you have a while loop in a spawn, it's going to change the flow of execution in that thread.

dusk sage
#

You said It's going to give you the results the fastest, then your IIRC was in relation to the reasoning, at least it seemed to be

wispy cosmos
#

Yea, that's not exactly accurate.

#

My apologies.

dusk sage
#

Just seemed like a contradiction

thick lintel
#

@wispy patio Anyone here have a clue as to how I could spawn in the RHS paradrop waypoint? Dont know because I have not looked at it but im presumming it is a scripted WP in which case you would need to spawn a waypoint as normal, set its type as scripted and then use setWaypointScript to point to the script. You will need to look in the configViewer at the RHS waypoint definition see what it says it is.

dusk sage
#

But, as the wiki will tell you, for loops are much faster than while loops

wispy cosmos
#

If you have a bunch of "spawns" cluttering up the scheduled environment, the rate of execution in those spawns are going to degrade.

#

Correct?

#

How is a for loop faster than a while loop though?

#

The cost of a for loop is greater than a while loop in theory.

#

A while loop checks a condition to continue to the next iteration

#

a for loop manages an LCV, an iteration condition, and the iteration

#

but of course, you can manage that yourself in a while loop.

#

It's all about cost.

#

And the complexity of your algorithms.

#

@dusk sage

dusk sage
#

but of course, you can manage that yourself in a while loop.
You could, but it wouldn't be internal

#

You need to consider the fact the for loop is entirely internal

#

Obviously that isn't strictly true though

#

But the idea is there

#

(I hope)

wispy cosmos
#

Ah

#

That makes sense

#

Thanks @dusk sage

halcyon crypt
#

wouldn't worry about it too much, "readability" before (potential) optimization IMO

#

while is for doing stuff while something is true and for is for iterating

#

no need to make things less "readable" for a 0.00001ms (obviously don't know the number.. ^^) improvement

#

or intuitive rather

wispy cosmos
#

^