#arma3_scripting

1 messages Β· Page 399 of 1

tough abyss
#

arma 3 has the worst documentation on their modules

#

omg

winter dune
#

have you go through ALIVE documentation?

#
Can I save the progress without a dedicated server?
Set Persistence to Local in the ALiVE Data module. If you want to use War Room services such as Mission Stats, Server Monitoring and AAR, you need to run @aliveserver on the host machine and have a War Room account with the host details setup (ensure the IP address is correct).

Cloud Persistence works best with a dedicated server on a static IP. However, it is possible to set up a "local server" on your PC (arma3server.exe) running the same mods and register that with the War Room. Be sure to check the IP address in your War Room group profile from time to time, as most people are on a dynamic IP and it may change. See the BI Community Wiki for info about setting up a server.

Advanced users can set up their own local instance of CouchDB.
#
How do I reset persistence?
Change the mission filename. See ALiVE Data page for further details of how to reset persistence and stats.
#

And this is if you are running the mod locally

tough abyss
#

Alright, but as far as using the vanilla arma 3 save function. Im toast

#

but then i guess thats why most major mods, Have their own save function....lol

#

wla

#

overthrow

#

ect

frank ruin
#

" + "There are" + _amountb + "boxes"

#

Can I correctly merge text + _variable amounts with it?

indigo snow
#

if _amount is a string, yea

#

else, no

frank ruin
#

Fuck

#

How would I compile something

#

message = "text" _variable "text" _variable Γ©more textΓ©"

#

How would one do this correctly?

indigo snow
#

"i have " + str(_amount) + " apples"

frank ruin
#

"i have " + str(_number) + " apples"

#

will work too?

indigo snow
#

sure

#

or use format

#

probably better

frank ruin
#

fml why didn't it work earlier then 😐

indigo snow
#

format["I have %1 apples",_apples]

still forum
#

Format is much better if you have more than 2 strings

frank ruin
#

Ah yes ofc

#

Dafuq I have been doing format ofc

#

Cheers

#

Fucking stupid

#

why I forgot the hole format shit ...

tulip cloud
#

Is there a function that allows you to take the first/middle/last x characters in a string? Or do I need to convert my string to an array and then back into a string?

still forum
#

select + count + math

tulip cloud
#

oh nice it works with strings too.

#

thanks

tough abyss
#

hey whats the best way to create a unit that isn't really there? his only purpose is to open a dialogue and click something, that dialogue will allow him to choose the actual unit he will play as.

lone glade
#

agents

tough abyss
#

how do i spawn one?

#

on the eden editor

lone glade
#

you don't

#

they are created via createAgent

tough abyss
#

so, instead of placeing a payable unit in the editor, i can just create an agent in the init and make the player play that agent?

#

or wait hold up

#

i got an idea

#

nvm

lone glade
#

wait, what the hell are you asking

tough abyss
#

I dont wanna place a playable unit in the editor

#

Because he isnt going to be used

#

or well hes just going to be used for one thing

#

i guess i could just delete him on player switch

meager heart
#

@peak plover with help of mister google... this thing is working```sqf
0 spawn
{
onEachFrame
{
_start = ASLToAGL eyePos player;
_end = (_start vectorAdd (eyeDirection player vectorMultiply 50));
drawLine3D [ _start, _end, [0,1,0,1]];

    _pos_player = getPos player;
    _screen = screenToWorld [0.5,0.5];
    _get_direction = ((((_screen select 0) - (_pos_player select 0)) atan2 ((_screen select 1) - (_pos_player select 1))) + 360) % 360;
    hintSilent format ["Direction %1", (round _get_direction)]; 
};

};

jovial ivy
#

Does arma have a function to convert 123456 to 123,456 by chance?

meager heart
#

round wil do 123,456 to 123

jade abyss
#

convert 123456 to 123,456? Like 123456 / 1000?

jovial ivy
#

I guess that would work to add commas to a number wouldn't it. Assuming I replace decimals with commas.

jade abyss
#

No clue what you want

#

You are US, or?

jovial ivy
#

Let me give a better example. Say I have a fairly large number, lets go with 123589334. Basically I just want to add some commas to make it more readable. So that would turn into: 123,589,334

still forum
#

I don't know of a pre-made function that does that

jovial ivy
#

Gotcha. Just wanted to know if there was a pre-made before I went ahead and made my own.

jade abyss
#

Sounds like an life issue to, i bet there are some solutions for that already

still forum
#

Probably some life server that has that. Meaning.... You have to make your own

meager heart
#
hint str (123456 toFixed 3); //--- 123456,000
jade abyss
#

But he want's 123,456 as result, sldtmnondfgo1ck

meager heart
#

ic .Hugh Dschasdjhfsiudhfsdfhckman

nocturne iron
#

do split string

#

_string = _arr select 0 + _arr select 1 + _arr select 2 + "," + _arr select 3 + _arr select 4 + _arr select 5
still forum
#

Wow

nocturne iron
#

you can make it more sophisticated with for do loops etc to detect where you should put the comma

still forum
#

dude

#

Man...

nocturne iron
#

it's lazy

lone glade
#

wow

nocturne iron
#

very lazy

lone glade
#

I have no words for this

still forum
#

lazy and dumb

nocturne iron
#

oh wow I totally forgot the string syntax of select

#

it's pretty dumb but

#

if you need it to work quickly and only once, bodges are fine

#

(not for production code ofc)

lone glade
#

the whole thing is stupid

#

and in arma all code is prod code

jade abyss
#

tostring, forEachIndex, toArray, etc

#

There are many ways, many are dumb^^

still forum
#

BIS_fnc_numberText formats with spaces instead of commas or dots. But that's already close

nocturne iron
#

that is the right way

still forum
#

No it's not

jade abyss
#

Not rly

still forum
#

It's even localized to your language

lone glade
#

damn, that's powerful google fu right there

still forum
#

And it's using the select variant that I thought of.

#

Man these poor people that are unable to google... Can't imagine how they can live. I bet they wouldn't even be able to figure out how to use a lightswitch

lone glade
#

depends what type of switch

#

I'm sure I could troll people by wiring differently and using different types all over the house

still forum
#

XD I would probably love that

nocturne iron
#

just install them upside down

#

that would get people

lone glade
#

"to turn this one on, you have to keep it pushed"

#

you can't install them upside down

#

which kinda sucks

still forum
#

Or use emergency push switches. And install a camera so you can watch people trying to figure out how to turn it off

lone glade
#

inb4 I end up with levers everywhere

#

requiring insane amounts of strength to move

nocturne iron
#

that's an aesthetic

still forum
#

Old rusty squeeky levers πŸ˜„

#

And a "Touch both ends to turn light on" sign above it

edgy dune
#

how can I get a list of all units that are not players?

lone glade
#

allUnits - allPlayers ?

edgy dune
#

it cant be allUnits-allPlayers XD

still forum
#

Ok.

lone glade
#

buuuut why?

#

allUnits select {!isPlayer _x}

edgy dune
#

ah thx

lone glade
#

🀦

#

nevermind, i'll just ignore you

still forum
#

allUnits is also a script. I don't even know how you would do anything without a script`
@edgy dune What can you do without a script?

nocturne iron
#

it's checking every unit on the map and only adding units which are not players to an array

lone glade
#

stare at the screen and hope his brain waves somehow changes transistor states to do what he wants

nocturne iron
#

we don't have an allAIUnits command because @lone glade's method is succinct and does not need a separate function

edgy dune
#

oh boi

#

I cant type at all

lone glade
#

we noticed

edgy dune
#

XD

#

oh well I already figured it out

nocturne iron
#

@edgy dune, if you know the size or the different possible properties of a set you can define the subset you want with information from one subset

#

ie

#

if I wanted to move the red and green marbles from a bag with 25 mixed red, green and yellow marbles and count them, I can take the yellow marbles out and count the remainder of the marbles in the bag

still forum
#

I don't even know what you are trying to do there

lone glade
#

me neither

#

it's a fucking goddamn substraction

edgy dune
#

see wat I was tryna do was apply a script to all non player units

lone glade
#

yes, and you need all non players units for that

still forum
#

Yeah? What is preventing you from doing that?

#

@nocturne iron I don't really see the reason to explain primary school math on a 3 year old level on a Discord for a USK 16 Game.

nocturne iron
#

he might not have realised that's why you need allUnits

lone glade
#

that's a bit harsh

