#arma3_scripting

1 messages · Page 357 of 1

queen cargo
#

you can add scripted EH to the vehicle

#

getIn

#

tht triggers whenever a unit gets ijn

#

not sure about what you try to archive

#

but that should get you some steps closer to your goal as long as you understand some SQF

astral tendon
#

is this

#

helicopter is called med1

#

medi once there is a player inside cargo must go to a landing area

#

and repeat the cicle all over

#

{isNull gunner _x} was working

#

but i dont wanna the player have to be in the gunner seat to be trasported

#

{isNull gunner _x} count [medi1] == 0

#

this is the full activation

#

and {isNull cargo _x} does not exist

queen cargo
#

Array - An array with all units in the vehicle is returned.

astral tendon
#

crew counts evreyone

queen cargo
#

<CODE> count <ARRAY>

#

_obj = gunner _x; {_x != _obj} count crew _x > 0

#

whoops

#

what is that

#

magic 😱

#

hf 😃

astral tendon
#

medi1 = gunner _x; {_x != medi1} count crew _x > 0

#

i did something wrong?

queen cargo
#

yes

#

{isNull gunner _x} count [medi1] == 0 is bs

#

isNull medi1 would be sufficent

#

private _obj = gunner medi1; {_x != _obj} count crew medi1 > 0

#

use that

astral tendon
#

now the tigger activate when there is not player inside

#

also, there is the AI pilot inside it

queen cargo
#

add more exceptions

#

alternatively you also can remove gunner etc. from the crew

#

think there was also a passengers command

astral tendon
#

i made it work

#

private _obj = gunner medi1; {_x != _obj} count crew medi1 > 1

#

that 0 in the end was what?

queen cargo
#

with crew filter

astral tendon
#

im gonna use that one you give me, thanks.

still forum
#

@queen cargo a object variable contains a pointer to a pointer. If the unit is deleted the second pointer is a nullptr.

queen cargo
#

but not in the SQF-VM

runic surge
#
if (_grpSide != west || east || civilian) then {_grpSide = resistance;};

Since there is basically no consistency with what is used to refer to the independent side, I am trying to use this to make sure that the player side gets set to resistance. It says generic error in expression before the first ||

still forum
#

yeah...

#

that's true

little eagle
#

my

still forum
#

that's not how "or" works

#

you are doing
(_grpSide != west) || (east) || (civilian)
Which doesn't make sense

little eagle
#
if !(_grpSide in [west, east, civilian]) then {
    _grpSide = resistance;
};

But that still is pretty nonsensical.

still forum
#

It also doesn't give you a generic error in expression.. It shows what the real error is just above...

little eagle
#

Since there is basically no consistency with what is used to refer to the independent side
Yes there is. It's resistance and independent just like how NATO is on blufor and west.

runic surge
#

the strings return "GUER"

little eagle
#

So?

#

civilian is stringified as "CIV"

runic surge
#

so it messes up my script format and complicates things

little eagle
#

That is a problem with your script then.

#

Not with the SIDE or SQF.

runic surge
#

it only works if I set the default value to be resistance

little eagle
#

Then fix your script.

#
private _fnc_serializeSide = {
    #define SIDES [west, east, independent, civilian]
    #define SIDES_STR ["WEST", "EAST", "INDEPENDENT", "CIVILIAN"]

    params [["_side", sideUnknown, [west]]];
     SIDES_STR param [SIDES find _side, "SIDEUNKNOWN"] // return
};

call compile str resistance // any
call compile (resistance call _fnc_serializeSide) // GUER

I posted this 3 times this week already. D:

runic surge
#

YOU CAN DO THAT

#

I'm going to go hang myself bye

still forum
#

Yes.. you can script using SQF.

#

It's a thing.

robust hollow
#

😱

runic surge
#

I didn't know you could modify values like that

little eagle
#

I don't get the problem. This is very easy to do.

still forum
#

There is no value being modified in that script...

#

literally...

#

also.. @little eagle isn't the comment on the last line incorrect?

little eagle
#

How so?

robust hollow
#

itd return INDEPENDENT

#

cause thats the string?

little eagle
#

GUER IS independent

still forum
#

The function only returns "WEST", "EAST", "INDEPENDENT", "CIVILIAN", "SIDEUNKNOWN"

#

It can't return "GUER" or GUER

runic surge
#

so it doesn't change what the green side string is?

little eagle
#

GUER is how independent is represented.

still forum
#

I just assumed the comment is telling the returned value

little eagle
#

It does.

#

call compile (resistance call _fnc_serializeSide)

#

GUER

#

call compile str resistance

#

any

still forum
#

I see....

little eagle
#

Don't tell me this is too difficult for you too^^

still forum
#

It is

runic surge
#
params [
    ['_grpType',configNull,[configFile]],
    ['_grpCost',0,[0]],
    ['_grpSide',sideEmpty,[civilian]]
];

if (_grpSide == civilian) exitWith {hint "You cannot recruit civilians!  That's a war crime, you absolute cunt";};

private _p_balance = [WEST_balance , EAST_balance, GUER_balance] select ([west, east, resistance] find _grpSide);

If I play as independent it always uses the default value, which in this case is sideEmpty, because the "GUER" string is what is being passed into the function

still forum
#

I already closed everything besides discord because I wanted to go to bed

#

just make the default value be resistance instead of sideEmpty

#

if you already know that sideEmpty can't happen as you always pass in a valid side

little eagle
#

There is nothing wrong with this script. The issue must be in how it's called.

still forum
#

yeah. He posted earlier today. He is calling this via a formated string

runic surge
#

Command is formed with the format string

little eagle
#

You can't do that. Change it.

#

If you really really have to "format string" (serialize) the side, then use:

#
private _fnc_serializeSide = {
    #define SIDES [west, east, independent, civilian]
    #define SIDES_STR ["WEST", "EAST", "INDEPENDENT", "CIVILIAN"]

    params [["_side", sideUnknown, [west]]];
     SIDES_STR param [SIDES find _side, "SIDEUNKNOWN"] // return
};

call compile str resistance // any
call compile (resistance call _fnc_serializeSide) // GUER
#

And it will all work out and there will be no problem.

#

...

runic surge
#

I kind of need to since it is a diary record and the part that calls the function is dynamicish

#

Anyway, thanks for your patience

little eagle
#

Yes and I posted how you have to do it

runic surge
#

Where should that code be?

little eagle
#

I really really REALLY don't see how this is still an issue.

#

Anywhere you need it.

runic surge
#

because I'm retarded I don't know what to tell you

little eagle
#

Post the line where you 'format string' the side

runic surge
#

could I post it in the init to be used in all of the format strings? There are several of them

#

actually nvm I can just post it where all the records are created

little eagle
#

... ?

astral tendon
#

is there a way to turn off a trigger? like, i dont wanna hes conditions to be meet until another trigger activate first

runic surge
#

triggerActivated triggername

#

or set a variable to true when the first one activates

#

use that as the condition

astral tendon
#

how i set a trigger to false?

runic surge
#

not sure what you mean

astral tendon
#

you said about set a variable to true?

runic surge
#

In the init or a game logic, put myvar = false and in the first trigger myvary = true on activation and the second trigger put myvar as the condition

#

second trigger won't activate until the first one

astral tendon
#

i find somehing

#

i can put && to multiple conditions

runic surge
#

yeah

astral tendon
#

in case of triggerActivated triggername && triggerActivated anothertriggername

#

i nedd to activate the 2 triggers or 1 at time and still works?

runic surge
#

both need to be activated

#

same if it was two variables

astral tendon
#

{isNull gunner _x} count [car1, car2, car3, car4, heli1, heli2] <= (4 - ({alive _x} count playableUnits)) max 0

#

this condition is supouse to work only if there is 4 gunners in total in those units but only alive players/AI slots

#

this is not activating

#

any idea?

#

they need to activated at same time?

robust hollow
#

// if there are 4 gunners this will return 2
{isNull gunner _x} count [car1, car2, car3, car4, heli1, heli2]

// if there are 4 playable units, this would be 0
(4 - ({alive _x} count playableUnits)) max 0

so your basically doing 2 <= 0;
2 is never less than or equal to 0

astral tendon
#

and if i put >=?

robust hollow
#

do u want it just players as gunners or any player or AI, as long as there are atleast 4 gunners?

astral tendon
#

4 alive PLAYES and AI as gunners

#

becasue the AI is slot for players

robust hollow
#

