#arma3_scripting

1 messages · Page 392 of 1

still forum
#

hand written stuff is completly useless. Because if you fix the error accidentally while typing code no one can tell you what the problem is

cosmic kettle
#

@limpid pewter go to %localappdata%/Arma 3/ and find the latest .rpt file.

limpid pewter
#

ok thanks

lone glade
#

^that, there's even a plugin for sublime to open the latest one

limpid pewter
#

Alright, will use that in future to paste code/errors

cosmic kettle
#

When developing, turning on the 'show script errors' in the arma 3 launcher parameters is a good way to spot them.

#

Coding without a way to verify what you're doing is as good as driving your way home blindfolded.

limpid pewter
#

@still forum : "_objPos is wrong. The error is not inside the while loop.
Your _objSpwnPos is wrong(edited)" Yes, so like i said the first time it is fine, it recieves the parsed variable as position array, but the second time the loop runs it replaces the postion stored in _objPos with my player object ID.

#

@cosmic kettle Yeah. Should have looked at this before hand really

still forum
#

the next time your code is remoteExec'ed

#

btw params can also type check.. You should maybe use that

limpid pewter
#

No, the next time the while loop, looops

#

oooh ok.

#

Sounds handy

cosmic kettle
#

Am I the only one who actually avoids while wherever it is possible btw?

still forum
#

I don't write scheduled stuff.. so.. no while at all

cosmic kettle
#

ok happy to know. lol

still forum
#

Though I only wrote Intercept stuff the last few months.. So.. I don't really do SQF currently 😄

cosmic kettle
#

Just scanned to be sure, 1 while in +/- 3000 files. Yep that's what I thought lol

limpid pewter
#

Yeah, i think i will just have to fiddle arround with it a bit more myself. It's weird tho because i have an almost identical function that runs in almost the same way and it works fine.

params ["_objPos","_Dir"];

mld_fnc_healthMain = {

if ((damage (_this select 0)) > 0.005) then {
_health = damage _unit -0.005;
_unit setDamage _health;
};

};

_count = count medKitArray;
if (_count > 14) then {
deleteVehicle (medKitArray select 0);
 medKitArray deleteAt 0;
};
_obj = "Land_MetalCase_01_small_F" createVehicle [0,0,0];
_obj setPosASL _objPos;
_obj setDir (_Dir - 90);
medKitArray pushBack _obj;


while {!isNull _obj}  do {
    _units = nearestObjects [_obj,["man"],3];

    {

        [_x] call mld_fnc_healthMain;
    } forEach _units;
    sleep 0.5;
};
still forum
#

I already told you your problem is not in that function.

cosmic kettle
#

```sqf
not
```
sqf
Just saying

limpid pewter
#

yeah ik, didn't want to work

cosmic kettle
#

oh ok

limpid pewter
#

ok dedmen, idk will have to check. Both of those functions are executed in the exact same ways ,with the exact same variables, which is the weirdest part

cosmic kettle
#
private _obj;
still forum
#

@cosmic kettle no

cosmic kettle
#

params def private?

still forum
#

yes. but still no

cosmic kettle
#

yeah just noticed _obj not in params

still forum
#

The script doesn't have any parent scopes

#

so no reason to privatize variables

cosmic kettle
#

Oh, wish you'd said that like 1 week ealier

#

lol

still forum
#

besides good style

limpid pewter
#

Sorry to bother you again with this problem, but can you quickly see if there are any errors with this CfgRemoteExec ? ```sqf
class CfgRemoteExec
{
class Functions
{
mode = 1;
// Ability to send jip messages: 0-disabled, 1-enabled (default)
jip = 1;
/your functions here/
class healthMain
{
allowedTargets=0; // can target anyone (default)
jip = 0; // sending jip messages is disabled for this function (overrides settings in the Functions class)
};
class ammoMain
{
allowedTargets=0; // can target anyone (default)
jip = 0; // sending jip messages is disabled for this function (overrides settings in the Functions class)
};
};
};

#

I ask mainly because there is obviously an issue with how the variables are being parsed into the functions, and i just want to check all things that could affect this

lone glade
#

mode 1 is broken, i'm fairly sure BIS never fixed it

#

it won't affect what you mentioned but will completely fuck networking

limpid pewter
#

? "completely fuck networking" a bit extreme

#

how so?

lone glade
#

it increases network usage for remoteExec dramatically

#

they miiight have fixed it, or not

limpid pewter
#

ah ok

lone glade
#

the issue have persisted from 1.52 to 1.64 last I checked

limpid pewter
#

i shall research on this

robust hollow
#

looking at ur snippet from earlier u use mld_fnc_healthMain. so i believe u would want to do class mld_fnc_healthMain in the remoteexec cfg

limpid pewter
#

oh fuck. hahaha holy shit, how did i not spot this haha

#

Thanks connor. I have a function as a variable within the function as a file, with the SAME name hahahaha

#

i need to descramble my brain

lone glade
#

stop using inline functions saved in global vars for one

limpid pewter
#

Ye, more of an experiment in this case

manic sigil
#

{ if ((side _x) == West) then {_x setcaptive true; _x playmove "AmovPercMstpSsurWnonDnon" ; _x disableAI "ANIM";}; } forEach allUnits;

If run, this should make all blufor units put their hands on their heads, stop moving, and stop being shot at, correct?

lone glade
#

if it's local to the unit then yes

manic sigil
#

._. So for instance, admin console on a server?

#

Locality is still black magic to me

tough abyss
#

That reminds me of "coming to america"smiles

lone glade
#

locality is fairly simple once you "get it"

#

units and objects have an owner, some commands require that they are executed on the owner's machine

astral tendon
#

How does i remove a unit of the count in a array?

lone glade
#

wat

tough abyss
#

Their owenr is the machine that spawned them unless otherwise set?

lone glade
#

no

#

it's a bit more complicated than that

tough abyss
#

ah ok, i was just wildly guessing

astral tendon
#

Like
selectRandom [playersgroup] setdamage 1
in playersgroup there is 3 players and the arays are [Player_1, Player_2, Player_3] i want to exclude the Player_1 from that count

lone glade
#

is it a specific player ?

#

why exclude the first one?

astral tendon
#

yes, but can be any other player

tough abyss
#

playersgroup=if not player_2, player_3 maybe?

lone glade
#

nah, you'd use array select range and then use selectrandom

#

but i'm not sure what he want to do so it may not fit what he needs

astral tendon
#

i dont wanna the selectRandom to chose player_1

lone glade
#

yes, but the issue is that player_1 could be any player from my point of view, because I don't know how you get that array or why you want to exclude player 1

manic sigil
#

"A bit more complicated than that" is an understatement, but thanks :p ill play around with the script in the environment i need it in, see how it goes.

tough abyss
#

This is the goal i think: When there are, lets say, 10 players, all but #1 (or #5) shall be exluded from randomly being hurt

#

uhm, or better said, all but #5 shall be excluded from being chosen to get damage

lone glade
#

think of it this way, there can only be one owner of an object / unit at a time, players are always local, light sources are always local

#

the tricky part is finding the machine where the object / unit is local

#

and making sure the commands you use actually take global arguments or if you need to execute it where the object / unit is local

astral tendon
#

that was only a example, it could be anything

tough abyss
#

@astral tendon would it not be easier to select that exluded player before adding him to the array of randomly chosen hurtable players?

#

So that player doesnt even get added in the first place

lone glade
#

roque, is it always the first player of that array, no matter what?

astral tendon
#

i just wanna know if i can remove some object from the aray

tough abyss
#

Coudlnt you make him some sort of non-player for just that moment?

#

ah ok

astral tendon
#

that was just a example

lone glade
#

well yes you can

#

but you need to know which one

astral tendon
#

urg

lone glade
#

how the hell do you want to remove something you can't reference?

astral tendon
#

selectRandom [BuchOfAIGroup] setdamage 1
the aray: [AI_1, AI_2, AI_3, AI_4]

tough abyss
#

hm, insert if chosen_player=player_x then skip set-damage-part before setDamage=1?

astral tendon
#

need to remove the AI_2 from that conting so it does not get chosen by the selectRandom

tough abyss
#

You know, tear apart the chosing and the setdamage and insert a selectorthingy

lone glade
#

I get that, but why AI_2 specifically ?

#

and do you have it saved in a var so you can compare it?

astral tendon
#

because i like him.

lone glade
#

because if it's just that you can use:
array apply {_x != _myVarWhereAI_2IsStored}

tough abyss
#

that took long grins

astral tendon
#

so it would be
selectRandom [BuchOfAIGroup] apply {_x != AI_2} setdamage 1?

lone glade
#

no, apply returns an array

#

well, yes it would be but you're missing parenthesis

#

i'm fairly sure selectrandom would execute before apply here, plus it's difficult to read

#

selectRandom ([BuchOfAIGroup] apply {_x != AI_2}) setdamage 1;

astral tendon
#

well, i got it

#

```selectRandom (units testgroup - [AI_2]) setdamage 1;````

cosmic kettle
#