rancid ruin
#

why did you write game with a capital G

#

so formal

#

why so formal

lone glade
#

even i wouldn't insult someone to such lengths

still forum
#

formal gud cuz formula

edgy dune
#

XD

nocturne iron
#

damn dude

rancid ruin
#

there's no reason to spell it Game though

#

it's actually wrong

#

I hope you have bad christmas because of this

#

you damn well deserve it

meager heart
#

lulz

edgy dune
#

wait r we all triggerd cause game was spelled Game

#

wat if

#

Game is a company

still forum
#

Yeah. I'll have to spend christmas with my in-laws instead of sitting here and writing code

nocturne iron
#

Not a proper noun in that case so you'd still use lowercase

#

that sounds shit

rancid ruin
#

your mum isn't a proper noun

lone glade
#

can't have a bad christmas if I don't celebrate it

rancid ruin
#

you're guaranteed to have a bad christmas if you don't celebrate it

lone glade
#

wrong

rancid ruin
#

yes

tough abyss
#

i agree with alganthe

#

like on my birthday, it just feels like a regular day to me

#

Cant be disappointed if you arent anticipating anything

peak plover
#

@meager heart thanks, but that won't work on the server

#

screenToWorld only works on clients with interface

#

And not from remote units

tough abyss
#
    myCurator addEventHandler [
    "CuratorObjectRegistered",
    {
        _classes = _this select 1;
        _costs = [];
        {
            _cost = if (_x isKindOf "B_CTRG_Soldier_base_F") then {[true,0.1]}; 
            _costs + if (_x isKindOf "ReammoBox_F") then {[true,0.1]};
            _costs + if (_x isKindOf "B_CTRG_LSV_01_light_F") then {[true,0.1]};
            _costs + if !(_x isKindOf "B_CTRG_Soldier_base_F" || {_x isKindOf "ReammoBox_F"} || {_x isKindOf "B_CTRG_LSV_01_light_F"}) then {[false,0]};
            _costs = _costs + [_cost];
        } forEach _classes; 
        _costs
    }
];
#

lol, im pretty sure theres a better way to do this, but i dont know how. and on top of that, it doesnt work because it doesn't like the "+"

#

signs

#

but i wanna beable to set the individual prices

still forum
#

Uhm

#

if the if doesn't work it...... what?

#

that doesn't work at all

#

you add _costs and either an array or nil and discard the result

tough abyss
#

@still forum that was a long deserved blue btw

peak plover
#

What did he mean by that πŸ€”

tough abyss
#

his rank

jade abyss
#

Dedmen = BlueManGroup now

peak plover
#

Wasn't he blueman the whole time?

jade abyss
#

Nope

tough abyss
#

nope

jade abyss
#

He was a whitey

peak plover
#

Whoa, congratsulations

#

πŸ‘πŸΏ

tough abyss
#

lul

#

that spelling

peak plover
#

Wha?

nocturne iron
#

@tough abyss use BIS_fnc_curatorObjectRegisteredTable

tough abyss
#

thanks, i took me awhile to realize how to make it work. It doesnt take parent classes but the actual addons

tough abyss
#

well

#

i wish there was a video or detailed tutorial because the way the wiki explains it, i am just lost

#

i keep getting an error at the bottom, getting 1 argument expecting 2

#

When i go to copy the code that the excel is suppose to generate

nocturne iron
#

Ohhh you're doing that

#

I'd just fill it manually

tough abyss
#

how so?

nocturne iron
#

here's a code example

#
[zeusEast,SV_TECH_REB_INFANTRY_2]  call BIS_fnc_curatorObjectRegisteredTable;```
tough abyss
#

zeus east is the curator module name right?

#

whats the sv_tech?

nocturne iron
#

Yep

#

Ah it's just the prefix I'm using

#

You could use any variable you want, ala

bling_unlock_1 = ["classname1",-(cost of classname1),"classname2",-(cost of classname2),...]```
#

You can also just paste the array straight into the called function but storing the cost tables in variables is important if you want to do unlocks etc

tough abyss
#

Hey is there a way i could plug in a parent ?

nocturne iron
#

just looks better

#

Nope, only unit-level classes

#

You can't do "LandVehicle" for instance

tough abyss
#

or B_CTRG_Soldier_F ?

#

and get all the CTRG soldiers?

#

damn well thats going to take a ton of time πŸ˜›

nocturne iron
#

Nope, that's the classname of the Altis rifleman anyways :p

#

Yeah, it's very time consuming

tough abyss
#

but you can plug in an array?

nocturne iron
#

You can take the addon unlock route, but you won't be able to restrict units

#

?

tough abyss
#

oh

#

nvm

#

wait

#

what if we did multi dimensional arrays?

#
configs = [
    (configFile >> "CfgGroups" >> "Indep" >> "LIB_US_ARMY" >> "Infantry"),
    1,
    false
] call BIS_fnc_returnChildren select {inheritsFrom _x isEqualTo (configFile >> "Man")};
``` this allows you to get the vehicles of infantry groups
#

i wonder how i could manage to get the pricing in there, Because i mean its all going to be the same price

#

I just want 1 unit to = 0.1

#
configs = [ 
    (configfile >> "CfgGroups" >> "West" >> "BLU_CTRG_F" >> "Infantry"), 
    1, 
    false 
] call BIS_fnc_returnChildren select {inheritsFrom _x isEqualTo (configFile >> "Man")};

loadouts = [];
{loadouts pushBack getText (_x >> 'vehicle')} forEach configs;
publicVariable "loadouts";

{ 
[myCurator,[_x,-0.1]] call BIS_fnc_curatorObjectRegisteredTable;
} forEach loadouts;
#

im going to try that // Nvm it worked!

meager heart
#

@peak plover remoteExec

tough abyss
#

lol no errors, but it didnt work

peak plover
#

Ohh okay

#

The issue with that is

#

I want to clientside caching from server

#

But if I updated player head direction on every frame to the server via sqf

#

It will crap the network

tough abyss
#

nvm it worked

meager heart
#

@peak plover well i didn't know that it server side only... and yes it will

#

.Hugh Dschacsdgfsfg Β© Β―_(ツ)_/Β―

peak plover
#

hmmh

#

Trying to get this stuff working, I guess I can't do it based on head dir, fov and view distance

#

Or wait

#

πŸ€”

subtle ore
#

Nigel, do you have some cheapy cocaine gong through your veins right now or something?

peak plover
#

What if attachTo an invisible object to players head, and then inPolygon on the server?

subtle ore
#

Do I need to send an amberlance? Got heart palpatations going on right now? Is your mind in complete chaos right now?

peak plover
#

Hmm?

meager heart
#

What happen then after player will fast turn around couple times?

subtle ore
#

you're coming up with very convoluted methods Nigel

#

Wait until Dedmen comes and sees this

#

he'll probably suggest Intercept like the schill he is 😱

tough abyss
#

define schill?

subtle ore
#

Has some sort of gambling reference attached to it, but I am using it in the latter context

tough abyss
#

neat word

warm gorge
#

How do you guys do GUI development these days? The Arma 3 GUI editor is absolutely horrible and outdated, with half the available controls creatable through it as well as heaps of bugs. Plus it doesnt support any of the new grid coordinate systems such as pixelGrid. So makes it very difficult

peak plover
#

I do it in .hpp files

#

Just manually write there

warm gorge
#

How do you get all the positioning right easily

peak plover
#

Divide the area into grids

#

I just used safeZoneW/40 and safeZoneH/25

#

middle is safeZoneW/40*20 and safeZoneH/25*12.5

warm gorge
#

Understanding safezones and the maths around it confuses me

peak plover
#

safeZoneX andsafezoneY is always top left corner

#

safezoneX+safeZoneW and safezoneY + safezoneH is bottom right corner

#

safezoneX+safezoneW and safezoneY is top right corner

#

safezoneX and Y are not 0

#

if you add the W to X you get the max pos

#

So safezoneX(0.7) + safezoneW(2.5) = right side of screen(3.2)

#

But it's different on every computer what the numbers are

#

I used that and It looks exactly the same size on every screen based on screen percentage

#

So if you are on 50'' it's 50 % your screen, if you are on a 20'' it's still 50% of your screen

warm gorge
#

Ah yep I see

edgy dune
#

can u add a evenhandler to Ai?

worthy spade
#

@edgy dune Yes.

edgy dune
#

aye thx

earnest ore
#

Don't suppose anyone knows how to change ACE cargo (un)loading speed?

frank ruin
#

Anybody can show me how to simply an array select ?

#

My stuff works

#

But I know there could be a much better way of showing it.

#

Cheers if anyone has a minute to show me a more cleaner way πŸ˜ƒ

winter dune
#

can you show how your array is composed?

frank ruin
#

Yes I can sir.

#
    _poseswreck = count _wreckloc;
    _inArrwreck = floor(random _poseswreck);
    _wreckpos = _pos select _inArrwreck;```