then u could just do
{!isNull gunner _x && {gunner _x in playableUnits}} count [car1, car2, car3, car4, heli1, heli2] >= 4
which is if the gunner is not null and the gunner is a playable unit.

astral tendon
#

about the trigger, they need to be activated at same time or one time only?

runic surge
#

I am just going to start over with my better understanding of things now. I hopefully will do things right this time

astral tendon
#

{!isNull gunner _x && {gunner _x in playableUnits}} count [car1, car2, car3, car4, heli1, heli2] >= 4

#

this did not worked

#

3 AI gunners in and 1 player in and still not firing the trigger

little eagle
#

Well yeah, this only is true when 4 players are the gunners, not AI

robust hollow
#

playableunits includes playable AI?

little eagle
#

Yes.

#

allPlayers doesn't

astral tendon
#

i find another way around

#

quick question, if i add a DLC prop, units, vehicle people need to own the DLC to play my mission?

rancid ruin
#

i expect it will add said DLC to the requiredAddons list in your mission file so yeah

robust hollow
#

no. You can play still play the mission but if you use weapons or vehicles belonging to a DLC u dont own it will have watermarks (and maybe wont let you use some things, im not 100% certain on that).

waxen tide
#

is the biki dead slow to anyone else?

vague hull
#

dead, yes

waxen tide
#

D:

#

where are the triple redundant mirrors? how am i supposed to work like that?

vague hull
#

google cache?

tough abyss
#

Both the forums and biki are down.

waxen tide
#

stares at a wall, motionless

little eagle
#

What do you need?

waxen tide
#

a working biki.

waxen tide
#

😗 thanks commy2

rancid ruin
#

just use google cache like senfo said

#

or you could wget the whole wiki the next time it's online, i did that a year or so ago

waxen tide
#

somehow google cache isn't working out for me on biki.

halcyon crypt
#

it's a bit outdated though ^^

#

google cache works fine for me

rancid ruin
#

same

austere granite
#

Anyone aware of a way to figuring out if PIP setting is turned on?

rancid ruin
#

@Adanteh#0761 isPipEnabled?

austere granite
#

that works. Guess i sholudve checked the archive page

shut flower
#

Does anybody have a clue how I could get the path of the surface texture? With surfaceType I can get the surface type. When I remove the leading # I get the config name in CfgSurfaces. But there the paths to the textures are not defined, there is a wildcard for the file name. When just using maps from A3 I can parse this and get the path of the surface texture (\a3\map_data\<tetxure>_co.paa) but this doesn't works for community made maps. Theoreticially the absolute path has to be defined somewhere. But where is it defined?

tough abyss
#

Why you want the path ? Its prob baked in the wrp or rvmats for the surface mask.

austere granite
#

One example could be having custom fortifications with a hiddenSelection for the dirt mound, which you would then texture according to the surface it is placed on, by retrieving the surface texture for it.

#

Anyway from a terraijn making perspective you never specify the path in something that you would be able to read through scripting. The full path is specified in layers.cfg, but that gets baked in

polar folio
#

does anyone know if teh NVG goggles overlay is a dialog control or display that can be accessed?

austere granite
#

looking at my terrain files and scripting i dont think it's possible @shut flower

#

i think you'll have to go the route of either creating some config entries yourself for each terrain or using a switch for worldName and just looking up the paths that way

#

It would require you to manually add support for terrains, but dont think you got another option

shut flower
#

Ok thanks

#

And yeah you are right, it’s intended for retexturing fortifications

austere granite
#

😄

#

what a guess

#

had the exact same thing in mind, but never tried it

astral tendon
#

this disableAI all;

#

this cant be used for this?

still forum
#

you should read the wiki page of disableAI

#

your syntax is incorrect

astral tendon
#

thanks for point me out what is it

still forum
peak plover
#

hi, can I script here?

shut flower
#

Yes you can script here

astral tendon
#

script machine broke

simple solstice
#

special someone told me that you would like this