no missing )'s lol

tough abyss
#

No matter what, where or when, there are never enough smiles!

#

It is kinda re-assuring that in programming at least, every frown "(" HAS to be followed by a smile ")" If only RL would be that easy and neat.

cosmic kettle
#

The best example of that would be yin/yang but I'm not getting into this.

tough abyss
#

Agreed, let's not.

#

Just this last one: RL should have a debug log!

cosmic kettle
#

it has, DNA.

tough abyss
#

Have you watched youtube lately? grins Clearly, that system does not work anymore

cosmic kettle
tough abyss
#

Agreed and... none taken

astral tendon
#

with that i can do stuff like this
```alive ((player nearEntities ["Man", 10]) - [player] select 0)````

limpid pewter
#

Im using magazinesDetail atm to retrieve the ID for the magazines that are not fullly loaded. I then want to remove these magazines and replace them with fully loaded ones (a basic rearm script). From what i have seen on the Wiki, the removeMagazine commands, only use the classname. What is the point of having a magazine ID if you cannot refer to it when trying to remove that specific magazine. Am i missing something, or is this something everyone has to work around?

tough abyss
#

I think there is a mod that re-organizes magazines, uhm...

limpid pewter
#

nah, i wanted to do it through scripting, without mods or config mods

tough abyss
#

Yes, i just thought, looking at it might help you, not using it

limpid pewter
#

yeah all g, thanks anyway

tough abyss
#

oh hey, its "qs mag repack v1.0.0" made by quiksilver who is actually in here now

#

I bet he or she can help

limpid pewter
#

ahh ok, will check it out

tough abyss
#

@tough abyss sorry, your mod.cpp doesn't specifiy a version. i then always apply v1.00

#

Oh, it was not criticism, more like informatism :-)

#

@limpid pewter seems to try something like that mod does and i thought, well, i marry you two grins

limpid pewter
#

haha, yeah im just having trouble making a re-arm script

#

Yeh ok, so that's an example where the magID is used. But my question was; Is there a way to use that magID to remove a specific magazine from a unit's inventory?

tough abyss
#

If i drop a rifle, all matching magazines are dropped as well, maybe looking into that mechanic would help?

#

But only those in the visible inventory (not in my vest, if i look at my carrier rig) are dropped, i think,. so the game must make see some difference

limpid pewter
#

yeah maybe. As usual with arma, doesn't seem to be an easy option haha, will take a while of just testing different things i think

tough abyss
#

If you need a guineapig, just holler

#

but... no brainporbing!

#

nor probing

#

Yup, QS is oaky with BP ;oP

limpid pewter
#

a guineapig for testing missions?

#

Well not to be offensive to differently specied, but guinea pigs would be useless for this application 😄

tough abyss
#

uhm, no opposing thumbs?

limpid pewter
#

Sure, i suppose it would be interesting to use setAnimSpeedCoef on a guinea pig in arma tho haha

tough abyss
#

Oh wait, i got it now... guinea pigs are smarter than the arma3 AI, so they would just run off and play chess instead

limpid pewter
#

Sure....

#

Thanks for the help

tough abyss
#

Gladly

tough abyss
#

Any idea why the action doesn't work? ```SQF
{
_x addEventHandler ["Killed", {
params ["_unit"];

    {
        _action = [
            name _unit,
            "Take " + getText (configFile >> "CfgWeapons" >> _x >> "displayName"),
            "",
            {player action ["TakeWeapon", _unit, _x]}, // Issue here, picking up weapon doesn't work
            {!alive _unit}
        ] call ace_interact_menu_fnc_createAction;

        [_unit, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
    } forEach weapons _unit;
}];

} forEach allUnits + allDead;

#

I'm assuming this happens because the weapons no longer belong to the unit after it dies? But are WeaponHolderSimulated or whatever?

jade abyss
#

The Unit is just dead

#

so it can't execute actions ¯_(ツ)_/¯

tough abyss
#

Hmm?

#

The action is added to the unit, and is preformed by players.

jade abyss
#

This command has no effect when a dead unit is used as input.

safe forum
#

Hi all. What differences between draw3D and OnEachFrame?

tough abyss
#

@jade abyss - ah, ok.

jade abyss
#

draw3D is executed after all Calcs

safe forum
#

Thanks

jade abyss
#

So if you want to show stuff -> draw3D

tough abyss
#

So I need some fuckery to work around that limitation.

jade abyss
#
  • @tough abyss iirc, the Dead Unit drops the weapon
tough abyss
#

Yeah, it becomes a WeaponHolderSimulated .

jade abyss
#

(at least the EH was triggered for it)

#

Yep. Try to find that with nearestObjects or so. I think Sa-Matra had the same fkery

tough abyss
#

Something like this? ```SQF
player action ["TakeWeapon", (nearestObject [player, "WeaponHolderSimulated"]), typeOf _x]

jade abyss
#

Test it out. It's too long ago that i played around with that stuff ¯_(ツ)_/¯

tough abyss
#

Nope, doesn't work 😕

jade abyss
#

add a *put EH, then check it there

tough abyss
#

There might something more to this than that... a statement of {hint "test"} doesn't even work.

jade abyss
#

No clue what you are talking about

#

(btw: it could take a few frames, until the WeaponHolder can be found)

tough abyss
#
{
    _x addEventHandler ["Killed", {
        params ["_unit"];

        {
            _action = [
                name _unit,
                "Take " + getText (configFile >> "CfgWeapons" >> _x >> "displayName"),
                "",
                {hint "test"}, // Statement
                {!alive _unit}
            ] call ace_interact_menu_fnc_createAction;

            [_unit, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
        } forEach weapons _unit;
    }];
} forEach allUnits + allDead;
jade abyss
#

Statement must be True/False, or?
nvm, just reading ace page

tough abyss
#

Looking back at it, I probably should've asked this on the ACE Slack, it's their function after all.

#

rip

#

Fuck did you do to get banned?

jade abyss
#

Just being himself? 😂

tough abyss
#

"beeing"

#

🐝

#

🐝

#

📠🐝

jade abyss
#

idiots (one type... -.- )

tough abyss
#

...

#

There's no selection.

#

It's just how Slack works 😂

#

Try again? Check spam?

#

Got another e-mail?

thorn pine
#

Hi. Can I create a headless client using a script? not changing the mission.

#

Thanks, but I'm using mod (config)?

little eagle
#

You may be able to make a mod for 3den to automatically place a hc, but not sure that's what anyone wants.

inner swallow
#

Considering it needs to be slotted before the mission scripts are even loaded, I don't think you could

peak plover
#

@tough abyss Checked the logs, you were banned for "slackin' off" /jk

inner swallow
#

(that said, I know it's possible to createUnit a curator object via script)

peak plover
#

It is probably easier to use the old fashioned way

carmine maple
#

short question, why is
missionNamespace setVariable ["laserdesignator", [[0, 15], "Equipment", "CfgWeapons"]];
working fine, but
missionNamespace setVariable ["Binocular", [[0, 15], "Equipment", "CfgWeapons"]];"
is causing the error

 9:25:56   Error Reserved variable in expression```

I know "Binocular" is also a command, but its passed as a string here, why does it still cause "Reserved variable" error?
still forum
#

Because Binocular is a command.

#

missionNamespace setVariable ["Binocular", 123]; is equal to Binocular = 123 which doesn't make sense as Binocular is a command.

astral tendon
#
waitUntil {
 if ({alive _x} count units WareHouseGuys_1 ==0 AND {alive _x} count units WareHouseGuys_2 ==0 AND {alive _x} count units WareHouseGuys_3 ==0 AND alive truckhunter_1) exitWith {
sleep 1;
Track17NoLoop = addMusicEventHandler ["MusicStop", {playMusic "Track17";}];playMusic "Track17";
 true};
  }; 
};```
This one did not worked in MP, the sever hoster did hear the music but not the client
#
waitUntil {
 if (trucktodeka distance placa <= 30 ) exitWith {
Track18Loop = addMusicEventHandler ["MusicStop", {playMusic "Track08";}];playMusic "Track08";
 true};
  }; 
};```
but this one worked
#

what it could be wrong with the first one?

lone glade
#

your count is completely wrong

#

also why use "AND" when you can type &&

astral tendon
#

is there a key diference to this?

#

this is to check if those groups are dead, and the last one to check if a offroad is alive

tame portal
#

@tough abyss when i do such if statements i like to group things by formatting them differently

#
if (
        ({alive _x} count units WareHouseGuys_1 == 0)
    AND
        ({alive _x} count units WareHouseGuys_2 == 0)
    AND
        ({alive _x} count units WareHouseGuys_3 == 0)
    AND
        alive truckhunter_1
    ) exitWith {
        
};
#

makes them easier to read imo

tough abyss
#

thats unoptimized though?

lone glade
#
if (
        ({alive _x} count units WareHouseGuys_1 == 0) &&
        ({alive _x} count units WareHouseGuys_2 == 0) &&
        ({alive _x} count units WareHouseGuys_3 == 0) &&
        alive truckhunter_1
) exitWith {
        
};
tough abyss
#