#

Is there like a more cleaner way of doing things?

#

I mean it works but ... :p

winter dune
#

you want a random selection?

#
 _wreckloc = [[18882.9,16449.3,26.4],[18720.5,16828.5,34],[18972.1,16576.7,24]];
 _wreckPos = _pos select (floor(random(count _wreckloc)));
frank ruin
#

Yes I want it to random select between those 3 locations

split coral
#

_wreckpos = selectrandom _wreckloc is a bit simpler

winter dune
#
_wreckloc = [[18882.9,16449.3,26.4],[18720.5,16828.5,34],[18972.1,16576.7,24]];
 _wreckPos = selectRandom _wreckloc;
#

test it into the debug console

#

and see the output

#

it should work btw

split coral
#

selectRandom doesn't have that kind of syntax

#

What is _pos by the way?

frank ruin
#

Yeh I saw that one was wrong

#

Β¨_pos needed to be _wreckloc

#

Copy paste from the statement above who used _pos ;D

split coral
#

that makes sense. πŸ˜ƒ

frank ruin
#

This select random

#

looks like exactly what I need

#

With less syntax

#
    _wreckpos = selectRandom _wreckloc;```
#

Seems allot better πŸ˜„

#

Thanks you both for the help and additional information πŸ˜ƒ

meager heart
#

You can do just

_wreckloc = selectRandom [[9270.8,15959.9,112.3],[9358.59,15813.4,129.18],[9749.3,15870,113]];
frank ruin
#

True

meager heart
frank ruin
#

But I like it seperated on the location part.

#
switch ((_dest select 0)) do {
    case 9305: {
    _wreckloc = [[9270.8,15959.9,112.3],[9358.59,15813.4,129.18],[9749.3,15870,113]]; // Agios
    _wreckpos = selectRandom _wreckloc;
    };
    case 18795: {
    _wreckloc = [[18882.9,16449.3,26.4],[18720.5,16828.5,34],[18972.1,16576.7,24]]; // Rodopoli
    _wreckpos = selectRandom _wreckloc;
    };
    case 5087: {
    _wreckloc = [[5127.51,11119,47.5],[5068,10775,30],[5130,11427,60]];// Panachori
    _wreckpos = selectRandom _wreckloc;
    };
};
meager heart
#
switch (_dest select 0) do 
{
    case 9305: {_wreckloc = selectRandom [[9270.8,15959.9,112.3],[9358.59,15813.4,129.18],[9749.3,15870,113]];};
    case 18795: {_wreckloc = selectRandom [[18882.9,16449.3,26.4],[18720.5,16828.5,34],[18972.1,16576.7,24]];};
    case 5087: {_wreckloc = selectRandom [[5127.51,11119,47.5],[5068,10775,30],[5130,11427,60]];};
    default {["Position not exist"] call BIS_fnc_error;};
};
winter dune
#

one suggestion, do not use that BIS_fnc_error

#

if you are 100% sure that your switch is correct and won't have different values from the cases

#

then just put default {}

frank ruin
#

Yes cause basiclay the script itself can only choose between 3 city coordinates.

#

I then read the X value.

#

Where it will decide what random position the truck will be.

#

So there is no possibility it can go wrong.

meager heart
#

up2u this is just an example

frank ruin
#

Oh yeh don't get me wrong. I like people's input on things.
Cause that's how I see more and pick things up on how to do it. πŸ˜‰

meager heart
frank ruin
#

Oh yes I know how the switch things work.

#

Didn't put default in cause I forcefeed the input myself.

little eagle
frank ruin
#

Lorem Ipsum

meager heart
#

Why vanilla don't looks like this...

little eagle
#

The nice thing is that the slots and groups are created / destroyed by script and can be changed dynamically mid mission. The unit is created by script.

#

And the slot creation is local, so you could create slots for specific player uids.

meager heart
#

So the playable units are created when actual jip connected ?

little eagle
#

Yes.

meager heart
#

wow that nice one

little eagle
#

You have to place dummies for the server browser though.

#

So the mission needs some editing.

#

This test has 20 dummies, therefore 20 players can connect to the server and I don't think these 20 are freed up once you pick a slot and leave the lobby.

#

But it requires more testing.

winter dune
#
13:38:33 Performance warning: Very large search for 1120800 (>300 m)
13:38:33 Performance warning: Search for 1120800: concrete_smallwall_8m_f.p3d was very large (13080 m)
#

what does this mean in my server logs?

tranquil nymph
#

Has anyone successfully used the menuAdd command?

#

I'm working on adding a context menu to my display and can add items easily via config, but would prefer to initalise it with a script so I can more finely control certain behaviour

little eagle
#

onLoad?

tranquil nymph
#

I assumed the path it would expect is similar to a tree view ctrl, but apparently not

#

I'm doing a ctrlCreate for the context menu because they self-delete when losing focus

little eagle
#

The command only has the shitty syntax (menuAdd [idc, path, text]) and the idc versions don't work the same frame or something like that.

tranquil nymph
#

Nah it has the control version too

#

Just not on biki πŸ˜‰

little eagle
#

I see.

tranquil nymph
#

Some trace debugging I tried:

12:53:32 [ACE] (spectator) TRACE: 9428 Addition2: _menu menuAdd [[],  "Help"]=-1
#

Also tried it with an index 0 to no avail

drowsy hollow
#

About that Unknown enum value thing:
Is there a list of all functions which take an "enum" including their respective possible values?
(It'd help finding missions with enum issues when you have hundreds of missions on a server.)

little eagle
#

I don't think there is a list of all commands that do this. But all special strings should be listed on the commands page. E.g. "NONE", "FORM", "CAN_COLLIDE" and "CARGO" for createUnit.

tranquil nymph
#

Yeah basically any command that takes a specific list of strings is taking enumerated values

peak plover
#

bbb

drowsy hollow
lone glade
#

all commands that take special strings as input are using enums

#

that's fairly simple

little eagle
#

They use "enum" for any string constant essentially, and I don't think that is technically correct.

lone glade
#

not unlike a lot of other stuff

half moth
#

Trying to have an unarmed OPFOR ("BADGUY")a.i. unit pull out a weapon via a trigger. Currently have in trigger "on act" null = execVM "BADCIVI.sqf" and in that sqf [BADGUY, "hgun_Pistol_01_F", 1, 0] call BIS_fnc_addWeapon . This works but I do not wish create a script for each and every bad dude I want pulling this stunt. So I want one script that I can define the badguy in the trigger activation and then run the script giving that guy the weapon. So I can easily set up triggers doing this for each bad dude. Low level of coding other than some QBasic back in high school and having a hard time figuring out how to define a variable in a trigger and then in that simple script.

drowsy hollow
#

@lone glade yes, but I was asking for a list of these commands so that one could automatically check hundreds of missions for this bug.

lone glade
#

all of them are fixed on dev branch

#

only some remain on stable right now

winter dune
#

is it possible to retrieve a playerid from a list by using lbData without having that playerid converted into a number?

#
"Unit ID: 7.65612e+016"
#

str can solve the problem?

lone glade
#

that ID won't be usable anyway

#

notice the E+016

winter dune
#

yeah, I have to find a way to retrieve a playerid from a selected player in the list

#

even with str did nothing to it

#

find it lol

#

missionNamespace solve the error

#

@lone glade do I have to set and after that get the variable from missionNamespace?

#

or the set must be in a different script

south rivet
#

I have a bit of a problem. I have started using a script to create and assign zeus logic modules to certain players, but it is not working properly. It works perfectly in local host when im host, but once i try it on dedicated it doesnt. I can press y as many times as i want, but it doesnt go into the zeus interface nor does it ping zeus. And when I check assigned logic and which unit is assigned to that logic, it all checks out. Even reassigning doesnt fix anything.

#

Im currently not home, so cant give the script directly. But it is a script by commy2, available on his gistgit.

rancid ruin
#

commy's scripts are well known to be bad, you shouldn't use them tbh

#

i suggest moving to another script provider

little eagle
#

I don't even know which one that'd be.

lone glade
#

"gistgit" wat

little eagle
#

A gist.

lone glade
#

yeah, "available on a gist he shared"

#

not "his gistgit"

south rivet
#

Github gist

south rivet
#

Yes

#

Just wanted to link it

little eagle
#

Cuel left a comment about needing to reassign it after respawn.

south rivet
#

It isnt different from anything else, other than that this one runs in a playerconnected eh

little eagle
#

So maybe:

#

And when I check assigned logic and which unit is assigned to that logic, it all checks out. Even reassigning doesnt fix anything.

south rivet
#

And i reassign on respawn already

little eagle
#

Isn't true, and the unit only appears to be the same.

south rivet
#

Because i had that problem in local host

little eagle
#

Do you use the vehicle var names?

#

You have to do the reassigning on the server, because assignCurator only works on the server, because.

south rivet
#

Yes, that is what I do

#

All that zeus related stuff is done on the server

#

And which ones would be the vehicle var names?

little eagle
#

Naming them in the editor.

#

The units.

south rivet
#

Stuff like "L Zeus 1-1"

little eagle
#

No.

#

Add some debug to it and look what goes wrong. Β―_(ツ)_/Β―

#

Bonus for leaving a comment on the gist after figuring it out.

south rivet
#

I will do, cant pass on bonus points

winter dune
#

do missionNamespace setVar and getVar have to be in the same script to work?

lone glade
#

wat

winter dune
#

or they act like normal set / get vars

lone glade
#

the hell are you saying

winter dune
#

don't know, can't make a missionNamespace work ...

#
missionNamespace setVariable ["playerIDfromList",lbData[9381,lbCurSel 9381]]
#

have to do this in a script

#

but don't know where

#

in debug console works great, but I have 0 knwoledge how this works

edgy dune
#

question, how do I get the name of a player use select a action on a box? What im tryna do is have a box where a player uses the scoll menu to select a kit and doing so would change that players kit

subtle ore
#

@edgy dune

_coolActionThingy addAction["Action",
{
    params["_coolActionThingy","_user"];
    hintSilent format["Player: %1",name _user];
}];
edgy dune
#

thx

earnest ore
#

@south rivet I believe the corpse of a unit retains their var name, thus trying to reassign zeus without being specific or deleting the corpse will result in the assignment being tied to the corpse rather than the intended unit.

south rivet
#

It isnt on respawn, it is when first joining that it doesnt work already

modern aurora
#

hey guys anyone know how to make a Object/Container Respawn

little eagle
#

this respawnVehicle [-1]

#

into the init box.

modern aurora
#

Awesome thanks

little eagle
#

Never tried this on boxes, but it works for the hemmett truck.

modern aurora
#

cool ill try it and see if it works

#

Can you help with a non script issue?

little eagle
#

Is it a math issue?

modern aurora
#

lmao no

#

RHS issue

#

Helicopter weapons not loading

#

works when i test the mission in editor/Multiplayer but when i upload it to a server it does not appear

#

unfortunatly the script did not work i appreciate the help though

south rivet
#

Ignore my whole problem with the zeus script and not being able to enter zeus. There was A FUCKING OVERLAPPING KEYBIND!! Now please excuse me as I go cry myself to sleep for being stupid.

edgy dune
#

if{cire} then {crie};

tough abyss
#

And execution error

jade abyss
#

if{} oh myyyy

subtle ore
#
if(_dschaLoser) then
{
   hintSilent "Dscha is a loser, let the testers reign supreme";
};
jade abyss
#

pff, uprising of the peasants? pff, cmon, as if that could work out

subtle ore
#

@jade abyss Sure it could, it's happening as we speak. You just don't know

jade abyss
#

wake me up, when you are done

subtle ore
#

0kie D0kie

jade abyss
#

(So: never)

subtle ore
#

Don't doubt the rebellion Dscha

#

The testers have tricks up their sleeves

jade abyss
#

zzZZzz

#

Like: Finding Bugs where none are

#

πŸ˜„

subtle ore
#

πŸ€”

#

Give me sum pond shaders Dscha

#

Then we'll talk

jade abyss
#

You remember that "PayPal Link without a text" - "There is?" - "Oh, now there is" yeaaah yeaaahhhh

subtle ore
#

Eeeeehhhh

jade abyss
#

Do i look like, as i would give af about the ponds? πŸ˜„

subtle ore
#

Bugs = Cup features?

#

Treats you come bearing?

thorn saffron
#

But I want to hear other speech stuff like calling out targets etc.

jade abyss
#

You can't have everything

subtle ore
#

(Local)

tough abyss
#

Make a pbo and override the sound files with empty ones

jade abyss
#

btw: By removing/disabeling the Audio files -> Commands will be executed in an instant

#

No delay

thorn saffron
#

Not gonna work that way. Instead I think I would need to rerout the game to empty files using a config

tough abyss
#

I assuming arma has recorded voices and doesn't generate them. Never looked into it

thorn saffron
#

@jade abyss hey a bonus

jade abyss
#

Not gonna work that way. Instead I think I would need to rerout the game to empty files using a config
Thats what deco said? oO

#

+Yeah, that waiting for the sentence to be finished is a pita ^^

thorn saffron
#

@tough abyss Yeah, but you can't just "replace" the files, the path changes if you create a pbo and you still need a config tweak for your replacement to work. That is why the Xian cockpit texture had to be changed using a tool as there was no way to just replace them

jade abyss
#

hu?

tough abyss
#

You can override files with pbo, or u can do it via config in this case if not hardcoded

jade abyss
#

Of course you can replace the pathes (using CfgPatches)

tough abyss
#

Only issue overusing files is you need to override the entire directory via pboprefix

jade abyss
#

The soundfile itself is, iirc, just a cfg entry

warm gorge
#

Tweaked: The Object Door States attribute was overhauled (24 doors supported, new state "LOCKED" added)

#

Whats the difference between this and the lock command?

#

Not lock command sorry, the other BIS variable for locking

tough abyss
#

Its just eden support

warm gorge
#

Alright cool ty

little eagle
#
private _dummy = _display ctrlCreate ["RscEdit", -1];
_dummy ctrlSetEventHandler ["SetFocus", format ["serverCommand '#kick %1'", _player select 0]];
ctrlSetFocus _dummy;
ctrlDelete _dummy;

Am I missing something or is this the only way to kick people by command?

#

If serverCommand is executed on a client, it must be executed from UI event handler

peak plover
#

@little eagle nice progress. I assume you'll make lines different colors

#

Will there be like an admin tab to add more from that menu?

little eagle
#

But it does work in that it spawns everyone as civilians in their own ingame group : P

#

What would the admin tab be used for? You can double click the player list to kick them.

peak plover
#

Admin -> add group || add unit

little eagle
#

Oh, edit them right on the lobby screen.

#

Customizeability 200%!

peak plover
#

yeah

#

❀

little eagle
#

Nice idea.

meager granite
#

Check this out, somebody made a worm using OA inGameUISetEventHandler exploit πŸ˜‚

peak plover
#

haha

#

I fucked that up in arma 3 too once

#

I was saving tons of stuff into profilenamspace

#

Some of which was code

#

One day launched arma and all that code executed and even the main menu was bugged

#

I should try to reproduce that

warm gorge
#

Yeah I know someone who had code saved in their profile namespace somehow, which was used to run some dodgy code

peak plover
#

inBefore It is possible to make a keydown EH and a scripted code execution window and use it on vanilla servers

little eagle
#

I reported some of those already, probably more exploits.

meager granite
#

Its been fixed in A3 few years ago (and entire EH made useful), but still persists in OA

little eagle
#

In A3 this probably would error, because createAgent and FORM enum πŸ˜‚ πŸ”«

peak plover
#

πŸ˜‚

little eagle
#

Apparently FORM is valid for createAgent. How does one spawn an agent, which is defined to be a unit without group, in a group formation?

#

Dscha, those names πŸ˜‚

peak plover
#

Yeah so what I did,(3-4 months ago), missionnamespace variable with code type. I ended up deleteing my vars for a couple of time and had to str the code before saving and compile afterwards

#

why are the english ones in 16 system

#

CF == 207?

little eagle
#

What?

winter dune
#

CF == 207?
Yes

peak plover
#

Thanks

#

16 numbers obsolete

little eagle
#

You can write 0xCF in sqf btw.

peak plover
#

Wait ,really?

#

ok that's cool didn't know

little eagle
#

You can also add:

#include "\a3\ui_f\hpp\defineDIKCodes.inc"

as line 1 and then just write DIK_WHATEVER.

#

don't you have to define them?
No.

winter dune
#

forgot about that

little eagle
#

And the hexadecimals work regardless of macros.

#

They're native sqf.

peak plover
#

so hex auto converrtion

#

I assume variables can't start with numbers and if you start with 0x it will do it

little eagle
#

variables can't start with numbers anyway. That'd error.

peak plover
#

Global namespace not passed during

queen cargo
#

@little eagle meeep
Wrong

#

Use set variable

#

And it will work

little eagle
#

What?

jade abyss
#

Β―_(ツ)_/Β―

stable wave
#

What woulld happen if I connect 2 local game instances using the same player profile to a local dedicated server which runs a mission using profile namespace for persistence?

jade abyss
#

I guess it overwrites it?

#

Or select another Profile with the 2nd Client

stable wave
#

If I use profile a with the 1st client and profile b with the 2nd, what profile will the game use after close both client and restart the game?

jade abyss
#

i guess that depends on where the saveProfilebla command is executed (on wich client)

tough abyss
#

Pretty sure arma complains about profilenamespace, vaguely remember either warning in rpt or popup error

jade abyss
#

Or that Β―_(ツ)_/Β―

tough abyss
#

Best way is to just test it, been atleast 2 years since i encountered it though

jade abyss
#

I always tested on "Real conditions" (Dedi, 2 different Machines, etc)

#

Are the profile files locked, while Arma is opened?

tough abyss
#

Think so, am pretty sure it complains and warnings it cant save to profilenamespace etc

jade abyss
#

Time for Jermin to find out πŸ˜„

stable wave
#

I saw post where a guy complained his KOTH save was lost because of this

tough abyss
#

That or learn not to use profilenamespace for persistence on a client ;P

jade abyss
#

His fault Β―_(ツ)_/Β―

#

That also ^^

#

I know a guy, who made some decent stuff for that

#

Like saving stuff in a Database, etc

#

pretty awesome tool/extension

stable wave
#

I just want to test A3Wasteland in a local dedicated server. It is forced to use profilenamespace where extDB and iniDB are not available

jade abyss
#

"local" πŸ˜‰

stable wave
#

guess I would save my profile first

tough abyss
#

It uses profilenamespace on the server not the clients

little eagle
#

Local dedicated server πŸ€”

jade abyss
#

Also: Are the wasteland files public? πŸ€”

stable wave
#

when I preview it in the editor, everything is saved

tough abyss
#

A3wasteland ones are, but the server+client files are mangled together, so annoying to work on

jade abyss
#

kk

#

btw. Macro Christmas @little eagle o7

peak plover
#

πŸ˜„ πŸ‘ŒπŸΏ

jade abyss
#

wash your hands pls (or are you Frankenstein's Monster?).
Your "Head to Hand"-coloring doesn't fit

peak plover
#

πŸ‘ŒπŸΏ -> 🀽🏿 -> πŸ‘Œ

#

πŸ‘ πŸ‘ƒ πŸ‘

little eagle
#

\ \ πŸ‘„

jade abyss
#

🀦 sherbFail

peak plover
#

haha

jade abyss
#

fk off discord

peak plover
#

πŸ‘ πŸ‘ƒ πŸ‘
πŸ† πŸ‘„

little eagle
#

it's it's...

#

BEAUTIFUL!

#

πŸ‘ 🐽 πŸ‘
πŸ† πŸ‘„ 🍌

jade abyss
#

better!

stable wave
#

how come there are 2 local dedicated server entries (with different ping values) in the in-game server browser after launching the 2nd client?

peak plover
#

I don't get that one

stable wave
#

You were kick from the game. Same Steam user already in game.

#

I can't join the server with the 2nd client

#

and what's weird is that server just broadcasted a message saying player Lisik was caught cheating

#

Before this happened I saw on the 2nd client that there were 2 players in the server

#

aha. I forgot to add loopback = true in the server.cfg

peak plover
#

Umm, wrong chat?

meager heart
#

also add kickDuplicate = 0;

nocturne iron
#

can I use euler's number in script aseor do I need to give a decimal approximation?

little eagle
#

exp 1

nocturne iron
#

thanks

little eagle
#

yw

nocturne iron
#

may it be inherent to the draw 3d stacked EH?

lone glade
#

use the draw3D mission EH, and stop abusing exitWith like this

#

stackedEH are deprecated

nocturne iron
#

alrighty, I'll give it a look

#

exitWith is faster than switch isn't it?

lone glade
#

no

#

exitWith is used to exit the current scope

#

it has NOTHING to do with switch

#

breakOut is the closest command to exitWith.

nocturne iron
#

of course, but in the context of an if>then compared to a switch condition check

lone glade
#

i'm telling you, it's not supposed, and should not be used like this

nocturne iron
#

okay

winter dune
#

is someone who use the sqf linter for atom?

inner swallow
#

Hey @still forum you're quite familiar with the engine and stuff right? I was wondering, is there anything particular with the ~22 FPS mark that makes it special? It seems to be a typical lower limit for performance across hardware (unless things get really bad).

(and well, open question to anyone else that knows)

#

(on the server too, ~21 fps is the point below which clients get affected, apparently)

limpid pewter
#

If anyone knows, what is a good way for getting a weapon's classname from a projectile? I am using the HandleDamage EH to return the projectile classname and now i need to get the weapon that uses that projectile's classname.

#

From my understandings on configs, it is easy to retrieve information if you have the classname from higher up in the hierachy than the infromation you are trying to get, but i have no idea how to retreive the parent class

indigo snow
#

You can't, fully. There is getShotParents but that will only list the shooter and possibly his vehicle, youll need to do some work from there.

edgy dune
#

question,can u bind a action on the scoll menu to a key?

edgy dune
#

nvm

#

i figured it out

limpid pewter
#

@indigo snow Ahh thanks alot, spent 40mins looking for how to get it haha.

edgy dune
#

can u change the background color of a hint?

lucid junco
#

hi, do someone know how to exec script by load game? like after the game is loaded script is executed.

#

basically how to detect the load game

meager heart
#

@lucid junco ```sqf
waitUntil {!isNull player};
//OR
waitUntil {time > 0};
//OR both ^
// OR
if (getClientState == "BRIEFING READ") then { /* CODE*/};
//OR in the initPlayerServer.sqf with the following at the top:
if (_this select 1) exitWith {};
//OR Execute it in the initServer.sqf will runs once on mission start, only on the server.