#
tickTime = diag_tickTime;
diag_log format["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];

that returns
"Time to complete: scalar NaN (in seconds)"

tame portal
#

@simple solstice its because the first "tickTime" is missing an underscore

simple solstice
#

I know that, but people were looking what causes a NaN error(?)

little eagle
#

_tickTime being undefined.

#
str [0 + _undefined]
#
"[scalar NaN]"
#

Not a Number

simple solstice
#

yup, x39 was looking for NaN errors 😃

little eagle
#

It's not really a NaN value though. It's a nil with the NaN type. Because all math commands can return either NUMBER (scalar) or NaN (NaN scalar).

#

All the math commands in SQF are set up to report NaN by default.

#

Other commands that can't report NaN, but only NUMBER do this:

str [_undefined ammo _undefined]
#
"[scalar]"
simple solstice
#

@queen cargo

little eagle
#

So careful, scalar NaN is a nil value and not a NaN value like 1+INF or QNAN

#
[nil, nil ammo nil, + nil, sqrt -1]
#
[any,scalar,scalar NaN,-1.#IND]
#

damn copy paste

peak plover
#

ugh...

little eagle
#
[nil, nil ammo nil, + nil, sqrt -1] apply {typeName _x == "NaN"}
// [bool,bool,bool,true]
[nil, nil ammo nil, + nil, sqrt -1] apply {isNil "_x"}
// [true,true,true,false]
#

all these typos, urg

peak plover
#

How can I setVariable on before initPost

little eagle
#

By doing it?

peak plover
#

When I do it in init for editor

#

When does it happen?

still forum
#

at init.

peak plover
#

I guess I might jsut add a sleep to my function that requires the variable

little eagle
#

setVariable works fine in the object init boxes, including setvariable public.

peak plover
#

I might just have to put a sleep for ~1 sec and then loadout

#

probably best to do a little randomization for the sleep as well, as loadouts might cause fps drops

little eagle
#

setVariabe public is broken for the object init events. It doesn't synch, no matter if the object is created at mission start or during the mission. And that is one reason why InitPost exists in CBA.

astral tendon
#

well, im having trouble with AI (once more), now i dont know what i did but they are not following correctly the leader of the convoy

#

they just stop in the middle of the road sideways and do nothing

#

any idea how to fix that?

little eagle
#

Delete them and create new ones?

astral tendon
#

by doing that im trowing a week of work to the trash

peak plover
#

That's impossible

#

You already worked, so you already spent it. Can't get it back and throw it away.

You could however throw the result of your work in the trash

#

they just stop in the middle of the road sideways and do nothing
Are they grouped together?

astral tendon
#

yes they are in the same group

#

actually, one of they stop in the midle of the road stoping everyone

peak plover
#

hmm

runic surge
#

is there any way to prevent an object from jumping up when being detached from a parachute?

#

I have tried several things, mostly attempts with enableSimulation and setPos

#

but everytime the object gets detached, it appears a few meters above where it was and falls to the ground

#

nvm setPosATL seems to be the way to go

astral tendon
#

threre is a command to make enginne invunerable?

tough abyss
#

Anyone who can help me regarding to script a weapon I'm making?

runic surge
#

you need to be more specific

tough abyss
#

well, I want to know what I need to do

#

My modelling artists are setting up the weapon model

#

how do I actually make it work

#

assign a sound to it

#

assign the animation they're making*

runic surge
#

You should do some research before coming here, since that AFAIK is pretty basic stuff, but if you have trouble, you should ask in #arma3_model

#

that is all just the config and model.cfg work

austere granite
#

@astral tendon No, you'd have to use handleDamage eventhandler instead

peak plover
#

Is there a way to avoid doing private do get to the previous scope?

#

because I'm too lazy to private ~20 variables

#
_var 1 = 1;
call {
    _var2 = 2;
    _var3 = 3;
};
_varTotal = _var1 + _var2 + _var3;
#

How to I do this with the least amount of effort?

#

I might just do global variables ...

peak plover
#

I'll try using global variables

#

and I used allVariables command to grab the varaibles

#

So I'll reset after every use

#

I hope this won't be slow

#

jeez. this all seems stupid..

little eagle
#

You're drunk.

peak plover
#

Nop.

little eagle
#

Is there a way to avoid doing private do get to the previous scope?
???

peak plover
#

Well, basically

#

Example code

#

It says _var2 undefined

little eagle
#

Yes.

#

Well, solution 1:

_var1 = 1;
_var2 = 2;
_var3 = 3;

_varTotal = _var1 + _var2 + _var3;
#

Get rid of the scope.

peak plover
#

I need it because I'm loading a file

little eagle
#

"loading a file"

peak plover
#

call compile preprocessFileLineNumbers _factionFile;

private code = call compile format ["loadout%1Code",_role];

little eagle
#

🤔

peak plover
#

I'm adding a file that can be anything and then I'm getting a value that can be anything

#

Unknowns

little eagle
#

I'd rethink the structure of what you're doing.

peak plover
#

Before I had a huge array of private variables, but that ment if I ever wanted to add something I had to add another variable to private array

little eagle
#

Basing your code on carried over locals is really bad.

peak plover
#

Now I will just use global variables instead

little eagle
#

but that ment if I ever wanted to add something I had to add another variable to private array
Yeah, that's why we have the keyword now.

peak plover
#

Well now I can just _unit setVariable ["unit_loadout_role","ANYROLE"]; and it will get it from the proper file

little eagle
#

Object namespace variables are always a good idea.

peak plover
#

When I last tested, I think with 32 bit game

#

Took many millions variables to crash game

#

So it should not be an issue

#

Either way I got a script to delete everything

little eagle
#

Eh, all the variables you can think of will only ever make up a tiny fraction of what a single texture will eat of memory.

peak plover
#

I'm also going for more of "First do it, then optimize it"

#

Seems to be working out nice

#

Havind doubts 'tho:S

little eagle
#

It's not what I do, but the more "professional" programmers I know talk sometimes about that approach.

#

Very rarely do people actually use techniques to optimize code in SQF. It's more like rewriting it to compensate for the lack of a compiler that would do that stuff for you.

#

And stupid arguments like count vs. forEach.

peak plover
#

Yeah, while in reality all we need is 200 fps server 😂

#

I wonder if that benefits scripts?

#

In theory it should give more time per second to the scheduler

#

So scheduled scripts should run better...

little eagle
#

Quantum computers.

peak plover
#

Ok, in theory there are way better and faster script engines / languages... so there's no need to push hardware until we've peaked software wise...

little eagle
#

Don't think the problems of Arma with performance come from SQF.

peak plover
#

What's the biggest killer?

little eagle
#

I have no idea, maybe dedmen knows. I suspect animations and PhysX.

peak plover
#

ai...

little eagle
#

Eh, not sure. Many soldiers also means many animations going on.

peak plover
#

I think what's also a huge part of understanding is comparision to other games...

little eagle
#

To test one would have to place like 100 v 100 VirtualMan_F against each other.

#

Those have no model.

peak plover
#

VirtualMan_F The what?

little eagle
#

It's just like B_Soldier_F, as soldier classname, but without model.

#

No model = no animations. In theory.

peak plover
#
for "_i" from 0 to 1000 do {private _guy = "VirtualMan_F" createVehicle position player;}
//3fps
#

stabilized to 15 in a few sec

little eagle
#

You need createUnit

peak plover
#

Very unresponsive

#

Should have started with 100

peak plover
#

12 fps with 100 createUnit

waxen tide
#

"Yeah, while in reality all we need is 200 fps server 😂 " That guy is so annoyingly stupid ...

runic surge
#

is there a way to set the high command commanders entirely through scripting?

waxen tide
#

The eden editor has a function to save compositions. they're saved in an extra file each, sqe format, and the contents look like this: https://pastebin.com/xtAG5CLi

#

i would like to use this format to save objectives i spawn dynamically by scripts during the mission. but i'm a bit clueless how to interact properly with these classes? i mean i know the basic concept of classes i've just never used them in sqf and my google fu failed me. maybe someone can point me in the proper direction. 😳

robust hollow
#

include them in ur description.ext (or config.cpp if ur doing a mod?).
for spawning them id just use soemthing like forEach ('true' configClasses <configDir>) to loop through each item in the composition.

waxen tide
#

it is just a mission, not a mod. okay i'll play around with configClasses. but it doesn't seem there is any real advantage in this data format?

#

i guess the advantages of classes (inheritage?) can't really be utilized in that case

robust hollow
#

its good for readability i guess. i tend to use configs instead of arrays of data cause to me its easier to understand getNumber(missionConfigFile >> 'myClass' >> 'myNumber') than _array select 4 or whatever

waxen tide
#

fair enough

tough abyss
#

getNumber(missionConfigFile) can be replaced if they fixed it using the BIS function.

#

@waxen tide

waxen tide
#

by what?

tough abyss
#

Less messy.

#

or

#

Not sure if it still works though.

#

It had issues with some config files I used #include config.hpp to use seperated config files.

#

Had issues where it wouldn't pick up the #include headers copy placed into the file

waxen tide
#

i'll check that out, thanks!

tough abyss
#

np.

tough abyss
#

Can be a sod to get them to do it.

#

@rough heart

rough heart
#

gotta copy paste it over

#

hold on

tough abyss
#

You know how to post it as SQF?

#

backticks sqf at the end

rough heart
#

DutchMan.Hx - vandaag om 09:28
i never saw that channel
btw
quick Scripting question
i wanna have AI follow into a Player vehicle
multiplayer session
i have a netID
Major Mittens - vandaag om 09:28
Lol go #arma3_scripting 😛
DutchMan.Hx - vandaag om 09:29
Do i need to use the Netid from the player to dertermine what kinda vehicle it is or get the NetID from the vehicle so that i set the AI to follow it

tough abyss
#

backtick backtick backtick sqf

rough heart
#

so, all sorted

tough abyss
#

If you wanted to post the code you've got so far.

rough heart
#

actually trying to adjust something

#

hold on

tough abyss
#

AI is handled server-side.

rough heart
#

I know

tough abyss
#

So making them follow the player isn't too hard. Even in MP

rough heart
#

its a file that runs while true

#

serverside ofc

tough abyss
#

Do you need to know what kind of vehicle the player has?

rough heart
#

cant post the code in here

tough abyss
#

Can.

#

See on the keyboard

rough heart
#

no to long

#

cant post it

tough abyss
#

codeshare?

rough heart
#

some like that

tough abyss
rough heart
#

that fm tho 😮

#

im so shitty with arma scripting

tough abyss
#

Just waiting for Atom editor to install SQF syntax highlighter.

#

afk I've got do go do somethings.

rough heart
#

Np, i gotta go get some sleep anyway 😛

#

like 10 am here

tough abyss
#

I'll have a look at it.

#

Did you check to see your var existed?

#

getVariable?

rough heart
#

it exists

tough abyss
#

Okay so it's a flow logic error.

rough heart
#

it follows the player

tough abyss
#

But?

rough heart
#

but i need to let it check if the player is inside a vehicle and if

#

let it get in the car with the player

#

that it is following

#

but

#

with whatever i tried untill now it didnt work

#

so i took a snippit from a other script that i knew worked in the past, not sure if it still does but anyway, i figured adapting it to get the vehicle from the netid or something would be sufficent enough to make the ai stick to it and get in

runic surge
#

waitUntil {!isNil BTH_RTS_MissionInitComplete}; Shouldn't this wait until a variable called BTH_RTS_MissionInitComplete is defined? It gives me an undefined variable in expression error, which doesn't really make sense

#

nevermind it is supposed to be a string

#

btw that group spawning issue I was having a couple days ago is something I just decided to approach differently.

BTH_RTS_TEAM_BLU_Grp_List = [
    [["B_Soldier_SL_F", "B_soldier_LAT_F", "B_Soldier_GL_F", "B_soldier_AR_F"], 550, "Fire Team"]
];

An array with a list of units to create a group from makes things much easier and allows much more customizability

tough abyss
#

Can also use other data structures

#

Beyond just a list.

astral tendon
#

why is my unit not holding on the hold marker?

#

i need to put something else?

lavish hamlet
#

i need to run a line of code whenever a player removes his backpack.. how do i detect this event. ?

astral tendon
#

You guys know any way to disalbe fiendly fire?

distant egret
#

@astral tendon like no getting damage or preventing friendly AI shooting you?

astral tendon
#

no get any damage by fiendly

still forum
#

@peak plover true. The more fps the more scheduler time. so scheduled scripts finish faster. That's about the only improvement I am sure about.
And yes.. There are faster script languages.. #Intercept
Biggest part of Arma frametime is usually simulation and rendering.

@runic surge The syntax is isNil "varName" not isNil varName

little eagle
#

Does simulation include animation and physics?

still forum
#

yes

little eagle
#

Now the question is which part of the simulation is the worst.

tough abyss
#

Likely the physics.

#

PhysX as a whole is a performance hog.

little eagle
#

I suspect it is really bad, but does it come into play when everything is stationary? Is it that poorly programmed?

#

I'm really suspicious of the animations of soldiers. They seem very complicated when you look at the config and how many classes there are and how convoluted they are linked.

tough abyss
#

Yeah. Some of the animations look pretty bad.

#

But again doesn't all this get piped again through SQF?

little eagle
#

No.

#

The only things that are SQF in vanilla are... let me think... Many ui things and stuff like modules and eden attributes.

tough abyss
#

Yet I recall a considerable amount of other code is SQF not just UI.

#

Or modules.

little eagle
#

What exactly?

tough abyss
#

Can't recall and don't have A3 installed but I de'pbo'd a bunch of files and found a number of scripts.

#

I mean come on the cfgFunctions.hpp

#

is written in SQF :/

#

I've seen the code that manages it.

little eagle
#

Oh yeah. The initFunctions.sqf is SQF. But that runs at mission start and is done at some point.

#

Also the .fsm of the animals etc.

tough abyss
#

But a lot of the functionality as a whole the entire game is built on SQF I think that there is in part of the problem.

little eagle
#

Everything SQF is not part of what dedmen said is simulation and rendering though. It should be it's own item.

tough abyss
#

No that is true.

#

But his "FPS unlocking solution" according to dwarden will just improve some scheduled scripts execution

#

Doesn't unfortunately effect the Simulation loop

little eagle
#

I think that there is in part of the problem.
And I don't think so. Not because it wouldn't be if the premise was true, but the most complicated things are done outside SQF.

#

The FPS unlocking is rather pointless when your server already is below 47 FPS.

still forum
#

@tough abyss initFunctions.sqf us actually quite performant. I rewrote it in Intercept and didn't get much improvement out of it

little eagle
#

It's pretty ugly though.

still forum
#

@tough abyss "But a lot of the functionality as a whole the entire game is built on SQF" Not that true.. SQF is still a very small part if you look at the rest of the engine

#

It does affect the simulation loop. In that it get's double the executions if you run at 100 fps

tough abyss
#

Thats the sim-loop you can also see how many AI are active.

still forum
#

and as you can see rendering is what.. 75% part of the frame?

tough abyss
#

Nope

#

wDisp

little eagle
#

The vanilla debug console is so tiny^^

tough abyss
#

I know.

#

That was only with 15 AI

#

fighting

still forum
#

@tough abyss Can you even read what you post? wDisp 2ms rendr 16.5ms

tough abyss
#

Look at my dia_capture you could say sound is the performance hog.

still forum
#

it's definetly rendering...

#

sound is also just 0.4ms

tough abyss
#

Look at the "main thread"

still forum
#

I do..

tough abyss
#

wSImA

#

preLd

#

VisuA

#

What the hell is preLd

still forum
#

You are trying to tell me that of 28ms the 0.6 and 2ms ones are the most performance hogs? but you ignore rendr which takes 16.5ms

#

preload. Load Models/Textures from disk

little eagle
#

Yeah, I never bought into this the "sound breaks the FPS". I believe people started thinking this, because a problem that causes bad FPS also affects the sound. But not the other way around. Also gunfire sounds, but the simulation of the fired bullet is the actual problem.

tough abyss
#

Yeah

#

Particles are they calculated GPU or CPU?

little eagle
#

I just don't see how playing a sound would be expensive compared to drawing a landscape and models.

still forum
#

It does sometimes though.. @little eagle There is some bug that causes sound to sometimes go to 90+ ms. It's processing sounds you don't even hear and that shouldn't even exist.
Very hard to reproduce so I don't know of BI already fixed that by accident

#

Particles are on CPU

tough abyss
#

There is lies a big big problem

#

Move the particles to the GPU

#

SpaceEngineers recently did this.

#

Eliminated a number of performance issues

still forum
#

Particles are also multithreaded.. except they need to be on main thread for some reason

little eagle
#

t does sometimes though.
Sure. Never exclude dumb bugs like that..

tough abyss
#

I really don't like the word multi-threading when talking about ArmA 3

rough heart
#

Space engineers is still a power hungry game regardless of those Little performance updates

tough abyss
#

It does a weak scaling multi-thread.

still forum
#

Also server still has to calculate particles. Server's usually don't have GPU's

tough abyss
#

Called... function parallelism if I remember correctly.

still forum
#

It is real multithreading though.

#

just only for that small part

tough abyss
#

Everything is talking back to the main thread.

#

So you can clearly see this when you try to run 4 HC's

#

I've done it for a community CPU core 0 maxed out.

#

The entire server effectively got crippled, and when a HC DC'd oh yeah that wasn't good.

#

I even had the HC's locked to specific cores

#

to keep them contaminating the server loop

still forum
#

do a serverside captureFrame and check why that happens

little eagle
#

Oh, also MP is pretty poor compared to SP.

little eagle
#

If you have 4 HC's on your server, you have 5 different main threads.

tough abyss
#

Yeah we had a dual socket Xeon server

#

48 cores in all

#

128GB of RAM

still forum
#

@tough abyss Where did you come from btw? Your first message in this Discord was starting this conversation.

tough abyss
#

I'm the one you and RyanD were berating for being a retard

little eagle
#

I've seen this name before.

still forum
#

Why do you need a new account?

tough abyss
#

Seperation from personal-life.

#

As I said I am not a "noob" when it comes to this game.

#

I had to do a lot of RND for that community.

#

The servers just couldn't handle everything on 1 thread.

#

Even with HC's...

#

That needs to be fixed.

still forum
#

Again. Check what exactly is the problem using profiling build.

tough abyss
#

I was belittling your results I got shirty when RyanD was being an asshat

#

I apologize.

little eagle
#

48 cores is a lot though. And Arma is single threaded for the most part. Maybe the server just isn't suited for the game? Lot's of smaller cores shouldn't help at all.

still forum
#

Yeah.. Fewer higher clock/IPC cores are way better

little eagle
#

It has been offtopic from the start. But it's not like any meaningful discussion about sqf was going on here. So who cares. Don't make me switch between 50 channels-

still forum
#

We always go offtopic here anyway 😄

little eagle
#

Let's talk about how replacing forEach with count is dumb.

still forum
#

well.. it is faster...

#

BI should just add a forEach without _forEachIndex.. That will be faster again because it doesn't count

little eagle
#

I put that into the same category as saying
false || true
is faster than
false || {true}

#

It's technically true, but in practice worse.

#

A)

{
    _x;
    nil
} count [1,2,3,4,5,6,7,8,9,10];

B)

