#arma3_scripting

1 messages ยท Page 294 of 1

tough abyss
#

Is there a way to do the following with a loop? ```SQF
_yearBox lbAdd "1982";
_yearBox lbAdd "1983";
_yearBox lbAdd "1984";
_yearBox lbAdd "1985";
_yearBox lbAdd "1986";
_yearBox lbAdd "1987";
_yearBox lbAdd "1988";
_yearBox lbAdd "1989";
_yearBox lbAdd "1990";
_yearBox lbAdd "1991";
_yearBox lbAdd "1992";
_yearBox lbAdd "1993";
_yearBox lbAdd "1994";
_yearBox lbAdd "1995";
_yearBox lbAdd "1996";
_yearBox lbAdd "1997";
_yearBox lbAdd "1998";
_yearBox lbAdd "1999";
_yearBox lbAdd "2000";

little eagle
#
for "_year" from 1982 to 2000 do {
    _yearBox lbAdd str _year;
};
bleak schooner
#

@tough abyss It seems lights are created local. When I use [[[_vehicle],"scripts\light.sqf"],"BIS_fnc_execVM",true,false,false] call BIS_fnc_MP; to call my script it works

#

Anyone knows which is the best way to let objects play custom sounds in MP? playSound3D seems to only work with Arma Sounds

tough abyss
#

Thanks @little eagle!

little eagle
#

"#lightpoint" is usually created with createVehicleLocal

#

all the commands for light sources have local effects, so it makes sense.

dusk sage
#

What effect if any does using the global vers. have when creating lightpoints out of interest?

little eagle
#

Good question, no idea.

#

The light commands have local effects, so even if it was transferred, it would be invisible on all other machines

#

sound sources are created using createVehicle (global) and the commands for those have global effects.

#

Nvm, they actually use createSoundSource

#

It's all weird and inconsistent in Arma.

plucky beacon
#

whyyyyy

12:01:15   Error position: <_setText ctrlSetText format["%1",[(Timer>
12:01:15   Error Undefined variable in expression: _settext
12:01:15 File mpmissions\__cur_mp.Bozcaada\timer.sqf, line 35
12:01:15 Error in expression <sed_time = diag_tickTime - _start_time;
_setText ctrlSetText format["%1",[(Timer>
    while {Timer_Length > _elapsed_time} do 
    {
        _elapsed_time = serverTime - _start_time;//will change to serverTime when working
        _setText ctrlSetText format["%1",[(Timer_Length - _elapsed_time),"MM:SS.MS"] call BIS_fnc_secondsToString];
    };
#

because it still works

dusk sage
#

'still works'?

plucky beacon
#

It still displays the timer counting down perfectly fine

dusk sage
#

does it error every time?

plucky beacon
#
    _display = uiNameSpace getVariable "NitroInfo";
    _setText = _display displayCtrl 1010;
#

yes every frame

#

so every loop

#

so even though I define setText it says it's undefined

#

WAIT

#

server has no UI

#

can't be given ui commands

#

so I need to exclude server from running this command

#

but I did HMMM

if!(isDedicated) then
{
#

gosh darn

dusk sage
#

Does anyone know if there is a command to extract weapon addon info for weapons in a backpack?

#

Ignoring the new loadout commands

dusk sage
#

That helps somewhat, cheers ๐Ÿ‘

dry egret
#

hi commy

little eagle
#

@plucky beacon Use hasInterface to don't error on headless clients either.

#

In fact, don't use isDedicated ever. isServer and hasInterface are the commands to use 99% of the time.

#

hi whoever you are

dry egret
#

you helped me get my object into 3den editor so players can put place d objects into backpack

plucky beacon
#

thanks commy

#

๐Ÿ‘Œ

dry egret
#

i have a question about how to count game logics in a mission

plucky beacon
#

lyke if commy saves ur code erry tyme

dry egret
#

i use eden enhanced mod, and i noticed on the forums people talking about game logic counts in their mission getting to high. I was wanting to know how to use the debug consol to show my current count to see if i have the same issue

little eagle
#
count entities "Logic"

???

dry egret
#

will try

#

thanks a bunch man

#

hint str count entities "Logic";

#

so far so good, testing out if scripting AI in multiplayer mission really are duplicating logics

#

well scripting animations that is

#

interesting reasults

#

by chance does anybody have a good metric for logic counts to stay under?

little eagle
#

How many are we speaking?

dry egret
#

from what i was just testing, 4 AI running animations with 1 player creates 4 logics + 1 for the player. when multiple people connect to the server it doubles the number of logics per AI running animations, 2 players = 9 logics running

little eagle
#

Sounds pretty broken to me then,

dry egret
#

running animation loops on the AI via ambiant animations combat

#

i have about 25 AI that run animations at this objective area and its a 16 player mission

#

im testing out BIS_fnc_ambientAnimCombat for a multiplayer mission

#

wanted to have ai do something other than just stand around or walk

#

are you using this in multiplayer or SP

#

this is the other one im using as well

#

playmove will only play the animation once right?

cerulean whale
#

Yup @dry egret

dry egret
#

what im trying to do is have AI sitting in a chair at a desk lol

cerulean whale
#

If you need to it play for longer to a configClass to get the animation length (I believe there is that option) then chuck it in a loop

#

switchMove

#

will put u in the final stage of animation

#

u could just make a looping anim, like a lot of anims

#

Ye^^

dry egret
#

the way i was doing it was attaching the AI to a helper arrow on top of the chair seat

#

that got rid of the jerky animations

#

just use the small blue arrow and set it just on the edge of the seat and disable simulation on the chair

#

blue arrow and turn off model visability

#

trying to follow how that code works lol

#

how are you calling that code on the server? unit init field?

#

execvm "script.sqf"

#

that and local variables dont work in init from what i have tried

#

yep but i kinda suck at arma scripting lol

#

still learning it

#

im creating a base at mike air station, and inside one of the building i have build an office setting and made it look like its a working base. Now im trying to get the AI to animate propperly so when players attack it they see Ai actualy doing stuff lol

#

@tough abyss what MP mission did you do this in?

steep matrix
#

the only way to have backpacks and weapons visible is to put them on the ground in a GroundWeaponHolder, right?

#

trying to get the editorPreviews also working for Bag_base type (backpacks, static weapons, weapons). however the script has some fancy camera and boundingbox logic to move the object into view. i assume the groundWeaponHolder doesnt play ball here ๐Ÿ˜ any ideas?

ref: https://paste.ubuntu.com/24112495/

#

or anything wrong here?

        _object = "GroundWeaponHolder" createVehicle _posLocal;
        _object addItem _class;```
velvet merlin
#

addBackpackCargo works.. ๐Ÿ˜Š

meager granite
#

everyBackpack\firstBackpack should get you entity that will work with boundingBox

little eagle
#

Use with caution as this technique is not very clean - should not be used for many objects and definitely not in MP games.

#

Why?

#

Sounds like exactly what I would want in MP.

little eagle
#

Not if you put this in the init box of editor placed objects.

#
this call BIS_fnc_replaceWithSimpleObject
little eagle
#

1.66?

tough abyss
#

is there a way to check if someone has an animation playing right now?

night frigate
#

RE simple objects - yes, there is a tick box for simple object, but I don't know where eden ends and 3den enhanced begins. 1.66

little eagle
#

So there might be a checkbox.

jade abyss
#

In Multiplayer, you can not access the RscInGameUI ?! -.- Awww cmonnn...

#

~~Works in Editor, but not MP... dangit