edgy dune
#

Thx

still forum
#

@inner swallow Arma engine fps target is 30fps.
20 fps maybe is lower than the minimum amount of network simulations that should run. After that the messages are maybe too delayed that everyone has to interpolate too much and get's confused

lone glade
#

20 fps is also the equivalent of a very fast powerpoint

meager heart
#

Also at 20 fps or below everything in UI with ctrlCreate randomly delayed somehow

still forum
lucid junco
#

@meager heart i cant figure this out. can you describe how exactly use it? need it for single player

#

oh, and im not talking about starting mission, but when player save/load the game

meager heart
#

Exec your script after savegame

#

With load - no idea

#

Check bis sp missions

#

Btw that savegame point will be load after restart...so anything after will be executed

tulip cloud
#

Using the default revive and healing systems how do I have a script that runs only if successful?

meager heart
#
NOTE: This Event Handler is broken but somewhat usable. When attached to a unit it will fire when medic action is started (not finished!)
tulip cloud
#

That says, it only works local.

#

Looking to do this in a multiplayer setting.

still forum
#

only works local doesn't at all mean it doesn't work in MP

tulip cloud
#

HandleHeal fires on incapacitated also?

still forum
#

@meager heart Some people just cannot read probably... It says Triggered when unit starts to heal (player using heal action or AI heals after being ordered). on the first line of the description.
So yeah.. It fires when it starts.