{
    _x;
    false
} count [1,2,3,4,5,6,7,8,9,10];

C)

{
    0 = _x;
} count [1,2,3,4,5,6,7,8,9,10];

A, B or C?

still forum
#

all are kinda bad

#

Thinking of it... Turning true/false into constants instead of commands.... Would make that even faster again

little eagle
#
myTag_true = 1 == 1;
myTag_false = 0 == 1;

#define true myTag_true
#define false myTag_false

+100FPS

still forum
#

That's not a constant

#

that's still a variable

little eagle
#

No.

still forum
#

might even be worse than the command call

little eagle
#

Hmm.

#

Didn't you say unaries are worse than variables?

still forum
#

Which again.. nulars being variables or commands is evaluated at runtime.. so... another thing to fix

little eagle
#

nularies* I meant

still forum
#

ah yeah... the player thing..

#

calling player is slower than getting it from a local variable in lowest scope

#

which is different from a global variable again

tough abyss
#

#define is probably better than a variable assignment only if it's used constantly.

little eagle
#

Yeah, globals are worse.

still forum
#

as it doesn't check if that could be a script command. because commands don't start with _

#

#define doesn't make any runtime difference

tough abyss
#

Weird according to the wiki it saves memory.

rough heart
#

Hmmm

#

fracture?

still forum
#

What?

little eagle
#

Disk space?

still forum
#

where does it say that? 😄

tough abyss
#

Yeah hang on.

#

No memory.

little eagle
#

Doubtful.

rough heart
#

Geekguy, are you fracture?

still forum
#

@rough heart yes. he already said that before

rough heart
#

I just came in

#

and pls. dont tag

little eagle
#

It's rather slightly worse due to it's usage and you having to make the macro callsafe.

rough heart
#

it triggers the shit out of me

still forum
#

If it says that on Biki then I need to remove that. It's wrong

#

@rough heart Ok.

rough heart
#

GAWD

tough abyss
#