_Display = uiNamespace getVariable ["RscUnitInfo",DisplayNull]; 
_Ctrl = _Display displayCtrl 2302; 
systemchat str _Ctrl;```~~
little eagle
#

Display probably doesn't exist yet. There are race conditions between pre/postInit and display creation.

jade abyss
#

Ingame

#

e.g.:
((uiNameSpace getVariable "RscUnitInfo") displayCtrl 2302)
MP: No control
Editor: Control #2302

#

nvm, an Addon seems to screw it up. Vanilla seems to be working.

tough abyss
#

is there any function/command which can be used to get similar vehicle classes? Just like i've got "C_quadbike_01_F" and instead of using (typeof (vehicle player) in [...long list of all similar vehicles like "B_quadbike_01_F" etc.] i can put this classname into a function and it returns all other quadbike classes?

tame portal
#

@tough abyss I think it would be easier to check whether the vehicle config you currently have inherits from a base

#

Like "does the vehicle inherit from the quad base"

tough abyss
#

could you give me an example? i'm not into config crawling ๐Ÿ˜„

pliant stream
#

ui eventhandlers execute in the mission namespace don't they

tough abyss
#

what command for animation would i use if i want to INSTANTLY change my animation to defualt (like switchMove "")

little eagle
#

switchMove ""

#

ui eventhandlers execute in the mission namespace don't they
I had issues with this too and certain onLoad eventhandlers. Might be a bug actually. It's not always the case.

#

Bug with other ui events using the with command. Never bothered to look too deep into it.

#

@tough abyss

"_x inheritsFrom ""Quadbike_01_base_F""" configClasses (configFile >> "CfgVehicles") apply {configName _x};
pliant stream
#

apply... that naming is so bad ๐Ÿ˜‘

tough abyss
#

thanks @little eagle, i see there are many roads leading to rome - OPTIX gave me this one already:

"Quadbike_01_base_F" in ([(configFile >> "CfgVehicles" >> (typeof _vehicle), true] call BIS_fnc_returnParents);

also works fine ๐Ÿ˜ƒ

#

player setUnitPos "DOWN"; doesnt seem to work. Is there an alternative?

#

nvm found it

quasi rover
#

What am I doing wrong?

if (...true statement...) then {
#define _locselrad 1000
} else {
#define _locselrad 1500
};

// _locselrad always get 1500

indigo snow
#

thats not how defines work

#

just do _locselrad = 1000

tough abyss
#

#define is a hardcoded command for writing macro's it's not sqf syntax

little eagle
#

Preprocessor commands are evaluated when the file is preprocessed, so before any of the SQF is executed. The control structure during that time is
#ifdef

#elseif #else

#endif

#

also
#ifndef

quasi rover
#

thanks @indigo snow , @tough abyss ,@little eagle ๐Ÿ˜…

pliant stream
#

are you sure #elseif exists?

little eagle
#

#else oops

pliant stream
#

in a C preprocessor there is #elif but not in OFP

#

also it's noteworthy that nested preprocessor control structures don't work

#

unless they fixed it in A3

little eagle
#

Good question, no idea.

pliant stream
#

i wish they'd just have used an existing C preprocessor instead of rolling their own shitty broken one

#

no variadics QQ

tough abyss
#

Could someone explain paramsin a nut shell to me? I'm having a hard time wrapping my head around it.

dusk sage
#

You could extend that idea to their whole scripting language

tough abyss
#

"It's kinda like C++".

#

"Sliders are the devil".

dusk sage
#

Everything you need to know about params is documented well on the wiki

#

Is there anything about it specifically?

dusk sage
#

You are lacking understanding for

tough abyss
#

What @halcyon crypt linked pretty much covers it. Thanks.

leaden summit
#

Is there a way to turn off unit insignias on a mission by mission basis? I'm working on an undercover style mission and would rather our squad insignia not appear on the side of our civilian vehicles/clothes. Is there a way to do it without having everyone untick the unit in the launcher?

tough abyss
#

@leaden summit that was asked sometime earlier this week. I believe the consensus was no you cannot

leaden summit
#

That is... Unfortunate

polar folio
#

_veh setObjectTextureGlobal [_indexOfInsigniaSection, ""] won't work?

lavish ocean
vital onyx
#

@lavish ocean cool, just one question, does it mean that we are able to limit certain commands to a specific syntax/use case?

say allow "cmd $string" and disable "cmd $array"?

dusk sage
#

Oh my

#

Security

tough abyss
#

Look at the biki link.
You can limit the commands, to server/hc/client (pretty nice) or different alternative syntaxs for the command.
But there is no ability to limit it via some regex string match i.e like BEFilters

lavish ocean
#

be aware it's way more effective than BE filters and no performance hit (native engine implementation)

#

so 1st step secure what you can via cDC and then bother with BEfilters or than maybe some 'soso script' anticheat mess

willow basin
#

Sounds great ๐Ÿ˜ฎ

dusk sage
#

Also pretty neat

lavish ocean
#

https://www.reddit.com/r/arma/comments/5xui2m/166168_documentation_of_wip_new_security_for/del0l5o/
MP security in nutshell ;)
0. properly set server.cfg security, file/folder structure and enabled BattlEye

  1. cfgDisabledCommands (properly configured to disable unwanted not needed script commands)
  2. server-side BattlEye filters (simplest/shortest as possible, regex, performance hit by quantity/complexity)
  3. client-side BattlEye filters (simplest, shortest as possible, no-regex, overhead equals major performance hit)
  4. open-source anti-cheat callExtension bonus + well designed in-scripting security with logic (performance may vary)
  5. whatever soso urban-myth anticheats (performance crippling, insecurity galore, headache ensured)
    note: BattlEye filters are optional bonus feature by BattlEye for Arma scripting, not it's primary purpose to combat
    ... some will disagree but i was writing it quickly Ninja
little eagle
#

@lavish ocean
Can this disable the original syntax of createUnit, but still allow the newer alternative syntax?
The old one transfers code over the network, so you can execute it on every machine, while the new one doesn't have this exploit. One might still want to use the new syntax since that is the only way to spawn units in a group.
See: https://community.bistudio.com/wiki/createUnit

#

Good work

lavish ocean
#

๐Ÿ˜ @ @little eagle

little eagle
#

I thought of this question while showering and didn't look up the wiki again.

dusk sage
#

ARMA leak team

plucky beacon
#

mpeventhandlers run globally don't they?

dusk sage
#

one takes a string

#

๐Ÿ™ƒ

plucky beacon
#

is that it?

little eagle
#

The setVehicleLock one is easier to comprehend when you read the code, but the lock one is consistent with the only getter locked.

I think the best way is to use it with macros.

#define UNLOCKED 0
#define LOCKEDDEFAULT 1
#define LOCKED 2
#define LOCKEDPLAYER 3
plucky beacon
#

hm

pliant stream
#

macros make everything better

peak plover
#

MAKRO

plucky beacon
#

what's your favorite constants to define that you use

pliant stream
#

#define if while

plucky beacon
#

#define datass

plucky beacon
#

if a drone is landed does it stay isKindof Air?

lavish ocean
#

@tough abyss imho the key is the multi-layered approach ... we do something engine wise, BE does something, creative content makers can do something, admins can do something ...

plucky beacon
#

Is there any reason a mission would run a function before init.sqf

#

because i did not set this up like that intetionally but it appears to be the perpetrator of a major bug im having

pliant stream
plucky beacon
#

compiling doesn't mean they're run though right? and functions by default are postinit?

halcyon crypt
#

functions, by default, are neither preInit or postInit

#

and compile doesn't run them

#

maybe you're calling a function in an init field or a trigger?

plucky beacon
#

I guess it wouldn't matter because postinit is preinit on multiplayer

#

no definately not, I removed all triggers and the function or script is nowhere in the sqm

#

and it only happens on the second time loading the mission, in the instance where the mission fails the last time

halcyon crypt
#

and when it ends with a mission success it doesn't?

plucky beacon
#

no it repeats the failure

#

and the logs say it's running the blufor remiaining function

#

before init

#
if(isServer) then {
    disableSerialization;

    diag_log format ["|remainBlufor|--!--Units: %1, number of units in array: %2", _this, count _this];
    diag_log  "|remainBlufor|--!--Checking the alive Blufor units";
    private _BluforAliveCount = {alive _x} count _this;
    diag_log format ["|remainBlufor|--!--Checking if one remaining | %1", _BluforAliveCount];
    private _displayCount = _BluforAliveCount - 1;
    [[_displayCount],"GUI\update_blufor.sqf"] remoteExec ["execVM",0,false];

    if(_displayCount == 1) exitWith
    {
        diag_log format ["|remainBlufor|--!--count should be 2 for last one (adding one for hidden AI unit) | %1", _BluforAliveCount];
        [[],"LastMan.sqf"] remoteExec ["execVM",0,false];
    };

    diag_log format ["|remainBlufor|--!--Checking if all dead | %1", _BluforAliveCount];

    if(_displayCount < 1) exitWith
    {
        diag_log format ["|remainBlufor|--!--count should be 1 for all dead (adding one for hidden AI unit) | %1", _BluforAliveCount];
        [[],"BluforFailure.sqf"] remoteExec ["execVM",0,false];
    };
};
#

called on from...

#

well actulally it could be multiple places

#

the logs say it just... runs

#

the function

#

wat

halcyon crypt
#

doing anything with the uiNamespace or event handlers?

plucky beacon
#

yes

#

the function is called on an MPeventhandler

#

or at least that's one of the conditions where it does

#

and it updates a Ui thing

#
disableSerialization;
private _BluDisplayNumber =_this select 0;
diag_log ["|updateOpfor|--!-- %1 is the remaining number of opfor, updated on interface",_BluDisplayNumber];
"NitroBlu" cutRsc ["NitroBlu","PLAIN"];
_display = uiNameSpace getVariable "NitroBlu";
_setText = _display displayCtrl 1015;
((uiNameSpace getVariable "NitroBlu") displayCtrl 1015) ctrlSetStructuredText (parseText format ["<t size='2' color='#006296'>%1 | BLUFOR</t>",_BluDisplayNumber]);
halcyon crypt
#

uiNamespace persists between mission reloads but I'm not sure about the event handlers ๐Ÿค”

plucky beacon
#

weird

#

so how do I circumvent this?

#

make it null after displaying?

halcyon crypt
#

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

#

no clue really

plucky beacon
#

rip

#

at least I know it's the event handlers or uinamespace now

halcyon crypt
#

it's time to do some fun diag_log logging of all the calls I guess

plucky beacon
#

I kinda do already

#

just need to ad one for the numbers

#

16:38:36 ["|updateOpfor|--!-- %1 is the remaining number of opfor, updated on interface",0] like there

halcyon crypt
#

that's the log after mission restart?

plucky beacon
#

ya for some reason I forgot to use format

#

I hope that fixes it but even then it's blufor remaining count that's the problem not opfor

#

unless for some reason it had issues reinitializing

halcyon crypt
#

I doubt that fixes it though

plucky beacon
#

I'll try

#

at least I can replicate it easy

halcyon crypt
#

you could delete the MP event handler on mission end

#

if that's causing the log entry

plucky beacon
#

nah it's working fine, it's only mentioned where it's supposed to be and parameters add up

#

unless it was some kind of weird persistance

little eagle
#

@halcyon crypt Eventhandlers added to displays will persist as long as the display persists, which can lead to duplicate eventhandlers in certain cases.

plucky beacon
#

commy to the rescue

little eagle
#

E.g. a mission restart in the editor and I think loading a SP mission from within a SP mission will not delete and reinitialize the RscDisplayMission (#46) display.

plucky beacon
#

oh, well this is on a dedi server

pliant stream
#

call removeAllEventHandlers before addEventHandler

little eagle
#

Dedicated servers have no displays and commands like createDisplay will report diisplayNull

#

Only machines with hasInterface -> true can have controls or displays.

plucky beacon
little eagle
#

removeAllEventHandlers is a great method to break other missions and mods.

plucky beacon
#

oh

pliant stream
#

heh i'm not used to thinking in those terms

little eagle
#

Well you remove all eventhandlers. Maybe some of which that don't belong to you.

pliant stream
#

you just need to find the callsite

plucky beacon
#

I'm guessing I can do that with logs?

pliant stream
#

well if function x is being called and you've no clue why, you could add a log message at each callsite

plucky beacon
#

riperoni peperoni still broken

#

mmm I do that already that's why I'm so confused

pliant stream
#

if this weren't SQF you would breakpoint x and look at the callstack

#

of course it's possible to implement callstacks in sqf but that's another story

little eagle
#

the debugging is horrible in SQF. Thankfully I always work with the right frameworks.

plucky beacon
#

xP

pliant stream
#

technically using a debugging extension and a code processor you could implement a proper debugger

halcyon crypt
#

supposedly there is already such a thing but just for internal use ๐Ÿ™

pliant stream
#

there is

#

disabled in release builds ๐Ÿ™‚

little eagle
#

And it sucks.

#

So good riddance.

pliant stream
#

it's not what i meant though

plucky beacon
#

I would kill for some breakpoints

pliant stream
#

you'd just have to insert an extension call between every single instruction to be able to break and step, thats where the code processor comes in..

still forum
#

My Debugger is almost half way done. Will be open sourced soonโ„ข

plucky beacon
#

I will be your first 'customer'

still forum
#

You actually won't be ๐Ÿ˜„ X39 is already making a UI for it. ๐Ÿ˜„

plucky beacon
#

Dammit!

pliant stream
#

sqf is so simple though there's not really a need for a debugger

plucky beacon
#

second

#

#soSimple
#ggEZlanguage
#getgud

pliant stream
#

you got it

vital onyx
#

What a mess, who designed that magazinesDetailUniform should return magaine display name instead of classname?

pliant stream
#

some very smart person

vital onyx
#

I hope it was a sarcasm

halcyon crypt
#

"Returns an array with the type names of all the unit's uniform magazines."

#

sounds like it should return the classname

vital onyx
#
_magazinesDetail = magazinesDetail player;
/*
[
    "6.5mm 30Rnd STANAG Mag(30/30)[id:3]",
    "6.5mm 30Rnd STANAG Mag(30/30)[id:9]",
    "9mm 16Rnd Mag(16/16)[id:12]",
    "Smoke Grenade (Green)(1/1)[id:14]",
    "Chemlight (Green)(1/1)[id:16]",
    "RGO Frag Grenade(1/1)[id:18]"
]
*/
tough abyss
#

^^ https://community.bistudio.com/wiki/magazinesAmmoCargo


I wouldnt call SQF easy. Debugger / Metric Tools can save alot of time.

Some of the script engine quirks are very odd.
Event dealing with newer engine stuff like remoteexec without a engine form of mutex lock is annoying
i.e When you get a player d/c for 30secs and reconnect (before kicked from server) + all the remoteexeccall get sent at once to server etc

halcyon crypt
#

^ event - t ... made me hang for a bit.. ^^

vital onyx
#

@tough abyss thanks, it seems to be the only way to get magazine vs ammo remaining per uniform/vest container

tough abyss
#

Inventory commands were abit ad-hoc together in arma. So it can be weird but most of the stuff is doable.
(Except for adding weapon attachments to a weapon in a container)

vital onyx
#

it is doable, but... like spawn logic, give weapon with attachments + issue Put action

#

shitty algorithm

#

anyway, I am working on a module to store inventory in MySQL, so saving weapons with no attachments is a known limitation

tough abyss
#

Nah that is horrible method. I prefer just have the attachments fall off the weapon ๐Ÿ˜ƒ

vital onyx
#

agree

#

anyway even if you put it, there is a slight problem to read it

pliant stream
#

they should have just made serializeInventory and deserializeInventory commands... serialize gives you an array with all the information from the inventory tree, deserialize adds all the stuff to the unit/vehicle/buttplug

#

but that would have made sense so it's a big nono

vital onyx
#

well, for now we write such functions for ourselves

#

serialized disguise and weapon info example

[
    "U_B_CombatUniform_mcam",
    "V_PlateCarrier1_rgr",
    "B_AssaultPack_mcamo_Ammo",
    "H_HelmetB_grass",
    "",
    "NVGoggles",
    "arifle_MX_ACO_pointer_F",
    "",
    "acc_pointer_IR",
    "optic_Aco",
    "",
    "30Rnd_65x39_caseless_mag",
    30,
    "",
    0,
    "",
    "",0,
    "hgun_P07_F",
    "",
    "",
    "16Rnd_9x21_Mag",
    16,
    "",
    "",
    0
]
pliant stream
#

Yeah but you can't handle attachments inside a backpack inside a vehicle

vital onyx
#

yes, it is a limitation, I know there is a chance to do it, but I am not willing :)

#

better to rewrite entire inventory system from scratch

native hemlock
#

Why not try and use setUnitLoadout and getUnitLoadout?

vital onyx
#

it does not save the remaining ammo count per magazine

native hemlock
#

Fair enough

little eagle
#

?
Yes it does

vital onyx
#

show me

vital onyx
#

well, thanks for that, definitely a way to go

#

pity I already spent couple of hours for script implementation :(

kindred lichen
#

Is there a way to take a gun from a mod, and pack it into a mission?

#

Is that like an ass hole thing? Trying to work some vietnam war missions together but dont want to add another 10 ar15 variants to the modpack just to get the m16a1

tawdry cave
#

no you cant do it, and yes it would be a dick move

kindred lichen
#

Looking at the niarms packs which are awesome, but my clan would hate me if i add 2 gigs of guns to get a decent m14,m16 and m60

little eagle
#

Why did you assume it doesn't report ammo?

leaden knoll
#

Niarms is modular. You subscribe to the weapon you want

leaden summit
#

What's the syntax to add a variable to the end of text?
eg I have
["Villager", "Yes I have seen him he is "_SL] remoteExec ["BIS_fnc_showSubtitle"]};

And I want to append the "Yes I have seen him" with the contents of the variable _SL

pliant stream
#

"yes " + "blah blah"

#

format ["yes %1", "blah blah"]

leaden summit
#

So in my case it would be

#

["Villager", "Yes I have seen him he is "+ _SL] remoteExec ["BIS_fnc_showSubtitle"]};

willow basin
#

is _SL a string?

pliant stream
#

if _SL is a string

leaden summit
#

Yeah

willow basin
#

then yes.

leaden summit
#

Cool thank you very much

leaden summit
#

ok I'm not very smart, what's wrong with this?
if (_nearestMarker == "saddiqiLocation_1") then {_SL = str("at the Northern Market")};

#

_SL always comes back empty?

meager granite
#

because _SL no longer exists after your condition ends, it is local to that scope only

#

you need to declare it in lower scope where you actually use it

#

_SL = "default";
... then {_SL = "message"};
hint _SL;

leaden summit
#

Wow that's all there was too it.
Just adding the private"_SL";fixed it thank you

meager granite
#

you need to define private variables in whatever scope you want to use them, otherwise they are initialized in wherever you first declare them

leaden summit
#

Ok now when I do
["Villager","Yes I have seen him he is " + _SL ] remoteExec ["BIS_fnc_showSubtitle"]};

I get quotes around the "at northern market" how do I stop that?

meager granite
#

because you str'ing string

#

str on string adds quotes around the string

leaden summit
#

Ahhh ok gotcha

#

Thank you so much, now I can go to sleep ๐Ÿ˜

indigo snow
#

Remove that str command

#

str("string") = ""string""

pliant stream
#

makes total sense amirite

peak plover
#

{deleteVehicle _x}count allDeadMen;
Sometimes does not delete the unit if the unit has died in a vehicle

#

Anyone know a workaround?

plucky beacon
#

Count?

#

You want forEach

peak plover
#

Some units are untouchable by scripts when they have died in vehicles.

#

That's not the issue here

#

I can go deleteVehicle (allDeadMen select 0). It will still not work

#

Count is faster btw

plucky beacon
#

There was a script for ejecting bodies from vehicles

peak plover
#

This is the issue I'm having

halcyon crypt
#

forEach +1 ... count shouldn't have side effects

peak plover
#

Reported on the feedback tracker but no response in a week, so Now I want to find a workaround on my own

#

I tried setPos and that did not work as well

#

getOut and moveOut don't work either

#

If I get in the vehicle as a driver and force the dead body out

#

It's deleted immediately

#

Because I ran the script earlier

halcyon crypt
#

delete the entire vehicle and recreate it ๐Ÿ˜

peak plover
#

That's probobly more performance heavy and will cause more performance drop on missions with 10s of vehicles

#

My current workaround is that in my clean up script I exclude units that are in vehicles from the _deadMenCount, so it does not think there are 40 deadMen while there are actually 5 and 35 can't be deleted

halcyon crypt
#

spawn x number of (invisible) units and let them take up all the free seats and then move them out and delete again... same performance issue but would work as well ^^

peak plover
#

I guess that's one way to do it

#

I can spawn a unit local to the server and just drag him through the vehicles to force dead bodies out

#

I'll give that a go

halcyon crypt
#

I don't think you can do that with 1 unit though

#

wasn't it impossible to select a specific seat?

peak plover
#

Ughh, I can only think of more issues that this will cause

#

Players might have interactions with these entities and finding the correct seats etc.

#

I think I must accept defeat

halcyon crypt
#

wise ๐Ÿ˜ƒ

young current
pliant stream
#

can't you eject the unit and then delete

young current
#

is there a script command for that?

pliant stream
young current
#

Can dead unit do actions? But anyway deletevehiclecrew sounds a lot simpler

pliant stream
#

probably

#

as in probably is a lot simpler

#

don't know about the zombie actions

young current
#

in the comments of it says dead units are not affected by actions

vital onyx
#

@little eagle

Why did you assume it doesn't report ammo?

I messed it with Virtual arsenal export/import, but it did the trick, and I exported gear to db in the same format getUnitLoadout provides

#

thanks again

half inlet
#

continuing a problem I've explained in #arma3_config, I've got an object with an init EH attached to it via its eventHandlers class, however said init EH doesn't trigger when I preview a mission from 3DEN - it does trigger when I spawn a new object during mission-runtime or in 3DEN itself, though...

#

any ideas as to what could be causing this?

ivory timber
#

Hey guys

#

if((_veh isKindOf "Car") OR (_veh isKindOf "Ship") OR (_veh isKindOf "Air")) then {

#

Is there anything called Tracked?

little eagle
#

Tank

#

But it's kinda pointless then. You're basically allowing anything.

tough abyss
#

@ivory timber Tank clasd

#

"Tank"

ivory timber
#

Thanks

vital onyx
#

guys, do you know how identifiy from SQF function in what scheduler it is running? was it call-ed or spawn-ed?

#

Thanks @tough abyss

weak obsidian
#

So everyone switch to TypeSQF? ^^

plucky beacon
#

@tough abyss I knew they were hacking my mission files, the bastards

vital onyx
#

@weak obsidian we still have ViM

plucky beacon
#

There's no way I would make mistakes that stupid I mean... cmon right? eheh... uhhh ๐Ÿ˜…

weak obsidian
#

exactly .. all those "missing" ; and } - the CIA hacked em away!

#

@vital onyx I'm the pico kind of guy ;-D

#

probably also responsible for 3FPS bug ;-D

dusk sage
#

@plucky beacon EPM also uses SciLexer

#

!!!1!!

#

Hacked

plucky beacon
#

oh nooooooooo

dusk sage
#

SQX idea is nice

#

Shame it doesn't share more C# syntax than currently though

plucky beacon
#

So will anything change with scripting when 64 bit hits?

vital onyx
#

more waitUntil and while loops :D

plucky beacon
#

woot

#

I love wasting memory

dusk sage
#

SQX is just seeming like a more convoluted SQF :/

pliant shell
little eagle
#

Try [player] call CBA_fnc_addUnitTrackProjectiles;

pliant shell
#

yep, that works, thank you

little eagle
#

cargo index reported by fullCrew is different from the index used by action MoveToCargo.

#

fullCrew is shifted by the number of FFV slots

austere granite
#

but.. why

plucky beacon
#

Does the CBA track projectiles track multiple units unlike BIS?

little eagle
#

You can add multiple units, but you have to use forEach

#

@austere granite No idea. I was recreating the moveToTurret and moveToCargo action menu commands, because there is a bug in the game where you can't change positions if you're the driver of a vehicle with a FFV slot.

#

And one variant of our Eagle has a FFV slot and I don't want to hear complains about stuff I cannot change.

#

Well except for recreating the actions via addAction.

stray kindle
#

Yeah the projectile tracking stuff is pretty nice ๐Ÿ™ƒ

peak plover
#

commy2. Just have a script that checks if any spots are available. And then another one that drops you in a spot. I'm pretty sure that moveToCargo will do nothing once the unit is already in a vehicle. Therefor, you could just do all the commands and it would work for all the seats. The script won't know where the unit will end up, but in theory it will at least end-up somewhere in a vehicle.

#

moveToCargo should be first and then the last one should be turret and then gunner

little eagle
#

already solved my problem. All you have to do is to subtract the amount of FFV slots before using the action.

peak plover
#

any reason why trackprojectiles stops mid-flight sometimes?

#

issue tracking ricoches as well

#

Bullet moves more than once a frame, but projectile path is made every frame?

split coral
#

exactly

#

increase your fps to 500+ and the traces become much more accurate

civic maple
#

easy in Arma /s

split coral
#

resolution 320x200, view distance 2m

#

๐Ÿ˜„

civic maple
#

gotta run it in text adventure mode

split coral
#

nethack mode

peak plover
#

more fps = better lines

plucky beacon
#

like a high speed camera

peak plover
#

I guess the function can be modified into a while loop instead

#

That would result in better quality over performance

little eagle
#

no

plucky beacon
#

A while loop already checks per frame doesn't it?

peak plover
#

waitUntil checks per frmae

queen cargo
#

anyone here got some complex but valid SQF scripts?
talking about pretty lengthy but valid ones
need to test my SQFLinter

peak plover
#

Linter?

tough abyss
#

Got p drive setup. Try recursively check \a3\functions_f

queen cargo
#

@peak plover code analysis
currently only syntax and keyword usage

#

part of a larger tool i am currently building

peak plover
#

here you go

queen cargo
#

thx

peak plover
#

I must apologize for shit tier code however ๐Ÿ˜ฆ

queen cargo
#

does not matters

#

already helped me
instantly found a bug in the linter ๐Ÿ™ˆ

unreal siren
#

ARGH!

#

I've either screwed up syntax or I'm comparing apples to oranges somewhere.

chilly wigeon
#

Without knowing what the rest of the code looks like it's hard to say

#

Depending on your value for _requestedClass

#

My best guess is that first line

peak plover
#

() around format [blabal] ???

chilly wigeon
#

missionConfigFile >> "Unlocks" >> (cl_equipClassnames select 0) >> "classtype" returns the path to the classtype property, not it's value

peak plover
#

You could try having () around the first part of the first line as well

#

if ((missionConfigFile >> "Unlocks" >> (cl_equipClassnames select 0) >> "classtype") != _requestedClass)

chilly wigeon
#

That generic error could be trying to compare a config type to a string (althought I'm not sure if thats even a real error)

peak plover
#

hmmm

#

maybe isEqualsTo is faster than == / !=

dusk sage
#

yes

tough abyss
#

@peak plover it is. Last time I asked it was the size of bytes

#

So is equal to is faster

dusk sage
#

No. of bytes? Definitely not

#

But it is a binary comparison like the wiki states (unless it's all a lie)

#

No type restrictions, etc

tough abyss
#

@dusk sage could have sworn someone said something about the amount of bytes

dusk sage
#

Then they're silly and you should ignore them ๐Ÿ˜ƒ

tough abyss
#

Okay

dusk sage
#

a & b are the same amount of bytes

#

I'm sure you can see where this is going ๐Ÿ˜„

tough abyss
#

Yeah

unreal siren
#

Yeah, thanks for the help guys

#

I alt tabbed and you had the answer that I took 30 minutes to stumble upon after working it out... XD

#

So while I'm at it I should swap for isEqualsTo?

plucky beacon
#

Collective debugging

pliant stream
#

@dusk sage it's not a "binary" comparison. i don't know what the commenter on the wiki is on about but you can't perform binary comparisons on complex data structures

plucky beacon
#

But muh binary

pliant stream
#

the only way in which it can be called binary is that it takes two inputs

unreal siren
#

lol

#

While we are at it, is there a way I can improve effeciency on this?

dusk sage
#

Sure, it's a totally ambiguous thing to say. I think he is trying to portray that it is type agnostic. I can only imagine engine side it's a cast -> equality, but who knows

pliant stream
#

most likely each value in sqf is an object that points to a specialization of some kind of implementation interface class, which defines a virtual equals function

#
{
    virtual bool equals(const sqf_value_data&) = 0;
};

class sqf_value_data_scalar : sqf_value_data
{
};

class sqf_value
{
    sqf_value_data* m_data;
};``` something like this perhaps
#

