#arma3_scripting

1 messages · Page 495 of 1

compact maple
#

You could add that EH in another EH, never tried it before

signal pulsar
#

tbh ive been coding in arma for like 3 weeks but ill try

#

i didnt even know what EH was until 10 min ago

#

so i need to figure out how to execute code only when player is in vehicle

#

?

compact maple
#

nevermind forget what I said

#

Well

signal pulsar
#

hahaha lol

#

also i dont want to use the version from the code that person sent me its not mine. sqf (vehicle player) addEventHandler ["IncomingMissile", { titleText ["SHOT", "PLAIN"]; }]; I could use this format and it would work?

compact maple
#

Yes

#

sqf need to be on the same line without space

signal pulsar
#

im so dumb

#

this discord formatting tho

compact maple
#

markdown syntax

signal pulsar
#

oh okay lol

signal pulsar
#

okay whatever i dont care i cant do markdown properly

#

just want to learn how to code this stuff really

compact maple
#

lmao

#

Well thats not really complicated

#

you got the code

#

But idk how you could assign it to a vehicle

signal pulsar
#
playSound "warning";
(vehicle player) addEventHandler ["IncomingMissile", {
    [parseText format["<img size='0.52' image='exile_assets\texture\mod\icon.paa'/><t color='#e5e7ea' size='0.6' font ='PressStart2P' shadow = '1'> MISSILE INCOMING</t><br/>"],-1,-0.2,1,1] spawn bis_fnc_dynamictext; 
}]; ``` how could i remove all the parts from the code i sent?
#

so that it still uses the parsetext format

#

like i dont wanna use his code

compact maple
#
(vehicle player) addEventHandler ["IncomingMissile", {
    titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true];
}];
signal pulsar
#

Thank you so much

#

now i will google the shit out of this

compact maple
#

didnt test it tbh

#

google what ?

signal pulsar
#

how to apply eventhandler to vehicle

#

or whatever

compact maple
#

well tbh go into a vehicle, copy/paste the code in the console debug, exec local it

signal pulsar
#

i mean only when player is in vehicle **

compact maple
#

but in your mission

signal pulsar
#

how do u actually exxec code w infi

compact maple
#

Idk how we could do

#

wait until some vet answer you

signal pulsar
#

ok thanks

compact maple
#

w infi ?

#

infistar?

signal pulsar
#

infistar

#

ye

compact maple
#

You cant execute local code ?

#

I'd say disable infistar lmao

#

this is so old

signal pulsar
#

what is infistar?

compact maple
#

thats an "anti-cheat"

#

actually hackers used to pay the creator lmao

#

well maybe quicksilver know the answer about that EH

signal pulsar
#

who chris? idk whats true and what isnt but anythings possible

#

honestly infistar is more of an admin tool than anything

#

you have to know how to spot the hackers and dupers

#

look up like 20 messages in chat?

#

incoming missile

#

yessir

#

i dont know how i would implement that into the code so it actually functions?

#

sqf (vehicle player) addEventHandler ["IncomingMissile", { titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true]; }]; like how to put this into use

#

fuck i cant markdown to save my life

#

ok i guess maybe i should ask then

#

how do i put EH into action?

#

how do i call them

compact maple
#

Lol i tought about that too but in my head it was like "addind an EH every time a player enter a vehicle is bad"

#

didnt tought about that delete eh

#

getIn is for vehicle I guess

#
player addEventHandler ["GetInMan", {
(_this select 2) addEventHandler ["IncomingMissile", {
    titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true];
}];
}];


player addEventHandler ["GetOutMan", {
    player removeEventHandler ["IncomingMissile", 0];
}];
#

oh sure

#

@signal pulsar well you have to create a file that is called when the player connect

signal pulsar
#

ok so this is all really helpful

#

ok thats my question

#

ty

#

so like if im running exilemod

#

could i attach this to initplayerlocal?

compact maple
#

sure

#

But Im not sure about the removeEventHandler part

#

(the index part)

signal pulsar
#

alot of this is going over my head unfortunately

compact maple
#

could you give us the exemple quick

signal pulsar
#

instead player addeventhandler?

#

but hey ty for answering questions i am learnig alot

compact maple
#

@signal pulsar well, if we add an EH when the player enter a vehicle, we need to make sure that this EH is deleted when the player get out, other wise you're going to have xxxx active EH.
but to delete the right EH we need the index

#

thank you

tough abyss
#

removeAllEventHandlers no need to save variable

signal pulsar
#

i feel like theres soemhting im missing here because you three kinda lost me there /:

compact maple
#
player addEventHandler ["GetInMan", {
(_this select 2) addEventHandler ["IncomingMissile", {
    titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true];
}];
}];

player addEventHandler ["GetOutMan", {
(_this select 2) removeAllEventHandlers "IncomingMissile";
}];
#

thanks M242 lol

tough abyss
#

Yeah like this

compact maple
#

thats tricky and hope @signal pulsar doesnt have other EH

#

should do the work

#

but the script quick posted is nice

#
private _vehicleEventHandlers = [];
        {
            _vehicleEventHandlers pushBack [(_x select 0),(_vehicle addEventHandler _x)];
        } forEach [
            ['Local',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventLocal')}],
            ['Killed',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventKilled')}],
            ['Hit',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventHit')}],
            ['HandleDamage',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventHandleDamage')}],
            ['IncomingMissile',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventIncomingMissile')}],
            ['Fired',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventFired')}],
            ['EpeContactStart',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventEpeContactStart')}],
            ['Engine',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventEngine')}],
            ['Fuel',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventFuel')}],
            ['Deleted',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventDeleted')}]
];
signal pulsar
#

i dont think i have any other EH

#

but okay so where would i want to put these then?

#

make a file and call it mission side?

compact maple
#

Yes

#

Create a file, name it as you wish, then call in whatever init you want to

#

Well you could execVM it ?

signal pulsar
#

should i call it in initplayerlocal after client is loaded in?

compact maple
#

Sure

signal pulsar
#

sorry u guys are having to ELI5 this

compact maple
#

eli5 ?

signal pulsar
#

explain like im 5

#

subreddit

compact maple
#

lol its ok

signal pulsar
#

well to me it seems like ur method would be the best no?

compact maple
#

its never the best

signal pulsar
#

i am a simpleton rn true

compact maple
#

and btw @signal pulsar this discord is very good to get started, bc people always talk and debate about things, scripting, optimization...

signal pulsar
#

okay i copied what 3rk suggested to my init

#

gonna reboot and try

compact maple
#

add a hint too in case of titleText doesnt work

#

lmao

signal pulsar
#

am listening

#

yes

compact maple
#

logs are precious

signal pulsar
#

been coding arma for a long time like 5 yrs just never got into understanding what i was reading ya know

#

i started with a2 overpoch

#

and this time around im trying to learn

#

what everything means so i can start writing my own stuff

compact maple
#

arma is very satisfying when you got a "ok" lvl

signal pulsar
#

also quick question u said add title text?

compact maple
#

you can do what ever you want in the game

#

I said add a hint before the title text

#

In case I messed up something with the <t </t> tags

signal pulsar
#

or no

#

sorry ishould be more clear

#

where in the updaded EH code u sent me would i wanna add the hint

#

ok wait

#

yeah nvm im lost

compact maple
#

Just before the titleText part 😄

signal pulsar
#

i didnt even add any of that to the code

#

i thought id only need the part that i could put in my initplayerlocal

#

do i also need to include ``` player addEventHandler ["GetInMan", {
(_this select 2) addEventHandler ["IncomingMissile", {
titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true];
}];
}];