Using a hard coded constant more than once? Use preprocessor directives rather than storing it in memory or cluttering your code with numbers. Such as:

rough heart
#

But, for real, he got banned?

tough abyss
#

#define BUFFER 1.053

_a = _x + BUFFER;
_b = _y + BUFFER;

still forum
#

no

little eagle
#

Macros do save disk space though. At least for SQF. But no one should care about that.

tough abyss
#

I think the most interesting article I dug out of the net was this one.

still forum
#

true. It's easier to code. But at runtime it doesn't make a difference.
It makes the uncompiled raw script smaller but after compiling there is no difference

still forum
#

Also a compiled script stores the preprocessed script. not the unpreproced variant

tough abyss
#

Compiled script is so confusing does anything actually get compiled?

little eagle
#

Using a hard coded constant more than once? Use preprocessor directives rather than storing it in memory or cluttering your code with numbers. Such as:
Macros are better than global variables performance wise, but so is putting the same number over and over again into your code. And doing that is exactly the same as using macros after the script is preprocessed.

still forum
#

@tough abyss Read what it is telling you. Storing something in a variable is using more memory.
Which does make sense

#

@tough abyss Yes.. SQF is being compiled.

tough abyss
#

Compiled in what way?

still forum
#

From string to binary instructions

tough abyss
#

Couldn't be.

#

ArmA 3 's VM isn't an interpreter or a JVM

little eagle
#

I have a way that could disprove this, maybe.

still forum
#

Correct. Arma's VM is not a Java VM.. which doesn't make sense... Because Arma is not Java

#

@tough abyss What is it then.. If you know so much better than me

tough abyss
#

Yeah but it uses a Virtual Machine to execute code correct?

still forum
#

I don't think the definition of VM is quite fitting here

rough heart
#

^^^

still forum
#

it is called ScriptVM.. But I wouldn't call it a VM

#

Not really virtual.

tough abyss
#

Not in that sense it's virtualized in the sense ArmA 3 understand s it

little eagle
#
test_code_str = "call                {             'code with whitespace a compiler should remove'                }";
test_code = compile test_code_str;
"{" + test_code_str + "}" == str test_code

???

astral tendon
#

is there a way to reduce gunner acuracy?

still forum
#

SQF script is compiled into a tree of instructions

#

@little eagle no.

little eagle
#

Why not?

still forum
#

a CODE variable consists of the preprocessed string & the compiled instructions.
when you call str it returnes the preproced string. preproc doesn't remove whitespace

tough abyss
#

I'm betting that the ArmA 3 VM is just a string based interpreter mapping those strings to C++ insutrctions.

still forum
#

@astral tendon setSkill ? I guess

tough abyss
#

And if that is the case where does the "code get compiled" ?

astral tendon
#

i set to 0 and still sniping me

still forum
#

@tough abyss It's compiling the string to an array of instructions. Each instruction has a Execute function that does stuff.

peak plover
#

@astral tendon Using mods?

still forum
#

compile @tough abyss

astral tendon
#

RHS

tough abyss
#

But what are those instructions?

little eagle
#

a CODE variable consists of the preprocessed string & the compiled instructions.
That is really weird, but it would explain the issue. It also means that sending compiled code over the network is even worse than sending uncompiled strings.

still forum
#

Constant,Nular,Unary,Binary call for example

tough abyss
#

If for example you look at intermediate languages like MSIL or Java Byte code

astral tendon
#

this setSkill ["aimingAccuracy", 0.0]

tough abyss
#

is that what this is?

still forum
#

yes roughly

peak plover
#

I had the smae issue with tanks. They would never miss, no matter what accuracy. I guess they are using a weird way of doing shots for tanks

astral tendon
#

for the gunner and the vehicle

tough abyss
#

So what is that intermediatry language coded in itself?

still forum
#

coded in itself?

#

@little eagle true that. I think Arma doesn't even compress the string when sending

tough abyss
#

The programming language used to build the intermediatry language interpreter or compiler.

still forum
#

C++

little eagle
#

And C I believe

still forum
#

Well... C++ that is also C code..

tough abyss
#

No...

#

C is not C++ not even close.

#

C you have to manipulate memory addresses by hand...

still forum
#

C code is the same code in C++

little eagle
#

The result is the same after the game is build, no?

tough abyss
#

pointers and all that fun.

still forum
#

yes

tough abyss
#

No C is not the same as C++

#

C is far more efficient, if used correctly.

#

C++ is managed a lot of the time.

still forum
#

Write a piece of C code. Paste it in a C file. works. Paste it in a C++ file. works. exactly the same.

tough abyss
#

Thats all being handled internally.

#

They're not the same.

little eagle
#

You could say that every C code IS C++ code.

still forum
#

true

tough abyss
#

C++ is mainly an extension to C

#

It is C with "objects"

peak plover
#

I wonder, if #intercept would help with performance when doing loops there and for ex. remove ai FSM and do ai stuff there?

little eagle
#

Not every C++ code is C code though.

tough abyss
#

^

little eagle
#

Hence, Arma is C++

tough abyss
#

C++ is much easier to deal with.

#

Than C

#

C is very unforgiving of errors segfaults are a persistent issue you have to deal with. Also, buffer overflows are really easy too. due to memory constraints of data types.

little eagle
#

The question is, do we trust the compiler making the C++ efficient more than the programmer writing efficient C?

#

Depends on the programmer.

#

Now look at what we got.

#

: P

tough abyss
#

Tell that to Linus Torvaldus

#

😛

still forum
#

@tough abyss Same in C++.. Except you stick to modern c++

tough abyss
#

#Linux Revolution

#

#Fedora
#Redhat
#Debian

little eagle
#

We're not talking about Arma, not a kernel.

still forum
#

so @tough abyss If you know C++ I can also explain it to you that way.
SQF code is compiled into a tree structure of C++ Classes. Each class has a virtual execute method.
The levels of the tree are the scopes in SQF. If you use call you go into a subscope which is a level lower in that tree.
Arma goes through the tree then. So a SQF instruction execution is a pointer lookup in the vtable and a function execution.
It's not parsing the String live as in SQS

tough abyss
#

Yep understand and no currently focusing on studying Python and C

#

Been using Linux more and more so C is very useful.

lavish hamlet
#

were should i use CBA_fnc_addPlayerEventHandler need it to run a script when it detects loadout change.. i have tried initserver.sqf and init.sqf to no avail.

tough abyss
#

When you talk about classes yes I understand instantiation so this tree which is the root class?

little eagle
#

init.sqf

still forum
tough abyss
#

Tree data structures have a root is call that root?

still forum
#

@lavish hamlet Player Eventhandler only works on the players machine. Not on the server

#

The root is called "Simple" it does nothing besides holding a local variable namespace. It's execute method

lavish hamlet
#

so this ["loadout", player call '\RDF_Radioer\scripts\forceWalk.sqf', true] call CBA_fnc_addPlayerEventHandler;

in init.sqf should work ?

tough abyss
#

So in which direction is this traversed?

still forum
#

no. you are missing {} @lavish hamlet

tough abyss
#

Are all tree links connected to each other?

#

In a mesh structure?

still forum
#

no.. A tree is by definition not that.

little eagle
#

call expects {CODE} and not 'STRING'.

still forum
#

Wait I'll do a thingy for you

tough abyss
#

So this tree is basically starting at "Simple" this branches off to more tree branches

#

So which is processed first in this tree?

#

In terms of commands?

#

This is intriguing and might explain some of the screwy results SQF gives.

astral tendon
#

or any way to reduce the damage of a vehicle?

still forum
#
1.0 call {
diag_log _this;
}

Base
Constant (1.0)
Code ({diag_log _this})
binary func call (call) (call opens a new level and executes the code)

And here is what is inside that Code:

Base
Nular func call or varialbe (_this)
unary func call (diag_log)

little eagle
#
RDF_fnc_forceWalk = compile preprocessFileLineNumbers "\RDF_Radioer\scripts\forceWalk.sqf";

["loadout", {
    player call RDF_fnc_forceWalk;
}] call CBA_fnc_addPlayerEventHandler;
tough abyss
#

As I said which part of the class tree gets processed first?

still forum
#

So when it executes that code in the end it does in this order

Constant (1.0)
Code ({diag_log _this})
binary func call (call) (call opens a new level and executes the code)
Nular func call or varialbe (_this)
unary func call (diag_log)(edited)

#

It is a stack machine internally. Constant and Code push to the stack

#

a binary func call pops it's left&right arguments from the stack

tough abyss
#