then to compare... bool isEqualTo(const sqf_value& a, const sqf_value& b) { return a.m_data->equals(b.m_data); }

halcyon crypt
#

๐Ÿ˜›

pliant stream
queen cargo
#

@unreal siren put configFile >> "CfgWeapons" >> _classname into a temporary variable and use it
that nasty operator is pretty slow
though ... if you only fire it once a while, it wont rly hurt and improving is not that worth then

#

@velvet merlin your lil sample you gave me now gets recognized correctly โค

unreal siren
#

!?

#

Ah!

#

It's calculated every time you open the respawn menu

#

Oh wait, it parses the whole of CfgWeapons doesn't it? XD

pliant stream
#

no

#

and worrying about performance somewhere like ui loading is pretty pointless

#

unless you're doing something real heavy

unreal siren
#

Well

#

It's pretty snappy right now and I'd like to keep it that way

pliant stream
#

as long as you don't put that in like onMouseMoving or something you'll be fine

unreal siren
#

Haha, gotcha.

#

I figure loose code here and there will add up over time.

tough abyss
#

@unreal siren that looks pretty good

unreal siren
#

Thanks, JFC this is annoying

#

I'm missing a bracket (I assume) and it's breaking all the things because it's a config. Anybody with good eyes?

#

Surely there's a way of easily locating it...