because if the condition fails it will continue the line

tame portal
#

yeah that comes after that but i was just formatting it differently ^^

lone glade
#

actually we tested that cloud on the ACE3 slack

#

can't remember the results, but for simple checks it's better to not use lazy eval, but I just don't care and use it everywhere 😄

#

paging @still forum since he did the tests

tough abyss
#

right but speaking of longer and more heavy code

still forum
#

hm? lazy eval?

#

a CODE count ARRAY loop can always be considered heavy.

#

so always lazy eval on that

tough abyss
#

lol

lone glade
#

thefuck quik

still forum
#

things like lazy evaling boolean variables doesn't make sense and I think is slightly lower perf

lone glade
#

== is case insensitive, isEqualTo isn't and support more stuff

#

just use whatever you need

still forum
#

so if you run any actual code in the if statement make lazy eval. if you only retrieve variables then don't

#

@tough abyss you don't ever see anything

#

So yeah. The code posted above is terrible and should lazy eval

astral tendon
#

but what about music?

#

yes and the other one worked

#
waitUntil {
 if (trucktodeka distance placa <= 30 ) exitWith {
Track18Loop = addMusicEventHandler ["MusicStop", {playMusic "Track08";}];playMusic "Track08";
 true};
  }; 
};```
still forum
#

@tough abyss use your eyes.. Gosh

lone glade
#

wat

#

I still don't get the "people won't steal my shit"$

#

that's what licenses are for

tame portal
#

^

blissful wind
#

i think most times the worst part is jsut not crediting the author, so much could be avoided and most times thats the only thing the author wants

tame portal
#

Obfuscation and Encryption can only hold back people that are not willing enough to get something

lone glade
#

it just makes maintaining it a lot worse

#

it's a bad idea overall

tame portal
#

(Atleast the encryption BI uses)

lone glade
#

they use encryption?

tame portal
#

EBO

lone glade
#

it's probably because they're legally forced to do it

#

making mods and other stuff does too

broken flint
#

hello guys

#

Do you know if it is possible to use hoist with anything other than a helicopter

#

sorry for my english i'm french

little eagle
#

You're forgiven for the English, but not for being French.

tame portal
#

Rest in White Flags

lone glade
#

triggering initialized

#

if you mean sling loading then no

#

only helos can do that

broken flint
#

I am doing a crane, and I will love this feature

south pasture
#

Hi,
what is the safe approach to wait till player object is present both locally and on the server?
Looks like waitUntil {!isNull player}; on client still gives flase on server for {owner _x == _id;}count allPlayers != 1.
What i'm trying to achieve - headless clients register on server as task workers. Somehow waitUntil {!isNull player}; is still not enough for them

broken flint
#

I will have to make a attachto

lone glade
#

you can use attachTo with ropes

#

but you cannot replace the rope model

#

@south pasture you preferably don't

south pasture
#

@lone glade ?

lone glade
#

where is that waitUntil?

south pasture
#

it's in the beginning of initPlayerLocal.sqf

little eagle
#

Does initPlayerLocal even work for hc?

lone glade
#

you're suspending an init script, it's a terrible terrible idea

#

yes

little eagle
#

Why not use initPlayerServer then?

lone glade
#

but player reports nil there, same as initPlayer

little eagle
#

null or nil?

lone glade
#

either of the two, I know it's not defined

little eagle
#

But then the waitUntil will always fail.

lone glade
#

suspending an init script should never be done

#

actually I wonder why BIS didn't add safeties to avoid that

south pasture
#

actually everything is working on HC. wait passes, request to server to register is sent, but server cant correlate clientOwner from HC with any owner of known players

#

@little eagle initPlayerLocal works for HC

little eagle
#

Hard coded, QS.

lone glade
#

same as the splash screens

#

that are in sqs

little eagle
#

I'm looking for the hoist key. But I can't find anything.

#

What is it by default?

lone glade
#

B afaik

little eagle
#

That's only one key though. I thought it's one for raise and lower or smth like that.

#

The dialog for the heli can definitely not be reused for a crane.

tame portal
#

I wonder who put into the Wiki

#

Oh nevermind

candid jay
#

If you were to have 5k cars on your map, how would you treat the enabling / disabling of simulation (which is necessary for that amount)?
Would you have a process for each player that enables / disables the simulation on the cars that are within a 1km radius or so? Other ideas?

candid jay
#

that applies to a whole mission though

#

I'd like to enable it in a module, for module vehicles only

tough abyss
#

Honestly at 5k vehicles you might aswell be doing it mission wide plus its engine based.

lone glade
#

5K cars would crash your game

tough abyss
#

i.e Arma will be struggling around 8k objects due to network traffic etc

lone glade
#

10 000 inventory items destroy your framerate (about 20fps with frequent freezes)

candid jay
#

5K cars is what EXILE does.

#

that's why i am saying that they need to have simulation disabled

jade abyss
#

aren't they disabled anyway, after a certain distance?

candid jay
#

everything is conceivable, including switching from local to global objects

jade abyss
#

Or was it "just" PhysX?

candid jay
#

I don't know, it's a good question

little eagle
#

Are they actually to be used? If not -> simple object.

candid jay
#

well not necessarily used, but simple object would not react for instance to collisions

#

or a bomb

jade abyss
#

Collision = Does react, just no dmg

candid jay
#

yeah that's what i meant

jade abyss
#

k

candid jay
#

ok anyhow, any ideas welcome 😃

#

otherwise i'll just proceed as planned, i.e. 1 process / player marking vehicles

#

and 1 process on server enabling / disabling them

jade abyss
#

What are you trying to achieve in the end and whats the current Situation?

candid jay
#

I didn't want to bother you 😃 but here it is

jade abyss
#

*edited

candid jay
#

I am just considering adding civilian vehicles as part of a terrain. I just think this could add extra-realism. So I would allow to change the behaviour of these vehicles depending on settings and init.sqf configuration, something like 0 = no vehicles, 1 = non enterable vehicles, 2 = enterable vehicles

#

Default would be 1

jade abyss
#

adding civilian vehicles as part of a terrain <- ?

candid jay
#

yes

jade abyss
#

What do you mean by that?

candid jay
#

We are building a 25x25km terrain

jade abyss
#

If you add them via TerrainBuilder -> Nope, can't be added to be used by players

candid jay
#

and on top of standard & custom objects (for instance we have a fully working cableway)

#

I know, but I can simply replace vehicles on postInit

lone glade
#

use wreck objects

jade abyss
#

Meh

candid jay
#

Again, CONSIDERING. 😃

jade abyss
#

Don't do that. Let the MissionDesigners handle that

candid jay
#

why

#

BTW as said, that would be a configurable option if they don't want them.

jade abyss
#

hmmm

#

Still: Meh, i wouldn't do it

candid jay
#

We have precedents, for instance OpenChernarus replaces all houses in a map on postInit, and we are talking more than 5k (which BTW would just be some upper limit of sorts, i don't expect that many vehicles).

#

Ok, I respect that opinion

#

so much so, that again I'm just considering doing this as an option.

jade abyss
#

aye, in the end, you decide what you do. But i would be annoyed by it^^

candid jay
#

To a part of me, it does only seem reasonable that there would be cars in a 25x25 map. Otherwise what is that, a gigantic holocaust where we put everything including garden chairs but then... no cars? did they all flee?

jade abyss
#

There is almost no furniture on Altis, soooo....

candid jay
#

I get it, that is in the other part of me 😄

jade abyss
#

+Thats why it's called "Sandbox" 😉

candid jay
#

eheh

#

sure, I understand your point, I really do

#

so while I evaluate this idea, I'm also considering technical implications (hence my original question)

jade abyss
#

If a Missionmaker want's cars on it -> He will probably end up setting them himself on "strategic positions" for example

candid jay
#

sure

jade abyss
#

IF so, i wouldn't even hassle with placing them on the map itself

#

Note positions, put them in an array, spawn em in the init

candid jay
#

well

jade abyss
#

The only thing i would place down, would be Wrecks.

candid jay
#

placing them in the map allows us to have exact positions and if we change them in TB then it will reflect without further changes.

#

ok

jade abyss
#

Like "scenes" -> Hey, there are 2 wrecks who had an accident, maybe adding a corpse to it too.

#

¯_(ツ)_/¯

candid jay
#

eheh

jade abyss
#

"Details" <--- !!!

little eagle
#

Wait. Was there a command to report the line count of a multiline control?

candid jay
#

we're getting phylosophical about what a sandbox is

#

good 😃

jade abyss
#

Not that i know of @little eagle

#

Can you count \n or <\br> ?

little eagle
#
private _lineCount = {_x isEqualTo ASCII_NEWLINE} count toArray ctrlText _ctrlValue;

Guess I'll stick with that ^ then :/

jade abyss
#

Or that

candid jay
#

^

jade abyss
#

admit it, you just wanted to pose again Commy 😛

candid jay
#

eheheh

little eagle
#

Nah, but I haven't tested it yet and vaguely remembered there being something for this.

still forum
lone glade
#

oh jesus

#

JESUS

#

that file would fucking crash atom, I have RPT logs shorter than this

#

why the everloving fuck are you using comment

#

I have so many questions

jade abyss
#

Like:

_QS_productVersion = productVersion;
_QS_resolution = getResolution;
_missionStart = missionStart;
_QS_worldName = worldName;
_QS_worldSize = worldSize;```
Why?!
still forum
#