So all the commands are in this stack?

#

call etc ?

still forum
#

The "binary func call" class has an array of possible functions as member variable

#

in case of call that array has only one element. That element contains the pointer to the C++ function in the engine

tough abyss
#

so call.methods ?

still forum
#

that array has multiple elements for SQF commands that are different depending on which type you pass into one of it's arguments

tough abyss
#

No offense but this sounds like a screwy way to make a compiler.

still forum
#

okey.

#

I don't know how that concept is called. It definetly has a name

tough abyss
#

Finite Automata?

barren magnet
#

i am not sure if you can call that a compiler

#

its more or less an interpreter

tough abyss
#

So it is line by line instruction

#

So why doesn't BIS make an actual high speed bytecode interpreter?

#

Take all commands translate them to byte code execute?

still forum
#

Enfusion does that

#

kinda

rough heart
#

I love dat Kinda

#

Olmost makes me think they werent able to do it

barren magnet
#

SQF comes from a little basis of commands from the first arma, back then there was no need to have that few things on highspeed, as arma itself and hardware back then was still slow

still forum
#

A Interpreter by definition parses the source code while executing it. Which Arma is not doing. It's compiling it into a intermediary that's easier and faster to execute

barren magnet
#

then arma got bigger and then kept using the same engine again and again

still forum
#

SQF comes from SQS.

barren magnet
#

Now Enfusion is their attempt to make things better, and they did

rough heart
#

THEY DID?

#

Kinda shocked here...

tough abyss
#

Yeah I've open'd the DayZ pbos

#

Enfusion is different

#

It even looks far more akin to C++

barren magnet
#

i played dayz mod for ages, and when i look at standalone i got more fps everywhere, and the leaked enfusion scripting looks way better to use than sqf

lavish hamlet
#

@little eagle thanks works like a charm 😃

tough abyss
#

I just wish ArmA 3 SQF actually allowed me to run my little immersion scripts around the bas 😦

#

They weren't even processor hungry.

#

simple PlaySound3D compiled with a spawn'd loop

#

and a sleep command.

#

It was utilizing the builitin sound-files arma 3 had like the quad-bike to mimic a generator running at a base.

#

And the chatter from the radio sounds file to mimic radio chatter under tents

#

with sat-phones and computers.

little eagle
#

So what's the problem? That sounds feasible.

tough abyss
#

It was, till the mission had 30 - 40 people.

#

it was running scheduled and started to stall.

#

The generator sound I had running on a while loop

little eagle
#

it was running scheduled and started to stall.
I hate the scheduler too.

tough abyss
#

every 0.5; seconds

still forum
#

Running clientside? @tough abyss

tough abyss
#

Server-side.

#

PlaySound3D was running on the object.

rough heart
#

Move it clientside?

tough abyss
#

Can't.

#

It was on the generator object.

little eagle
#
[{
    //playSound3D
}, [], 0.5] call CBA_fnc_addPerFrameHandler;

fixed

still forum
#

Then grab my 200fps patched server. If you run at 200 fps then you'll execute 4 times the scheduled scripts

tough abyss
#

PlaySound3D plays global

#

Can't limit it to CS otherwise the object wouldn't exist.

#

But I had all these little scripts I had for the community I'd written.

little eagle
#

Don't use the scheduler and it will work just fine.

tough abyss
#

I mean on Takistan I had to massively modify a script to work with a sand storm

#

biggest issue with it was, getting the scheduler to play nice.

#

It hated that script.

rough heart
#

Sandstorm, sounds nice

#

Unique

tough abyss
#

I was also playing with new weather ideas as I said did a lot of RND for that community.

#

Owner became an arrogant ass, and never went back.

little eagle
#

The scheduler just isn't suited for UI, effects, sounds etc.

tough abyss
#

I mean for I&A I re-wrote the entire destroyed objective manager

little eagle
#

So get used to not depending on sleep and waitUntil.

tough abyss
#

And used onDestroy to manage clean-up

#

Lightning fast.

#

I think one of the biggest problems @little eagle was that community was running a shit ton of mods

#

the LHD was one of them it's geometry was screwed.

#

Stretching models and bunch of other screwery

#

Including vehicles placed on it exploding at mission start

#

I had to write a workaround that by putting a script on every blufor vehicle on the LHD

#

Mods...

#

Are...

#

a pain.

still forum
#

Have to disagree. Mods made by bad scripters are a pain

tough abyss
#

I wouldn't know I protested many changes, such as adding lots of faulty mods.

#

"I was just the server and code monkey"

peak plover
#

Well can't really complain about performance when 100+ units active, because that's pretty impressive, compared to other games

#

Is there something good to compare the scripting to ? dayzSA ?

tough abyss
#

SpaceEngineers does fully fledged C#

#

For it's scripting engine

#

@peak plover

peak plover
#

Does that have any significent performance issues?

still forum
#

You could call everything that doesn't complete in 0 time a performance issue

tough abyss
#

No as they limit how many lines of code you are allowed to have

#

Atleast in the Programmable blocks

#

Outside that the game is fully moddable with C#

atomic epoch
#

Can you try 100 agents? See if the performance is better

queen cargo
#

The way scripting in space engineers works is by creating byte code out of any scripted thing

#

And then just executing it normally in the clr

peak plover
#

// Check last notification, so we don't repeat the same thing.
private _lastSide = missionNamespace getVariable ["mission_respawn_notifyLastSide",sideEmpty];
private _lastTime = missionNamespace getVariable ["mission_respawn_notifyLastTime",(time-5)];

// Quit if it has not been 5 seconds and side is same
if ((time - _lastTime < 5) && (_lastSide isEqualTo _side)) exitWith {};

// set new side/time
missionNamespace getVariable ["mission_respawn_notifyLastSide",_side,true];
missionNamespace getVariable ["mission_respawn_notifyLastTime",time,true];
#

What are the chances that 2 clients run this script at nearly same time and both get past the if

#

Also how do I avoid this ?

still forum
#

Let the server tell the client to execute?

little eagle
#

What are the chances that 2 clients run this script at nearly same time and both get past the if
Guaranteed over time.

peak plover
#

Hmm, yes remoteExe will bail me out here!

lavish hamlet
#
RDF_fnc_vehicleDenie = compile preprocessFileLineNumbers "\RDF_Radioer\scripts\vehdenie.sqf";

["vehicle", {
    player call RDF_fnc_vehicleDenie;
}] call CBA_fnc_addPlayerEventHandler;

private ["_veh","_backpack"];

_backpack = backpack player;

if (_backpack == "RDF_M11_a_d") then {
    _veh = player vehicle;
    if (_veh != player) then {
        player action ["getOut", _veh];
        Hint "Antennen er foldet ud"
    };
};

why doesent this kick the player out when the == is true

still forum
#

Because player vehicle is invalid syntax

#

You have a script error in there.

#

and Arma should tell you

little eagle
#

-showScriptErrors

#

Example 1

? vehicle player != player : hint "Player is in a vehicle"

Let's delete this.

still forum
#

That is SQS right?

little eagle
#

Yes.

#

Example 1 for vehicle.

still forum
#

Put a big (SQS ONLY) after the example and move it to be the last example

little eagle
#

The wiki should explain things. This example just confuses more.

still forum
#

Oh.. it already says SQS

#

SQS is deprecated but it is still used

lavish hamlet
#

i tried this

if (_backpack == "RDF_M11_a_d") then {
    if (vehicle player != player) then {
        player action ["getOut", _veh];
        Hint "Antennen er foldet ud";
    };
};

stil dosent work

little eagle
#

_veh undefined?

lavish hamlet
#

yes.. thanks 😃

peak plover
#
missionNamespace setVariable ["GUER",resistance,true];
missionNamespace setVariable ["CIV",civilian,true];
#

Why didn't I think of this before ?

slender halo
#

what would you use to compare a var type, typeName or isEqualType ?

#

nvm

still forum
#

isEqualType

little eagle
#

Why didn't I think of this before ?
Wow, this is so stupid, it might just work.

peak plover
#

It just did 😂

#

👌🏿 👌🏿

#

15:48:45   Error position: <GUER,"nigel"]]>
15:48:45   Error Undefined variable in expression: guer
15:48:45 Error in expression <ide","_name"];
!(
_targetSide isEqualTo _side
)
};
};


if (_target isEqualType >
15:48:45   Error position: <_side
)
};
};