vital onyx
#

preparing new release, made a wrapper for getUnitLoadout/setUnitLoadout to store inventory in MySQL, hope the release will happen this weekend

dusk sage
#

what's this a release for? @vital onyx

vital onyx
#

the script which store unit's loadout to database, and reads it from it

#

for persistent missions

dusk sage
#

Ah right. I thought you were making a release for something pre-existing

vital onyx
#

well, I have not seen someone published a ready to use code with documentation

#

my release will icnlude, script, database schema, config files and documentation

dusk sage
#

Does something like this need a wrapper? I guess it depends on how you've decided to store the data

vital onyx
#

I store it separately

#

one sec

#

something like this:

unreal siren
#

Neat!

dusk sage
#
SELECT myloadout FROM loadout
#

๐Ÿ˜„

vital onyx
#

yes we can store entire getUnitLoadout as a string, but it is too dirty

dusk sage
#

blah, nonsense! ๐Ÿ™ƒ

#

Are you updating all the columns on every update?

vital onyx
#

no, saving loadout with the same id is:

  1. clear loadout for that id
  2. store new loadout
dusk sage
#

So you wipe it, then insert again?

vital onyx
#

yes

dusk sage
#

Is there a reason for that, instead of just updating?

vital onyx
#

simple queries, and wiping method is needed anyway