Because someone said retrieving stuff from local variables is faster than calling nular functions.

#

which is true

#

but dude

jade abyss
#

how much? 0.000001?

still forum
#

That's a perfect example of some idiot taking performance advice tooo far

lone glade
#

"too far"? have you seen the code?

still forum
#

no. More like 0.002ms

lone glade
#

no way that's optimized

#

compiling that func must take ages

jade abyss
#

so many if else

#

and so many if if if if if instead of putting it in one

#

if(bla && {bla2}) etc

still forum
#

Yeah.. Just an idiot paying attention to the tiny optimizations that you should do when you are done with your script. And completly ignoring the big picture

#

It's like..

<very unreadable but extremly optimized code>
Sleep 5;

WTF dude?

jade abyss
#

XD

tough abyss
#

Lul

tough abyss
#

@tough abyss quality work isEqualTo quality meme

#

i used isEqualTo pay careful attention

jaunty zephyr
#

wat. 6k lines? please tell me it's generated code.

#

if not... props for being able to not go insane while coding

tough abyss
#

you should add another 30 or so comments

#

that way the file is over 7k lines

jaunty zephyr
#

at one point you've got 14 levels of "if"

#

that must be a global record

peak plover
#

That's so much better. If you wanna train your neck
Go and watch tennis from the first row

queen cargo
#

Mother of God

#

@tough abyss that is horrible stuff...
At least split the file up and use the preprocessor

#

@jaunty zephyr more levels are actually more efficient then less but chained ones in sqf

jaunty zephyr
#

I know. I'm not disputing efficiency here.

peak plover
#

Can someone explain why people use

If (cond)
{
} Else
{
}
#

Absolutely disgusting

queen cargo
#

In regards of "one large vs multiple small ones"
That is complete and utter Bullshit
But it is indeed quite optimized
But sacrificed too much for nothing

jaunty zephyr
#

^ very much that.

ivory nova
#

I wrote a function that creates markers. In another script I'm trying to call it 3 times in a row, but only one of the markers gets made. Anyone have any ideas where I should start troubleshooting that?

queen cargo
#

Gets only worse if it is only ran once per game

#

Marker name @ivory nova

peak plover
#

Unique name

ivory nova
#

They're all different, if that's what you mean

#

Both text and name

queen cargo
#

Organization @tough abyss

jaunty zephyr
#

mantainability. way easier to find your way around and to avoid code duplication if it's in small chunks.

ivory nova
#

@queen cargo @peak plover You were right, misplaced "" 😳 Thank you

queen cargo
#

Lemme repeat: you did wrong and let loose of a hell lot of tools
Your execution is horrible
Not the one "thread" thingy but rather how you approached

#

@ivory nova no problem

#

How long is that file again?
0-EOF