meager heart
#

wut

tulip cloud
#

I mean when attempting to revive a downed player

still forum
#

I don't see why it wouldn't work with unconsious.. Try it out I guess

tulip cloud
#

Dedmen you are too reasonible πŸ˜ƒ

still forum
#

Otherwise you have to specifically know which revive script/system is being used. Maybe it has special scripted EHs

tulip cloud
#

well I found some code in functions

still forum
#

Yeah.. Functions usually have code.

tulip cloud
meager heart
tulip cloud
#

Though I'm not to full coder status so I get a little confused on how to use this.

still forum
#

@meager heart yeah...?

meager heart
#

I never said that it will not work or something lol

still forum
#

@tulip cloud Where is that stuff on the screenshot from?

#

@meager heart The note you posted does tho.

#

And says it's "broken" because it does exactly what it was supposed to do

tulip cloud
#

Marks\functions_f_mp_mark.pbo (in revive folder)

still forum
#

That is the handleHeal EH that I linked above

tulip cloud
#

got it so I can use that code to figure out what exactly happening internally?

still forum
#

I guess . Probably Β―_(ツ)_/Β―

tulip cloud
#

πŸ˜ƒ well time to start doing some testing and learning. Thanks for the assist.

lucid junco
#

@meager heart _id = addMissionEventHandler ["Loaded",{ exec whatever you need }];