if (_target isEqualType >
15:48:45   Error Undefined variable in expression: _side
15:48:45 File plugins\respawn\files\fnc\fn_srvDeadRemove.sqf [respawn_fnc_srvDeadRemove], line 259

No longer errors 😂

little eagle
#

You could've just used my function to stringify resistance instead though. Now you wasted a week for nothing.

peak plover
#

I had this issue in many different scripts, the last issue I had was with tasks and groups as well. But thanks anyway

#

Couldn't stringify grups like that, so I just use "group" and compile it when I need it (not before).

#

I don't think I wasted a week on nothing

still forum
#

You wasteda week on nothing every 2 weeks.. Sleeping is such a waste of time

peak plover
#

github says 23k additions. I doubt I wasted a week on resistance 😄

little eagle
#

BIS_fnc_netId for groups

#

Or even better, don't make strings in the first place.

peak plover
#

don't make strings

#

?

#

🤔

still forum
#

no strings attached

little eagle
#

Yes, don't convert resistance into a string in the first place.

#

Or your groups.

peak plover
#

Well If I don't convert the group it errors

little eagle
#

Rewrite it so it doesn't error and accepts GROUP.

peak plover
#

The reason It does not work is because I have a function for adding a task and a function that loops the tasks

#

adds _target to array

#

then tries to grab it

#

fail

little eagle
#

Rewrite it so it doesn't fail.

#

Converting to string is never needed outside from callExtension maybe.

peak plover
#

I did, it checks if it's a string and if it's a string, it compiles it in the loop

#

No error

#

Finish it Then optimize, right? right?

little eagle
#

Sounds like twice the work.

still forum
#

write optimized code to begin with

vague hull
#

this doesnt sound like an optimization case in the first place..

subtle ore
#

Anybody know why the animal fsms work for a little while then just stop?

#

Had a dog move around for a little bit, but the rest that spawned just sit there

#

Disregard last

#

For future reference for anyone who is running into the same siutation: the animals were created to early and didn't load their proper fsm

still forum
#

what means too early?

peak plover
#

During preinit?

subtle ore
#

Yeah during preInit

#

Hmm, now i am only getting a certain area to populate with animals.

slender halo
#

i need some help

#

i have an object and i want to find its rotation angles relatively to world

subtle ore
#

You could use zero as a base distance, and then getPosATL on the player

#

Trig will be your friend on this one

little eagle
#
(_vehice modelToWorld [0,0,0]) vectorFromTo (_vehice modelToWorld [0,1,0])

something like this?

subtle ore
#

Or something like that ^

#

Way to steal my thunder Commy 👁 👄 👁

little eagle
#
AGLToASL (_vehice modelToWorld [0,0,0]) vectorFromTo AGLToASL (_vehice modelToWorld [0,1,0])

Just to be safe on hilly maps.

slender halo
#

yep, something like that but the position doesn't matter

#

i juste want the angle according to world x y z

#

i went with a rotation matrix but i ended with what vectorUp and vectorDir returns...

little eagle
#

Well, that is what I posted. Add some sine and cosine and you have angles.

slender halo
#

ok, i try that

thick sage
#

what is the category in cfgFunctions for?

little eagle
#

The ingame functions viewer.

slim verge
#

? wanting to add a marker link in a briefing but the link is part of a string.... stripped down example...

_STR= "1) <a href='marker:EF_POI_1'>Place of Interest 01</a>";

player createDiaryRecord ["Diary",["> ENEMY Forces", _STR]];

Tried wrapping the marker in '', "", '"
Anyone any idea of the correct syntax ?

indigo snow
#

Its certainly not a href

#

Where did you get that from? Sec for correct syntax

slim verge
indigo snow
#

Briefing.html isnt a thing anymore

slim verge
#

okay so whats the reference i should be using, havent done any scripting for a few yeats now

indigo snow
#

<marker name="nameofmarker">link text </marker> iirc

slim verge
#

ah ok thx for that

indigo snow
#

Might be a phone typo in there

little eagle
#

And what are the expected results?

slim verge
#

works as expected thanks

indigo snow
#

Click on link in briefing text, map zooms to maker coord, commy

slim verge
#

apart from needed wrapping in ' not "

#

wiki needs updating then

indigo snow
#

Nah since that page is on briefing.html

#

The current 'briefing' system is in the diary pages

#

Its certainly outdated but theres text on top saying its not for arma 3 iirc

slim verge
#

thx for the link cptnnick

indigo snow
runic surge
#

anyone know if the apex uniform boxes create and apex dependency?

still forum
#

yes they do. But everyone has apex anyway

#

so no. it doesn't matter

lavish hamlet
#
RDF_player_connect    = compile preprocessFileLineNumbers "/rdf_deltag/functions/fn_player_connect.sqf";
RDF_player_disconnect = compile preprocessFileLineNumbers "/rdf_deltag/functions/fn_player_disconnect.sqf";

["RDF_player_connect",    onPlayerConnected,    RDF_player_connect]    call BIS_fnc_addStackedEventHandler;
["RDF_player_disconnect", onPlayerDisconnected, RDF_player_disconnect] call BIS_fnc_addStackedEventHandler;
#

Error in expression <DF_player_connect", onPlayerConnected, RDF_player_connect] call BIS_fnc>
16:21:54 Error position: <, RDF_player_connect] call BIS_fnc>
16:21:54 Error Invalid number in expression
16:21:54 File \rdf_deltag\functions\fn_deltag_init.sqf [RDF_stats_fnc_deltag_init], line 4
16:21:54 Error in expression <DF_player_connect", onPlayerConnected, RDF_player_connect] call BIS_fnc>
16:21:54 Error position: <, RDF_player_connect] call BIS_fnc>
16:21:54 Error Invalid number in expression
16:21:54 File \rdf_deltag\functions\fn_deltag_init.sqf [RDF_stats_fnc_deltag_init], line 4

simple solstice
#

why not just add the files to cfgFunctions?

#

also the second parameter should be in quotes

lavish hamlet
#

how would you write it in cfgFunctions ?

simple solstice
#

instead of compile blabla

#

open your description.ext

lavish hamlet
#

this is my config.cpp

class CfgPatches
{
class RDF_Statistics
{
units[] = {"RDF_STATS"};
requiredVersion = 1.0;
requiredAddons[] = {"A3_Modules_F"};
};
};

class CfgFunctions
{
class RDF_stats
{
class Statistics
{
file = "\rdf_deltag\functions";
class deltag_init{postInit=1;};
};
};
};

still forum
#

@lavish hamlet onPlayerConnected is wrong syntax. onPlayerDisconnected is wrong syntax. you are missing the parameter to the unary function call.

#

Maybe you should read wiki.

simple solstice
#
class CfgPatches
{
    class RDF_Statistics
    {
        units[] = {"RDF_STATS"};
        requiredVersion = 1.0;
        requiredAddons[] = {"A3_Modules_F"};
    };
};

class CfgFunctions
{
    class RDF_stats
    {
        class Statistics
        {
            file = "\rdf_deltag\functions";
            class deltag_init{postInit=1;};
    class player_connect {};
    class player_disconnect {};
        };
    };
};
#

oh fuck the spacing on discord

lavish hamlet
#

dont know if it changing anything but im trying to make a serverside mod.. that writes to db on connect and disconnects to track attendance.

simple solstice
#

ok, what I wrote is that the function is compiled already

still forum
#

@lavish hamlet Read the wiki entry to addStackedEH and onPlayerConnected

simple solstice
#

and you dont need to compile bla bla

#

or if you are using CBA, use the CBA one

little eagle
#

That is not the problem. CfgFunction sucks, might as well compile the functions yourself for a mission.

simple solstice
#

I know, but since he has it already why not just throw in there

little eagle
#
["RDF_player_connect",    onPlayerConnected,    RDF_player_connect]    call BIS_fnc_addStackedEventHandler;
["RDF_player_disconnect", onPlayerDisconnected, RDF_player_disconnect] call BIS_fnc_addStackedEventHandler;
["RDF_player_connect",    "onPlayerConnected",    RDF_player_connect]    call BIS_fnc_addStackedEventHandler;
["RDF_player_disconnect", "onPlayerDisconnected", RDF_player_disconnect] call BIS_fnc_addStackedEventHandler;
runic surge
#

if I want a module to only exist if a player has the role (AI disabled) would it be better to check it the player unit is alive or if it is null

little eagle
#

Who is djotacon?

runic surge
#

who is who?

thick sage
#

@little eagle "The ingame functions viewer." thank you. So, no semantic change besides being easier to search on the editor