You could have used multiple ways to get it split up (variables containing parts of the code, #include,...) or even could have created a proper system and iterate over that
Instead you just put everything into a single file without any real benefit

#

Form

#

Functionality wise it would change nothing

#

But it would be readable by any human being

#

Coding is not only getting the problem solved but getting it maintainable solved
You may succeeded in getting the job done but failed in all other requirements for coding miserably

jaunty zephyr
#

in my experience, "others" often includes a very sad future self

#

i for one tend to forget what i did when and where

queen cargo
#

Does not matters
You will look in a few years onto this monstrosity and ask yourself what you did there

#

Code styling matters just like structure does and comments do

jaunty zephyr
#

I've seen code and thought "who was the idiot" only to discover it was me

queen cargo
#

But you are the dev
The player is just your osi layer 8 problem

jaunty zephyr
#

right, but we're in #arma3_scripting here, so expect to be grilled for bad coding practices ;)

queen cargo
#

@jaunty zephyr problem is more that he is no rookie here doing this

#

So what?

peak plover
#

It's about speed and nanosecond performqnce

ivory nova
#

@tough abyss = White Rose

subtle ore
#

of course it is Nigel, if it's not 0.0000000001 nanoseconds then it's garbage

queen cargo
#

There is benefit to the approach... Bit it could still have been performed better and properly

#

With preprocessor overriding the default commands for example

#

But that would not change when you would split the file up
Now you created something nobody ever will bother to read

peak plover
#

See that's good practice, less scripts running = less nanoseconds used

queen cargo
#

Where would that happen?
You could even remove the "overhead" that gets caused when using call

peak plover
#

You could have made 1 script handler that runs and split every function up 'tho and still only have 1 script running at any timw

queen cargo
#

Simply by utilizing the only thing nobody really complains about
Preprocessor

#

That @peak plover

#

False assumption of yours is the problem then

#

Call will not run unscheduled

#

No

#

Only way to get non scheduled is from within non scheduled environment

#

Spawn something and then call { sleep 1}

peak plover
#

Isnil causes unscheduled

queen cargo
#

Call is not different from if or any other command taking code as input parameter

#

And doing stuff with it

#

Otherwise if would also be automatically unscheduled

#

TL;DR for that script @tough abyss

peak plover
#

Yeh, too unorganized, might be bad for you too because going back to add or fix things will take longer than alternatives

#

I try to write in a way that I would understand it yesterday and tomorrow

little eagle
#

I just hope it doesn't catch on just because a con artist told people that it's the magic fix for fps.

tough abyss
#

@Moldisocks#2334 thanks for the help mate but i have managed to get compositions to spawn with my ai by using
private _cargo = [_position,0, call (compile (preprocessFileLineNumbers "objects\base1.sqf"))] call BIS_fnc_ObjectsMapper;

peak plover
#

@little eagle whitespaces? Shhh... It's top secret fps trick

winter dune
#

can someone explain me when should be using bis_addstackedeventhandler with the param onEachFrame?

peak plover
#

When you wanna do sth every frame

winter dune
#

and is it better than a for loop / while true?

#

if I want to run something that last forever

peak plover
#

It's definitely better for some things

winter dune
#

like?

#

the wiki says that only one onEachFrame loop can exist at any time, does that mean that I can't used it anywhere else beside that script?

peak plover
#

Ohh, using, bis fnc add stack mean u can use more

winter dune
#

reading the kk guide atm

#

seems clear

peak plover
#

Normal oneachframe it's only 1

#

If you want to limit the player to a specific area that wud come in handy

winter dune
#

and when onEachFrame wouldn't come in handy?

#

for example, in what scenarios?

peak plover
#

While loop that needs to run more than once per frame

shut flower
#

@little eagle do you remember my problem I had with xeh init evh and so on? It seems like xeh get's recompiled at the same time the editor is initializing all placed objects. Therefore it's not even firing. Now I'm using onMissionPreviewEnd provided by 3den but strangely my functions are nil when this evh fires so I have to wait until they are not nil any more. Any ideas why this is happening? I assume it's because of the way cba compiles (and recompiles) functions.
https://github.com/chris579/grad_trench/blob/editor-place-fix/addons/functions/Cfg3DEN.hpp#L4

peak plover
#

It doesn't matter as much as I know, but it really depends on what you are doing. If you post code maybe I can help you dwcide

astral tendon
#

Im trying to get a array of units in a side but
Units west is not valid, how is the right way to do it?

little eagle
#
private _allWestUnits = [];
private _allWestGroups = allGroups select {side _x isEqualTo west};

{
    _allWestUnits append units _x;
} forEach _allWestGroups;

_allWestUnits
#

Alternative:

private _allWestUnits = (allUnits + allDeadMen) select {side group _x isEqualTo west};
_allWestUnits
astral tendon
#

thanks

little eagle
#

yw

#

addAction with all the default parameters:
Midnight, if that was you, you are a hero.

astral tendon
#

(player nearEntities ["Man", 20])
this does noe return array in order by distance, what are the requirements to be the first in the array? also, is the player allways is the first in the array?

still forum
#

@tough abyss Your code doesn't say anything about FPS if it's scheduled. Your code can be a crapfest that takes hours for a single run and still run at 120fps because.. scheduled. So good fps actually say nothing at all about the performance of your scheduled scripts.
So if you say using monster scripts gives good fps.. So does any number of scheduled scripts... Even if you had thousands of scheduled scripts running it wouldn't change anything. As they run for 3ms and that's it

little eagle
#

@astral tendon I don't think nearEntities has guaranteed ordering by distance. They should be sorted the way they appear in the internal entities list.

#

nearestObjects is sorted.

still forum
#

#350

jade abyss
#

Yep, #350 (aka: Unpayable)

little eagle
#

This is the one place on earth to not ask this question.

#

You'll only get sarcastic answers.

jade abyss
#

That's "life" ¯_(ツ)_/¯

astral tendon
#

That mean any array comes in randon order by default?

still forum
#

"This command does not guarantee that the returned array is ordered" -> Every array is always random ordered.
No.
"This car is red" -> All cars are red. NO.

astral tendon
#

Like, names influence in the order?

jade abyss
#

No

little eagle
#

No, the internal entity list does.

jade abyss
lone glade
#

dedmen had to go around and delete a bunch of shit they posted last time

still forum
#

Leaving it so BI staff can work on countermeasures

lone glade
#

erf, can't remove the page :/

still forum
#

don't.

lone glade
#

yeah, figured as much

still forum
#

Right now you can post anything without verifiying your email or even going through a captcha.. Although the wiki software has captcha support builtin.. but BI just didn't enable it cuz... BI

lone glade
#

I wonder if they fixed the forums certs

little eagle
#

What's the point of making a bot spam "google email google"?

lone glade
#

that's what i'm wondering....

still forum
#

They spam phone numbers for tech support scam stuff I think

lone glade
#

I don't see any tho :/

little eagle
#

^

still forum
#

wut.. then you're blind

little eagle
#

Especially if you can't even find any shady links or telephone numbers.

still forum
#

<number> GOOGLE CUSTOMER SERVICE NUMBER
‎Google®© <number>®

little eagle
#

r18662017657
^ that is a phone number?

lone glade
#

it looks like someone passing out on numpad 😄

still forum
#

I guess

little eagle
#

This is what the world will look like when the machines take over.

#

I never bought something that I've seen in advertisement.

inner swallow
#

1866-2017-657

#

clearly a phone number 😄

astral tendon
#

the addMusicEventHandler, if i add another addMusicEventHandler i will have 2 running or only one can run?

#

thanks

winter dune
#

silly question, is it better using params or private? When should I use params instead of private?

#

👍

still forum
#

params and private are totally different things.

#

For when you should use private... Always. But never use private ARRAY.

little eagle
#

Should I repeat it again?

#

3 is the magic number.

#

Instead of apples and oranges, I suggest bananas and aubergines.

#

If someone leaves a wishlist on a feedback "tracker", and that someone is named "Shekelberg". How likely is it for them to be a troll?

#

No ((())), but I'm not even sure if that software allows for them.

#

Cute.

#

F5

#

Heh, this pushes me at the top of the client list.

tough abyss
#
Triple Parentheses, also known as (((Echo))), is a symbol used by anti-Semitic members of the alt-right to identify certain individuals as Jewish by surrounding their names with three parentheses on each side. The symbol became a subject of online discussions and media scrutiny in June 2016 after Google removed a browser extension that automatically highlights Jewish surnames in the style.
austere granite
#

~Echos are the best thing to happen to internet culture in a long time tbh

inner swallow
#

I mean it's probably less about taking offence and more about how it's used

austere granite
#

Is there an issue with attachTo on simple objects? AttachedTo returns what it should, but it doesn't move when I move the simple object

still forum
#

simpleObjects are not simulated

#

attachTo'd objects are moved along when the object is simulated

jade abyss
#

isn't Network update of SO also disabled?

austere granite
#

Hmm okay thank you. I'll set position every frame then

jade abyss
#

MP or SP Adan?

austere granite
#

both, MP but locality updates will be... special 😄

#

my main position movements for quick updates already used the setPosLocal workaround tricky magick stuff

#

the object that i'm attaching is local btw

jade abyss
#

Then you shouldn't use updating per Frame. When i did that with 2017mod it looked well on the OwnerPC, but all of the other clients had lagging objects ( ~1 1/2 years ago)

#

You better test that pretty early of Dev in MP (DediMachine) with a friend first.

austere granite
#

i know

#

but this thing is local so its fine

#

params [["_object", objNull], ["_position", [0, 0, 0]], ["_commitTime", 1]];

if (isMultiplayer) then {
    private _localMover = _object getVariable ["localMover", objNull];

    // -- Create local object, that we attach to, so we can do local positioning
    if (isNull _localMover) then {
        _localMover = __LOCALMOVERTYPE createVehicleLocal _position;
        _localMover setObjectTexture [0, "#(rgb,8,8,3)color(1,1,0,1)"];
        _object setVariable ["localMover", _localMover];
        _localMover setVariable ["localMoving", _object];

        //private _relativePos = [0, 0, 0];
        _object attachTo [_localMover];

        // -- Add to an array that we loop through with commit times
        private _localMoveArray = GVAR(namespace) getVariable ["localMovedObjects", []];
        _localMoveArray pushBackUnique _object;
        GVAR(namespace) setVariable ["localMovedObjects", _localMoveArray];
    };

    // -- Set the new time at which we want to make the position change global
    _object setVariable ["localMoveCommitAt", diag_tickTime + _commitTime];
    _localMover setPosWorld _position;
} else {
    _object setPosWorld _position;
    // -- (Because setPosASL and getPosASL dont'use the same coordinate system) (No i'm not joking. Arma ladies, gentlemen and attack helicopters)
};
#

that's what i use outside of that

#

but in this case i'm attaching a local object to the thing i'm changing position of, so it's fine

jade abyss
#

Why don't you just exchange the SO with a "normal" one on attaching, then replacing it when dropped?

#

Would cause less brain and scriptfuckery, or? ¯_(ツ)_/¯

austere granite
#

because my library is build on Terrain builder template files and the actual model paths for everything

#

it parses the .tml files, no create vehicle for any of the object placement

jade abyss
#

I am afraid to ask what you wanna do oO

austere granite
#

i posted videos in bludclots channel 😉

jade abyss
#

wich of them? I mostly skip em^^

rotund cypress
#

Hey guys, so it appears that owner returns 0 for everyone on client side

#

Any other way to do this?

willow trail
#

Hey guys is there a script that would make it so " If player is wearing vest run this script "? i can't find anything like it

lone glade
#

why do you need to use owner?

still forum
#

owner of what? owner player= @rotund cypress

rotund cypress
#

yes

#

@still forum

#

I am using remoteExecutedOwner together with owner

still forum
rotund cypress
#

That is only local though, thats the thing

still forum
#

player is also local

rotund cypress
#

Which always returns 0

still forum
#

owner returns 0 because the client doesn't know who owns some other thing I'd guess

#

try netID one part of it should be owner

little eagle
#

^ only the server knows which object belongs to who

lone glade
#

which remoteExec go through so you don't need to know who owns what

rotund cypress
#

I was using remoteExecutedOwner

#

then a function to get the player of that owner id

lone glade
#

and again, why?

rotund cypress
#

Because I want to get the player who remoteExecuted ^^

little eagle
#

Sounds weird. Just pass the player object as additional argument.

rotund cypress
#

Yeah could do obviously, but I could just use remoteExecutedOwner

#

Then no need for unnecessary arguments

little eagle
#

No, you obviously can't.

rotund cypress
#

Netid works fine

#

Seems to work fine

little eagle
#

People ¯_(ツ)_/¯

still forum
#

But you won't get the player that way @rotund cypress

#

A client can have more than one local object

rotund cypress
#
{
    if (owner _x isEqualTo _ownerID) exitWith {_unit = _x};
    true
} count ALLPLAYERSNOHC;```
#

This is what I used to get a player from a remoteexecution

#

but obviously it didnt owrk

#

But I guess netID would work fine?

#

Getting the owner from that

willow trail
#

let me rephrase myself is it possible to make it that a script will ONLY work if a person is wearing a certain vest? sorry if its not possible but i cant find anything about it.

little eagle
#

This is just trolling at this point.

lone glade
#

@willow trail yes.

still forum
willow trail
#

thank you

#

but how would i apply that?

rotund cypress
#

Wait, is the owner id not the same as the first numbers before : in netid ? @little eagle

still forum
#

if vest unit == "vest name" then stuff

little eagle
#

Just pass the player object as additional argument.

rotund cypress
#

No need if I can get the owner id through that 😉

little eagle
#

Just pass the player object as additional argument.

rotund cypress
#

lol

#

Okay, one question though, why is doing it in my way bad?

little eagle
#

This is the best advice I can give you. If you want to hack around for no reason or benefit, ok.

still forum
#

because you are trying to find complicated workarounds instead of just going the easy way

little eagle
#

^

rotund cypress
#

I beg to differ, never having to pass an object of the executor again, which in short term means less code

still forum
#

a serialized object is just one integer. So you don't really create any network overhead

lone glade
#

wat

#

quik, you lost all ability to troll after we saw that file

still forum
#

@rotund cypress You are trying to write code as a workaround. Why does not needing that code mean more code?

little eagle
#

Why ask a question if you dismiss the obvious answer?

rotund cypress
#

What was wrong with the code? @lone glade

#

Obviously I know that I could just pass in the object, however, if I can get it in this way: there is maybe no need to pass in an object @little eagle

still forum
#

passing an object is easier and more efficient though...

little eagle
#

You're making things worse. You got a bad idea.

still forum
#

Also
Using the workaround means there is no need for passing an object.
Passing an object means there is no need for your workaround.

willow trail
#

hey @still forum I've currently got

if vest player = "V_HarnessOGL_brn" then;

followed by my script but it doesn't work, I apologize in advance but i'm rather new to scripting in arma 3

rotund cypress
#

Is this what you want instead? @lone glade allPlayers select {owner _x isEqualTo _ownerID} select 1; cause iirc that is slower way

still forum
willow trail
#

yeah i cant make anything out of what it says on that page

lone glade
#

well, how about the 5+ lines of private array ?

#

or the WHOLE THING?

still forum
#

Well.. I guess then you gotta take a reading comprehension course @willow trail

lone glade
#

or even using comment seemingly randomly

rotund cypress
#

Wait are you talking about my script snippet? @lone glade

willow trail
#

yeah sorry my english isn't as good as yours that really helps

lone glade
#

no simzor, i'm talking to quik

little eagle
#

He's using it because he's an edgy contrarian.

rotund cypress
#

oh

#

Lol

still forum
#

@willow trail There is an example.

#

@tough abyss why do you put so much stuff like worldSize and stuff into a private variable?

lone glade
#

just to have a 6K lines func behind it

#

well, yes

still forum
#

Why do you do that?

lone glade
#

that func is barely readable, and a mess

still forum
#

less function calls. So. You want more performance?

little eagle
#

Every if statement is a function call btw.

#

So there are thousands of function calls.

still forum
#

Like you make completly idiotic decisions to improve performance. And then you use the most idiotic ways to waste performance

#

Like you are a completly brainless piece of shit that doesn't understand the most basic things.

lone glade
#

but it's unmaintainable

still forum
#

It's like when you want to go through a door. You disassemble the doorframe. Take the door out. Go through. And reassemble the doorframe.
Because. uh.. Dunno. "I'm dumb I guess?"

little eagle
#

Maintainability is not form. But that isn't the only problem. Far from it.

still forum
#

20

lone glade
#

the worst part is that you know what you're doing, but for the wrong reasons

still forum
#

If you want performance then all the local variables make good sense.
But you apparently don't want performance because you don't care a couple lines later.

little eagle
#

I treat it as an elaborate trolling attempt that worked perfectly.

still forum
#

You spend days writing a bunch of shit because.. No reason.

little eagle
#

Sadly some people will take it seriously and waste hours on the ideas for nothing.

still forum
#

I'm more about the fact that someone already tried to send a link of your crap to a beginner trying to learn SQF as a example of good code.

#

You are dooming every beginner that looks at your code to learn stuff

little eagle
#

Maintainability is not form. But that isn't the only problem. Far from it.

still forum
little eagle
#

But the preprocessor is evil, Dedmen.

still forum
#

compiler*

little eagle
#

w/e

#

Nerds.

jade abyss
#

pff

lone glade
#

also, quick tip, you don't need to use saveProfileNamespace

#

the file is written whenever the namespace changes

still forum
#

Or _QS_uiTime = diag_tickTime; Storing the time.. That's just dumb. The first time you use the time you stored it's already a second later. At the end of your function several minutes could've passed and you still use the time from minutes ago.

jade abyss
#

1st

little eagle
#

also, quick tip, you don't need to use saveProfileNamespace
I've been saying that one for years, but that's another thing that won't go into peoples heads.

#

They somehow think it's needed.

#

people ¯_(ツ)_/¯

still forum
jade abyss
#

The whole thing is just badly written...
exactly

little eagle
#

One up.

lone glade
#

you have so many fixed values, why not use macros?

jade abyss
#

Or stuff like: _QS_player = player; <- dafork?

#

It makes no sense at all

still forum
#

no that makes sense

#

because performance

jade abyss
#

lol

still forum
#

looking up a local variable is faster than calling player

jade abyss
#

0.000000001ms ?

still forum
#

but false is just as slow as player so if you want perf you also need to save things like true/false

little eagle
#

How many scopes you need to make it worse, dedmen?

still forum
#

I guess about 1-2

little eagle
#

Because there are like 20 in some places.

still forum
#

Which

lone glade
#

so many scopes, do errors even print properly?

still forum
#

Because that idiot wants to have nested if statements everywhere.. and each if statement is a scope

little eagle
#

alganthe, they never do, so who cares.

lone glade
#

good point

still forum
#

using local variables is probably like 10x slower than calling the commands

little eagle
#

Somehow functions calls are bad if they use call, but perfectly fine if they use then.

still forum
#

XD

#

Idea

#
private _callFunc = if (true);

_callFunc then My_FNC_Stuff;
little eagle
#

Yes.

#

This is what we deserve.

still forum
#

That might actually be faster than call

jade abyss
#

Anyone remembers the timeDiff of

if()then{
    if()then

vs

if(bla && {bla2})then```
?
#

lets say... with 6 Sub If's?

little eagle
#

On average, the nested if is better under the condition that the first statement is likely to be false.

jade abyss
#

what i recall is that the {} version was faster

little eagle
#

Depends on the probability of the statements.

jade abyss
#

Lets say 6 if's, last one is false

#

Can you just run a check?

little eagle
#

The nested would be better.

#

Or what do you mean by last?

jade abyss
#

*me slaps @little eagle with a large trout*

little eagle
#

Can't you like try yourself?

still forum
#

if(true)then{if(true)then{};}; 0.007ms
if(true && {true})then {}; 0.0059ms
if(true)then{if(true)then{if(true)then{if(true)then{if(true)then{};};};};}; 0.01ms
if(true && {true} && {true} && {true} && {true})then {}; 0.0092ms
if(false)then{if(false)then{if(false)then{if(false)then{if(false)then{};};};};}; 0.0042ms
if(false&& {false} && {false} && {false} && {false})then {}; 0.0061ms

jade abyss
#

thank you.

#

Now in readable pls 😄

still forum
#

No can't.

little eagle
#

Dedmen, you did the lazy eval wrong.

still forum
#

If it's readable it wouldn't be comparable to the quickshit code.

#

where

little eagle
#
if(false && {false && {false && {false && {false}}}})then {};
#

There.

jade abyss
#

wut?

little eagle
#

ikr ¯_(ツ)_/¯

jade abyss
#

nah

#

hm

#

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

Now the engine will only continue reading the condition after the group has some knowledge about the object. Alternatively you can use lazy evaluation syntax. If normal evaluation syntax is (bool1 .. bool2 .. bool3 .. ...), lazy evaluation syntax is (bool1 .. {bool2} .. {bool3} .. ...). Now let's look at the above example using lazy evaluation:

if (_group knowsAbout _vehicle object > 0 && {alive _object} && {canMove _object} && {count magazines _object > 0}) then {
            //custom code
};```
Wrong info in there?
still forum
#

@jade abyss The code inside the {} will only be executed if the previous one is true.

little eagle
#

Wrong info on Code Optimisation page?! You don't say.

jade abyss
#

¯_(ツ)_/¯

still forum
#

Using what you posted still calls the && operators needlessly

jade abyss
#
Dedmen (∩`-´)⊃━☆゚.*・。゚ - Today at 7:18 PM
@..aDscha The code inside the {} will only be executed if the previous one is true.```
Yes, i know?! oO
little eagle
#

Remember that && itself is a command in this language.

still forum
#

if(false&&{false&&{false&&{false&&{false}}}})then {}; 0.0047ms
if(true&&{true&&{true&&{true&&{true}}}})then {}; 0.0086ms

little eagle
#

And by encapsulating it in the code block, you can skip it too.

jade abyss
#

It's so borked

#

(btw 1st)

little eagle
#

Of course.

#

Not anymore.

jade abyss
#

wrong

#

anyway: Still a mess in Quiks code

still forum
#

a useless mess without any reason for being like that

little eagle
#

You are changing your nickname too fast. Try again later.

jade abyss
#

lol

little eagle
#

I concede.

still forum
#

@tough abyss

jade abyss
#

muhahaha, i am the commy2, i love macros

little eagle
#

😱

jade abyss
#

😱 imposer!

still forum
#

imposter*

jade abyss
#

I am commy2, i make spelling mistakes.

#

Dscha is the best ❤

still forum
#

@jade abyss

#

no.

#

Discord! Bad discord!

jade abyss
#

Okay, enough fun. ttyl guys o7

austere granite
#

pls remove blue tags 😦

lone glade
#

by commy2 huehuehue

little eagle
#

?

real tartan
#

I have array of classes ["B_GEN_Soldier_F", "TapeSign_F", "OfficeTable_01_new_F"] and need to determine if class is "unit" (e.g. CaMan)

still forum
little eagle
#
_units = _classnames select {_x isKindOf "CAManBase"};

: /

real tartan
#

ahh, I missed "alternative syntax", thx tho 😃

still forum
#

Btw to the storing nular commands in local variables being faster.
Actually storing into the variable is slow AF.
So it only pays off if you reuse it about a dozen times atleast.

winter dune
#
 private _populateList = {
    params [
        ["_input","",[""]],
        ["_params",[],[[]]]
    ];

    private _list = (_params select 0) displayCtrl 40004;
    private _cfg = missionConfigFile >> "Crafting" >> _input;
    private _icon = "";

    (_display displayCtrl 40006) ctrlEnable false;
    lbClear _list;

    for "_i" from 0 to count (_cfg) - 1 do {
        private _curCfg = _cfg select _i;
        private _name = getText (_curCfg >> "name");
        private _id = getText (_curCfg >> "craftedID");
        _list lbAdd _name;
        if !(_input isEqualTo "Utilitari") then {
            private _info = [_id] call life_fnc_fetchCfgDetails;
            _icon = _info select 2;
        } else {
            _icon = ITEM_ICON(configName(_curCfg));
        };
        if !(_icon isEqualTo "") then {
            _list lbSetPicture [(lbSize _list) - 1, _icon];
        };
    };
};

switch (_mode) do {
    case "onLoad": { 
        (_display displayCtrl 40001) ctrlAddEventHandler ["ButtonClick", { ["Armeria",_this] spawn _populateList; }];
        (_display displayCtrl 40002) ctrlAddEventHandler ["ButtonClick", { ["Abbigliamento",_this] spawn _populateList; }];
        (_display displayCtrl 40003) ctrlAddEventHandler ["ButtonClick", { ["Utilitari",_this] spawn _populateList; }];
        /*(_display displayCtrl 40004) ctrlAddEventHandler ["LBSelChanged", { [_this] call _selectItem; }];
        (_display displayCtrl 40006) ctrlAddEventHandler ["ButtonClick", { [] call _craftAction; }];*/
        ["Armeria"] spawn _populateList;
    };
    default {};
};```
#