#

how simple πŸ˜„

meager heart
#

You see you can google 😁

lucid junco
#

i was googling for something more complicated. πŸ˜„ did not expect ....... hmm... THIS πŸ˜„

tulip cloud
#

I set this setUnconscious true; and also enabled revive system and I can't revive an AI. Looks like it has to be an actual player?

still forum
#

I'd guess you can only revive people that really went unconsious by being shot

tulip cloud
#

tried shooting them too :/

stable wave
#

When triggerActivation _tr1 returns ["NONE","PRESENT",true], does it mean nothing can activate it?

subtle ore
#

@stable wave.No, you just haven't set the activation

stable wave
#
(createTrigger ["EmptyDetector", [0,0,0], false]) setTriggerStatements
[
    "!triggerActivated thisTrigger", 
    "thisTrigger setTriggerTimeout [30,30,30,false]",
    "{if (markerShape _x == 'POLYLINE') then {deleteMarker _x}} forEach allMapMarkers"
];
subtle ore
#

Activation type rather

#

If it's intentional then yes

stable wave
#

can you explain what this code does in order?

#

When will the activation criteria be met?

little eagle
#

You might as well write the condition as false.

stable wave
#

Is it that if triggerActivation is not set (["NONE","PRESENT"]), conditionStatement = true alone will activate the trigger?

little eagle
#

Try it? What is this supposed to do?

stable wave
#

Removing line drawings from map. I tried it, it was working.

little eagle
#

Why create a trigger for this though?

stable wave
#

nope. I used the script

little eagle
#

The trigger framework is very bad, because I find it's behavior to be very unpredictable and illogical. So the best thing you can do is try it out.

stable wave
#

OK

little eagle
#

!triggerActivated thisTrigger as a condition for a trigger seems to be circular and confusing logic, so you should avoid it anyway. Even if it behaves as needed, there is very likely a better way.

stable wave
#

I just copied it from the web

subtle ore
#

🀦

inner swallow
#

dedmen thanks

still forum
#

throws brick at @inner swallow. There is a note on it saying "no need to thank"

inner swallow
#

thanks for the brick dedmen πŸ˜›

little eagle
#

Thank you, Dedmen.

#

Dedmen, the PR. See my note.

still forum
#

Vanilla without profiler 0.0016ms. Current profiler 0.0045ms. New profiler 0.0027ms
Yeah man! Optimizing the important things. But still too slow πŸ˜„

little eagle
#

You have to continue until the profiler is faster than the actual game.

still forum
#

I think I can actually do that now...
Engine checks everytime you set a local variable if that variable name is also a script command name. If I just disable that setting local variables will be about twice as fast...

little eagle
#

Dedmen, how should I feel about people using my functions in ways I never intended and it seems to work for them, but when you - the creator - look at what they're doing with your stuff you want to rip your hairs out? You must know about this TFAR and all.

still forum
#

Just handle them like any Arma idiot doing stupid things

little eagle
#

But I like my hair.

still forum
#

Yeah. Leave your hair be and ignore them

still forum
#

set/getVariable for the local scope?
localScope setVariable ["_var",value]
Would that be useful for anything? πŸ˜„

#

or allVariables localScope. That would probably be useful when dev'ing

peak plover
#

Yes dedmen

#

if variable name is randomized/dynamic

still forum
#

What do you mean by randomized/dynamic

tough abyss
#

Someone people will dynamic create variables via missionnamespace & format etc

#

But i really don't see the need for allVariables localScope, if you added the ability to read/set variables using script handle like you can do with fsms. That might be useful for debugging spawn sqf scripts i.e when you got multiple ones running

still forum
#

scripthandle getVariable Would indeed be interesting

#

I'll check if I can do that

#

Yeah.. theoretically. Still two things missing for that though

peak plover
#
_varN = format ["_man_%1",(name player)]; 
localScope setVariable [_varN,"Scooby Dooby Doo"];
#

I ran into this same issue once, ended up using group as namespace

still forum
#
["Scooby Dooby Doo"] params [format ["_man_%1",(name player)]]

Man that's crusty. But params!

little eagle
#

You can do this already btw.:

private _varName = format ["_man_%1",(name player)];
private _varName;
call compile format ["%1 = %2;", _varName, str "Scooby Dooby Doo"];
#

πŸ˜‚

still forum
#

no the params one is better :U

little eagle
#

They're both shit, and you should not encourage shit.

peak plover
#

call compile replace all getVar

still forum
#

OHHHH I have an Idea.. I'll make a script to assembly translator :3

peak plover
#

Can you make a program that checks the mission for stupid things

#

And grades it based on mistakes

still forum
#

Was my thought before I got that assembly translator

#

that will show you if you do something dumb :3

peak plover
#

private array - 1 points

#

no private

#

-2 points

#

select -3 points

jade abyss
#

life: -1000000000Β³

little eagle
#

billion

peak plover
#

obsfucated: -100000000000000000000000000000000000000000

still forum
#

bullion

little eagle
#

bullyion

jade abyss
#

sry, misstyped. Editing

#

done.

peak plover
#

Are you guys also jealous that life server owners earn too much money for doing shit and most of the time nothing, just using life missions someone else craeted

little eagle
#

Question!
If you write:
-10Β²
Is the result:
-100
or
100
?

peak plover
#

100

jade abyss
#
      • = +
#

πŸ€”

little eagle
#

Try it in sqf.

#

-10^2

jade abyss
#

i am scared

peak plover
#

ohh god

#

Is this another magic trick of the day?

little eagle
#

Idk.
Now try it in google:
-10^2

peak plover
#

ahaha

#

works in aram

#

100 in arma

jade abyss
#

What did you type in directly?

little eagle
#

But which do you trust more? Google or Arma.

peak plover
#

google does -(10^2)

#

You can see the equation

still forum
#

Because point before strich

jade abyss
#

point before strich πŸ˜‚

little eagle
#

"strich"? πŸ˜‚

still forum
#

dunno.. line? hyphen?

jade abyss
#

No clue, but sounds funny

peak plover
#
(-10)^2
#

Works in google

little eagle
#

But you're not allowed to change the question.

#

Truth is that there is no unary command priority in math. But there is in SQF.

#

You get the "math correct" way in sqf by using the binary minus:
0-10^2

peak plover
#

If I call call call call with the same array

#

and use set in the last call

#

it should change the array in the main call

little eagle
#

Example?

peak plover
#
private _arr = [["pump","gang"],[],[]];
private _ar1 = _arr param [0];

_ar1 call {
    _this call {
        _this call {
            private _arr1 = _this;
            _arr1 set [0,"gucci"];
        };
    };
};
?? _ar1
?? _arr

#

set should edit orignal

#

I used to before change the whole original array with setVariable and overwrite hte whole array (sometimes 1000 nested elements)

#

I realized that might be slow

still forum
#

That should edit the original... yeah

peak plover
#

Would it still do if there was a spawn?

still forum
#

yeah

#

But not that guaranteed

peak plover
#

Hmm okay

#

Well this is a lot better than before

#

I'll just use call

#

Caching thousands of groups of ai will never be the same

still forum
#

https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_directCall.sqf