#

and fits 150 lines of code inluding comments

dusk sage
#

Simple queries? Two vs one?

vital onyx
#

second is needed anyway (wipe out)

dusk sage
#

Reasoning?

vital onyx
#

example use case: player in RPG mission shuts down the game to avoid fight, he must lose his gear

dusk sage
#

That'd be up the mission maker, no? But that doesn't give solid reasoning to DEL/INS @ every update

vital onyx
#

or if we se this function to store loadout presets in db, we might want to remove some of them

dusk sage
#

You've lost me ๐Ÿ˜ƒ

vital onyx
#

No I did not

#

that is an optimization of course, but not needed now

#

and this is applicable only to storing linked items, outfit and weapons, for items and magazines we need anyway to delete+insert, because each magazine is stored separately

dusk sage
#

I'll take your word for it ๐Ÿ˜‰

spring ravine
#

anyone have some documentation on what LootWeaponHolder is and how it is different from GroundWeaponHolder/WeaponHolderSimulated? I found docs on Ground and Weapon but no luck with finding LootWeaponHolder so far.

spring ravine
#

Yep

#

oh sorry I thought you meant like a legit copy of arma, no I am running a mod.

thin pine
#

Lootweaponholder is exile stuff

spring ravine
#

oh ok

thin pine
#

Google is your best friend in cases like these

spring ravine
#

I did google it but nothing pointed out that it was specifically tied to exile. Guess I just didn't come to that conclusion.

pliant stream
#

@vital onyx why would you lose all your shit if you log out in combat?

#

what i mean is... why not just keep the unit in game and if they die then they die.. otherwise they can log back into the same unit

little eagle
#

are you using a default/unmodified version of arma?
Yep
I think this answer is funny.

civic maple
#

hahaha

austere granite
#
Link cannot be resolved
Object id 95063151 (337) not found in slot 198,168
Link cannot be resolved
Object id 95063151 (337) not found in slot 198,168
Link cannot be resolved
Object id 9526292b (299) not found in slot 197,169
Link cannot be resolved
Object id 9666c2c9 (713) not found in slot 216,179
Link cannot be resolved

Any ideas what's up with this in server .RPT? About a bazillion or more lines of it

thin pine
#

@little eagle tbh with quiksilvers way of asking that, it was to be expected :D

regal ore
#

hey guys, got questin: How to spawn dialog for player (first time he connects only) while in MP enviroment? It works in SP but not MP.

little eagle
#

Same thing.

#

If it doesn't work in MP your code has a bug.

regal ore
#

so tell me, how to exetue createDialog in MP locally.

#

except using addaction

pliant stream
#

createDialog "SomeDialog" like this

regal ore
#

well exactly this doesn't work in MP.

pliant stream
#

uhuh and where are you calling it

still forum
#

Are you expecting that a script executed on your Computer will have an effect on the Computer of someone else?

regal ore
#

onPlayerConneted.sqf:
waitUntil {alive player};
player enableSimulation false;
nul = createDialog "Dialog";

jade abyss
#

It must be executed on the Client

#

You are executing it on the Server.

#

does remoteExec had createDialog in it?

little eagle
#

Makes sense. onPlayerConneted sounds like something that runs on the server each time a player connects.

#

What for? initPlayerLocal.sqf

pliant stream
#

he doesn't want to do it using remoteExec anyway..

#

+_array differs from a manual recursive copy only when there are arrays in the graph?

little eagle
#

"recursive copy" ?

pliant stream
#

i assume you know what recursion is

little eagle
#

Please elaborate on

+_array differs from a manual recursive copy only when there are arrays in the graph?

pliant stream
#

by recursive copy i mean iterate over the array and any arrays in the graph recursively

#

iterate over the array.. if an array is encountered do the same thing for that recursively

#
_b = [_a];
_c = +_b;``` contents of **_c** are not the same as the contents of **_b**
regal ore
#

initplayerlocal works. Im stupid I didnt think about this. thanks guys.

pliant stream
#

however... ```
_copy =
{
local _a = [];
_a resize count _this;

for "_i" from 0 to count _this - 1 do
    { _a set [_i, _this select _i]; };

_a

};

_a = [];
_b = [_a];
_c = _b call _copy;``` now they are

#

this is a manual copy

#

but it is not recursive

thin pine
#

What are you using this for

pliant stream
#

+_array is recursive, but my question is, does it differ from a manual recursive copy only in the case of arrays

#

i need to decide if i can use +_array to safely deep copy arrays

#

or in other words are all leaves in the graph +_array equivalent to the respective leaves of _array

dusk sage
#

@pliant stream I think you are safe to assume it is a deep copy yes

pliant stream
#

well i know it is, essentially being different from a manual copy in the case of arrays, but my question is, is it different from a manual copy in the case of any other data type?

little eagle
#

Your question is, if copying an array also copies the array type elements. And the answer is, try it.

#

I'd say no, but I never tested it.

dusk sage
#

It's a good question

#

Not sure any other data types are mutable though

pliant stream
#

One more time... given these two functions a and b a = { _this } b = { (+[_this]) select 0 }
Is there any data type, other than array, for which the result is different between the two functions

little eagle
#

Well as far as SQF is concerned, the arrays still are the "same" even when copied. isEqualTo reports true even if both arrays point to a different array entity in memory.

dusk sage
#

By value yes

little eagle
#

Array are the only type that has this pointer stuff going on.

dusk sage
#

He's asking whether, given any other data type, will copying it (+[datatype1, datatype2 ... datatype3]) have any effect

pliant stream
#

Certain sqf commands may think the two arrays are equal but there is a hugely important semantic difference especially if you want to do any real oop

little eagle
#

Sure. As far as I know, there is no way to compare variables by their identifier or by the array pointer thing.

dusk sage
#

I.e, if your array contains no other array, is the copy purely manual?
I.e,

_copy =
{
    private _a = [];

    {
        _a pushBack _x;
    } forEach _this; 
    _a
};
#

As he posted above

little eagle
#

I think this is the same as _copy = + _this; whether _this contains arrays or not.

dusk sage
#

It is not. This would not copy the nested array elements

pliant stream
#
(+_a) set [0, 1];
diag_log _a;```
vital onyx
#

@pliant stream this is a requirement for my use case, I make such option, use it or not - would be the question to mission author

pliant stream
#

+-copying an array that contains complex objects will completely break them thats why its so importantt

little eagle
#

It is not. This would not copy the nested array elements

#

But that is the question. Does that even happen?

dusk sage
#

Yes, it is a deep copy

#

Untelo is asking whether the behaviour of copying elements of the array occurs for other datatypes (except other arrays)

little eagle
#
_a = [];

_m = [_a];
_n = + _m

{
    _x pushBack 1;
} forEach _n;

_a // [] or [1] ?
dusk sage
#

it'll be []

little eagle
#

Will it though? I wonder.

dusk sage
#

I am 100% sure

little eagle
#

Have you tried it?

dusk sage
#

No I haven't. But _a is copied by val, by definition of the deep copy

#

And I know for certain +[] is a deep copy

#

๐Ÿ˜ƒ

pliant stream
#

Thats exactly why it breaks complex or shared objects

little eagle
#

"complex" and "shared objects", huh

pliant stream
#

By complex i mean objects that contain other objects

little eagle
#

โžก
๐Ÿ˜•

pliant stream
#

And shared is pretty self explanatory isn't it

#

Objects that have shared ownership

little eagle
#

I have no idea what you're talking about.