does someone know why the actual fuck do I get _list undefined?

#

if I change the spawn in call, everything works

still forum
#

the display control doesn't exist?

winter dune
#

yes, it exist xD

#

or I think

still forum
#

The control not being there. dunno

#

But then _list would be ctrlNull and not nil.

winter dune
#
(_display displayCtrl 40001) ctrlAddEventHandler ["ButtonClick", { ["Armeria",_this] call _populateList; }]; ```
lone glade
#

control ID being nil

still forum
#

you can use sqf highlighting btw.

lone glade
#

or typo

winter dune
#

if I call my local function by using call, it works

#

if I spawn it, no

lone glade
#

well ofc

#

you can't store displays and controls in vars in scheduled without disableSerialization

still forum
#

Should show errors tho shouldn't it?

lone glade
#

yes

winter dune
#

if using spawn yes

lone glade
#

it should print it in the RPT at least

winter dune
#

I do actually have disableSerialization

#

in my script

still forum
#

Why don't you ask about the error telling you you can't pass displays then?

#

No you don't

#

(_display displayCtrl 40001) ctrlAddEventHandler ["ButtonClick", { ["Armeria",_this] call _populateList; }];
The script starts at { and ends at }
I don't see any disableSerialization in that script

winter dune
#

ohhh

still forum
#

and your _polulateLists script also doesn't have disableSerialization

winter dune
#

i typed disableSerialization at the beggining of my file

#

isn't that going to cover all?

lone glade
#

nah

#

especially not if you're going unscheduled -> spawn -> scheduled

still forum
#

disableSerialization covers your script.

winter dune
#

gonna test it right now, thank you all

still forum
#

The eventhandler script is a new script

#

and your spawned script is another new script

winter dune
#

👍

jade bluff
#

If i host a mission to play with my friends, hosted on my comp, is there a way to spawn in certain vehicles using the server Exec thing?

little eagle
#

Yes.

jade abyss
#

dam dam dam, another one for the list *sing*

candid jay
#

does anyone know what this could mean (in a log):
Setting invalid pitch -5759945593732464640.0000 for B Alpha 3-4:42 REMOTE

#

and also

#

22:34:44 Server: Object 49:327 not found (message Type_114)

jovial ivy
river meteor
#

I'm having an issue calling a function I created in cfgFunctions.hpp. All the function does is attempt to diag_log but nothing happens when I call it. My cfgFunctions is sqf class CfgFunctions { class MANA { class System { file="functions\System"; class playerDisconnect{}; }; }; };

#

I completely failed at my attempt to highlight that, but if anyone knows what I'm missing in this would be a big help

little eagle
#

Open RPT and check if it says file not found or something like that.

#

Mission or addon?

river meteor
#

it's server side code, rpt doesn't seem to show an error for it. I have a diag_log in the file that calls it which is running and right before the log it says this "Client: Remote object 3:0 not found" not sure if related

little eagle
#

Tf is server side code? Is this an addon only running on the server?

river meteor
#

Yes

little eagle
#

Then the function will not be defined on the client period.

river meteor
#

Oh. I'm dumb. I just need a config.cpp

little eagle
#

config.cpp with CfgPatches and CfgFunctions.

river meteor
#

yeah. Thanks for the help

astral tendon
#
 if (true) exitWith {
if (alive player) then{
Hint "ready";
     };
true};
}; ```
Just chceking, in case that if (alive player) is not true the code still have exited?
little eagle
#