new command
const "_CBA_code"
const {}
const {}
array (1 items)
array (3 items)
const "_this"
array (0 items)
array (2 items)
array (2 items)
function params
new command
const "_CBA_return"
function private
new command
const {

_CBA_return = ([_x] apply {call _CBA_code}) select 0;
}
function isnil
new command
const "_CBA_return"
function isnil
function !
function if
const {_CBA_return}
operator then
#

woop woop

#

The magic of script assembly

peak plover
#

What does that mean?

still forum
#
const "_CBA_return" //Push the string constant "_CBA_return" onto the stack
function private //call the function "private" and pass whatever is on the stack
new command //End of expression (semicolon) clear the stack if anything was leftover
const {
_CBA_return = ([_x] apply {call _CBA_code}) select 0;
} //Push a piece of code onto the stack
function isnil //Call isNil with the code on the stack
new command //Clear leftovers on the stack (isNil's return value)
const "_CBA_return" //Push string
function isnil //Call isNil with string and put return value on stack
function ! //call ! with isNil return value from stack and put return value onto stack
function if //call if with ! return value from stack
peak plover
#
private "_var";
private _var = nil;

first one is 3 mikroseconds faster

still forum
#

{private _var = true;}

new command
var true
_var = ... (local)

{private "_var"; _var = true;}

new command
const "_var"
function private
new command
var true
_var = ...
#

double the instructions == slower

meager heart
#

How it will be with ? ```sqf
private _var = _somevar call tag_fnc_somefunction call tag_fnc_somefunction2;

still forum
#

yes

#

it with how be will!

peak plover
#

essentially the more = the slower

#

Just have 1 liner insted of uselss =

#

_pos = getpos leader _group;
_arr set [0,_pos];

into


_arr set [0,getpos leader _group];
#

unless _pos is used more than once

still forum
#

well.. yeah.. that's obvious tho

peak plover
#

To you

still forum
#

Here comes the stupid thing
{[1,2,3,4,5];}

new command
const 1 //push 1 onto stack
const 2 //push 2 onto stack
const 3 //push 3 onto stack
const 4 //push 4 onto stack
const 5 //push 5 onto stack
array (5 items) //build array from 5 elements on stack

If Arma had a optimizer it would look like

new command
const [1,2,3,4,5] //push complete array onto stack

Easy <number of elements>x speedup for all arrays that are made up of constants

peak plover
#

Wud it be faster to create a new object and setvariable 100 times or have an array with 100 elements?

#

like a new namespace instead of array

#

Array is still faster

still forum
#

define "faster"

#

inserting elements: array
reading elements by index: array
reading elements by string: namespace

peak plover
#

less performance impact on the engine?

still forum
#

depends on what you need

#

if you need a list of things then array.
If you need a map of string->thing then namespace

peak plover
#

sure

still forum
#

if you need a map of thing->thing then Intercept-CBA hashmap

peak plover
#

1000 namespaces vs 1000 element array

#

Sounds like 1000 degree knife lol

still forum
#

1000 namespaces or 1000 values in 1 namespace?

peak plover
#

yeah

still forum
#

Even then. Performance impact is 0 if you don't use them

peak plover
#

1000 ELEMENT ARRAY

still forum
#

I have no Idea what you want

peak plover
#

So

#

I cache a group I need to save it's data

#

Do I save it into an array with the other groups

#

Or do I make a namespace for every group that was cached

still forum
#

what data do you save

#

if it's a finite amount use one namespace for all groups. give each group an array with all their data

peak plover
#

~40 parameters

still forum
#

one namespace then

peak plover
#

In theory 1000s of groups

#

Need to be supported

still forum
#

Β―_(ツ)_/Β―

peak plover
#

Is that beneficial instead of array?

still forum
#

What?

#

Dunno

peak plover
#

namespace

still forum
#

Depends on how you access it

#

If you search in the array by a string then namespace is better

#

otherwise array is better

peak plover
#

I search the parameters by a string

#

But parameters are diff per group

still forum
#

Dude.

#

Just use your brain. Or stop caring

peak plover
#

But I need the most MS possibkle 😭

still forum
#

The most? Then do a for ARRAY loop through all elements a couple dozen times everytime you want to do anything

meager heart
#

Btw any better solution for this ?```sqf
(sqrt (count "_string"))

still forum
#

what?

little eagle
#

Yes, remove the parenthesis.
The code raises the following question: "Why?".

still forum
#

How about

2.64575131106

? That's the best you're gonna get

little eagle
#

Maybe he meant:

sqrt count _string

With _string being a variable string, not a constant.

still forum
#

But that's not what he wrote. Why would someone write something he doesn't mean and then ask a question about what he wrote even though he doesn't even mean what he wrote although he wrote it

meager heart
#
drawIcon3D ["a3\Ui_f\data\GUI\Rsc\RscDisplayEGSpectator\UnitName_ca.paa", [0,0,0,0.5], _pos_frame, (sqrt (count _text)), 3, 0, "", 0, 0,"PuristaMedium", "top"];
#

That thing

still forum
#

I don't know any "better" way to get the square root of number of characters in a string.
Getting the square root of number of characters in a string sounds like it's the best way to get the square root of numbers of characters in a string.

meager heart
#

LOL

still forum
#

I mean you could square the numbers of characters in a string and then take the square root of it's square root.. But why

meager heart
#

Thanks Dedmen

#

But why

#

Β―_(ツ)_/Β―

dusk sage
#

this channel these days

peak plover
#

haha yeah

#

Well thanks

#

I'll do my thing with array now and then convert to namespaces and test perf

jade abyss
#

Ask quaksliver about Performance @dusk sage

little eagle
#

Maybe it's some sick optimization question about square roots.

#

Like lookup tables or polynomial approximations.

#

But then again, the input is all constants, so you could just calculate the result and use that as constant instead.

#

Why would someone write something he doesn't mean
Maybe it wasn't intentional.

#

As in the code does not what it was intended to do.

meager heart
#

the question was about "is there any better solution" for sqrt count _string and there example with draw3d... nothing more

little eagle
#

sqrt count _string is different from sqrt count "_string"

meager heart
#

i thought it will be more clear tbh

#

BUT

#

no...

little eagle
#

More clean to put around the quote marks around "_string"?

#

Oh, for us to understand it? No, it was more confusing evidently.

#

This notation could help for what you intended:

#
sqrt count STRING
#

It's still a bit weird for drawIcon3D. This is about the width of the text. The width of text is proportional to the amount of the characters, roughly.

#

But not the sqrt of that.

#

It would be too short, and that would show for long strings.

meager heart
#

So that draw3d is just text

#

And its ok for short and long strings

little eagle
#

Weird.

meager heart
#

Yep

#

That's why i asked

still forum
#
push string "_CBA_code"; 
//Now on stack: "_CBA_code"
push code {}; 
//Now on stack: {}; "_CBA_code"
push code {};
//Now on stack: {}; {}; "_CBA_code"
makeArray 1; //Takes 1 element from stack, packs it into array and pushes the array back onto the stack
//Now on Stack: [{}]; {}; "_CBA_code"
makeArray 3; //Takes 3 elements from stack, packs it into array...
//Now on Stack: ["_CBA_code", {}, [{}]]
push string "_this";
//Now on Stack: "_this"; ["_CBA_code", {}, [{}]]
makeArray 0;
//Now on Stack: []; "_this"; ["_CBA_code", {}, [{}]]
makeArray 2;
//Now on Stack: ["_this", []]; ["_CBA_code", {}, [{}]]
makeArray 2;
//Now on Stack: [ ["_CBA_code", {}, [{}]], ["_this", []] ]
callFunction params; //Call params [ ["_CBA_code", {}, [{}]], ["_this", []] ]

https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_directCall.sqf#L25

I'm starting to love this.

#

Next step is parsing SQF assembly and building SQF code out of it. So that you can turn all that into

push array [["_CBA_code", {}, [{}]], ["_this", []]];
callFunction params; //Call params [ ["_CBA_code", {}, [{}]], ["_this", []] ]

EZ 10x speedup

meager heart
#

Ok then my apologies for the unappropriate form of the questions,from the bottom of my heart Β©
And thanks from the same places for the helps for everyone involved in conferention πŸ˜‚

tranquil nymph
#

@meager heart Interesting little relation you found there, I can add this to ace spectator πŸ˜ƒ

meager heart
#

πŸ‘

delicate lotus
#

I want to create a script to manage IEDs. Would it be better to create a trigger checking for target for every IED or a loop / waitUntil for every IED or a secondary script looping and doing all the checks in a single instance?