#

You must be talking about some kind of framework. The only objects in Arma are Tanks, Soldiers and Buildings.

halcyon crypt
#

he's talking about OOP style ownerships

#

which SQF just isn't suitable for ๐Ÿ˜›

pliant stream
#

Yes obviously OOP objects as in class instantiations, not vehicles and units lol

little eagle
#

SQF has no OOP and doesn't need it imo.

#

opinions

pliant stream
#

And saying SQF is not suitable is like saying C is not suitable

little eagle
#

Well SQF is very different from C.

pliant stream
#

Yes but neither implements OOP

#

But in you can still do it perfectly fine

#

In both*

little eagle
#

It's a waste of time.

pliant stream
#

I assure you it is not

little eagle
#

No one's gonna use it and it will always look and perform worse in SQF.

halcyon crypt
#

I'd even say that OOP in general is (in most cases) a waste of time ๐Ÿ˜›

dusk sage
#

eeh what

tough abyss
#

You will find it rare were people will use that array shared pointer thing in sqf.
Plus there are nothing else like it for other datatypes in arma.
Most of time people will just use a global variable.

People have also tried todo OOP SQF before, never works / gets wide acceptance. You are welcome to try though if you want

little eagle
#

All I need is with do to work with LOCATION/OBJECT etc.

pliant stream
#

oop allows you to implement things like delegates, promises, complex data structures and so much more

#

@tough abyss i use OOP all the time very succesfully but i'm not saying everything should be an object

little eagle
#

Sounds like a lot of things no one needs, tbh.

tough abyss
#

You wont see any major changes to SQF to natively support OOP.
So you need to write it using current SQF which will generally mean extra overhead.
But like i said you are welcome to try it out, people have done it before like i said. It just never gained any traction.

Or you could wait to see if dayzsa gets public modding support. Its scripting language is apparently more c++ like

little eagle
#

It's [], so yeah, + does make a deep copy.

halcyon crypt
#

or invest your time in intercept instead and get the full power of C++ ๐Ÿ˜„

pliant stream
#

doesn't that cba library or whatever its called have some oop as well like maps/hashmaps etc

halcyon crypt
#

๐Ÿค” maps/hashmaps are not "OOP"

little eagle
#

It's not the same, but it at least has applications.

pliant stream
#

hows that? it's a data structure that you use specific functions to modify or access, and direct access to its data would probably leave it in an invalid state

little eagle
#

it's a data structure that
Check
that you use specific functions to modify or access
set and get, and a forEach I guess
and direct access to its data would probably leave it in an invalid state
Yeah

halcyon crypt
#

OOP isn't about structures (or classes)...

little eagle
#

True

halcyon crypt
#

e.g. C has structs but it's not OOP and the class keyword is mostly just an alias for struct

#

slapping a couple of methods on it doesn't make it OOP either

pliant stream
#

huh

halcyon crypt
#

it's mostly about wasting time on design ๐Ÿ˜

#

and to scratch an academic itch

civic maple
#

Any way to iterate over a CBA namespace?

dusk sage
#

C has structs but it's not OOP
inheritance, mem functions.. etc

civic maple
#

or does good ol' forEach work?

dusk sage
#

Of which your classes would

still forum
#

Namespace? allVariables _namespace probably

civic maple
#

kk, thanks

unreal siren
#

Just wanted to say you guys are awesome... lol

halcyon crypt
#

@unreal siren what's the error? ๐Ÿ˜

#

judging by the indentation you have 1 bracket too many at the end

unreal siren
#

To be honest I don't remember, I have a habit of glazing over crap when I'm doing configs late at night and I made it worse and had to go through it line by line. Atom's bracket highlighter helped.

#

Basically I closed something before I should have while copy/pasting stuff

halcyon crypt
#

ah ^^

#

so the comment above was not about ignoring your question? ๐Ÿ˜›

unreal siren
#

No, I literally meant it XD

#

Much faster than the forum for getting quick advice.

halcyon crypt
#

the ... makes it sarcasm ๐Ÿ˜

#

that's my interpretation of it anyway

unreal siren
#

Oh, my bad

halcyon crypt
#

no worries, we all still love you โค

unreal siren
#

XD

regal ore
#

hey guys, could you please look at my function? I'm already clueless. http://pastebin.com/f7iXmWun every time I get error with invalid expression, or the switch control structure. But I don't see any problem.

little eagle
#

Just wanted to say you guys are awesome... lol
Thanks I guess. lol

#

urg. Brebera's file is a good example of why "{" should go at the end of the line instead of in a new line.

regal ore
#

why?

little eagle
#
    params ["_deletetanks","_front","_line","_range"];
        _deletetanks = _this select 0;
        _front = _this select 1;
        _line = _this select 2;
        _range = _this select 3;
#

This part looks fucked up

#

Either you use params or you use select.

#

why?
Wasting space, making me scroll

pliant stream
#

when in doubt.. use both!

little eagle
#

lol

#

line 55 is broken

#

_raketveh setDir ;

regal ore
#

Well, it wasn't working even when this part wasn't here. And these brackets are inserted automaticaly by visual studio. But I think I could change it.

little eagle
#

setDir ... what?

regal ore
#

270

pliant stream
#

VS? you know you're not writing C/C++/C# right? ๐Ÿ˜„

regal ore
#