player addEventHandler ["GetOutMan", {
(_this select 2) removeAllEventHandlers "IncomingMissile";
}]; ```

#

do i need to include that event handler too?

#

ok nvm

#

im so dumb

compact maple
#

? xD

signal pulsar
#

i think i understand what ur saying

#

let me show u and u tell me if im gright

#

so i learn

compact maple
#

alright

signal pulsar
#

titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true]; adding this to ['IncomingMissile',{_this call (missionNamespace getVariable 'QS_fnc_clientVehicleEventIncomingMissile')}],

#

?

compact maple
#

what

signal pulsar
#

ok yeah im just dumb

compact maple
#

1 - Create a new file
2 - Paste the following in it :

 player addEventHandler ["GetInMan", {
(_this select 2) addEventHandler ["IncomingMissile", {
    hint "lol";
    titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true];
}];
}];

player addEventHandler ["GetOutMan", {
(_this select 2) removeAllEventHandlers "IncomingMissile";
}]; 

3 - Call the file you just created in initPlayerLocal.sqf

hollow thistle
#

@tough abyss what is the reason for missionNamespace getVariable in your example?
Event handlers are executed in mission namespace by default, ...['Local',{_this call QS_fnc_clientVehicleEventLocal}],...this would be enough and it would be more readable IMO.

compact maple
#

thank you

signal pulsar
#

it didnt work

#

obviously i did something wrong

#

or im not understanding

#

i dont understand where to add the hint or titletext

compact maple
#

@signal pulsar I just gave you the code you have to copy

signal pulsar
#

i put it in my initplayerlcal

compact maple
#

Yes

#

and thats all

signal pulsar
#

oh u posted a new thing while i was tabbed into game testing it

#

i see

#

let me try

compact maple
#

Helmet-cam live feed. Players at base can watch a live feed of operations.

#

thats cool

signal pulsar
#

i did exactly as u said

#

it didnt work @compact maple

#

thats my initplayerlocal

compact maple
#

sorry but I dont see my code in that file

signal pulsar
#

you said to call it in its own file @compact maple

compact maple
#

yes sure

#

what line is it

signal pulsar
#

all the way at the bottom

#

call compile "overrides\incomingmissile"

#

some thing like that

compact maple
#

[] call compile preprocessFileLineNumbers "Overrides\IncomingMissile.sqf";

#

replace it by

#
[] execVM "Overrides\IncomingMissile.sqf";
#

btw how are you testing it ?

signal pulsar
#

llol on my test serve

#

i ocpied my whole liver server

#

to another folder rename test

#

new DB

#

exactly like how the real server setup

#

i will try this ``` // Compile all the things!!
{
_code = "";
_function = _x select 0;
_file = _x select 1;
_code = compileFinal (preprocessFileLineNumbers _file);
missionNamespace setVariable [_function, _code];
}
forEach
[

["IncomingMissile","Overrides\IncomingMissile.sqf"],

]; ```

#

@compact maple u thunk that will work?

compact maple
#

uuh

#

no

#

never saw that before

signal pulsar
#

thats how its being compiled by the dude whom gave me his file

compact maple
#

well idk

still forum
#

Sure that'll work. It's basically poor mans CfgFunctions

signal pulsar
#

@compact maple dont know if ur still around but still no dice

#

no matter which way i try to call the file

compact maple
#

@signal pulsar try it in debug console

signal pulsar
#

ive never used armas default debug editor guess its time for me to learn that too

tough abyss
#

What’s to learn, paste code and press execute button

compact maple
#

but yea check your CfgFunctions too

#

your functions.hpp

still forum
#

Why? No need to check CfgFunctions if you know there's nothing in there

compact maple
#

Why would it be empty ?

still forum
#

He put his function into initPlayerLocal as he said. And the guy who made that framework has his own method to compile functions, as he said. So why would the guy who made the framework use his own method AND CfgFunctions.
And why would he put his function into initPlayerLocal AND CfgFunctions while he probably doesn't even know that it exists.

compact maple
#

I dont know how the framework works

#

Didnt know that

still forum
#

He wrote that it does that. Right in this channel

tough abyss
#

expecting people to read
Good one

signal pulsar
#

ive just never used the debug console is what im saying

#

do u access it in the map editor?

tough abyss
#

You've never pressed 'escape' before?

rough cradle
#

lol

signal pulsar
#

yeah but u cant on the live server

tough abyss
#

You can if you're in CfgAdmins.

signal pulsar
#

ok kuplion

rough cradle
#

waves

tough abyss
#

You've never pressed escape in a single-player game before?

signal pulsar
#

yeah no i have nvm

#

ok

tough abyss
#

And you failed to notice that big-ass box that pops up?

#

🤔

signal pulsar
#

um no thats not what im saying

still forum
#

Seeing != using

signal pulsar
#

can u access on a live server running infi

still forum
#

you are a word

signal pulsar
#

ok so um once i execute this in the debug what do i want to be look for in whats returned

still forum
#

test whether your eventhandler works now.. I guess

signal pulsar
#

no it didnt work

#

sorry for late reply had to teach myself some things lol

tough abyss
#

Probably wouldn’t hurt to learn some basics before attempting to modify someone else’s mod

signal pulsar
#

okay but how is it someone elses? its being remade from scratch...

#

im not using their code at all

#

the concept yes maybe

tough abyss
#

You are trying to hook it up to their framework, no?

signal pulsar
#

no sir

#

quick was showing me his framework

#

but i am not attempting to use anyone elses code the person who made this script was pointing me in the right direction

#

bc what fun would it have been if he just gave me the code

#

he told me this: you have to add an incoming missile event handler to a player vehicle" and from their i just googled alot and been asking questions

tough abyss
#

It cannot be simpler

#

Get in vehicle, open debug console and copy paste code someone gave you here already

#

Do you know how to test it?

signal pulsar
#

well yeah i need someone to shoot a rocket at me

#

once i exec the code in debug

#

what i was asking earlier tho is can i do this with infistar debug bc i need a second person to shoot the rocket

still forum
#

you can do it with whatever can execute code for you

tough abyss
#

So what is the problem? Once you get it working from debug console then you can try to make it permanent

signal pulsar
#

@tough abyss went into to it in editor placed a bunch of AA ai to shoot me down which they did but nothing came up when i executed the code before hand

tough abyss
#

There you go so you are doing something very wrong

signal pulsar
#

is there a way i can find out why?

tough abyss
#

What code you executed in console

signal pulsar
#

@tough abyss i pasted this ```sqf
player addEventHandler ["GetInMan", {
(_this select 2) addEventHandler ["IncomingMissile", {
hint "lol";
titleText ["<t color='#e5e7ea' size='0.6' shadow = '1' font ='PressStart2P'>SHOT</t>", "PLAIN", -1, true, true];
}];
}];

player addEventHandler ["GetOutMan", {
(_this select 2) removeAllEventHandlers "IncomingMissile";
}];

#

pasting this version in the debug instead makes the message popup but still need to go about adding it to Getin

#
 private ["_vehicleObject"];
_vehicleObject = _this select 0; 
playSound "warning";
[parseText format["<img size='0.52' image='exile_assets\texture\mod\icon.paa'/><t color='#e5e7ea' size='0.6' font ='PressStart2P' shadow = '1'> MISSILE INCOMING</t><br/>"],-1,-0.2,1,1] spawn bis_fnc_dynamictext;  ```
arctic veldt
#

You want to assign the eventhandler for incoming missile to the vehicle

signal pulsar
#

yeah im trying to figure out how to do that right now in a way that works

#

because they were trying to show me above @arctic veldt but um i couldnt get it working

#

getin getout

#

theres a serverside file: ExileServer_object_vehicle_event_onGetIn not sure if it would be affecting what im doing

tough abyss
#

The code you posted works for me, so as I said you are doing something wrong

#

Are you adding the code while you are in a vehicle?

signal pulsar
#

when u say the code works for you which of the two the top or bottom? @tough abyss

#

im trying to figure out how to make add only when u get in

tough abyss
#

Top

signal pulsar
#

i pasted the top code into my debug

#

and got shot by a rocket

#

and it did nothing.....

#

clearly im just autistic

tough abyss
#

Were you in vehicle when you executed code?

signal pulsar
#

no

tough abyss
#

No idea, then

signal pulsar
#

i shouldnt need to right isnt that what the get in get out is for?

#

like thats the whole point

tough abyss
#

Yeah it should add itself when you get in

signal pulsar
#

ive re read everyones messages like 3x over now

#

maybe im missing something

tough abyss
#

Try vanilla, leave only hint

#

Get rid of titleText

signal pulsar
#

so i shouldnt go into editor with servers modlost loaaded on client?

tough abyss
#

Try without any mods

#

The only way to debug is to get clean mission

#

Or you could be guessing forever why it doesn’t work

signal pulsar
#

were making progress! @tough abyss so um without titletext and all that it worked

#

it said lol right before rocket hits

tough abyss
#

It should say it when rocket is fired, get some distance

signal pulsar
#

mayne im just too close to AI less than 500m

#

its just idk how far the AI will attempt to lockon or shoot

#

ok yeah so i got it working but if im hella close to the AI it delays too long

torn juniper
#

you cannot stack getIn so what you are trying will not work

signal pulsar
#

wdym by stacking it

#

also your right @torn juniper it didnt work on the live server only in the editor

#

i think it has to do with not executing the code right

#

because i can paste it into the debug like i said and it works fine but implementing into the live server code

#

is where i have an issue.

random estuary
#

@signal pulsar is that code from my mission file? 😂

#

You're missing server sided stuff which I run in a server pbo

signal pulsar
#

i think i figured it out

#

and also plz read up in chat before saying im using ur code omy server

#

cuz im not and happy to prove this to you

#

i think snow messaged you the other day if your MGT dave right? @random estuary

random estuary
#

Yes

high marsh
rough cradle
#

🍿

random estuary
#

Press2start is an Exile exclusive font that I use in my mission file for incoming missile event handling, it's all good, you can learn how to do it now

signal pulsar
#

i was looking for you today i joined ur discord was gonna ask u bout it but coudnt find ur name

exotic tinsel
#

i have a question about spawning enemy ai and mortar. do i spawn the ai and the mortar object separate and then tell the ai to get in or something on the mortar?

random estuary
#

Just add the event handler where vehicles are spawned and make sure any info you pass client > server and vice versa is whitelisted for remoteexec

rough cradle
#

It’s all well and good attempting to reach out to the people you stole from 😂

tough abyss
signal pulsar
#

how did i steal his work? im not using any of his code man i just told you i was looking at it to learn

ebon sparrow
#

Hello

exotic tinsel
#

@tough abyss thanks mate

rough cradle
#

He’s just shown you how.

ebon sparrow
#

I have a problem to disturb.

high marsh
#

Disturb at will

rough cradle
#

You tried to steal it, as is evidenced by the code being the same as that by @random estuary . You were just too dumb to admit it.

ebon sparrow
#

Now I'm adding voice to Altis city.

#

Like ambient noise to add atmosphere

high marsh
#

Ok.

#

Chris already answered your question

ebon sparrow
#

I should tell you that I might have a communication side.

#

I Am Thai

high marsh
#

A language barrier? Ok, what are you confused about?

ebon sparrow
#

Is the connection of objects to the origin of the sound.

#
{
    sounds[] = {};

    class africancity
    {
        name = "africancity";
        sounds[]={sfxsound};
        sfxsound[]={"sound\africancity.ogg",15,1,18,1,1,1,0};
        empty[]= {"",0,0,0,0,0,0,0};
    };```