Yes.

astral tendon
#

thanks

#

One thing i noticed, seens like for a split second in MP the player is set alive before even spawns adding a Sleep 1 to the script seens to fix it, but that second can be diferent depending on the PC running (like low perfomace) or even lag? or does the initPlayerLocal starts at the same time when the spawn screen apears?

little eagle
#

initPlayerLocal is executed when your player becomes not null.

astral tendon
#

so its better ask isNull intead of Alive?

little eagle
#

Shouldn't make a difference. alive reports false for null. I guess !isNull is clearer though.

blissful wind
#

mine dispensers don´t go off with setDamage 1 ? -_-

little eagle
#

Need a dummy unit.

_unit addOwnedMine _dispenser;
_unit action ["TouchOff", _unit];
blissful wind
#

ah! Thanks @little eagle

little eagle
#

Maybe try with a createUnit'd "Logic".

#
private _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
_logic addOwnedMine _dispenser;
_logic action ["TouchOff", _logic];
deleteVehicle _logic;
#

Or maybe it needs an actual unit. Idk.

blissful wind
#

yea either that or incorporate it into the mission or task with a unit that won´t be deleted

#

yea that

#

after a quick though maybe this one would go really nice with my hack the terminal task in which you have to open the terminal and use the laptop within a certain ammount of time to complete the " hack", the only consequence so far is task failed but maybe adding a couple of dispenser that will go off if you fail it... hm.. tension that´s what i need

little eagle
#

Why not use the satchel to blow up the player?

blissful wind
#

hahaha

#

i like the dispensers

#

they go off and better you stay still for a second

little eagle
#

Spawn a bunch of stachels closing in on the player.

blissful wind
#

if done well it can completly imobilize a whole squad

little eagle
#
0 spawn { 
    for "_i" from 0 to 30 do { 
        sleep random 2; 
 
        private _pos = player getPos [10 + random 50, random 360]; 
        _pos = _pos vectorAdd [0,0,30]; 
          
        private _bomb = "SatchelCharge_Remote_Ammo_Scripted" createVehicle ASLToAGL _pos;  
        _bomb setDamage 1; 
    }; 
};

^ like this.

blissful wind
#

nah i want something balaced.. it can be hard but there is a chance .. with satchels you just blow up

#

plus mine dispensers are new

little eagle
#

New and shiny.

blissful wind
#

like these new commands

#

loving them

little eagle
#

Which?

blissful wind
#

for instance getunitLoadout

#

so simple so powerful

#

allmines i think its new too

little eagle
#

Still mad they didn't make one for cargo.

blissful wind
#

i think they did

little eagle
#

No.

blissful wind
#

oh im confusing with the getVehicleCargo

#

which is also nice

#

you can do fullcrew and even getCargoIndex afterwards if you need that info

#

i think fullcrew already returns the index

#

yea it does

little eagle
#

I mean the item/weapon/mag/backpack cargo. And there is no setter, and to remove you have to clear.

blissful wind
#

give me an example

#

addBackpackCargo

#

getBackpackCargo

#

clearBackpackCargo

#

are we talking the same thing ?

little eagle
#

Try to remove a single weapon from cargo.

#

Try to add one with specified attachments, mags and ammo count.

#

Oh.

#

Look what I found.

blissful wind
#

so addWeaopnItem is not working ?

little eagle
#
private _dispenser = "APERSMineDispenser_Ammo_Scripted" createVehicle _position;
_dispenser setDamage 1;
#

_Scripted is the one that exploded when dead.

blissful wind
#

ah! you create as a vehicle and not create mine command and it works ?

little eagle
#

Yeah, and you have to use this classname.

blissful wind
#

good find!

#

i will try to get around what you said to me about adding specific things to cargo to test it out

#

now im curious

little eagle
#

Don't waste your time. It has been determined as impossible.

#

Years ago.

astral tendon
#

The array [1,2,3], the command
select 4
is there a way to detect of that selection have nothing?

plucky beacon
#

you can check if its nil or null

#

although I think null is empty, nil doesn't exist

#

iirc

astral tendon
#

neither nil and null return value