I know. But it has the best sqf addon (:

pliant stream
#

o really

#

fair enough

little eagle
#

well, you have to write that down. L55 is broken.

pliant stream
#

this IDE should be able to know what i meant anyway!!!

little eagle
#

Line 107 uses a suspension command
sleep 3;
But the header doesn't say anything about the function having to be spawned.

pliant stream
#

that's not really an error so much as just poor documentation though

little eagle
#

If you go by the header and execute:

[ true, true, 'line1', '50m'] call fnc_BrebTankRange

via debug console, it will error.

pliant stream
#

personally i use different naming convention for functions, async functions and procedures

little eagle
#

Imo all functions should be safe for both environments. "Safe" as safe as you can get them with the scheduler.

regal ore
#

well the function is used in addaction. sorry I forgot that.

little eagle
#

It would help if you can copy paste the exact error from the RPT file.

#

Because that says what's wrong and which line is broken.

regal ore
#

Okay. gimme a minute.

little eagle
#

Well

#

Error Undefined variable in expression: fnc_brebtankrange

#

fnc_brebtankrange is not defined.

regal ore
#

well it is ๐Ÿ˜„ I got it initialized in init sqf.

little eagle
#

No it's not.

regal ore
#

execVM "scripts\fnc_tankrange.sqf"; in init.sqf

little eagle
#

Doesn't tell me anything. All I can tell you is, that the function is not defined.

regal ore
#
18:00:47 Error in expression <h2 pushBack _raketveh;
};
case "line3" {:
if (isNil "rakveh3") then {rakveh3=[]>
18:00:47   Error position: <{:
if (isNil "rakveh3") then {rakveh3=[]>
18:00:47   Error Missing ;
18:00:47 File C:\Users\Ondra\Documents\Arma 3 - Other Profiles\Brebera\missions\FOB_Vanguard_II.eden\scripts\fnc_tankrange.sqf, line 51
18:00:47 Error in expression <h2 pushBack _raketveh;
};
case "line3" {:
if (isNil "rakveh3") then {rakveh3=[]>
18:00:47   Error position: <{:
if (isNil "rakveh3") then {rakveh3=[]>
18:00:47   Error Missing ;
18:00:47 File C:\Users\Ondra\Documents\Arma 3 - Other Profiles\Brebera\missions\FOB_Vanguard_II.eden\scripts\fnc_tankrange.sqf, line 51 ```
#

there are no other errors in RPT regarding this script/function

little eagle
#
case "line3" {:
#

that is wrong. Should be : { and not { :

pliant stream
#

:}

little eagle
#

?

#

smiley ....

regal ore
#

werid smiley

little eagle
#

But I don't see that in your first pastebin, so you might have already fixed this and you have to reload the mission.

regal ore
#

Well it may've been caused while I was correcting all these brackets, to be on the first line ๐Ÿ˜„

halcyon crypt
#

don't worry about that, that's just @little eagle's personal preference ^^

little eagle
#

It's clearly objective. Just look how much space is wasted here.

halcyon crypt
#

it's not objective at all lol ๐Ÿ˜

#

well the fact that is uses more vertical space is an objective observation but the style in general is subjective

little eagle
#

Looks stretched. As if the whole file is falling apart and ripping in the middle.

pliant stream
#

it's easier to read when the braces line up

little eagle
#

fake news

halcyon crypt
#

I'm on the brace on same line team but it's still just a style preference ๐Ÿ˜›

pliant stream
#

that's why everyone should use this convention void foo() { doSomething(); }

little eagle
#

That isn't even SQF

pliant stream
#

that's irrelevant

#
  • with macros i can make it sqf
#

checkmate

queen cargo
#

i can make SQF out of it with simple REGEX

little eagle
#
if (something) then {
   //do something else
};

like god intended.

jade abyss
#

fk that

queen cargo
#

like nobody intended

#

but some voodo priest in some cult

tough abyss
#

Lol

jade abyss
#

The one and only

if (something) then
{
   //do something else
};```
queen cargo
#

^+1

little eagle
#

wrong

#

wrong

tough abyss
#

Right right

jade abyss
#

๐Ÿ‡ซ ๐Ÿ‡บ

little eagle
#

๐Ÿ–•

queen cargo
jade abyss
#

๐Ÿ–• commy

pliant stream
#

whitesmiths is best

jade abyss
#

๐Ÿ˜„

little eagle
#

Programmers are stupid people. No wonder they come to the wrong conclusion. I would be worried otherwise.

queen cargo
#

whitesmiths feels kinda odd ... but allman is my personal fav :3

pliant stream
#
{   something();
    somethingelse(); }```i like this as well
jade abyss
#

wtf

pliant stream
#

very pleasing

jade abyss
#

pleasing when you have cancer and lost the will to live oO

queen cargo
#
    something();
    somethingelse(); }``` better use that from now commy
no space wasted
pliant stream
#

yes

jade abyss
#

๐Ÿคฆ

pliant stream
#

very efficient ๐Ÿ‘

little eagle
#

Stop posting what is not SQF. You have to adapt to the language and SQF is bracket hell.

pliant stream
#

it is SQF mate just the macros are out of view

#

nub

jade abyss
#

^^

little eagle
#

while () is not SQF

queen cargo
#
    call something;
    call somethingelse; }```
fixed
jade abyss
#

that "nub" gave me a little smile

pliant stream
#

it's a mcro

little eagle
#

You cannot use parenthesis in macros you

jade abyss
#

*MRCO

pliant stream
#

#define while(x) while { x } do

little eagle
#

nub

queen cargo
#

@pliant stream rekt

little eagle
#

Except that he used
while SPAAACE ()

#

no macro

#

nub

jade abyss
#

๐Ÿคฆ

pliant stream
#

๐Ÿ˜„

jade abyss
#

You guys

little eagle
#

derailed

jade abyss
#

what was the start of the convo anyway?

little eagle
#

dunno who cares

#

someone had problems again

jade abyss
#

Yeh, i also like Bananas.

pliant stream
#

someone put : on the wrong side of { in switch

#

like this {:

#

:}

little eagle
#

:>

jade abyss
#

Thats bad, he should use:

if(true)then
{```

instead of
```sqf
if(true)then{```
#

giggle

#

(here we go again ๐Ÿ˜„ )

pliant stream
#

#define if(x) if(x)then

little eagle
#

what if I want to use commas

pliant stream
#

no commas allowed

jade abyss
#

Who wants to use commas?

queen cargo
#

#define COMMA ,

pliant stream
#

bis pls add variadic macro ๐Ÿ˜ฆ

regal ore
#

sorry to interrupt your very insteresting conversation ๐Ÿ˜„ but now the function kinda works, so thanks for help guys. (:

queen cargo
#

if([true COMMA false] select 0) { ... };

pliant stream
#

````#define if(...) if(VA_ARGS)then```

little eagle
#

"kinda"

#

okay

jade abyss
#

yepyep, next time: { = Next line!

pliant stream
#

yes

#

good advice

little eagle
#

Dscha is a horrible person.

#

Probably pushes old ladies.

jade abyss
#

I know.

regal ore
#

well the delete part and spawn tank while heading player do nothing, but I will try to figure that out myself ๐Ÿ˜„

queen cargo
#

we all are @little eagle ... all of us

little eagle
#

projecting

jade abyss
#

I also park on handicapped parkingspaces, because i wanna see them suffer.

queen cargo
#

anyway ... back to work
got a debugger to attach

jade abyss
#

And put some "Do not entry" signs on the Trainstations Escelator and Elevator

#

even when they still work evil

pliant stream
#

anyway... whats your indent preference? i like space-tab-space

jade abyss
#

who?

pliant stream
#

everyone

jade abyss
#

Yes.

pliant stream
#

for maximum flamewar))

jade abyss
#
if()then
{
TAB if()then
TAB {
TAB  TAB//CODE;
TAB };
};```
pliant stream
#

#define TAB

#

i like it

jade abyss
#

Yeah

peak plover
#

indent preferance >

{
    _array = _x;
    _array params ["_vehicle"];
    if (isNull _vehicle) then {
        _respawnVehicles pushBackUnique _array;
    } else {
        if(!alive _vehicle || damage _vehicle isEqualTo 1) then {
            _respawnVehicles pushBackUnique _array;
        } else {
            _lastIn = _vehicle getVariable ['brm_insurgency_respawn_vehicleLastIn',time];
            _passed = time - _lastIn;
            if (_passed > (60*30)) then {
                _closeDist = 1500;
                _close = false;
                if !(canMove _vehicle) then {_closeDist = _closeDist / 3;};
                {
                    if (_x distance _vehicle < _closeDist) exitWith {
                        _close = true;
                        true
                    };
                    true
                }count _players;
                if (!_close) then {
                    _respawnVehicles pushBackUnique _array;
                } else {
                    _vehicle setVariable ['brm_insurgency_respawn_vehicleLastIn',_lastIn + 60*10];
                };
            };
        };
    };
    true
}count _vehicles;
#

I'm already flaming myself for having that uselss params. Select is faster :S

#

My attempt at respawning vehicles with 1 loop. So I don't need to waste a spawn on every vehicle

pliant stream
#
    _array params ["_vehicle"];
    if (isNull _vehicle) then
    {    _respawnVehicles pushBackUnique _array; }
    else
    {    if(!alive _vehicle || damage _vehicle isEqualTo 1) then
        {    _respawnVehicles pushBackUnique _array; }
        else
        {    _lastIn = _vehicle getVariable ['brm_insurgency_respawn_vehicleLastIn',time];
            _passed = time - _lastIn;
            if (_passed > (60*30)) then
            {    _closeDist = 1500;
                _close = false;
                if !(canMove _vehicle) then {_closeDist = _closeDist / 3;};
                {    if (_x distance _vehicle < _closeDist) exitWith
                    {    _close = true;
                        true };
                    true } count _players;
                if (!_close) then
                {    _respawnVehicles pushBackUnique _array; }
                else
                {    _vehicle setVariable ['brm_insurgency_respawn_vehicleLastIn',_lastIn + 60*10]; }; }; }; };
    true } count _vehicles;```
#

i fixed it for you

peak plover
#

Do you really use it like that ? ๐Ÿ˜„

#

๐Ÿคข

pliant stream
#

of course pico style is best

peak plover
#

My true favourite

{_array = _x;_array params ["_vehicle"];if (isNull _vehicle) then {_respawnVehicles pushBackUnique _array;} else {if(!alive _vehicle || damage _vehicle isEqualTo 1) then {_respawnVehicles pushBackUnique _array;} else {_lastIn = _vehicle setVariable ['brm_insurgency_respawn_vehicleLastIn',time];_passed = time - _lastIn;if (_passed > (60*30)) then {_closeDist = 1500;_close = false;if !(canMove _vehicle) then {_closeDist = _closeDist / 3;};{if (_x distance _vehicle < closeDist) exitWith {_close = true;true};true}count _players;if (!_close) then {_respawnVehicles pushBackUnique _array;} else {_vehicle setVariable ['brm_insurgency_respawn_vehicleLastIn',_lastIn + 60*10];};};};};true}count _vehicles;
little eagle
#

This chat suffers from too many programmers.

peak plover
#

No identation at all

#

What would a programmers style look like?

little eagle
#

Untelo sounds like one, uhh

plucky beacon
#

What's that alphabet soup up there ^

little eagle
#

attempt at coding style gone wrong

thin pine
#

no indentation best indentation

pliant stream
#
BRACE_OPEN
    _array ASSIGN _x SEMICOLON
    _array params SQUARE_OPEN "_vehicle" SQUARE_CLOSE SEMICOLON
    if PAREN_OPEN isNull _vehicle PAREN_CLOSE then
    BRACE_OPEN
        _respawnVehicles pushBackUnique _array SEMICOLON
    BRACE_CLOSE
    else
    BRACE_OPEN
        if PAREN_OPEN NOT alive _vehicle OR damage _vehicle isEqualTo 1 PAREN_CLOSE then
        BRACE_OPEN
            _respawnVehicles pushBackUnique _array SEMICOLON
        BRACE_CLOSE
        else
        BRACE_OPEN
            _lastIn ASSIGN _vehicle getVariable SQUARE_OPEN 'brm_insurgency_respawn_vehicleLastIn' COMMA time SQUARE_CLOSE SEMICOLON
            _passed ASSIGN time MINUS _lastIn SEMICOLON
            if PAREN_OPEN _passed GREATER_THAN PAREN_OPEN 60 MULTIPLY 30 PAREN_CLOSE PAREN_CLOSE then
            BRACE_OPEN
                _closeDist ASSIGN 1500 SEMICOLON
                _close ASSIGN false SEMICOLON
                if NOT PAREN_OPEN canMove _vehicle PAREN_CLOSE then BRACE_OPEN _closeDist ASSIGN _closeDist DIVIDE 3 SEMICOLON BRACE_CLOSE SEMICOLON
                BRACE_OPEN
                    if PAREN_OPEN _x distance _vehicle LESS_THAN _closeDist PAREN_CLOSE exitWith
                    BRACE_OPEN
                        _close ASSIGN true SEMICOLON
                        true
                    BRACE_CLOSE SEMICOLON
                    true
                BRACE_CLOSE count _players SEMICOLON
                if PAREN_OPEN NOT _close PAREN_CLOSE then
                BRACE_OPEN
                    _respawnVehicles pushBackUnique _array SEMICOLON
                BRACE_CLOSE
                else
                BRACE_OPEN
                    _vehicle setVariable SQUARE_OPEN 'brm_insurgency_respawn_vehicleLastIn' COMMA _lastIn PLUS 60 MULTIPLY 10 SQUARE_CLOSE SEMICOLON
                BRACE_CLOSE SEMICOLON
            BRACE_CLOSE SEMICOLON
        BRACE_CLOSE SEMICOLON
    BRACE_CLOSE SEMICOLON
    true
BRACE_CLOSE count _vehicles SEMICOLON```
pliant stream
#

thanks bro

peak plover
#

dear god

queen cargo
#

@pliant stream best style โค

#

quick serious question: can we all agree on never placing #include ever again below a block comment?

pliant stream
#

no

peak plover
#

Why is that?

queen cargo
#
/*
 [...]
*/
#include "foo"
``` would be illegal then
#

because bad SQF internal magic

#

makes that block comment fold into a single line

pliant stream
#

it makes line references go all wonky don't it ๐Ÿ˜„

queen cargo
#

fucking up lines

#

ex-100%-actly

peak plover
#
/*
 [...]
*/

#include "foo"
#

Would this fix it?

pliant stream
#

nope

still forum
#

putting all #includes before the block comment fixes it

peak plover
#

incredible

still forum
#

example

/*
 * test
 */
#include "script_component.hpp"
error;

comment is line 1
include is 2
error is 3

#include "script_component.hpp"
/*
 * test
 */
error;

include is 1
comment is 2-4
error is 5

little eagle
#

can we all agree on never placing #include ever again below a block comment?
no

queen cargo
#

you really hate people dont you?

little eagle
#

Just you.

queen cargo
#

and as my big role model Donald J. Trump said: I am People, you are Fake News

little eagle
#

you're fired

pliant stream
#

๐Ÿ˜ฑ

rotund cypress
#

Does anyone here know what the escape menu display is IDD? Or what the display is called so I can check in config viewer?

queen cargo
#

no commy, I am the president and you are a mexican immigrant
thus you are getting put back where you belong
to africa!

#

all those illegal immegrants

halcyon crypt
#

wait, does that #include thing happen only with #include? I think I've seen errors where the linenumbers were all kinds of wrong

queen cargo
#

could also happen on other # instructions
my guess would be it is somewhere in the preprocessor

halcyon crypt
#

well at least I now know where to look when something like it happens ๐Ÿ˜ƒ

pliant stream
#

@rotund cypress it's like RscDisplayInterrupt RscDisplayMPInterrupt or something i think

#

at least in OA, maybe they changed it in A3

rotund cypress
#

Yes found it

pliant stream
#

coolio

rotund cypress
#

Thanks

plucky beacon
#

Has anyone tried to rip the endgame uploading effects before?

#

I wanna use the uploading effect with the proximity and upload speed stuff

vague hull
#

Quick nub question, how to quickly copy a 2D array without reference ?

#

just + right?

plucky beacon
#

if I were to make a script run when a diolag is closed in any way, would that be in the script that calls it or in diolags

vague hull
#

add it as UIEH
onUnload and onDestroy

thick ridge
plucky beacon
#

Thanks Senfo

thick ridge
#

See info here*

queen cargo
#

you still might get problems with nested arrays @vague hull but not rly sure right now

pliant stream
#

it all depends on whether you want a shallow or a deep copy

vague hull
#

deep

little eagle
vague hull
#

however, I just went with str, then parseSimpleArray (even if thats not the best way to do it (or maybe it is))

little eagle
#

What's wrong with +

vague hull
#
  • didnt help with deep copy
little eagle
#

We just established today that + does do a deep copy.

vague hull
#

the secondlevel arrays were still references

little eagle
#
_a = [];

_m = [_a];
_n = + _m;

{
    _x pushBack 1;
} forEach _n;

_a // []

explain this

vague hull
#

the template was going to be copied, lookin like this: [[0,0],[0,0]]
to copy it to another var I used _newvar = [] + template
resulted in the second level still being references

little eagle
#

repro

#

I gave you my repro that disproves you already.

vague hull
#

sec

#
AI_VAR_GRID = [[0,0],[0,0]];
diag_log AI_VAR_GRID; // [[0,0],[0,0]]
_temp = [] + AI_VAR_GRID;
diag_log _temp;//[[0,0],[0,0]]
(_temp select 0) set [0,1];
diag_log _temp; //[[1,0],[0,0]]
diag_log AI_VAR_GRID; //[[1,0],[0,0]]
#

shows + doesnt deepcopy by itself

#

its the syntax

#

= + does deepcopy

#

AI_VAR_GRID = [[0,0],[0,0]];
diag_log AI_VAR_GRID;
_temp = + AI_VAR_GRID;
diag_log _temp;
(_temp select 0) set [0,1];
diag_log _temp; [[1,0],[0,0]]
diag_log AI_VAR_GRID; //[[0,0],[0,0]]

little eagle
#

change
_temp = [] + AI_VAR_GRID;
to
_temp = + AI_VAR_GRID;

vague hull
#

I did

#

see above

#

Its interesting tho

little eagle
#
_a = [];

_m = [_a];
_n = [] + _m;

{
    _x pushBack 1;
} forEach _n;

_a // [1]
#

can repro this with
[] + array

#

but not with

  • array
vague hull
#

but its essential the same

little eagle
#

nah hold on

#

It's not

#

But it's useful to know that this way you can "shallow" copy

vague hull
#

yep

#

however

little eagle
#

question, does it copy at all

vague hull
#

took me a good 15 minutes to find out ^^

#

sec

#

will test

little eagle
#

It does

#

very useful to know. Someone put it on the wiki

#

But it makes sense if you think about it. The unary syntax creates a deep copy

vague hull
#

Yet its not documented anywhere, so .. not that straight forward

little eagle
#

And the [] + variant of the binary syntax merges the array contents (one is empty) in a new array = shallow copy

vague hull
#

depending on what you would expect of a merge that "returns a new array"

little eagle
#

The last one is what I would expect. The deep copy behaviour of the unary syntax is the outlier.

#

eh, not like this leads to particular good code anyway.

vague hull
#

However, there is actually a line about that in the operator section

#

Brain is now ready for sleep however

#

have a good night

little eagle
#

tell me why cbChecked reports false in the onLoad eventhandler even though the checkbox is checked.

vague hull
#

isnt that one of the new things?

little eagle
#

As new as A3

vague hull
#

srry mistaken it with the new table thingy

little eagle
#

sight, spawn it is

vague hull
#

spawn - resolves bugs since ofp

little eagle
#

it delays a frame.

vague hull
#

classical racecondition I would say

little eagle
#

I'm making a checkbox one can uncheck to disable the code validation of the init box in 3den

#

which allows you to use local variables and have return values, but no syntax checking.

vague hull
#

why tho?

#

ahh nvm

little eagle
#

@pliant stream @dusk sage

_a = [[]];
_d = + _a; // deep copy
_s = [] + _a; // shallow copy
plucky beacon
#

((findDisplay 9002) displayCtrl 1000) ctrlSetStructuredText (parseText "<t color='#960000'>Passcode</t>");
shouldn't this change the text on display 9002 and text object 1000?

queen cargo
#

If it is a structured text control then it should @plucky beacon

#

Normal RscText does not count

plucky beacon
#

gotcha

#

I'm looking to make a keypad with numbers

#

and gotta find a way to parse characters together

queen cargo
#

Mhh?

#

Parse characters?

#

What for?

plucky beacon
#

to combine strings?

queen cargo
#

Simple keypad is... Simple
Just a few images a text box and a variable and you are done

plucky beacon
#

Well makingthe GUI wasn't the hard part

queen cargo
#

Using count command you can get the length of the string to limit max possible input

plucky beacon
#

yes

queen cargo
#

Parsing is not really necessary due to the fact that you also simply can check the string with another

#

So... What is the deal with it then?

plucky beacon
#

I coudln't get it to display the settext

queen cargo
#

Got plenty of time as I cannot sleep right now (laying in bed...)

plucky beacon
#

I took the code from a thing with structured text when it wasn't so just changed to settext

#

now making a function that adds whatever number oyu pressed to the display

#

or maybe just a script to start with because functions gave me problems like time I used them with the gui

queen cargo
#

You still can get the text green btw by changing the foreground color

plucky beacon
#

that was originally for text alignment but unecessary now

queen cargo
#

Kk

#

Well... Concatenate strings is as simple as it could be

#

Most simple form is +

plucky beacon
#

_string = "Hello " + "world"

queen cargo
#

Yup

plucky beacon
#

hmm it'd be easier to turn an int into a string

#

str it is

queen cargo
#

Or "1"

plucky beacon
#

I'd rather not deal with the quotations mess in the .hpp

queen cargo
#

In the hpp?
Gross stuff

#

In fact

#

You could still use single quote

#

'1'

#

Still... Pure hpp ui coding tends to be kinda weird... Separates contexts too much if you would ask me...
Personally prefer to provide a create dialog sqf function setting up all eventing in there and starting a loop using spawn afterwards

#

As update "tick"

#

But well... Also dealed with Lil bit more complex uis ๐Ÿ™ˆ

plucky beacon
#

I guess it has something to do with compiling the diolags before the game is initalized

#

yay

#

now is there a way I can randomize a passcode before the game starts