#

I do not know how to go.

#

But I do not understand the correct work.

high marsh
#
createSoundSource[
    "africancity",
    getPos player,
    [],
    0
];
ebon sparrow
#

Is this what you want me to put in the stuff?

high marsh
#

This will create the source at player, if you want it elsewhere then reference the object or it's position.

ebon sparrow
#

Oh i have it but i do not understand

signal pulsar
#

hey @rough cradle id send u this screenshot about relavent things but i think u blocked me... what a shame.

ebon sparrow
#

Or maybe it's because of the different languages I try to understand.

#

haha

#

What I understand now is the origin of the sound.

high marsh
#

Yes, it's playing the source

ebon sparrow
#

And let me put it down to lnit.

#

I understand it right?

high marsh
#

Init wherever you'd like, the init.sqf works just fine.

ebon sparrow
#

Okay

rough cradle
#

Why would I want a screenshot from you? 😂

ebon sparrow
#
    {
        items=1;
        class Item0
        {
            position[]={3630.2627,17.24,2505.4241};
            name="West";
            text="West";
            markerType="RECTANGLE";
            type="Empty";
            colorName="ColorWEST";
            a=500;
            b=500;
        };
    };
    class Sensors
    {
        items=584;
        class Item0
        {
            position[]={5920.9106,14.246628,3313.363};
            a=30;
            b=30;
            angle=-90.1884;
            rectangular=1;
            activationBy="WEST";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            expCond="";
            class Effects
            {
                soundDet="sfxsound2";
            };
        };```
#

I did it with a mission, but I'm not sure it works.

signal pulsar
#

@rough cradle after thinking about it further im going to try to add this to a file careful createvehicle to the EH is put on from the get go

#

so it does it on vehicle creation?

rough cradle
#

😂

signal pulsar
#

so exile network messages

exotic tinsel
#

im trying to spawn in an enemy mortar and make it fire at nearby bluefor. this works

_mymortar = createVehicle ["O_Mortar_01_F", getMarkerPos "marker_0", [], 0, "NONE"];
    createVehicleCrew _mymortar;    

but this doesnt make then shoot

_mymortar setCombatMode "RED";
    _mymortar setBehaviour "COMBAT";
#

anyone know how to make the enemy mortar fire on bluefor?

agile anchor
#

hi i'm trying to run a loop when a player runs into trigger that will spawn fire on him until he kills a specific unit. I've tried and failed with various ideas here is my latest attempt am I any where near? while {true} do { loop = 0 spawn { while {true} do { this = "test_EmptyObjectForFireBig" createVehicle (getPos P1); sleep 3; }; }; if (!alive C1) then {breakOut "loop"}; sleep 1; };

exotic tinsel
#

rgr

open vigil
#

FYI, rule of thumb is to ask before using someone else's stuff. (this is not directed at anyone in particular, but it is a warning)

quasi rover
#

I'd like to get the base position which has the shortest distance from pickup place to some bases:"base_A", "base_B", "base_C".
Is there more concise expression?

//base_A, base_B, base_C, and _pickup

_aa = _pickup distance2D base_A;
_bb = _pickup distance2D base_B;
_cc = _pickup distance2D base_C;

if ((_aa < _bb) and (_aa < _cc)) then { 
    _spwanmark = getMarkerPos "base_A";
} else if ((_bb <= _aa) and (_bb < _cc)) then {
    _spwanmark = getMarkerPos "base_B";
} else {
    _spwanmark = getMarkerPos "base_C";
};
quasi rover
#

thx, @ruby breach

neat ridge
#

so, if I'd like to check if all players are in one or two vehicles, would I put something like this in the condition of a trigger? (players are not grouped) ```
{alive _x && vehicle _x in (plane_1 && plane_2)} count playableUnits == {alive _x} count playableUnits

Or am I missing what Im trying to do completely here?  

😃
dim token
#

Quick question. If you call compileFinal with the same string value, is the resulting code cached and returned on the 2nd call onward without recompilation, or do you need to implement a cache yourself to avoid recompiling it on successive calls?

waxen tide
#

anything like "find" or "in" for subarrays?

cedar kindle
#

@dim token do you have an example of what you mean?

neat ridge
#

thanks Quiksilver ❤

still forum
#

@rough cradle if you take code that someone publicly posted to be taken and used by anyone. That's not stealing.
@dim token no. You need to cache yourself. Or just use CfgFunctions if that's what you need

#

@waxen tide or findIf I'm assuming BIS_fnc_findNestedElement is not using findIf and is using something very old with according performance

tough abyss
#

(allPlayers - crew plane1 - crew plane2) isEqualTo [] @neat ridge

rough cradle
#

@still forum That’s not what happened. He joined someone’s server, downloaded their mission file, then took code from it, not realising the server owner had protected his code by utilising a server side component too.

quasi rover
#

No need to use every saveProfileNamespace each time profileNamespace setVariable is used?
only last saveProfileNamespace is enough?
e.g.

if (isnil "_locselpos") exitWith {
    profileNamespace setVariable ["SAVE_OBJARRAY", nil];
    saveProfileNamespace;
    profileNamespace setVariable ["SAVE_MILARRAY", nil];
    saveProfileNamespace;
    profileNamespace setVariable ["SAVE_OBJMARK", nil];
    saveProfileNamespace;
    finish = true; publicvariable "finish"; diag_log format ["TASK LOCATIONS END PAST LOOP %1", ciy_objarray];};
still forum
#

once is more than enough yes

#

Also use tags for your variables. To make their names unique

#

Some vanilla script that's running atleast on client, continuously executes saveProfileNamespace. That script doesn't seem to run on a server though

#

saveProfileNamespace flushes all variables to file. So you need to do it alteast once

queen cargo
#

Some vanilla script that's running atleast on client, continuously executes saveProfileNamespace. efficient way to destroy ones SSD

quasi rover
#

thanks, guys. 😅

unborn ether
#

@queen cargo If to compare to what Windows does on the background - this is just a tiny bit of harm caused to your SSD.

#

But yeah, still not an excuse to using that much.

queen cargo
#

there is never any reason at all to save more then needed @unborn ether

#

this might even cause game hangs depending on how the saving is implemented and HD speed

quasi rover
#

and @still forum , what it means? use tags for your variables. To make their names unique

queen cargo
#

TAG_YOURVAR @quasi rover

still forum
#

barnes_myVariableName instead of just myVariableName

quasi rover
#

I did it SAVE_OBJARRY no?

still forum
#

SAVE_ is not really a good tag though. Many people save things

quasi rover
#

Aha.. thanks again.

hexed obsidian
#

Is there anyway to make a passenger seat able to use a gun
For example the quad bike passenger

manic bane
#

@hexed obsidian 2xCtrl to use gun in some passenger seat.

hexed obsidian
#

I am talking about when it is otherwise not enabled see the example

still forum
#

not with scripting

waxen tide
#

@still forum Yeah thanks i think i can use findIf !

#

0.0001 more FPS on your FX

#

I wasn't being sarcastic.

still forum
#

0.0001 more FPS on Intel maybe.
2 FPS on my FX

waxen tide
#

It's actually 0 FPS since i moved that code into the setup thingy that pre-generates data for the mission and buffers it in profilenamespace - https://i.imgur.com/kcyAQnR.jpg

#

first i was annoyed waiting 15-45 seconds to calculate roadblock spots for each city, and then it's much simpler to have a list of locations with features attached (x roadblock spots, x houses of class "whatever" for which i have a composition to fortify, etc) and then pick one that suits the mission than to randomly pick and then check afterwards (which, if done at mission runtime, takes 15-45 seconds)

queen cargo
#

for whatever reason that reminds me of my insurgency mission 🤔

#

but scanning will always be required for that to work 🙈

waxen tide
#

scanning

#

???

queen cargo
#

i am in need of a list containing all houses in any given square

#

as object references

waxen tide
#

oh yeah sure.

queen cargo
#

to get building positions and alive status

waxen tide
#

that's actually reasonably quick

#

what hurts me is the A* search thru 175.000 road objects to find paths that need to be roadblocked.

queen cargo
#

well ... it is not really quick

#

you have to scan each available 1x1 km² square

waxen tide
#

the A* stuff takes 2-3 times as long as finding the houses i need (which is a list of classnames of houses for which i have a composition to spawn into, and any house with buildingPos defined to randomly put some soldiers in those)

queen cargo
#

but it should be kinda readable to anybody (actual C notation, object based, SQF ... are raw SQF commands in COMMAND(LEFT,RIGHT) syntax)

still forum
#

" buffers it in profilenamespace" why? Why fill profilenamespace with garbage.
Why not cache in uiNamespace?

waxen tide
#

i could also just manually safe an *sqf file which contains nothing but 1 huge array like Amaury did if that makes you happier 😛

#

what's the difference between ui and profile namespace?

queen cargo
#

i guess the caching happens serverside? what about some callExtension for it?

waxen tide
#

it's entirely serversided, and it's not garbage but rather core data for literally everything ever spawned.

queen cargo
#

he ment that you bloat the profileNamespace file with that for no reason but to cache
and that there are better solutions

waxen tide
#

like?

queen cargo
#

like using an extension and saving actual cache files somewhere on the server

waxen tide
#

meh

#

would only consider that if there is some properly documented stuff that works out of the box

#

there are a lot of very scary points on that todo list of mine

#

i only know of the database stuff dayz people used in arma 2 days

#

and i would consider that overcomplicating things

#

would tbh rather do a copytoclipboard and paste it in some file, it's not like this needs to be done all the time, ideally it needs to be done once per map.

still forum
#

uiNamespace get's cleared at game restart. profileNamespace is saved and shouldn't really be bloated with crap.
It's probably enough to generate the cache once at game start and save it to uiNamespace

waxen tide
#

generating the cache takes like, idk, an hour?

still forum
#

wuht

queen cargo
#

if it really is that long you should consider making it mandatory to be inside of the mission itself Oo

still forum
#

in unscheduled?

queen cargo
#

and improving the god damn method

waxen tide
#

😄

#

i've spend several 100 hours on that already

#

this is like the 50th version of that script

#

and it's still not as clever as i would like

#

It's not worth it to improve that code performance wise, especially since i'll run it ONCE per map and safe the result in a lookup. If anything, i'll probably make it slower by adding more checks to come up with cleverer positioning.

queen cargo
#

--> making it mandatory to be inside of the mission itself Oo

#

stop even consider any namespace

#

and put it into the map as script file

unborn ether
#

@waxen tide Unscheduled. Scan in preInit (if scanning map). No profileNamespace.
End of the message.

waxen tide
#

it's a 1600km² map, it's still gonna take ages.

queen cargo
#

CACHE = call compile loadFile "mymission/mapinfo.sqf"

waxen tide
queen cargo
#

so that is the reason

#

you run path calculations inside of SQF

#

you are insane
that is the actual problem

waxen tide
#

yeah i talked about that here a few times

queen cargo
#

aka: problem solved

waxen tide
#

no it's not the problem, it's the solution.

#

i've tried 50 different approaches without path calculations, and it all failed. now with paths everything is splendid.

queen cargo
#

solution is some external tool you would pase that simple scan data inside
instead of processing it in SQF

#

because processing the ammount of data in SQF takes ages

waxen tide
#

it's not an issue, the map author so far updates every ~6 months 😛

queen cargo
#

not for you personally maybe
but there might be a shitton of ppl out there who do not really like to imagine having arma open for hours just to get something working on any map they like

#

TL;DR: Your user experience is horrible

waxen tide
#

my user experience is people playing on our server.

queen cargo
#

🤦 and then those theoretical people using that for their mission which are not on your server

#

also, callextension could save you here again
by speeding up the whole process by a magnitude

waxen tide
#

i have like 20% of my immediate todo list done

#

i'm not going to learn how to write a DLL to speed something up that runs automatically withhin an hour 2x per year on my pc while i watch a movie.

#

totally wrong priorities.

#

besides on like stratis it's like <5 minutes

#

this is a 40x40km map

queen cargo
#

generating the cache takes like, idk, an hour?

waxen tide
#

for the current map i intend to use.

queen cargo
#

besides on like stratis it's like <5 minutes

still forum
#

just executing your cache generation code in unscheduled should make it finish quiker atleast.

waxen tide
#

switching off the 50k debug markers it spawns and despawns should also help 😛

#

way bigger problems right now

#

i'm apparently too dumb to calculate a circle of coordinates

#

well, only half of the time.

#

Don't get me wrong, i'm extremely grateful this discord exists so i can ask my dumb questions and get incredibly good answers. Without this discord as ressource i wouldn't be scripting what i'm scripting. But currently performance optimising this basic stuff that works and is no immediate issue is just not high on the priority list. especially since 9001 other things are on that list as well. Maybe in a year or so.

queen cargo
#

#define TYPE_HASH "#CBA_HASH#"
what on earth is this supposed to do?

#

my guess is that this is equal to 'CBA_HASH' or #CBA_HASH

#

and "enables" parsing of the inner string even though it is "secured" via "

still forum
#

it's just a identifier

#

it's literally the string "#CBA_HASH#"

queen cargo
#

okay ..

still forum
#

preproc doesn't run inside "" quoted strings

tough abyss
#

URL will be http:

queen cargo
#

besides: define foo(bar) #bar #abc
is the # in ArmA pp also only working on arguments?

still forum
#

That's a very good question.. It would make sense I guess. But on the other side I expect "no".
Can't test right now

queen cargo
#

neither me ... steam again invalidated my arma installation

#

means i am downloading everything right now again ❤ -.-

tough abyss
#

HDD failing?

queen cargo
#

nope

#

just steam being steam

tough abyss
#

Never had it

queen cargo
#

it tends to remove games from my installed list

gray thistle
#

Does anyone know why

_unit = _group createUnit [_asset, _position, [], 0, "NONE"];

results in a

16:24:39   Error position: <createUnit [_asset, _position, [], 0, "N>
16:24:39   Error Fremdfehler: Unknown enum value: "NONE"

even though that "NONE" is documented here:
https://community.bistudio.com/wiki/createUnit

queen cargo
#

@tough abyss could you check that quickly? the preprocessor question?

#

Test Scenario is as simple as putting this into a file:

#define foo(bar) #foo #bar 
foo(bar);```
and then just loading its content via `preprocessFile`
tough abyss
#

Hold on

still forum
#

holds @tough abyss tightly

queen cargo
#

moves closer to @still forum and @tough abyss

#

expected output is either "foo" "bar" or #foo "bar"

tough abyss
#

It fails

queen cargo
#

uhm ... wut?

#

preprocessing the file fails Oo

tough abyss
#

Yep

#

Lemmie check where

queen cargo
#

just wtf arma 🤦

still forum
#

Maybe because foo is the name of a macro. But you are not providing the correct number of arguments. But it should just ignore the thingy if it doesn't match argument count

queen cargo
#

ohh.

#

crap

#

indeed

#

though ... no

#
#define foo(bar) #foobar #bar 
foo(bar);```
#

should not make any difference

#

because then the whole thing would just be empty

tough abyss
#

Is #bar on the new line?

queen cargo
#

mhh?

tough abyss
#

Im on mobile

queen cargo
#

nope

#

macro all in one single line

tough abyss
#

So it is 1 line?

#

Ok

queen cargo
#

gimme a sec. adding line numbers

#
1. #define foo(bar) #foobar #bar 
2. foo(bar);```
tough abyss
#

"foo" "bar";

queen cargo
#

well ... crap
as expected 🤦

#

now the next question is: would it parse macros inside the stringify?

#
#define foo f o o
#define bar #foo 
bar```
#

if this now yields "f o o" i will be in trouble and mildly surprised

tough abyss
#

"f o o"

queen cargo
#

sigh

#

gonna fix my preprocesosr

tough abyss
#

Gonna break it to fix it?

queen cargo
#

my preprocessor currently also would yield the above though
but that is because i forgot to skip " stuff

tough abyss
#

Just don’t forget that // is treated as comment inside "" in define

#

Only in Arma

#

He only time it is not a comment when it is inside "" and not in define

#

'//123' will be treated as comment

#

Every time

#

And it doesn’t perform string concatenation "123" "456" will not result in "123456"

queen cargo
#

just fuck this shit ... ""BA_HASH""

#

finally ...

#

"assign a name" is way to vague

still forum
#

Well it does exactly that

#

assigns a name to the VM Context

queen cargo
#

so ... pretty much a nonsense command? or do i miss something here

still forum
#

read the note at the bottom

#

Also it shows up in the profiler under that name

queen cargo
#

if all it does is giving a spawned script handle a name it is a nonsense command to me

#

does it only applies to unscheduled?

still forum
#

no

#

apply*

queen cargo
#

and what happens in non-scheduled?

still forum
#

exactly the same?

#

Why should it be different

queen cargo
#

so the only visible effect then is in the profiling

still forum
#

Could be yeah. Can't think of anything else

tough abyss
#

Think it is used for error reporting in bis fnc error

still forum
#

also in general script errors.
file: filepath [scriptName]

queen cargo
#

that counts as "stuff SQF-VM will not do"

#

anyways ... i think i finally nailed the preproc

tough abyss
#

Dude, you can’t pick and choose

velvet merlin
#

is there a way to get all memory point names from a vehicle via sqf?

still forum
velvet merlin
#

most ACE people are not here

#

so meaningful thing to do

still forum
#

Why would ace people know more than the commands list on biki?

velvet merlin
#

i know the cmd list too

#

its about hacks, or additional params like with selectionPosition

still forum
#

Well you can just make a huge list of common mempoint names. And use selectionPosition to check them

velvet merlin
#

if ppl were satisfied with what BI provides, modding wouldnt haven gotten anywhere

#

atm my idea is to make an o2script to copy the desired points to res lod

#

but something native in sqf would be best for compatibility reasons

still forum
#

You could also just set them in a custom config entry

#

would need to get every modder to do it though to turn it into a standard

tough abyss
#

std::memory_points

high marsh
#

Or you could make tiny "patches" for requested mods

#

have them seperated out.

velvet merlin
#

custom config entry is the current approach. its OK but for compatibility reasons not that great either (for our WW2 setting the scope is limited though)

mint kraken
#

quick question, do variables reset/get removed if the unit aka player respawns?

high marsh
#

@mint kraken Shouldn't. Certain attributes like fatigue being enabled gets reset after respawn. But things like event handlers or variables shouldn't reset as long as it wasn't set on the player object itself

mint kraken
#

Ok, thanks!

wide hamlet
#

is there a way to get the value that is currently inside of a RscEdit box? I.e have a number input, and be able to forward that to a fnc

high marsh
wide hamlet
#

so ctrlText <id of rscedit here>

#

ty

high marsh
#

Yup, np.

runic surge
#

so there is a command for getting the 2d distance between 2 points

#

is there a pre-existing function to do the same for only a single dimension?

#

specifically relative to another object's position and rotation

high marsh
#

and work with the numbers returned from there directly. shrug

digital hollow
#

A single dimension just means subtraction, right?

runic surge
#

basically yeah

high marsh
#

I don't think it translates directly

runic surge
#

but for local coords it is a bit more complicated

tough abyss
#

Yeah abs and - @runic surge abs(x2 -x1) distance in single dimension

runic surge
#

x: 100, y: 200 vs x: 100, y: 100
the y distance would only be 100

tough abyss
#

distance2D will return 100

wide hamlet
#

I guess my next question is something stupid cause im having a brain fart here. How can i check if x,y,z characters are inside of a string

runic surge
#

distance 2d only ignores height

high marsh
#

@wide hamlet

getPos player in [[0,0]];
wide hamlet
#

thats an array though

high marsh
#

What are you saying then?

tough abyss
#

[100,200] distance2D [100,100] what does this return? @runic surge

wide hamlet
#

you ever have that thing where you know what you mean in your head but cant put it into words. thats where i am at. One sec let me see if i can explain this better

high marsh
#

No worries.

wide hamlet
#

basically i have a string right? it could contain numbers, letters, symbols etc. I want to only allow numbers so i am looking for how i could check that string for forbidden characters and return true/false or whatever else is needed. For example "100" would be ok but "100a" would return false

#

i thought there was a built in function for it. i could be wrong and might just have to go through the string one letter at a time with a for loop

high marsh
#

parseNumber

wide hamlet
#

parse number returns the first number i.e. "a100" would return 0

#

and "1a0" would return 1

digital hollow
#

You can do "abc" find "a", but you'll probably be better off stripping out [0-9] and seeing what's left.

runic surge
#

@tough abyss [100,200] distance2D [100,100] what does this return?
I mean if both the x and y values were completely different, I only want the y distance as if the two points were perfectly aligned on the x axis

#

bad example I guess

wide hamlet
#

thought find required an array in front not a string

digital hollow
#

Look at the page. there's an example for string.

runic surge
#

I could just use worldToModel and modelToWorld actually

tough abyss
#

Then you use the formula I gave you for whatever element of the position array you choose, x or y or z @runic surge

runic surge
#

I'll try it out

#

thanks

digital hollow
#

You can also try ["100abc", "0123456789"] call BIS_fnc_splitString

wide hamlet
#

right. Ok ty

tough abyss
#

What do worldToModel and modelToWorld have to do with 1D distance 🤔

digital hollow
#

Right? You just select the coordinate you want, subtract, and abs.

tough abyss
#

_isNumber = count (_testString splitString "0123456789") == 0;

#

Maybe

ruby breach
#

This is a slightly tweaked version of something I wrote years ago that may help @wide hamlet. There's probably a better way to write this, I just gave it a 5 minute pass and updated the really dumb stuff. ```sqf
private _input = param [0,"",[""]];
private _output = _input;

private _arr = _input splitString "";
private _replace = false;
private _nums = "0123456789" splitString "";

{ if !(_x in _nums) exitWith {_replace = true}; } forEach _arr;

if (_replace) then {
_output = [];
{ if !(_x in _nums) then {_x = ""}; _output pushBack _x; } forEach _arr;
_output joinString "";
};

_output

still forum
#

apply should make this alot easier I think

#

or select I guess

#

((_input splitString "") select {_x in ["0","1","2","3","4","5","6","7","8","9"]}) joinString ""; that maybe?

ruby breach
#

Looks about right.

wide hamlet
#

i ended up doing a for loop that goes through each of the characters in the string and checks that against an allowed characters string. Works like a dream. Im struggling with ctrlChecked now. It says it recieved a number when it expected a control. But the control of the checkbox is 2800 so im kinda confused there

#

ooh it wasnt looking for the idc.

still forum
#

private _isNumber = (str parseNumber _string) == _string
how bout that?

wide hamlet
#

ctrlChecked control what value is used for control

#

it isnt the idc..

still forum
#

A... Control.

#

Is used for... control.

wide hamlet
#

well yea lol

still forum
#

a idc is a number.

#

a number is not a control

wide hamlet
#

right. the control is the type right? i.e. CT_CHECKBOXES

still forum
#

No

#

that's a number too

wide hamlet
#

so ..wat

high marsh
#

displayCtrl

still forum
wide hamlet
#

ty. If you cant tell its my first jump into guis lol

#

which didnt offer much ngl

tough abyss
wide hamlet
#

well i need it to return either true/false to my function and currently it is always returning false no matter if it is checked or not

#

but changeing the fuction from ctrlcheck to cbchecked worked out

tough abyss
#

Why not add an onCheckedChanged eventHandler to it?

onCheckedChanged= "TRUEORFALSE = ( (_this #1) isEqualTo 1 );";

runic surge
#

is there a simple way to add a line break to an array between elements?

#

using endl adds an empty string

carmine abyss
#

Question _timer = diag_tickTime;

waitUntil {
sleep 1;
peepsWithVar = count (allPlayers select {_x getVariable ["resetDone", false]});
playersInGame = count (allPlayers select {_x getVariable ["nowInGame", false]});
peepsWithVar == playersInGame || diag_tickTime >= _timer + 30;
};

still forum
#

how do you display the string to see that endl adds a empty string and not actually a line break?

carmine abyss
#

Does that not work because I have the count stored in those variables?

still forum
#

I don't see why that code won't work

runic surge
#

@still forum I just copy to clipboard

still forum
#

only problem I see is that you should use local variables. Or global variables with tags

#

Also.
Why do you count and select. Instead of just count?

#

allPlayers count {_x getVariable ["resetDone", false]}

carmine abyss
#

I can do locals, but for some reason it skips right over that waitUntil loop, not sure if its throwing an error or its passing some how.

still forum
#

check RPT then

#

if it's skipping the waitUntil. Might be because you are running in unscheduled where you cannot suspend

carmine abyss
#

I did. This runs on a dedi server and theres was no errors

#

its called

still forum
#

call doesn't change scheduledness.

#

where do you call it from?

#

what's the origin?

carmine abyss
#

another called script

#

nothing is spawned

still forum
#

and from where is that called. And so on. Where does it start

carmine abyss
#

yes it loops between 4 sqfs

#

all use BIS_fnc_MP with call set to true

#

execVM*

still forum
#

that's unscheduled then. You cannot...

carmine abyss
#

["scripts\roundReset.sqf", "BIS_fnc_execVM", true, false, true] call BIS_fnc_MP;

still forum
#

What now. BIS_fnc_MP or....

carmine abyss
#

thats one of the commands

still forum
#

What are you doing that ^^

#

for one. BIS_fnc_MP is deprecated. You should be using remoteExec.
Second why do you use the execVM BIS function instead of the execVM command

#

execVM is scheduled. So sleeping is not a problem

carmine abyss
#

The server has all clients run that sqf

still forum
#

You just told me the code runs on server

#

now you tell me it runs on all clients

carmine abyss
#

Sorry for the confusion. The server runs 1 sqf has the clients announce a variable when its done, (waitUntil) then runs a sqf serverside only then that runs an sqf for all clients as well. rinse and repeat

#

2 run for clients and 2 runs for servers.

still forum
#

so the waitUntil runs serverside? how is that serverside script called. From a eventhandler? or init.sqf or another init script?

carmine abyss
#

yes

#

initially initServer

still forum
#

initServer is scheduled.. so that also shouldn't be a problem

#

did you try adding logging before/inside/after the waitUntil to check what exactly is going on there?

carmine abyss
#

I have a suspicion its because I am storing the counts in those variables instead of just comaring

still forum
#

nope

#

But as I said. You really shouldn't use global variables here

carmine abyss
#

I can change that, its no problem.

#

well TBH not exactly sure how to do that. I did check the rpt for script errors and found nothing

#

I have like no skills in debugging serverside stuff

still forum
#
private _timer = diag_tickTime;
diag_log ["entering waitUntil", _timer];
waitUntil {
diag_log ["waitUntil1", diag_tickTime];
    sleep 1;
diag_log ["waitUntil2", diag_tickTime];
    private _peepsWithVar = allPlayers count {_x getVariable ["resetDone", false]};
    private _playersInGame = allPlayers count {_x getVariable ["nowInGame", false]};
diag_log ["waitUntil3", diag_tickTime, _peepsWithVar, _playersInGame];
    _peepsWithVar == _playersInGame || diag_tickTime >= _timer + 30;
};
diag_log ["waitUntil exit", diag_tickTime];
high marsh
#

@runic surge parseText and <br/>

carmine abyss
#

oh i see just add the diag logs to figure out where we are in the code?

still forum
#

yeah. And what code is running when with what variables

carmine abyss
#

nice wonderful trick thank you

still forum
#

If it exits somewhere inbetween. You'll see it.
If some variable are not what you expect. You'll see it.
If everything works fine and the problem is elsewhere. You'll see it.
If you see anything. You'll see it.
If you see it. You'll see it.
You'll see it. You'll see it.
Cookie. Eat the cookie.
Eat it god damnit!

carmine abyss
#

thank you very much for that. I use this already but not to this extent

#

lol OK nice

#

Thanks man

runic surge
#

@high marsh most I can get that to do is add a second comma after every element in the array

tough abyss
#

You copy array to clipboard?

runic surge
#

_Composition = parseText (_Composition joinString "<br/>Next Line");
Or doing it that way just replaces the commas with the actual text "Next Line"

#

yes

tough abyss
#

You can’t

carmine abyss
#

how do we put a code box up?

tough abyss
#

Only strings can be copied to clipboard

carmine abyss
#

like how dedmen posted that code in a box

still forum
#

```sqf
<code>
```

runic surge
#

copyToClipboard str _Composition;

#

that gives me the array in the proper form

#

no quotes

carmine abyss
#

ty

tough abyss
#

How do you expect to see line breaks there?

still forum
#

are you pasting the result in notepad. Or something intelligent like notepad++?

tough abyss
#

Line breaks will be part of the array not part of string

still forum
#

notepad doesn't show \n linebreaks

runic surge
#

I am using np++

tough abyss
#

You need to split the resulting string with line breaks not add linebreaks to array and then str it

#

Str "" is """"

#

It will not parse linebreak

still forum
#

copyToClipboard (((str _array) splitString ",") joinString endl) are you trying to do something like this?

runic surge
#

I don't understand why it can't be done to something other than a string

#

that is almost it except I have subarrays within the main array

still forum
#

well this code doesn't care about subarrays

runic surge
#

also that gets rid of the commas entirely

still forum
#

it does everything

#

so you want to replace , with ,\r\n ?

#

copyToClipboard (((str _array) splitString ",") joinString ","+endl)

tough abyss
#

Join it with (",”+endl)

runic surge
#
[[1,2],[3,4]]

becomes

[
    [1,2],
    [3,4]
]
carmine abyss
#

Dedmen your my new gf

still forum
#

I'm a twink tho

carmine abyss
#

w/e

still forum
#

Not a fem :U

runic surge
#

pretty much the same thing tbh

still forum
#

split the main array. But not the subarrays? oof

tough abyss
#

What same thing, still no comas?

runic surge
#

that's why I wanted to add a linebreak to the array itself

#

if that makes any sense

still forum
#

How many subarrays do you have?

#

how many levels

carmine abyss
#

I found the issue because of you. It was the global variable problem. I had to pieces of code... '''sqf< test >'''

runic surge
#

depends on how many input objects there are

carmine abyss
#

''' test '''

still forum
#

Because if it would only be one level. You could just throw shit at it till it works like this:
copyToClipboard (((str _array) splitString "],[") joinString "],"+endl+"[")

#

@carmine abyss wrong quotes. Just copy mine

tough abyss
#

No splitString doesn’t work like that

carmine abyss
#
<test>
still forum
#

aww ._.

#

Intercept to the rescue ☝

tough abyss
#

Bis fnc splitString does I think

carmine abyss
#
<peepsWithVar = count (allPlayers select {_x getVariable ["deciderDone", false]});>
``` and
#
peepsWithVar = count (allPlayers select {_x getVariable ["resetDone", false]});
#

because they were global they kept the old value

still forum
#

I already told you to replace select with count Your code does too much stuff for no real reason besides you not knowing that count can be used with code

#

no that's not how that works

#

the loops probably were both running and overwrote eachother

carmine abyss
#

thats why it was going right through the waitUntil. the values were already equal.

still forum
#

but they don't "keep" values. That's not how variables work. no.

#

if you set a variable. It get's set.
It doesn't keep a previous value whenever it feels like it. You set it, the value changes.

carmine abyss
#

so say I assign var = 1 and re run that sqf does var already equal 1?

still forum
#

if var is a global variable yes.

carmine abyss
#

yep thats what I am saying. on the waitUntil isnt the condition run first?

still forum
#

no

carmine abyss
#

ah

still forum
#

code is ran from top to bottom

carmine abyss
#

even in for loops

still forum
#

it can't know which of your lines where each line returns a value is supposed to be a condition

#

scripting isn't magical

#

yes. even in loops. everywhere

#

it jumps back to start at the end of the loop. But code always runs from top to bottom

carmine abyss
#

but waitUntil has to have the condition at the bottom no?

still forum
#

not necessarily

#

it should yes.

#

Still. SQF is not that intelligent

carmine abyss
#

maybe i am thinking of c++

still forum
#

that also doesn't do that

carmine abyss
#

well then i have no clue what I am talking about 😃

still forum
#

If it would just execute the condition first. Then all variables that are supposed to be defined before the condition will be undefined. That just doesn't work

carmine abyss
#

true

#

alright let me look into this "select"?

still forum
#

Just remember to not use global variables if you don't actually have a need for global variables

carmine abyss
#

copy that

still forum
#

and always add private before you "create" a new local variable

carmine abyss
#

private for anti cheat purposes?

still forum
#

Otherwise you might overwrite already existing variables with the same name that you don't intent to overwrite

carmine abyss
#

i gotcha

still forum
#
_func = { _var = 3; };
_var = 5;
_parameters call _func;
//_var is now 3. wtf. Why does someone else change my local variables. What the hell is going on
carmine abyss
#

🌻 🌻 🌻 thats for you @still forum

#

I understand

#

Dedmen you a professional programmer?

still forum
#

I guess so.. yeah

carmine abyss
#

what helped you learn sqf?

still forum
#

I knew other languages before.
Started with "AutoIt". And I already knew C++ before I got really started with SQF.
But SQF is really easy to understand once you understood the lowest-level basics

carmine abyss
#

I started with SQF. It was rough. Then learned c++ and went back to SQF and it helped a lot.

still forum
#

I'm not a good comparison tho. I learn fast

carmine abyss
#

self taught ?

still forum
#

ye

carmine abyss
#

cheers

#

btw I have peepsWithVar and playerCount update during that waitUntil loop incase someone leaves the game it wont throw the numbers off

#

_playersInGame***

still forum
#

You could also get rid of the variables. And just move the code directly into the condition. But that hurts readability

wary vine
#

macro ?

still forum
#

polo

tough abyss
#

To hurt readability even more?

carmine abyss
#
waitUntil {
    sleep 1;
    count (allPlayers select {_x getVariable ["resetDone", false]}) isEqualTo
    count (allPlayers select {_x getVariable ["nowInGame", false]}) ||
    diag_tickTime >= _timer + 30;
};
``` like that?
still forum
#

😮 Didn't expect the isEqualTo optimization. But yeah

#

you still need to replace the select tho 😄

carmine abyss
#

I'm pro man

still forum
carmine abyss
#

checking...

still forum
#

oops. The code I sent you doesn't work. Mixed up condition and array arguments

carmine abyss
#

that explains why I was confused

still forum
#

I'll be relocating to my exhaustion recovery station. brb

carmine abyss
#

keep the flowers

waxen tide
#

So all the "pregenerating data for an hour in sqf on a 40x40 map" i got laughed at for yesterday? I have a question. So far my format for saving it looks like this:

[
location,
[roadblock_pos_1,roadblock_pos_2,roadblock_pos_3],    // variable length
[
    [[fortify_house_classname,[[building_pos,cover_eval],[building_pos,cover_eval],[building_pos,cover_eval]]]],     // variable length
    [[fortify_house_classname,[[building_pos,cover_eval],[building_pos,cover_eval],[building_pos,cover_eval]]]],    // variable length
    [[fortify_house_classname,[[building_pos,cover_eval],[building_pos,cover_eval],[building_pos,cover_eval]]]]        // variable length
] // variable length
];

This seems suboptimal to me. Is there a better way to handle the data?

high marsh
#
hint parseText format["Blah array : %1 <br/> Blah array : %2,_arr1,_arr2];
waxen tide
#

I think my question was shit. New attempt: Is there a better way than nested arrays to store such data ?

#

the plan is to have a set of requirements on each mission, like the need for 3 fortify_house_classnames to spawn 3 mission objectives in 3 houses. so i would do like

if (count (_array select 2) > 2) 

to see how many i got for each location, and then pick random from whatever passed the check.

wary vine
#

params ?

waxen tide
#

and maybe a second check because there is 5 building_pos required for 5 objects to be spawned, so i would need to count the subarrays too etc. Oh i hadn't thought of params! might be brilliant. but then we're still talking arrays, not some other newfangled magic.

#

really likes arrays

still forum
#

you try to find a array with atleast 3 entries?
Out of multiple arrays? use findIf to find it.
You know about selectRandom to select a random thing I guess? you can preFilter using select and filter out all arrays that are too short. And then selectRandom

waxen tide
#

no i am wondering if multiple nested arrays are the ideal form of storage or if there is an alternative i'm not aware of.

still forum
#

Also for the array storage. You could split it into multiple arrays of course. That won't really make it much better

waxen tide
#

and then use the index?

still forum
#

If you need to look up things by classname. You could transfer it to a CBA Namespace. Which will have Hashmap like O(1) lookup times. Instead of iterating arrays everytime

#

Yeah. I guess.

carmine abyss
#

Dedmen have you made any mods or missions?

still forum
#

You can also after you load the cached data. Split stuff like
BuildingData = _bigArray select 0;
fortifyData = _bigArray select 1;
So that you can refer to these. Instead of always having to select the subarray first

waxen tide
#

the basic idea is to have a loopup table of pre-calculated data for each location, so i can pick locations by criteria a certain mission has.

wide hamlet
#

is there a way to simulate a player for MP type testing'

still forum
#

@carmine abyss I'm currently maintainer of Intercept and TFAR.
Made a couple Intercept based mods. Did some work on CBA/ACE.
Don't really have a completely self made mod that's public

waxen tide
#

well to match a mission to a location i kind of have to evaluate all the locations, and sort out the ones that match my criteria, and then randomly pick one.

carmine abyss
#

nice credentials though

still forum
#

if you wanna see what I do. Check my github/dedmen.

#

What kind of criteria?

carmine abyss
#

must be bitcoin

still forum
#

If you have a pre-determined set of criteria. You could filter once. And cache that stuff too

waxen tide
#

i'm not entirely sure yet. imagine you want to fill 3 houses with 5 objects each. then the criteria would be that a location has at least 3 houses with 5 building pos each.

#

the pre-determined set of criteria is defined for each mission that's defined and that can be spawned.

#

the goal is to have like, a couple dozen of said missions. or, ideally, piece them together randomly from sub-elements

still forum
#

or you could atleast pre-filter parts of that. Like prepare arrays with locations that have >1 or >2 or >3 or >4 houses. And then later at "runtime" filter for building positions

waxen tide
#

i think i would like to say flexible until the criteria emerge over time, and once the criteria that matter are established, i would do such optimisations.

still forum
#

Or something dynamic. Automatically cache things for a criteria once it's been seen once.
Do you have CBA?

waxen tide
#

i had criteria that proved to be not useful and then there was stuff i missed so i'm still afloat in that area atm.

#

vanilla is not of interest to me, so CBA and ACE are a given.

still forum
#

CBA Namespaces can be awesome for that.
just setVariable format ["criteria_house%1,buildpos%2", _minHouses, _minBuildPos]

#

if variable already exists, great. You already had that same criteria before and don't need to re-filter now

waxen tide
#

ahhh i see

still forum
#

But all depends on whether your code is really taking long enough that trading speed for memory usage is worth it

waxen tide
#

🤔

still forum
#

I guess generating missions doesn't happen every couple seconds

waxen tide
#

no, i would say 0.5 to 6 hrs

#

depending on the size of mission and lazyness of players.

still forum
#

At that point I wouldn't really care about optimization at all I think

waxen tide
#

heh yesterday X39 wanted me to write a dll for it

still forum
#

freeze the server for half a second every half hour. Who cares if AI lag a tiny bit. They already lag around randomly anyway. even without your code

waxen tide
#

i think it's already a great step forward to have pre-calculated data. spawning an AO took 45-90 seconds atm, now it's like 5 seconds while spawning 1000 objects.

#

isn't there a way to have the code run with low priority

carmine abyss
#

damn you guys are big league

waxen tide
#

i've noticed for example that shoving around array elements for several seconds in scheduled does nothing to performance sometimes, if you do not access anything (map data, cfg, logfile)

carmine abyss
#

so whats Invade and Annex' biggest problem? I cant play that with my best computer.

waxen tide
#

also when generating a mission, the previous mission has finished. at that point players are on their way back to base, with pretty much no to minimal enemy contact to be expected. i planned on doing sidemissions, but i would keep them small for performance reasons anyways and wouldn't have to do fancy filtering i guess.

#

since nobody yelled at me, i'll keep my nested array for now and see how it works out.

still forum
#

sheduled is low priority. 3ms max per frame. No real impact on fps should be possible

waxen tide
#

then why you assumed AI would lag? did you assume i would run this madness in unscheduled?

#

nervously adjusts his glasses

still forum
#

I did say unscheduled up there. yes.

waxen tide
#

i was under the impression that, if you hand the scheduler a single script that runs for a long time, AI calculation etc will still work relatively unaffected. unless the script does crazy stuff like spawning 100k objects

#

i've noticed tho that if you write self-replicating scripts and clog the scheduler with 100+ scripts that run forever, everything grinds to a sudden halt.

#

i kind of wish i would know a bit more about how it works inside the engine.

#

of only a subject matter expert would blog about such things

#

sigh

still forum
#

The scheduler always sorts scheduled scripts by last execution time.

#

If that sorting already takes 1ms. there isn't that much left of the 3ms

waxen tide
#

ah.

#

😆

carmine abyss
#

alright got the server up lets see how it works with the new code

still forum
#

and that part is also not 3ms limited. if it goes over, it does. And no scheduled script will be executed. or at most a couple lines

waxen tide
#

so minimizing the number of scripts in scheduler is good

#

how many scripts must there be in the scheduler to achieve that ?!

#

i hope that's then some accident, like some bug causing new scripts to be called all the time, and not actually by design.

#

that being said, placing 400 empty cars halfs my FPS in editor, so i guess there is plenty of bad stuff happening there already.

still forum
#

depends on CPU speed and cache size and memory speed and stuff

#

grab profiling branch and find out what's going on 😄

#

Or move your code to unscheduled. So that you can use my profiler to find the slow parts of your code :U

waxen tide
#

if you make a new, empty scenario and just place lots of vanilla vehicles, FPS does down the drain. zero scripting involved. that's what i meant.

still forum
#

stop deleting messages :U

waxen tide
#

b-but i accidently spammed the channel because my head fell on the keyboard.

#

i've figured it out.

Stage 1: scan map, calculate roadblock positions, collect houses + evaluate building positions     // needs to be done when map updates
Stage 2: sort houses with list of defined compositions                                             // needs to be done when we add new compositions
Stage 3: sort all the data by filtering it thru criteria of known missions                         // needs to be done when we define new missions
@ runtime: each mission has a set of available, suitable locations. pick one randomly.
#

well if you approach it with the right mindset, i find it quite easy to do things in a way which does not affect fps.

#

i guess managing the amount of enemies you have is quite important

#

i try to have as little as possible, but constantly replace them

#

also i set an arbitrary amount of AI i can spawn as max, and when that's hit, i don't spawn any more

#

each mission has a number of AI, and if it doesn't fit inside the budget it can't be spawned

#

think of it as "reserving" AI numbers.

#

say you can handle 150 AI max with good performance

#

and you spawn a mission that has a value of 100

#

if players kill half of those 100, i have freed up 50 i can spawn as reinforcements, but the global server AI budget still reserves 100 of the 150 for that mission. and i got 50 left for a sidemission.

#

so then i just check all my sidemissions and i can randomly spawn any which has an AI budget of less than 50

#

well what am i doing ... github readme starts with this:

The goal of this is to provide an interesting, dynamic mission that can run unattended 24/7 on a public server, providing a good challenge to experienced milsim oriented players.

The general scripting approach is to write a large number of functions that automatically parse existing map and mod data, to provide a lot of flexibility when porting the mission onto a new map or modset.

Missions shall be made up by basic building blocks, which in turn are mostly made up of generic functions that accept a lot of parameters to randomize them and adjust the mission size to the current player numbers.

Usability for vanilla gameplay is not inside of the current scope, CBA and ACE are to be considered mandatory.
#

i tried to come up with some artifical performance score, but i realised if i just take AI numbers, i'm probably quite accurate and it's trivially simple to count. Now does a tank with 3 AI inside cause more or less performance drop than 3 infantry units? idk, but i think that's irrelevant.

#

i would say the idea and concept is close to what I&A does, but targeted to a different audience and less restrictive. and, if i may be so bold, with some more fancy stuff.

waxen tide
#

i had 3 people play a very rough version a couple of days ago to test some basics. but it lacks tons of features.

#

80% of the static spawn stuff is figured out

#

only a few bits of the dynamic reinforcements tho

#

Ai behaviour is still just a point on the todo with lots of ideas attached

#

shrugs

#

hard to get people involved, too.

#

what do you think ACE can provide in terms of mission flexibility?

waxen tide
#

can apply delete an array element?

earnest ore
#
for [{private _i = 0}, {_i < count _struct}, {_i = _i + 1}] do {
    ...
    _cost = _cost + ([_filtered, _equipType, true] call ZE_fnc_calcCosts);
    ...
};

Is it normal behaviour that the _i variable is exposed to the function ZE_fnc_calcCost?

peak plover
#

Do people here use scripted dialogs/ui or config dialogs/ui?

waxen tide
#

oh, right.

fossil yew
#

how to create a placeholder empty group in 3den using script? I've tried the usual

_grp = createGroup west;
_grp create3DENEntity ["Object","B_Soldier_F",screenToWorld [0.5,0.5]];
_grp create3DENEntity ["Object","B_Soldier_F",screenToWorld [1,0.5]];

but it generates both in own group. Ignores groups created by createGroup

fossil yew
#

also, how to move a unit into a vehicle in 3den? I have references to both (dynamically created) but moveInDriver no habla

tough abyss
#

@earnest ore in SQF it is, that’s why you should use private in function too

waxen tide
#

i by default write private infront of every var i declare and only remove it if it doesn't work out 😛

earnest ore
#

Yeah, caught me off guard when my function started doing crazy loops. 👀

frigid raven
#

I have some NPCs with animations and props in my mission. U know... the immersive stuff :D
Sometimes things fall over or a stupid one shoots an NPC. I'd like to have a script called all 30min so reset all NPCs and their initial setup even the props. I can imagine there is already something convenient written for that case. Any suggestions?

waxen tide
#

1 char in a string is 1 byte, right?

tough abyss
#

For most cases but not always

compact maple
#

Hello guys, is there an existing command to found non used IDC for controls in a given range ?

unborn ether
#

@waxen tide Russian Ш is 2 bytes for example

tough abyss
#

Arma strings are multibyte strings containing Unicode, so if character is 2 bytes it will be 2 bytes in the string

unborn ether
#

Also AFAIR count also counts bytes in strings.

waxen tide
#

i won't be able to export map data with copytoclipboard, strings are limited to 10mb apparently :/

tough abyss
#

toArray reveals all the bytes

unborn ether
#

10mb of strings? whatya doing there buddy?

waxen tide
#

14mb

unborn ether
#

What do you export there?

#

blobs?

tough abyss
#

@compact maple how do you mean non used idc?

waxen tide
#

blobs?

unborn ether
#

Binary Large Objects in short.

compact maple
#

Well every controls have IDC when they're created, so I wanted to know if there is a function that automatically assign a free IDC to a control

#

or at least give me the number

tough abyss
#

@waxen tide write a compression function in sqf, to zip it, text could be zipped a lot, since you fanatically oppose extension use, this could be fun 👍

unborn ether
#

@compact maple Are you using ctrlCreate or config classes?

compact maple
#

config classes

unborn ether
#

Then how are you willing to assign them automatically? There are tools that do export in some sequence but nothing more.

tough abyss
#

What do you mean free?

#

You are free to choose any idc you want

unborn ether
#

Second question is why would you assign it automatically and what does free mean?

compact maple
#

I mean an IDC who's not used by an existing control

unborn ether
#

If you don't care about accessing that control from config, you can use -1 as an example.

compact maple
#

Yes but I do care 😃

#

-1 are good for background, image or such things, but for button, slider, etc.. If I want to interact with them I need an idc

tough abyss
unborn ether
#

Yeah, I got what you mean, well u can use #define preproc commands to create some automated process, but when I was working with configs I just used some range of like 5000-5100 and thats all.

tough abyss
#

I don’t understand what assign idc automaticallymeans

compact maple
#

Well I got it thank you, I was just asking my self about this

tough abyss
#

Free means it is your UI you can pick idc you want

compact maple
#

Yes I know, I just need to be organized lmao

tough abyss
#

The engine used idcs and idds matter only in UIs created by engine. Engine creates Gear dialog for example it will expect user interaction with certain controls with hard coded idcs, which would mean something, but if you create the same dialog yourself none of that would matter to the engine

compact maple
#

what's the difference between idcs and idds ? tought it was the same thing

tough abyss
#

c - control d - display

#

id, is well, id

waxen tide
#

googles "compression algorithm implementations"

unborn ether
#

I think you choose the wrong engine 😄

waxen tide
#

nah i'm good.

#

can't these terrain editing guys put their radiusA radiusB and angle values properly? jeez

still forum
#

@waxen tide can apply delete an array element? no. But you can have it return nil and filter them out afterwards with - [nil]
@waxen tide 1 char in a string is 1 byte, right? ASCII yes.

waxen tide
#

ponders

#

maybe i should just use a database extension, i know basic SQL anyways.

#

i bet SQL queries are so fast that i can do everything at runtime then.

#

btw thx dedmen (apply)

tough abyss
#

But you can have it return nil and filter them out afterwards with - [nil] computer says NO

#

Anyway this is known limitation, nil was always special case

#

If you want to remove nil you can use arrayIntersect with target array being both arguments

compact maple
#

Hey, do you know why this happen ?

this doesnt work
if (isClass (missionConfigFile >> "CfgVehicles" >> _classnameVeh)) then {
private _price = getNumber (missionConfigFile >> "CfgVehicles" >> _classnameVeh >> "price");
};
test1 = _price / 100; // _price undefined variable

but this works : 
private _price = getNumber (missionConfigFile >> "CfgVehicles" >> _classnameVeh >> "price");
test1 = _price / 100; 
tough abyss
#

_price is undefined?

compact maple
#

yep

#

I am struggling with this for 1 hour, decided to take it out the if statement, and it works

tough abyss
#

Because it is defined in then { scope and you attempt to use it outside of it, private or no private would not matter here

compact maple
#

Oh okay

#

I didnt know that

waxen tide
#

tl;dr remove private

compact maple
#

Well that make sense now

#

why should I ?

waxen tide
#

because i'm tired and telling you rubbish.

still forum
#

"computer says NO" wat? I've seen that code a ton of times

tough abyss
#

private or no private would not matter here @waxen tide

waxen tide
#

yeah i just noticed. i'm a bit tired, sorry.

tough abyss
#

I’ve seen people ending their scripts with if (true) exitWith {} tonnes of times

waxen tide
#

btw exitwith, is this weird ?

{
    private _abort = false;
    if (_something > _some_other_thing && _more) then 
    {
        _abort = true;
        [] call do_stuff;
    };
    if (_abort) exitWith {};
} forEach _array;
tough abyss
#

[1,nil,3] - [nil] what does sqf-vm return? @queen cargo

waxen tide
#

yeah, it is jcd

#

🤦

fossil yew
#

[1,any,3]

tough abyss
#

Not weird, legit way of breaking from the loop @waxen tide