#

is sure that this command is local in Arma 3?

plucky beacon
#

Global argument, local effect

#

ya, its local

astral tendon
#

i set that command to be ```team_2 say3D ["10MC536", 20, 1];````
that does not work

#

team_2 say3D "10MC536"
but this does work

#

oh i see, maxDistance also decrease allot the volume, i need to be kissing the unit to hear

river meteor
#

I'm trying to have initServer.sqf from an mp mission call init.sqf located in a server side addon. Having trouble finding init.sqf what file path do I use? Even more confusing because of the pbo packaging

daring pawn
#
switch _houses do {
    case 1..5: {};
    case 6..8: {};
};

Is something of the above possible when using case for if a variable is between two numbers?

limpid pewter
#

Good question idk

daring pawn
#
switch _houses do {
    case ((_houses > 0) && (_houses < 5)): {};
    case ((_houses > 5) && (_houses < 10)): {};
};

It appears the above works instead

limpid pewter
#

@daring pawn
what about

switch (true) do 
{
case  (1 >  _houses > 5) : {};
case  (6 > _houses < 8): {};
};
#

Oh, kk

#

Good to know

#

Good question idk
I am using the below code to return an array of all cars arround a marker. The script works fine when the vehicles at the position are empty and undammaged, but as soon as they explode the below code doesn't return any vehicle ojbect.

_nearbyCars = nearestObjects [(getMarkerPos _x),["car"],4];

Does anyone know how to find the 'type' name of a vehicle wreck, is in under CfgVehicleClasses?
i was thinking that this would work to return all vehicles and their wrecks

_nearby = nearestObjects [(getMarkerPos _x),["car","wreck"],4];
cedar kindle
#

@astral tendon regarding the array, use param with default value

meager heart
#

@limpid pewter entities "Car" will return wrecks and vehicles

ivory nova
#

Evening, does the way I have the params/variables set up look peachy? Getting undefined variable error when I try to call this with [[x,y], [x,y]] call MY_fnc_here;


private ["_point1", "_point2", "_x0", "_x1", "_y0", "_y1", "_x2", "_y2", "_deltaX", "_deltaY", "_slope", "_maxX", "_minX", "_marker"];

_point1 = _this select 0;
_point2 = _this select 1;```
#

oh, i messed up the expected data type didn't I ...

#

or not, i dunno

indigo snow
#

uh it looks very wierd. you should only need to first line (params) to initialize the _point1 and _point2 variables

ivory nova
#

Ahh, that makse sense

#

Hm, can you tell me anything else that looks weird?

indigo snow
#

also depending on where that variable undefined error shows up, if might be your function thats not defined

#

other than that no syntax is fine

ivory nova
#

Hmmm, thanks!

#

have defined function in functions.hpp and included in description

#

but yeah, muh params giving me trouble

indigo snow
#

are you sure it's actually that line? Is your cfgFunctions accidentally calling the functions by you setting pre/postInit to 1? etc

#

and then diag_log is the holy grail for debugging, looking at your variables and checking which is causing the error

little eagle
#

%LOCALAPPDATA%\Arma 3

indigo snow
#

you can go there from 3den now iirc

little eagle
#

Latest RPT file. Copy paste the error.

ivory nova
#

Wow, that's neat

#
21:02:21   Error position: <RND_fnc_slopeIntercept;>
21:02:21   Error Undefined variable in expression: rnd_fnc_slopeintercept
21:02:21 File C:\Users\Christopher\Documents\Arma 3\mpmissions\Subvert.Altis\init.sqf, line 11```
little eagle
#

RND_fnc_slopeIntercept as a whole is undefined, not a local in the function.

ivory nova
#

D: goodness me

#

Okay, I know what to troubleshoot now, thank you!

limpid pewter
#

holy shit the .rpt files are huge, how do you find what you are looking for?

indigo snow
#

you look at the bottom

ivory nova
#

don't control + f "error" lol

limpid pewter
#

^

ivory nova
#

yeah scroll to bottom

indigo snow
#

errors are logged at the end

#

if it gets too large i sometimes just delete all the contents and go from there

little eagle
#

you look at the bottom
You read them from top to bottom.

indigo snow
#

read the top, look at the bottom then

#

well compromise

little eagle
#

No, you look at the bottom last, because it's at the bottom.

limpid pewter
#
  • < aghhhhhh
little eagle
#

The first error can cause all kinds of follow up errors. Why would I want to fix the follow up if I can just fix the initial error?

limpid pewter
#

My .rpt file is 88774 lines long : (

ivory nova
#

I have CfgFunctions including functions.hpp, which lists this borked function, it also lists other functions though, which seem to work, any idea why that might happen?

indigo snow
#

typo? file in wrong folder?

#

been editing in the wrong folder?

ivory nova
#

had checked that, but will double check

limpid pewter
#

@ivory nova what is borked about it?

little eagle
#

Check the ingame functions viewer if the function is defined. missionConfigFile.

#

what is borked about it?
About 88000 things.

ivory nova
#

hm, you're right, it isn't in there

#

weird!

indigo snow
#

have you reloaded your mission in the editor?

#

i dont remember if arma refreshes the description.ext

ivory nova
#

oh, that did it

little eagle
#

Restart doesn't update configs afaik.

ivory nova
#

phew

#

thank you for the help!

#

yeah it's in the config viewer now, awesome

#

you're the best

limpid pewter
#

when i edit a multiplyer mission i have to go back to editor, save then reload in each time i want to update my functions, is that what you mean?

indigo snow
#

everytime you make changes to the description.ext, yea

#

or preview it works too iirc

little eagle
#

Only config, scripts are loaded after Restart too.

ivory nova
#

TIL!

limpid pewter
#

everytime i make changes to a fucntion as a file i have to do that too -_-, do you guys know a secret around this do you?

indigo snow
#

you dont

#

only when you change the description.ext and thus the missionConfigFile

little eagle
#

Maybe you need -filePatching for that? Idk.

indigo snow
#

i think thats just for addons

little eagle
#

That's what I thought.

limpid pewter
#

wait,so you're telling me that for the past year, i have wasted 50 hours+ reloading the mission each time i change a function?

indigo snow
#

maybe

limpid pewter
#

+_+

little eagle
#

I reloaded missions and the game so many times that I decided to just stop making errors.

indigo snow
#

thats why i normally define functions inline in init.sqf or something when making missions, then move everything to cfgFunctions wrapping up at the end

limpid pewter
#

i know BIS has a function that recompiles (BIS_fnc_recompile), but afaik that only works for singleplayer

ivory nova
#

@little eagle lol!

indigo snow
#

thats a different thing

#

that updates your functions while youre in a mission

limpid pewter
#

^

#

exactly what i meant that i needed

cosmic kettle
#

I work local

#

Recreate half the server idc

little eagle
#

Could also just set up the mission in a way that it works in SP and MP, so you can test in the SP editor.

cosmic kettle
#

I saw this when lookin at TFR iirc

#

never went back to something else

limpid pewter
#

yeah but i have about 20 diffrent functiosn that need to run on server for local functions to work

little eagle
#

And? In SP, you are the server.

cosmic kettle
#

20? i suggest now is the time before it reaches 200

little eagle
#

Just have to avoid isDedicated and use isServer instead.

cosmic kettle
#

isServer and hasinterface, right?

little eagle
#

Yes.

cosmic kettle
#

i member

little eagle
#

Good.

#

It's still true.

still forum
#

Discord!

cosmic kettle
#

Spend enough time here and commy drills things into yur head ^^

limpid pewter
#

So i mean if you load into arma, then you go "edit" and make a mission, that is SP. MP is when you host a server on LAN, then edit from there. That;'s what i understood

little eagle
#

He's just a troll, Dedmen, and doesn't actually give af about them. Just another line of attack.

#

Deflection.

#

just ignore.

cosmic kettle
#

@limpid pewter in 3DEN, you are server and player

still forum
#

@tough abyss Are you a child? People who ignore #rules and spam in like half a dozen channels deserve to get banned. Not get rewarded for breaking rules.
Also. Commy actually answered his question twice. He didn't ask how.

limpid pewter
#

@cosmic kettle No matter whether you edit in SP or MP?

still forum
#

I just arrived. I see there is a TFR up there. What's going on right now.
Btw @cosmic kettle it's TFAR*

cosmic kettle
#

Cries in corner knew it

little eagle
#

All I want is, that someone replies with "How?" instead of getting offended, or getting someone else offended in his stead.

#

It's a good way to measure how engaged they actually are.

cosmic kettle
#

@limpid pewter Having trouble with what you're saying, no matter what you do, in 3den, you are server. so everything will work as is, apart from things like playableUnits etc...

limpid pewter
#

k

little eagle
#

There always is one machine with isServer being true. In single player, there is only one machine. Therefore, your machine is the server in single player.

still forum
#

I'd say the fact that he spammed his message in multiple channels and then didn't reply to any of the answers he got within about a minute of him asking.. Shows how engaged he really is 😄

limpid pewter
#

ok, thanks