little eagle
#

Yes.

thick sage
#

good.

#

Another question that came up recently: is it possible to declare functions in cfgFunctions that can only be executed on the server?

#

(for missions, not addons)

#

so that e.g. some functions are not even initialized on the clients

still forum
#

afaik no

tough abyss
#

You will need to make up your own code to compile(final) the functions.
Or you could just add if !(isServer) exitWith{}; at top of the functions you don't run on client.
Or just split the server functions into a serverside addon.

little eagle
#

Just add

if (!isServer) exitWith {};

as first line. Stop overthinking this.

waxen tide
#

so private []; is bad

#

params is evil too

#

why not private param for each input individually?

#

yes.

#

YES.

subtle ore
#

you're telling me :

private _belh
private _meh
private _beh

is cleaner than

params["_belh","_meh","_beh"];

doesn't make sense.

waxen tide
#

no, faster.

subtle ore
#

By how much?

waxen tide
#

doesn't matter.

#

its faster.

subtle ore
#

if it's by 0.000000001 ms then yes I do care, cleanliness is better than a unoticeable difference when I'm reviewing latero n

simple solstice
#

why did you compare private to params, two different things

waxen tide
#

i mean suit yourself and use params and private not as a keyword but don't come crying tomorrow when dedmen painted dicks on your face while you sleept.

subtle ore
#

Dedmen can paint dicks on my face all he wants.

waxen tide
#

you can't apply private to vars if you define them with params.

#

but if you do it with param you can

simple solstice
#
for '_i' from 0 to 10000 do {
private _a = 'a';

private _b = 'b';

private _c = 'c';

private _d = 'd';

private _e = 'e';

private _f = 'f';
};
//28.4444 ms


for '_i' from 0 to 10000 do {
private ['_a','_b','_c','_d','_e','_f'];
_a = 'a';

_b = 'b';

_c = 'c';

_d = 'd';

_e = 'e';

_f = 'f';
};
//40.32 ms
#

credits to @peak plover

subtle ore
#

why would you even do that? Wtf?

#

If you're going to be using params, then just use the values that are passed

little eagle
#

I think Katekarin mistakes private ARRAY with params.

simple solstice
#

me?

lavish hamlet
#

```sqf`
_playerUID = getPlayerUID _Player;
_playerName = format ["%1",(name _Player)];

_sql_res = "extDB3" callExtension format ["0:SQL:INSERT INTO rdfstat SET playerUID = '%1',playerName = '%2',connected = NOW()", _playerUID, _playerName];
};

little eagle
#

No, asdfghj . I apologize.

simple solstice
#

i only referred what to what is faster, private [array] or private _var

lavish hamlet
simple solstice
#

someone here have an crystal ball?

#

post logs, post the query you run, post the script that runs the query

little eagle
#

🔮

simple solstice
#

we arent wizards

little eagle
#

Yes.

simple solstice
#

its because you are blue

subtle ore
#

😱

little eagle
#

daba di

simple solstice
#

first of all you have invalid SQL syntax

#

or maybe its correct, havent seen it

#

nontheless

lavish hamlet
#

logs are not showing anything.. but it only logs connect and disconnect not name and uid.. .

#

_sql_res = "extDB3" callExtension format ["0:SQL:INSERT INTO rdfstat SET playerUID = '%1',playerName = '%2',connected = NOW()", _playerUID, _playerName];
};

simple solstice
#
_query = format["INSERT INTO rdfstat SET playerUID = '%1', playerName = '%2', connected = NOW()", getPlayerUID player, profileName];
#

and I suggest you to use something like an extdbasync file that you can grab from eg. altislife

#

to make your life easier

lavish hamlet
#

im new at this.. but ill check i out..

simple solstice
#

but if you just want to insert using extdb3

#

@lavish hamlet does your database initialize properly?

lavish hamlet
#

yes im using it for presistent milsim mission.. i have just added the rdfstat table to track attendece..

simple solstice
#

ok, so if the syntax you provided for inserting the query is alright, and works with other functions

#
_query = format["INSERT INTO rdfstat SET playerUID = '%1', playerName = '%2', connected = NOW()", getPlayerUID player, profileName];
_sql_res = "extDB3" callExtension format["0:SQL:%1",_query];
#

in my case, I use 1:SQL:%1 for inserting, updating

still forum
#

@waxen tide I prefer params :D
you can't apply private to vars if you define them with params. Yes... because params does it automatically 😄 Read Biki

lavish hamlet
#

but still no uid

astral tendon
#

is there a way to force vehicle to NOT use the road at all?

simple solstice
#

@lavish hamlet anything in extdb logs?

lavish hamlet
#

[19:41:43:901909 +01:00] [Thread 5016] extDB3: SQL: Error MariaDBQueryException: Duplicate entry '' for key 'playerUID'
[19:41:43:901926 +01:00] [Thread 5016] extDB3: SQL: Error MariaDBQueryException: Input: INSERT INTO rdfstat SET playerUID = '', playerName = 'and', connected = NOW()

simple solstice
#

did you make playerid the primary key in the database?

#

if yes, switch the primary key to the ID

#

because playeruid will repeat

#

and do you have 0:SQL:%1 or 1:SQL:%1?

lavish hamlet
#

CREATE TABLE rdfstat (
id INT(11) NOT NULL AUTO_INCREMENT,
playerUID VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
playerName VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
connected DATETIME NULL DEFAULT NULL,
disconnected DATETIME NULL DEFAULT NULL,
UNIQUE INDEX playerUID (playerUID),
INDEX id (id)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;

simple solstice
#

unique index should be ID

#

you can have an index on playeruid, but its not necessary

lavish hamlet
#

["0:SQL:%1",_query];

simple solstice
#

unique index means that this value wont repeat

#

and the playeruid will repeat. cause its not unique to the table

#

if you insert it everytime someone connect

#

and try switching the 0 to 1

#

UNIQUE INDEX != INDEX

lavish hamlet
#

the plan i to have a new entry into the table every time a player connects so if i connect 3 times = 3 entrys

simple solstice
#

yes. I understand

#

switch the UNIQUE INDEX key to ID

#

if you leave UNIQUE INDEX on playerUID then that means playerUID CANNOT be repeated in the table

lavish hamlet
#

Ahh ill try 😃

lavish hamlet
#

@simple solstice tried both option 0 and 1 and changed the unique index.. now i get a new entry everytime i connect /disconnects.. but still on uid and only 3 letters in the playername

#

no uid

simple solstice
#

hmm maybe try a different syntax..

#
_query = format["INSERT INTO rdfstat (playerUID, playerName, connected) VALUES ('%1', '%2', NOW())", getPlayerUID player, profileName]
#

Oh @lavish hamlet is the table set to UTF-8?

#

and the database?

#

æ

lavish hamlet
#

yes it is COLLATE='utf8_general_ci'

simple solstice
#

try with the syntax I provided

#

and maybe try removing non unicode chars..

#

and see how they handled EXTDB

#

once you have it setup, so you can just

lavish hamlet
#

the last syntax does nothing not even connect disconect.. but no errors in extdb log

simple solstice
#
_query = format["INSERT INTO rdfstat (playerUID, playerName, connected) VALUES ('%1', '%2', NOW())", getPlayerUID player, profileName];
_sql_res = "extDB3" callExtension format["1:SQL:%1",_query];
#

you have it like that, I assume?

lavish hamlet
#

hehe missing ;

#

ill run it again.

simple solstice
#

When I submitted it without ; I was wondering if you are going to add it 🤣

lavish hamlet
#

need to learn so fine by me 😃 still dosent work.. in other tables it has no problem returning the uid and the correct playername

simple solstice
#

hope you solve it.. or someone else can help you.. I cant seem to find the issue. maybe player isnt initialized

#

you can try adding waitUntil {!(isNull player)} before the _query line

#

im going to bed now, maybe someone else can help you 😃

lavish hamlet
#

ill try.. thanks for helping

simple solstice
#

well one issue was solved

#

with playerid being unique 😄

lavish hamlet
#

yup 😃

lavish hamlet
#

@simple solstice got it working with

_query = format["INSERT INTO rdfstat (playerUID, playerName, connected) VALUES ('%1', '%2', NOW())", _uid, _name];
_sql_res = "extDB3" callExtension format["1:SQL:%1",_query];

_uid and _name comes from the onplayerconnected...

simple solstice
#

ohh, that's true!

#

completely missed the fact that you have it as an eventhandler