tranquil nymph
#

Generally minimising the number of loops running in parallel is best

#

(So the 3rd option)

dusk sage
#

If you needed to serve soup to 10 people would you use 10 different pots?

tranquil nymph
#

Triggers are handled by the engine though, so depending on how complex your condition is they might be better

#

Also on the number of IEDs, a single loop would scale better, but at low numbers triggers might be simplest

dusk sage
#

'better' is a very ambiguous word

delicate lotus
#

its just a nearby player check

#

And I dont plan on using lots of IEDs, only like I dunno a max of 20?

tranquil nymph
#

If it's just for a mission I'd have a single loop running yeah

#

while _IEDsRemaining > 0 do { { check for players } forEach _IEDsRemaining } etc.

delicate lotus
#

yeah like that

#

I think it would be good to let the manager script run only on the server, right?

tranquil nymph
#

Definitely

delicate lotus
#

thx ^^

#

params [["_object", objNull,[objNull]]];
This will declare the _object variable with objNull if nothing is given as first argument or when the argument is not an object, right?

winter dune
#

when _object is not defined, it will be defined with an objNull, if it's defined with a wrong data type, you will get an error on the screen

#

if i'm not wrong

peak plover
#

context

#

[variableName, defaultValue, expectedDataTypes]

#

Yes @delicate lotus

#

btw what happend to that guy who was developing an open source life thing?

still forum
#

Tonic? Dunno. What should've happened?

peak plover
#

Was some unknowns poopped here in semptember and asked if they should go open source and said they wanted to wait until 1.0

#

Just wondering if they managed to complete it.

jade abyss
#

Tonic doesn't give a f about life since.. idk.. 1-2 years min.

tough abyss
#

How do I create a life mod? /s

jade abyss
#

Download every FreeModel you can find (or port them from other games), import them shitty, steal somebodys mission, done.

peak plover
#

πŸ˜„

tough abyss
#

Sick let me go make thousands now

jade abyss
#

Yes, many $$$

young current
#

at least 350

rugged ledge
#

who knows how to create proxy on the additional device? own proxy on the additional device. (the example - on the left hand is attached by p3d model - but it isn't weapon, it doesn't shoot, it performs other functions. perhaps where that it was discussed? channelize

#

@young current ☺/

still forum
rugged ledge
#

@still forum it not absolutely concerns model, it is more how to create a new class or a script

still forum
little eagle
#

Dedmen, where's my hate for using tagged local variables? QS got shat on for that.

still forum
#

I don't know where your hate is. Did you check under your bed?

little eagle
#

The one that I'd receive, not the one I'd generate.

still forum
#

Oh. I didn't see anywhere where that would be appropriate

little eagle
#

But isn't it a double standard if some people are allowed to use tagged locals, and others aren't?

still forum
#

You are confusing me...

#

throws hate at @little eagle

still forum
#

{[1,2,3,true,false,"test",[["yes"]]]}
Normal compile: 0.0046ms
Decompile and recompile from ASM: 0.0034ms (difference is within measurement error)
compile from ASM using handwritten ASM code: 0.0014ms

Hand written SQF assembly 4x speedup when just having some simple array constant.

peak plover
#

ASM?

tough abyss
#

assembly

peak plover
#

How do you do that? interception?

tough abyss
#

yep

#

@still forum so i should just program in asm?

#

sounds easy

lone glade
#

IS I.N.T.E.R.C.E.P.T YOU NIGELHEAD

still forum
#

Crap.. parseSimpleArray can't have code inside it.. call compile it is then :/

#

I can now write directly SQF assembly with Intercept

#

Each instruction takes time. And now I can hand-write

endStatement;
push array [['_CBA_code',{},[{}]],['_this',[]]];
callFunction params;

which does the same as the engine does with

endStatement;
push string '_CBA_code';
push code {};
push code {};
makeArray 1;
makeArray 3;
push string '_this';
makeArray 0;
makeArray 2;
makeArray 2;
callFunction params;

But way shorter and thus faster

#

Now I need someone like @queen cargo to take this and turn it into a general script optimizer. And then you simply load a mod and all your script perf increases by 20% or more

peak plover
#

πŸ‘Œ

#

That's awesome

#

πŸ€”

#

How much stuff can I do with intercept?

still forum
#

Well.. What can you imagine of doing?

peak plover
#

math ,run commands, recieve and output. Right?

still forum
#

yeah

peak plover
#

Hmm

#

I wanna do like per frame checks which might get too expesnive so I can't do it

#

hideObject per frame for all things not in field of vision/viewrange

still forum
#

Probably not worth it

#

what's not in vision isn't rendered anyway

peak plover
#

I disagree

#

Strongly

still forum
#

:u

peak plover
#

Probably just gonna ditch the field of vision idea

#

But gonna have dis

#

inArean is pretty fast too

still forum
#

That's definetly something you could do with Intercept yeah.. Intercept has a special thingy for getting objects positions that reads directly from memory instead of going through sqf commands

peak plover
#

hmmmm

#

I used enableSimulation false

#

So there has to be some info coming about the units from server

#

In theory it shouldn't bee too bad

#

Loop on server, send units that need to be uncached to player

#

Prob. speed multipler and it is fine :\

tranquil nymph
#

@still forum Gimmie procedurally generated terrains pls πŸ˜‰

#

There's a challenge for ya

peak plover
#

Procedually generated FPS

still forum
#

no.

#

Very funny

queen cargo
#

@still forum not sure what exact task you would want to have me doing on this here

still forum
#

You are so good in writing linter and parser and all that stuff. Sounds like a Assembly based script opimizer would be a task for you

queen cargo
#

did not followed up the convo

#

soooo ... no idea what exactly you did there πŸ˜…

still forum
#

Another example params [["_CBA_code", {}, [{}]], ["_this", []]];
Engine generates

push string '_CBA_code';
push code {};
push code {};
makeArray 1;
makeArray 3;
push string '_this';
makeArray 0;
makeArray 2;
makeArray 2;
callFunction params;

And takes 0.0063ms to execute that.
I hand-write

push array [['_CBA_code',{},[{}]],['_this',[]]];
callFunction params;

And that takes 0.0032ms

Almost doubled performance just by optimizing the shit assembly Arma generates

#

I wrote a way to disassemble compiled SQF code and compile hand written SQF assembly

queen cargo
#

ahh
ok

#

well, sounds like the "issue" i had in the beginning by doing the parsing of arrays just like everything else in sqf-vm (now i also just build the array upfront instead of using instructions)

still forum
#

There is a nice example. If you could build a optimizer that runs over every compiled script and turns arrays from the first snippet into the second snippet that would probably speed up all scripts by over 20%

queen cargo
#

need more info about this to do it at all
right now this looks like some sort of sub-language?

still forum
#

You can only do that for Arrays made up of constants. Which almost every params call is. And params is everywhere

#

That is the assembly that SQF code is compiled down to

#

Just in a nicely readable form

queen cargo
#

ok
probably can do it
just gimme all info about the "syntax" of the readable form (or the binary variant) and i will see what i can do

#

if it actually is the human readable form or a binary version is not rly that interesting

#

and yeah πŸ™ˆ writing parsers is a hobby of mine πŸ˜…

still forum
#

There are only 7 different instructions

#

Besides the one I create myself but I don't really want to have them be assembly compatible

queen cargo
#

any sort of stream one gets for theese?

#

or you mean literally file-based assembly writing of SQF

#

because right now i am still a little bit confused about what to do
making this to what you would like to have is fairly simple

#

but figuring out what exactly you expect as tool ...

still forum
#

My Idea was something that get's the assembly string/binary/whatever and figure out if there are things in it that can be optimized.
For example when you write true then engine generates a callNular true which calls the true function which is obviously slower than a
push bool true which pushes a precomputed constant to the stack.
Or when you generate an array it pushes all elements to the stack and then says "build an array out of the last x elements on the stack"
which can be optimized to "push precompuled array constant to the stack" which is much much faster

queen cargo
#

is there some "mark" that tells you if an array is following?

#

would make things easier

still forum
#
push string '_CBA_code';
push code {};
push code {};
makeArray 1;
makeArray 3;
push string '_this';
makeArray 0;
makeArray 2;
makeArray 2;
callFunction params;

There is the makeArray instruction that takes the last x elements on the stack and makes an array out of it.

queen cargo
#

so no

#

kk