#arma3_scripting

1 messages ยท Page 263 of 1

little eagle
#

So explain to me.

#

How is asking every five seconds if the mission is finished better than using some kind of custom event handler?

tough abyss
#

That was how I&A did it.

#

I had no real say.

#

My assumption was eh if it isn't broke don't fix it.

#

Obviously that was incorrect.

dusk sage
#

ofcourse not

#

Depends what you mean by incorrect

tough abyss
#

We'll thats how I&A has always done it check every so often if finished

#

I clearly made a bad choice in how long the time out was or

#

I had changed the timeout to test for something breaking

#

One of the things that actually created the vehicles was this.

#
    _randomPos = [[[getMarkerPos currentAO, (PARAMS_AOSize)],[]],["water"]] call BIS_fnc_randomPos;
    _patrolGroup = [_randomPos, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> [INF_TYPE] call BIS_fnc_selectRandom)] call BIS_fnc_spawnGroup;
    [_patrolGroup, getMarkerPos currentAO, 400] call BIS_fnc_taskPatrol;

    _enemiesArray = _enemiesArray + [_patrolGroup];

    {
        _x addCuratorEditableObjects [units _patrolGroup, false];
    } foreach adminCurators;
#

A lot of I&A uses builtin BI function code

#

such as randomPos or taskPatrol

#

Hello... can anyone tell me if scripting alone allows the interaction with the virtual reality hardware?

#

No.

little eagle
#

I don't like how it uses untagged variable names

#

adminCurators

tough abyss
#

@tough abyss

#

All this code was mostly from the original I&A

#

I just partitioned the data into different files

#

@tough abyss was that to me?

#

No @little eagle

#

ah, sorry... do you have an answer to my question or do you not know?

#

But yes I know my code is of bad design

#

I was avoiding re-writing it largely because I felt I couldn't do it better @little eagle

#

@little eagle Is there a difference in performance

#

with not vs !

little eagle
#

vs?

tough abyss
#

is the key word if not(_condition) then {false}; faster or slower than the character if(!_condition) then {false};

#

Or are they identical?

dusk sage
#

there will be a negligible difference I imagine

little eagle
#

I think it's exactly the same

#

there actually is a difference between
getPos _unit
and
position _unit

#

because position can be used with LOCATION type, so there are additional type checks in C++ land

#

But not and ! only invert booleans

dusk sage
#

more bytes to read ๐Ÿ‘บ

#

๐Ÿ‘Ž

#

๐Ÿ’ฉ

little eagle
#

yeah, no. the functions are precompiled and the result is identical

dusk sage
#

What functions?

little eagle
#

or execVM pseudo threads

#

Although it probably is still different in memory since these functions seem to be strings with a special byte

#

And you can tell the difference between not and ! there

#

I'd say use ! and otherwise, at least be consistent

tough abyss
#

Explains in detail the different ways to run scripts

finite silo
#

how much of ArmA scripting overlap with 'real world' programming like C and stuffy stuff?

#

@tough abyss Apparently I need to mention someone to get responses, at least in the other channels, so please help ๐Ÿ˜›

open vigil
#

No, you need to be patient and wait for a response. Mention spamming to get responses is very poor form.

tough abyss
#

@finite silo There is elements that C contains SQF contains (Status Quo Function) which is ArmA 3's formal language name.

finite silo
#

@open vigil Oh I see, sorry.

#

@tough abyss I see. So SQF would be pretty narrow then?

tough abyss
#

Includes are similar to C

#

SQF also has a PreProcessor similar to C

#

and #define MacroFunc(INPUTS)

finite silo
#

Hmm ok. So, if I'm like awesome at SQF, how much work would it take me to be awesome at C as well?

#

like hypothetically

tough abyss
#

C is very low level

#

You operate on bytes sometimes bits

#

you also have the ability to define user data-types

#

using struct { }

#

You also won't like C in regards to not liking unhomogenous datatypes

#

E.g you can do this in A3 _array = [1,"",3,[]];

#

You cannot do that.

#

in C

finite silo
#

I SEE. Thanks bro

tough abyss
#

functions also require datatype declaration

#

And last but not least

#

You must allocate memory manually

#

Unlike C++ that does a lot of that automatically

#

So SQF vs C

#

They're not even remotely the same, that just share syntax. Not construction.

#

@finite silo

#

SQF is a dirty mixture of PHP,C,Java,JavaScript

#

Thats the only real was to describe it.

buoyant heath
#

scripting vs programming. On one hand you have a relatively small set of commands we use and abuse to do sometimes impressive things. On the other hand you have a massive and comprehensive language that arguably the majority of modern computing is built on.

tough abyss
#

^

#

Aka the GNU standard library

#

You can effectively given the comprehension do anything in a programming language.

#

Python is considered a scripting language I am not sure why as it has as many functionality components as any more lower level language

buoyant heath
#

Compiled vs Run Time?

tough abyss
#

Actually not true

#

CPython can be compiled to a cpy file

#

which is compiled python

buoyant heath
#

Can be

#

I don't think the difference is all that distinct in python's case any more. Way back when it was younger though

tough abyss
#

Ah same with Ruby I take it?

paper rain
#

Python is "compiled" into .pyc files. It's not the same as compiling C code. It compiles down to Python bytecode that the interpreter can run, not an actual executable.

tough abyss
#

@paper rain I know Java does the same

twilit nymph
#
switch (_caller) do
{
   case teamLeader:
   case medic1:
   {
       hint "Teamleader or medic";
   };
};
#

Will using switch this way do the code if _caller is teamleader or medic?

tough abyss
#

Uhhh no..

#

Why would you, ew...

twilit nymph
#

figured it out

#

Had to use ; after teamLeader instead

#

What ew? ๐Ÿ˜›

#

No fan of switch?

thin pine
#

Switches can be good for code overview. As long as you have more than two conditions

tame portal
#

But in ArmA switches are slower than multiple if statements, is that still so?

twilit nymph
#

Yeah I) u

#

I have lots of conditions

tribal crane
#

Are they really slower?

thin pine
#

I tested the speed of switch vs if statements a while ago but I forgot the results

#

If they are, the difference is negligible for 97% of all scripts

tribal crane
#

Naturally, but a ladder of if's does more local lookups which can be expensive.

thin pine
#

I think the difference in speed may be that switch evaluates all conditions perhaps...not sure though

tribal crane
#

It doesn't evaluate all conditions.

#

When it matches it does something similar to breakOut

thin pine
#

Someone should check the difference between speeds. Someone with a PC :p

tribal crane
#

Unless the difference is huge it would be context dependant anyhow.

thin pine
#

Yer

#

It's negligible for most scripts. Switches look pretty ^^

twilit nymph
#

Agree @thin pine

earnest valve
#

Tbh. I find if conditions unreliable at times. Sometimes they work, sometimes they don't (depends on what you are coding).

#

Plus it makes the code cleaner with a switch condition.

#

@thin pine same ๐Ÿ˜„

split coral
#

When don't IF conditions work? If your code isn't faulty that is.

little eagle
#

@tribal crane switch in Arma DOES evaluate all conditions

tribal crane
#
a = 0;

add = { a = a + 1; a };

switch (2) do 
{
    case call add: { };
    case call add: { };
    case call add: { };
    case call add: { };
    case call add: { };
    case call add: { };
    case call add: { };
}
#

Is "a" 2, or 7?

#

(After that executes)

little eagle
#

hmm. It's 2

#

magic

#

why is it so slow then though?

tribal crane
#

It shouldn't be.

#

If you have a lot of scopes and locals it should do a lot less namespace searching.

little eagle
#
call {

    if (random 0.5 < 1) exitWith {};
    if (random 0.5 < 1) exitWith {};
    if (random 0.5 < 1) exitWith {};
    if (random 0.5 < 1) exitWith {};
    if (random 0.5 < 1) exitWith {};
};

0.0082 ms

switch (true) do {
    case (random 0.5 < 1): {};
    case (random 0.5 < 1): {};
    case (random 0.5 < 1): {};
    case (random 0.5 < 1): {};
    case (random 0.5 < 1): {};
};

0.0141 ms

tribal crane
#

What if you replace the cases with the if's?

little eagle
#

?

tribal crane
#

switch (true) do {
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
};

little eagle
#

0.0066 ms

#

lol

#

new syntax found

tribal crane
#

How many times is it testing it?

little eagle
#

10k

#

the random averages out if that was your question

tribal crane
#

Replacing it with true would work as well, SQF isn't that smart.

little eagle
#

omg

#

random 0.5 < 1 is flawed

#

retesting...

#
switch {
    case (random 1 < 0.5): {};
    case (random 1 < 0.5): {};
    case (random 1 < 0.5): {};
    case (random 1 < 0.5): {};
    case (random 1 < 0.5): {};
};

0.0017 ms

call {
    if (random 1 < 0.5) exitWith {};
    if (random 1 < 0.5) exitWith {};
    if (random 1 < 0.5) exitWith {};
    if (random 1 < 0.5) exitWith {};
    if (random 1 < 0.5) exitWith {};
};

0.0117 ms

#

there we go. switch is better

tribal crane
#

Only when you don't use the "do" operator. ๐Ÿ˜‰

little eagle
#

0.0164 ms for the hybrid thing

#

derp

#

0.0161 ms

#

yeah. call, exitWith still faster

#

It's a shame, really

tribal crane
#

What if you try it with a more typical example?

#

if (_a == 1) ...

little eagle
#
private _a = random 5;

switch (true) do {
    case (_a < 1): {};
    case (_a < 2): {};
    case (_a < 3): {};
    case (_a < 4): {};
    case (_a < 5): {};
};

0.0237 ms

#
private _a = random 5;

call {
    if (_a < 1) exitWith {};
    if (_a < 2) exitWith {};
    if (_a < 3) exitWith {};
    if (_a < 4) exitWith {};
    if (_a < 5) exitWith {};
};
#

0.0147 ms

tribal crane
#

Without referencing _a every time

little eagle
#

how would that work?

tribal crane
#

private _a = random 5;
private _a = floor random 5;
switch (true) do {
case 0: {};
case 1: {};
case 2: {};
case 3: {};
case 4: {};
};

zealous solstice
#

@tribal crane your code will not work

#

true == Number? will never be true

little eagle
#
private _a = floor random 5;

switch (_a) do {
    case (1): {};
    case (2): {};
    case (3): {};
    case (4): {};
    case (5): {};
};
#

0.0176 ms

#
private _a = floor random 5;

call {
    if (_a isEqualTo 1) exitWith {};
    if (_a isEqualTo 2) exitWith {};
    if (_a isEqualTo 3) exitWith {};
    if (_a isEqualTo 4) exitWith {};
    if (_a isEqualTo 5) exitWith {};
};
#

0.0141 ms

zealous solstice
#

@little eagle try it with fixed numbers

#

and not random

#

so you can see if the performance differnce come from the random or from the swich/if

little eagle
#

5 for call exitWith: 0.0174 ms
5 for switch 0.0174 ms

#

1 for if exitWith 0.0081 ms
1 for switch 0.0145 ms

zealous solstice
#

best case faster worse case Equal

little eagle
#

So it seems to overtake eventually for switch, but only if you after about 5 failed tries when loading the variable

#

Yeah. Most of my switch seem to be switch (true) though

#

And those seem to be always worse

#

if you already use integers you might as well use ARRAY select

zealous solstice
#

this are still the same results i had a year ago

little eagle
#

for strings getVAriable

#

this are still the same results i had a year ago
1.66

zealous solstice
#

yeah as i started working on ace i did this test and i had the same results

little eagle
#
private _a = random 5;

call ([
    {},
    {},
    {},
    {},
    {}
] select _a);
#

0.0038 ms

#

rate xD

#

0.0043 ms with floor

#
private _a = sideLogic;

call ([
    {},
    {},
    {},
    {},
    {}
] select ([west, east, resistance, civilian, sideLogic] find _a));
#

0.0064 ms

#

๐Ÿ˜›

halcyon crypt
#

so basically just use switch do case ๐Ÿ˜›

little eagle
#

if you want to be able to read your code , sure. If you need every ms, then....

halcyon crypt
#

0.0xxx ms is nothing

#

couldn't care less ๐Ÿ˜›

little eagle
#

true, but control structures appear everywhere

tribal crane
#

Yeah, but in actual code a switch may be quicker.

little eagle
#

how so?

tribal crane
#

One of the more expensive things in SQF is searching for locals. In your benchmarks the local hashes only ever have 1-2 entries.

#

And they are only 1 or 2 scopes deep.

#

When you did a normal switch/if where you used a local variable the timings got very close to each other.

little eagle
#

have you seen my last example? it searches _a exactly as often as switch would do. once

tribal crane
#

0.014 vs 0.017

#

Yeah, short of doing that though any difference between switch/if for artificial benchmarks may disappear in real scripts with larger scopes (even for small numbers of items).

little eagle
#

so should we add a private [...] full of throwaway variables to the benchmark?

#

Or use globals instead?

tribal crane
#

Yeah, you'd need to nest calls and fill the private namespaces.

#

Globals are generally faster than locals but don't say that out loud in case someone decides that means everything should be a global.

tough abyss
#

Would thought it be the otherway around to be honest

tribal crane
#

Didn't Nou do a bunch of testing at some point?

little eagle
#
vars = [];

for "_i" from 0 to 1000 do {
    vars pushBack format ["_%1", _i];
};
tribal crane
#

It depends on how deep your scope stack is though so you can't just have one-liner benchmarks to test it.

little eagle
#
private vars;
private _a = floor random 5;

call {
    if (_a isEqualTo 1) exitWith {};
    if (_a isEqualTo 2) exitWith {};
    if (_a isEqualTo 3) exitWith {};
    if (_a isEqualTo 4) exitWith {};
    if (_a isEqualTo 5) exitWith {};
};
#

takes forever, but it might be due to the private command at the start

#

yeah. it's the private vars; part. Sadly no way to test then I think

#

the benchmark command from KK does not carry over local variables either

#

diag_codePerformance

tough abyss
#

Guess it makes sense
Engine is prob losing time walking the scopes checking for the variable name. Compared to checking a single scope in global namespace

tribal crane
#

Yeah. If the hashes are done right checking a single hash will be mostly converting the value to the hash key; walking the scopes does that repeatedly for each scope.

little eagle
#

I still don't see how this can make switch faster than the call-select-find thing

tribal crane
#

It won't, but if we're no longer comparing if to switch then something written in Intercept C++ will kill your find code.

little eagle
#

Sure, but it's something than can be done today

tribal crane
#

You can't write a .dll today? ๐Ÿ˜ƒ

little eagle
#

I don't think Intercept will be ready to use today ๐Ÿ˜‰

halcyon crypt
#

"ianbanks takes on challenge" pleeeaaaseeee โค

#

๐Ÿ˜›

#

(fixing up Intercept that is)

tribal crane
#

What's wrong with it?

halcyon crypt
#

To quote @grizzled cliff: By the way, last time I tried to boot with Intercept it was crashing on my test missions right off the bat, so there is probably some stuff that changed in Apex regarding the SQF interfaces.

tribal crane
#

Yeah, hence my previous warnings against using it (as cool as it is).

#

Only way to fix it is to break out IDA and blow many hours/days.

halcyon crypt
#

I thought that finding the addresses for the functions was dynamic-ish?

#

or whatever it's called ^^

tribal crane
#

Which means it works after changes to unrelated parts of the application; changes to related parts will still break it though.

halcyon crypt
#

hmm my C++/very low level system stuff isn't at the level to fully understand what's going on with Intercept

#

๐Ÿ˜ฆ

tribal crane
#

To work it needs to know (probably) hundreds of details about A3 internals, each one that would take a substantial amount of time to determine, and many of which may change with each minor release.

halcyon crypt
#

hmm back when I tried to go through Intercept I didn't find any statically defined stuff like addresses and such

delicate canyon
#

IIRC Intercept was searching pointers to functions starting from the address at end of the output buffer of RVExtension().

tribal crane
#

That's just the entry point.

#

To do anything it has to mirror/emulate a large number of A3 memory structures.

#

If you want to create an A3 string for example you need to know both the vtable and data layout of A3 strings.

#

(Or assume you know enough about the semantics of A3 strings to just manipulate the data directly, but that's even worse than assuming vtables don't change)

tribal crane
#

uintptr_t unary_hash = state_addr_ + 16;
uintptr_t binary_hash = state_addr_ + 28;
uintptr_t nulars_hash = state_addr_ + 40;

#

The very next thing it does is assume those offsets.

halcyon crypt
#

mhm seems like loader::do_function_walk does all the pointer magic

tribal crane
#

There's assumptions about A3 layouts everywhere; much of it is in struct definitions too.

halcyon crypt
#

BI should just absorb it and make it official ๐Ÿ˜

tribal crane
#

Hopefully they've done enfusion well enough that it's not necessary.

rancid ruin
#

any ideas why i can't get agents to move anywhere?

#

this from the wiki does nothing

#

{agent _x moveTo position player} forEach agents;

#

tried doMove as well

halcyon crypt
#

{_x doMove position player} forEach agents;

#

nvm ๐Ÿ˜›

#

doMove should work though

tough abyss
#

What is the agent ? custom animal or normal ai

rancid ruin
#

normal ai i think

#

i just dropped in a random vanilla a3 unit as the player and created a typeOf player agent

#

@halcyon crypt _x moveTo will throw an error, agent _x moveTo does not

halcyon crypt
#

mhm that's why I said "nvm", didn't think before spewing misinformation ๐Ÿ˜

thin pine
#

@rancid ruin did you disable the animal behaviour script by setting BIS_fnc_animalBehaviour_disable to true?

#

That used to be a thing you had to do to get agents to do what you want...not sure if that's still needed

ionic aurora
#

greetings why is this not working its suppose to disable fall damage since am using an exoskeleton mod

nolandDamage = {_damage = 0;
if((_this select 4) != "") then{_damage = _this select 2;
};_damage};
{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];
} foreach (units (group player));

little eagle
#

player is null?

#

other mods/missions using handleDamage overwriting your stuff?

paper rain
#

addEventHandler shouldn't overwrite other event handlers.

#

setEventHandler would

little eagle
#

so what? only the last return value is used. if you have multiple handleDamage returning stuff, only one get's used

paper rain
#

I've used add before and had multiple keypress handlers. I'd have to experiment with damage handling. But I know multiple is possible.

little eagle
#

nope. only the last return value of handleDamage is used

#

also, there is no setEventHandler for this

paper rain
#

right, I'm confusing it with displayeventhandler

little eagle
#

yes

paper rain
#

re-whitespacing the function for my own sake:

nolandDamage = {
    _damage = 0;
    if ((_this select 4) != "") then {
        _damage = _this select 2;
    };
    _damage
};
{
     _x addEventHandler ["HandleDamage", { _this call nolandDamage }];
} foreach (units (group player));```
#

Do you know the handler is firing? Did you test it with something like:
_x addeventhandler ["HandleDamage",{ systemChat format ["T=%1 : %2", time, _this]; } ];

twilit nymph
#

@little eagle Thanks for the help yesterday. Got a followup question though. To run remoteExec I had to preprocess my script. If I wan't to remoteExec something simple like playMusic <song> would this in init.sqf work

playSong1 = {playMusic <song>};

Instead of using playMusic <song> in a file and then this in init.sqf

playSong1 = compile preprocessFileLineNumbers "filename";
#

I am using remoteExec from debug menu in MP btw

little eagle
#

yes it would. it's not about preprocessing the file. It's just that the function has to be saved in a mission namespace variable

#

if all you're doing is a single command

#

like playMusic

#

then you can also use:
_song remoteExec ["playMusic"];

#

single commands are supported too

#

no need to make a function for that

#

although it can help appending the code with debug stuff etc.

twilit nymph
#

Like I don't need to add anything in init.sqf?

little eagle
#

no function is needed for remotely executing single commands

twilit nymph
#

So this in debug menu would be enough?

"song_name" remoteExec ["playMusic"];
tough abyss
#

@ionic aurora Is that the exoskeleton mod from the steam workshop?

#

Hey @little eagle Do both functions and commands inside those functions

#

require whitelisting to use them?

little eagle
#

I think they are all white listed by default, but any mission can wreck it if they disable them

ionic aurora
#

@tough abyss yeah thats from the steam workshop

tough abyss
#

@ionic aurora Thats getting DMCA'd

#

In other words it's ripped from CoD

ionic aurora
#

bare in mind this the script i was supplied with from the bi forums , so i barely understaing it my self ๐Ÿ˜ƒ

tough abyss
#

And in deep sh**

#

Were talking about it after I mentioned it.

little eagle
#

you won't be able to get it working if you don't understand it

tough abyss
#

As I said that mod is getting taken down

ionic aurora
#

mod getting taken down how come ?

tough abyss
#

DMCA violation

#

In other words it was owned by an actual game and ripped from it

little eagle
#

You cannot steal models from other games

tough abyss
#

@A3L Life

ionic aurora
#

right i understand ๐Ÿ˜ƒ

#

thank you gentman ๐Ÿ˜ƒ

tough abyss
#

If you wanted to make an exoskeleton mod yourself by all means do it.

#

Me I'd love to do it.

#

I have no idea how to approach it though.

ionic aurora
#

well i am an artist aftera ll but the coding is washy at best

#

same here

#

there is no tutorial i have found so far for making a mod

tough abyss
#

The exosuit I'd implement would be the HULC

ionic aurora
#

a full fledged mod

tough abyss
#

HULC reduces fatigue

ionic aurora
#

i know how to script and pu the add action not howto assign buttons to scripts and such ๐Ÿ˜ฆ

tough abyss
dusk sage
#

I can't see anything about an exoskeleton?

tough abyss
#

Now there is

tough abyss
#

does anyone know how to get old mission files into new editor ??

thin pine
#

Load old mission in new editor and let it convert

tough abyss
earnest valve
#

@split coral if you have 3 IF and ELSE commands, your code would execute 3 of the ELSE conditions. Rule of thumb is that if you only want 1 ELSE condition to run (but have several IF conditions executed), then SWITCH or EXITWITH Is best suited for that scenario.

#

I had issues using the IF and ELSE conditions for that particular reason, when creating DSS. So that's why imo SWITCH is best for that particular scenario.

#

I could've used EXITWITH, but I wanted the code to continue after the condition.

#

Another thing. If the first IF condition returns as FALSE, the other IF conditions won't run because it has been ended with EXITWITH.

paper rain
#

Switch is not implemented the best according to KillzoneKid's blog.

#

It's not that much faster, so don't let this get in the way of better looking code of a switch just looks nicer.

tough abyss
#

An interesting question to ask?

#

Are arma 3 scripters rare?

gray hemlock
#

Not rare, but a lot seem to get bored and move on after a while. What is rare are the older scripters with deep understanding of how arma works and how to get it to do what they want.

tough abyss
#

Well i've been re-writing I&A

#

Been more focused on learning software development

#

as I could quickly translate that directly to SQF

#

E.g I've already got plans to replace the AO initialisation with an event handler triggered system

#

using the radiotower as the event

gray hemlock
#

I know scripters that understand sqf, have an idea how to do things. Can write something to get the job done. Then I know people that could write the same thing, quicker, cleaner, and more efficient because they have a better understanding of how different aspects effect others, what works better in different situations.

tough abyss
#

radiotower is created after a eventhandler gets registered to the tower object it initialises all the vehicles etc.

#

All I had to do was register the EVH in the global space once it had a value > 1

#

calls the code to start all the AI units

#

Biggest problem @tough abyss was I&A's biggest flaw was you used BI functions

#

I mean functionality wise this is fine.

#

But it had a pretty expensive cost when it came to spawning the AO units

#

Not sure why.

#

Yeah that was a big problem I noticed.

#

Some functions I tried to implement to make AI more dynamic like using selectBestPositions

#

It was expensive but made Viper-teams spawn in tree covered areas

#

I probably should have pre-computed the next AO while the current one was running

#

And stored all the "candidate" positions in an array

#

then looped through them when the new mission was ready

#

It's a known optimisation if you can pre-compute data ahead of time for the next task.

#

And that applies to programming in general.

#

Not sure that would work

#

It could..

#

Depends on how long it takes for arma 3 to search the array if it would be faster.

earnest valve
#

@tough abyss well understanding and studying BIs code such as the Main Menu or Editor, qualifies. :P

#

I can create SP mods and scripts. But MP Is where I struggle at. >.<

little eagle
#

MP is just a bunch of SP interacting with one another.

halcyon crypt
#

once you wrap your head around that stuff you're good (enough) ๐Ÿ˜ƒ

thin pine
#

@tough abyss i for one was passionately working on a big mp gamemode for 7 months. However script fatigue kicks in and the fact arma is just a game and doesn't make your living are reasons why big script projects are rare

#

Finished script projects *

earnest valve
#

@halcyon crypt Cool, thanks! ๐Ÿ˜„

tough abyss
#

Hi guys does anyone know a tool available that people can use to create GUI menus for Arma 3 multilayer missions ? Like rule lists, settings etc etc

halcyon crypt
#

CBA

#

and/or the GUI editor that's part of the debug console, I think

#

@queen cargo was working on an external GUI editor but no clue about it's state

tough abyss
#

I've tried the GUI editor yes, but it didn't really work as intended. I've tried some other external ones but they simply didn't work anymore due to updates on ArmA 3

halcyon crypt
#

uhh which GUI editor? ๐Ÿค”

tough abyss
#

I honestly don't remember. Kinda gave up on the idea but working on a new Arma 3 project now for which an interactive menu would really streamline player experience

queen cargo
#

well @halcyon crypt
currently do not find the time to work on anything due to study & job & real life ... sooo ... its on hold

halcyon crypt
#

it's official and most definitely works

#

@queen cargo ah pitty ๐Ÿ˜ฆ

queen cargo
#

well ... it is open source so anybody can take up the work

tough abyss
#

I've used it, but it won't allow multiple windows. Also tried importing images to in paa format but they wouldn't load

queen cargo
#

but most people seem to use outdated versions anyway :3

meager granite
#

Best way to make UIs - learn to write UI configs yourself, then you'll understand them to full extent

queen cargo
#

still PITA in regards of designing them @meager granite

meager granite
ionic aurora
#

greetings gents , am trying this code so i can emulate an exo suit assisted jump using a loop but am not sure where am going wrong
code/
player addAction [
"<t color='#00FFFF'>exo assist.</t>", {
while {a < 8} do {
a = a + 1;player setPos (
player modelToWorld [0,1,1]
);
}
]
/code

indigo snow
#

you never define a

ionic aurora
#

@indigo snow thanks bud can you put it in the code please

#

am kind of new to scripting

indigo snow
#

a=0;

ionic aurora
#

where exactly do i put it

indigo snow
#

just before you start the while loop

ionic aurora
#

sorry can you modify the code with the change please

indigo snow
#

when the code goes while {a < 8} do { ... };, a has no value so the script gives an error

#

so you need to define a before your code does while {a < 8}

shadow sapphire
#

Anyone have a link to the wiki for how to script an item into a mission?... like... create an item that can be carried in the inventory and take up space in the inventory that doesn't exist in the vanilla game?

indigo snow
#

Didn't that revolve around taking another item and modifying the inventory control?

ionic aurora
#

@indigo snow thanks buddy i got it working

shadow sapphire
#

@indigo snow, was your last question aimed at me about inventory control? If so, I have NO idea.

indigo snow
#

yea, i believe it was something hacky like that. might help you add some search terms haha

shadow sapphire
#

Oh. Okay! I'll try to check it out more. I've seen some medical systems add in medical items without requiring mods, all done in-mission scripting. I'm trying to add in mortars as inventory objects.

indigo snow
tough abyss
#

May be this recomenfation does not exist but there is a guide or something that state basic recomendations to make your mod compatible with the most number of other mods possible? Thankyou in advance.

shadow sapphire
#

Thanks, @indigo snow!

lethal cave
#

is there a command that can show config file owner?

tough abyss
#

@lethal cave the parent of a config class?

lethal cave
#

the mod that added or modified that class last

#

something like that

native hemlock
lethal cave
#

that looks good, thanks a lot

native hemlock
lethal cave
#

for some reason my searching abilities fail me on the biki

native hemlock
#

CfgPatches is more specific than CfgMods

lethal cave
#

yeah, that looks good

#

what i need exactly

shadow sapphire
#

Is it possible to freeze an animation in a certain frame until conditions are met??

open vigil
#

do you mean like so:

0 = this spawn {waitUntil {behaviour _this == "combat"};

 _this call BIS_fnc_ambientAnim__terminate;}
little eagle
#

@shadow sapphire
freeze:
_unit unit setAnimSpeedCoef 0;
unfreeze:
_unit unit setAnimSpeedCoef 1;

shadow sapphire
#

Thanks so much, @little eagle!

little eagle
#

yw

shadow sapphire
#

Hmm... I wonder why there isn't an Arma 3 animation for just plain position of attention without the salute.

Is there a way to prevent the salute animation altogether while retaining the position of attention?

little eagle
#

No and don't think so

shadow sapphire
#

Rats. Can you cancel an animation?

little eagle
#

_unit switchMove "";

shadow sapphire
#

Interesting... I'll experiment with everything you've shown me. Maybe they can be used in combination to create a keydown position of attention.

little eagle
#

I seriously doubt it

#

timing would be impossible with anything you have in SQF

#

especially in MP and low FPS

shadow sapphire
#

Ugh... sorry for so many questions today...
But, can AI units in a group be given individual waypoints?

#

Well, that's okay. If they all salute before they leave the position of attention, it'll just be a quirk, assuming that I can get the animation to freeze at the appropriate time.

indigo snow
#

you can doMove individual units

shadow sapphire
#

@indigo snow, thanks so much!

paper rain
#

I'm trying to take a marker and create a location from it, but the bounds just seem... off

#

private _marker_pos = markerPos _marker_name;
private _marker_size = markerSize _marker_name;

private _location = createLocation [ "Name" , _marker_pos, (_marker_size select 0), (_marker_size select 1)];
_location setText format ["Location"];
_location setDirection (markerDir _marker_name);```
kindred lichen
#

Is it off by a lot?

paper rain
#

This makes a loction that seems... too small? I've tried doubling the size lengths and rotating the direction by 90

#

the center is correct

#

and no, not by too much

#

but noticable

kindred lichen
#

Could it be a rounding error? Is it a small location you're making?

paper rain
#

ohhhh... i think locations are elliptical

buoyant heath
#

Correct

paper rain
#

Now I have an error in an action condition

and (makerColor (name (nearestLocation [player, "Name"])) == [side player, true] call BIS_fnc_sideColor)```
```17:05:56 Error in expression <arestLocation [player, "Name"]))
        and (makerColor (name (nearestLocation [playe>
17:05:56   Error position: <makerColor (name (nearestLocation [playe>
17:05:56   Error Generic error in expression```
#

If I remove the condition after the and it works fine

native hemlock
#

makerColor is not a command

paper rain
#

๐Ÿคฆ

#

Thank you

eager prawn
#

Hey guys, hopefully simple question here.. I run a unit with quite a lot of people, and we are a "Paramarine" unit, so we jump at the beginning of every operation. That means we have 30+ people on each transport aircraft. Unfortunately, there is one asshat in the unit that will constantly play with the doors and ramp on the aircraft EVERY jump - I cannot figure out who it is, most likely one of the new recruits, only started happening recently.

#

Is there a way that I can disable the commands for everyone in the "Passenger" seats in the aircraft?

#

And make it so only crew members can access the ramp + door features? Any help would be awesome.

earnest valve
#

You could assign the action to the pilot, so that he Is the only one who has control. But you may need to name your plane and the script calling it, something like "plane1".

#

There's also some parameters in the addAction command that you can specify who can use it, too.

#

One sec

eager prawn
#

I'm really a scripting noob. - how can I remove the action when it's already made in the planes mod?

earnest valve
#

Wait

#

So its part of a plane mod?

#

Not a mission script?

eager prawn
#

Yeah - it's Sabs C130 and a C17A1 mod.

earnest valve
#

Damn

eager prawn
#

They both have the option for passengers to open/close jump doors, as well as the ramp.

#

So it's an action that's already there that I would like to remove for everyone but the pilots.

#

or, in a perfect world, only enable for people who are in the crew seats.

earnest valve
#

Yeah I can't help you with that, unfortunately. You may need to ask the Author of that mod, probably.

broken mural
#

How do you modify an existing eventhandler? AI on init needs to be immune (AllowDamage False) and after a trigger needs to only take damage from a specific side

                    _damage = _this select 2;
                    _shooter = _this select 3;
                    if (side _shooter == side _unit)then{_damage == 0;_unit setDamage 0;};
                    _damage;```

problem is after trigger the AI is still immune to all damage from either side.
#

Any idea why?

buoyant heath
#

You cannot modify the existing eventHandler. Until you remove it, it's in effect.

proven crystal
#

@cptnnick#7051 can i use the domove command to produce something like custom formations

#

Or at least make a group take positions for a while like in a circle back to back or so?

#

And why do my mentions @whoever not work anymore in discord?

#

And would anyone know if MCC will be available to the voted admin, if i restrict it to admins? Gotta play with that later...

#

Also can mcc be restricted to admin by default? Problem is that it is freely available also in set missions, where i dont want players to have mcc access and i cant/dont want to edit all the maps to add a module i think.

thin pine
#

Not sure if people still use MCC. It's not something I'd expect to be answered in here imo

tough abyss
#

Unfortunately you will need that module to restrict MCC access. However due to the created dependency I removed MCC completely. I think you'd be best off having an experienced Zeus-er do small operations. AI wise I'd recommend a custom ASR setting

#

@thin pine

#

@proven crystal

thin pine
#

MCC became quite useless with the release of Zeus, especially when combined with ARES imo.

tough abyss
#

hm I would consider ARES obsolete with the release of ACHILLES

#

it has way more functionality

thin pine
#

Haven't heard of that. But yeah

#

Fetzen I'd recommend stalkers advice

tough abyss
#

@thin pine It's basically ARES + more features https://forums.bistudio.com/topic/191113-ares-mod-achilles-expansion/

#

You only need Achilles, not ARES itself

icy raft
#

Any Lua lovers? :)

proven crystal
#

Ok havent tried either of the 2

#

Will give that a go

tough abyss
#

@broken mural add the handler then remove it

proven crystal
#

Why didnt they call it Mars. I mean the other 2 are gods, why step it down if you upgrade. We went from father of gods to gods to son of a god.

tough abyss
#

Well succession?

#

Wait.

#

Why didn't they just chose the son of Ares?

halcyon crypt
#

@proven crystal because there's already another tool that's called Mars ๐Ÿ˜›

tough abyss
#

Whoa

#

Anyone used that mod?

halcyon crypt
#

I have little use for it (community-less) but it looks pretty good

#

Eden-fied zeus ๐Ÿ‘

tough abyss
#

That looks like a good tool to add to my arsenal of mission creation tools

#

This Mars editor looks like it would superseed ares

#

or even compliment it.

proven crystal
#

Apparently achilles does that too. So how do achilles and mars compare then?

rancid ruin
halcyon crypt
#

neat ๐Ÿ˜ƒ

proven crystal
#

Achilles is only client sided or do i need to run it on the server?

#

Because it says there only zeus needs to have it installed

proven crystal
#

and all it does is add a few modules to zeus?

tough abyss
#

No need to include it at all on the server I believe

buoyant heath
#

Mars is a complete replacement for Zeus, not an extension of. It offers superior AI order and spawning controls, 3den-like unit/object selection and placement controls, simplified extension framework, faster execution, etc.

tough abyss
#

But apparently quite some bugs

buoyant heath
#

Well, it was the first early beta release this week. Definitely not bug free or feature complete. I think he's planning on an update this weekend/early next week.

proven crystal
#

achilles + MCC4 as combo for the zeus on the admin/zeus on the server

halcyon crypt
#

Do #defines propagate down the call stack?

#

e.g. I call a function and it "inherits" the defines from the calling script

indigo snow
#

#defines (and all macros) only get processed when a file is loaded, they dont propagate through

dusk sage
#

They should propagate

#

I.e

#
#define test 100

systemChat str test;

[] call {
    systemChat str test;
};
#

should work

#

On the logic they do work with spawn

halcyon crypt
#

I guess I'll find out if it works when I load up the game soon-ish ๐Ÿ˜›

dusk sage
#

I'd put money on it working ๐Ÿ˜‰

#

But

#

e.g. I call a function

#

I don't think will work

#

If your function is pre compiled, I doubt it

indigo snow
#

inside one file they propagate, but if you call a function defined outside of that file, it wont

halcyon crypt
#

ah that's what I'm doing, pitty

tough abyss
#

as the code that is above this part, is a safezone that deletes bullets etc, people without our squad xml can freely fire at base

distant egret
#

Any error?

#

Or does it just not work?

tough abyss
#

I'll check rpt one more time, but only thing I notice is guests firing freely at base

#

maybe infistar breaks it or something? I don't know

distant egret
#

And _email is defined right?

tough abyss
#

yes the hint shows up properly

distant egret
#

K

#

Authenticated is not used in the safe zone?

tough abyss
#

no but it seems that that part breaks it

#

as when someone is seen as true, the safezone works

#

who's seen as false can fire freely

#

Possibly found the answer in Infistar. Will report back results

#

FIXED!

#

@halcyon crypt More specific definition is macros are only defined after code is preprocessed

#

Script finds a macro #define doessomething(psuedofunc)

#

And replaces that macro with whatever is defined by the #define

halcyon crypt
#

damn macros ๐Ÿ˜›

little eagle
#

More specific definition is macros are only defined after code is preprocessed

#

I would say that they are "resolved" not defined

tough abyss
#

Yeah you #define them then the code is when you execVM

#

is basically equivalent to this

little eagle
#

You can place all your macro definitions inside a header file and include that in every script

#

#include

tough abyss
#

spawn compile preprocessorFileLineNumbers

#

== execVM

#

It's why execVM is so slow

halcyon crypt
#

[8:56 PM] commy2: You can place all your macro definitions inside a header file and include that in every script
Ah, we're already including script_component.hpp anyway. Should probably move them there. ๐Ÿ˜ƒ

tough abyss
#

Yes

#

script_component.hpp has all the sub-definitions inside it.

little eagle
#

execVM reads the file fron disc, preprocesses it, compiles the string to code and then spawns a scheduler pseudo thread. definitely not something you want to do mid mission

tough abyss
#

@little eagle People still do it you know?

little eagle
#

i mean, it doesn't matter if your file is a 5 liner without header

#

But it's definitely not good practice

#

BI for example replaced all door opening scripts, which where execVM'd with precompiled functions

tough abyss
#

I pre-compile most of my code as I've said before.

little eagle
#

script_component.hpp is where the macros should go

#

You just have to be carefull when you also include it into .cpp and you're making a mod with pbo project

#

It fails if you redefine a macro

#

for whatever reason

#

works in SQF

halcyon crypt
#

hmm I've put the defines in script_component.hpp and included it in the script but it's not recognizing them.. :/

#

facepalm.. wrong component ๐Ÿ˜„

tough abyss
#

@little eagle ACE's coding guidelines give sexy code.

#

I like it.

#

Bookmarked

noble juniper
#

coding guidelines, definitely a good idea.

tough abyss
#

@noble juniper It partially reminds me of PEP-8

noble juniper
#

@tough abyss how come that you know PEP-8 ?

tough abyss
#

Know about.

#

I am into python programming.

noble juniper
#

@tough abyss nice to know, wasn't using my head, am busy with arma stuff .

tough abyss
#

I've been over a few programming guidelines

#

Atleast ACE3 adds one

#

The amount of inconsistencies within the community in terms of "code design"

#

Some things I've come across are downright ugly...

noble juniper
#

oh jea .... and don't even mention securety holes and stuff

tough abyss
#

Which can mostly be avoided by defensive programming.

#

Macros are good for checking violations

#

As they become hardcoded

#

if you want them to.

noble juniper
#

do you have a specific example because i don't 100% get what you meant with that.

#

i know macros, i think i get what you mean with defensive programming, ehm

tough abyss
#

#define CheckVIolation(badvar) if (badvar isEqualTo objNull) exitWith {};

#

I think

noble juniper
#

interesting example, but why not use param and params ?

tough abyss
#

Doesn't catch illegal expresions like nullObjects

#

as far as I know

#

If it does well, then why do we use exitWiths so much?

noble juniper
#

should return false if it needed to intervene.

tough abyss
#

May as well stop using them.

noble juniper
#

if i remember correctly

tough abyss
#

You really dont need Macros for that though
Personnally i find SQF Macros make it harder to read exactly what some code is doing & making Battleye scripts harder. Since you can just do a search for the script snippet that got logged in the mod files.

steel mantle
#

Anyone know if it is possible to make like a radar for incoming missile and number them like "23421" And "32315" its kinda like a ID

tough abyss
#

I tried to wrap an error checking function into 1 piece of code

#

It went okay.

#

simply using a function call giving it a "legal" and illegal expression if the passed was an illegal it just broke out of all of the code.

#

checkLegality = [_passedArg,_compareTo] call GG_fnc_checkVarType;

#

if (!checkLegality) exitWith {};

#

Use 1 function instead of 5 or 6 different check expressions etc.

#

The theory behind it was sound

#

Atleast a cfgFunctions.hpp compiled check function

#

more or less was "hack protected"

#

Thats right isn't it?

#

cfgFunctions.hpp defined functions are compileFInal'd therefore can't be tampered with?

noble juniper
#

yes, if you don't fidle with the ram => BE

#

@tough abyss whats your Background AL ?

tough abyss
#

Not a huge amount

#

I never particularly liked the mission

#

Too many swagger teenage prepubscents @noble juniper

#

And it's genuinely boring.

#

So much grind for little reward

noble juniper
#

@tough abyss i know what you mean.

tough abyss
#

@noble juniper Is it "easy" for people to fiddle with RAM?

#

in regards to arma 3?

#

I mean I can use ProcessHacker to look at memory addresses

#

but I can't edit them.

#

Or well actually you could...

#

That program does allow you to.

#

But battle-eye obviously doesn't mind a lot.

#

If I did edit the memory battle-eye would probably have a hissyfit?

noble juniper
#

im not that up to date, but i think that has become good in detecting those.

#

Especially because it now runns before the game gets loaded

tough abyss
#

Would it ban me for process hacker?

noble juniper
#

and while BE is runing, you get insta Baned i think

tough abyss
#

If I am not actually tampering with anything*

noble juniper
#

i guess, 2 years ago i read some one had some ram usage scanner on his mac and got baned because BE in the VM Detected it ..

#

could be hoax, but be careful. Maybe not fiddle around with the ram while running arma

tough abyss
#

Turns out yes it's compatible.

#

BE won't freakout.

#

It might block PH

noble juniper
#

try it out ?

cedar bay
#

hey guys need help with locality

#

_caller = _this select 0;
if (player != _caller) exitwith {};

#

this used to work in A2... in A3 it doesnt work for player only. Any ideas how to enforce that on player only?

noble juniper
#

where do youactually need that ?

tough abyss
#

addAction?

#

@cedar bay

noble juniper
#

well, remoteExec has pretty good adressing

#

but this doesn't look like remoteExec usecase.

tough abyss
#

Yeah @cedar bay need more context

cedar bay
#

well it is a special night vision that worked if you were that player

#

it now activates even in 3den

tough abyss
#

Full code?

cedar bay
#

_caller = _this select 0;

if (player != _caller) exitwith {};

"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust[ 1, 0.66, 0, [-5, -2.14, -1.2, 0],[-5, -0.4, -0.16, -3.14],[-5, -0.13, -0.01, 0]];
"colorCorrections" ppEffectCommit 1;

#

thats it

tough abyss
#

is that linked to anything else?

#

e.g addAction?

cedar bay
#

nopers

#

i just need it to be visible in 1st person

tough abyss
#

What calls it ?

noble juniper
#

how do you get that code executed ?

tough abyss
#

Nothings call it..

cedar bay
#

config of unit

tough abyss
#

Ah.

#

Which config?

cedar bay
#

init.sqf

tough abyss
#

the class init block?

cedar bay
#

yes

tough abyss
#

AH.

#

First question

#

Are you absolutely sure that is the correct syntax?

#

_caller = _this select 0; ?

cedar bay
#

worked in A2 ๐Ÿ˜ƒ

#

init line is:

#

init="[_this select 0] execVM ""\addon\scripts\init.sqf""";

noble juniper
#

that is funy code

cedar bay
#

yeah tell me about it

#

i'll disable it for now

#

PPeffect is screwed up in A3 anyway

tough abyss
#

Don't know much about the init.sqf quirks

noble juniper
#

[_this select 0] ... is redundant

tough abyss
#

in addons

noble juniper
#

_this execVM is idetnical...

cedar bay
#

rgr

#

already fixed that

tough abyss
#

^

#

if you had [_var1,_var2] execVM "some.sqf"

#

then you would need _this select 0

#

as _this select 0 == indexes

noble juniper
#

no

tough abyss
#

No?

noble juniper
#

you should do the hole processing there where you actually know what to do with it

#

So, you should just send everything on, and select in the sqf file where you are using that info

#

but that is just a very minor thing , nothing to bitch about

tough abyss
#

@cedar bay Did you try this?

#
_caller = _this select 0;
diag_log ["_caller value was: %1",_caller]; 
 if (player != _caller) exitwith {}; 
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust[ 1, 0.66, 0, [-5, -2.14, -1.2, 0],[-5, -0.4, -0.16, -3.14],[-5, -0.13, -0.01, 0]]; 
"colorCorrections" ppEffectCommit 1;
cedar bay
#

i got rid of select... i'll see what causes eden to lit up ... it seems it takes player immediatelly

tough abyss
#

?

#

add diag_log

#

check through your rpt where it says "_caller value was"

#

If it returns objNull etc.

#

Then there is an issue

#

diag_log format ["%1,%2,%3",_var1,_var2,_var3];

#

is your friend.

cedar bay
#

tnx, will take a look

#

it seems the problem is in PPeffects not in the exec itself ๐Ÿ˜ฎ

tough abyss
#
params [
    [["_position",[0,0,0]]],
    [["_radius",0],
];


_vehicleOnRoad = isOnRoad _position;
_listOfRoads = _position nearRoads _radius;
private _roadObject = roadAt _position;

private _roadAttribs = [_vehicleOnRoad,_listOfRoads,_roadObject];

_roadAttribs;
#

Anyway to improve this?

#

I wrapped this into fn_roadAttributes.sqf

#

Generalised it into a single tool basically

#

now I can just [_position,_radius] call GG_fnc_roadAttributes

native hemlock
#

Your parenthesis inside of the params are incorrect, it should just be like this

params [
    ["_position", [0, 0, 0]],
    ["_radius", 0],
    ["_roadObject", objNull]
];
tough abyss
#

ah 1 square bracket was wrong

native hemlock
#

No, there were more

tough abyss
#

Fixed

#
params [
    ["_position",[0,0,0]],
    ["_radius",0]
];


_vehicleOnRoad = isOnRoad _position;
_listOfRoads = _position nearRoads _radius;
private _roadObject = roadAt _position;
private _roadAttribs = [_vehicleOnRoad,_listOfRoads,_roadObject];

_roadAttribs;
#

?

#

I am coding blindly here by the way

#

I don't know if they work.

#

I know listOfRoads will return a double nested array

#

might take all the getDir command variant pack them into a single function

earnest valve
#

I assume you are creating a random spawner?

tough abyss
#

No library.

#

Which will be used for our group

earnest valve
#

_vehicleOnRoad returns as a boolean. _listOfRoads returns as an array of positions. _roadObject I can assume returns an ID? I'm not sure. But _roadAttribs returns the listed variables in a nice array.

#

You could also try this, instead of the params line?:

#

`_position = _this select 0;
_radius = _this select 1;

_vehicleOnRoad = isOnRoad _position;
_listOfRoads = _position nearRoads _radius;
private _roadObject = roadAt _position;
private _roadAttribs = [_vehicleOnRoad,_listOfRoads,_roadObject];

_roadAttribs;
/*
optional - returns in hint format
*/
hint format ["%1", _roadAttribs];`

#

The / / at the bottom has a *, btw. Discord seems to have removed it

tough abyss
#

params

#

I am following ACE3 coding guidelines

earnest valve
#

Oh.

#

Well I can't help you then.

tough abyss
#
params [
    ["_position1",[0,0,0]],
    ["_position2",[0,0,0]],
    ["_object",objNull]
];
_dirFrom3D = _position1 getDir _position2;
_dirFromObject = getDir _object; 
_retDir = [_dirFrom3D,_dirFromObject] select (!_position2 isEqualTo [0,0,0]);
_retDir;
#

Generalised Dir function

#

Supports both syntaxes

tough abyss
#

Anyone know if debugLog

#

works outside of BI code?

#

Because a BI function for spawning groups

#

I want to over-write

#

the wall of TypeName calls hurts my eyes

#

@earnest valve Do you know if debugLog works outside of BI code?

#

I now know why BIS_fnc_spawnGroup is so inefficient

#

A wall of these

#

if ((typeName _pos) != (typeName []))

earnest valve
#

It does.. ish. debugLog notes stuff in the ArmA 3 logs.

tough abyss
#

So is it worth me removing all this completely in a BI-function

earnest valve
#

I haven't updated ArmA in a while, though. So I might have to check when I get online.

tough abyss
#

just to improve efficiency?

#
if ((typeName _pos) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] Position (0) should be an Array!"; grpNull};
#

There is about 9 checking for that.

#

all checking if typeName ! = []

earnest valve
#

Hmm

tough abyss
#

So I could get rid of 90% of inefficient code

#

including replacing param

earnest valve
#

I'm very confused. Is this related to the block of code 40 minutes ago?

tough abyss
#

No this is a BI-function call BIS_fnc_spawnGroup

earnest valve
#

Ok

tough abyss
#

It uses lots and lots of if (typeName "ARRAY" != Array etc

#

I can replace most of those with typeName as isEqualTo []

#

or if (!isEqualTo [] ) exitWith {debugLog

earnest valve
#

You could give it a go, I guess. But I usually leave the functions alone, unless they need some slight tweaking

tough abyss
#

It's very slow

#

This function in particular*

earnest valve
#

One sec. I'll see if I can get online. (Being on mobile is difficult, unless I have the game opened with the code)

#

Yeah I can't get online just yet. But I'll look at the code via wikia.

spring kindle
#

is anyone here familiar with makeing an animation work? when ever i run it it doesnt work but if i run arma's version of the animation it does, i used theres in a custom class to get it working, but its not and i copied the code from a forum post posted by a dev so not sure whats happening....

tough abyss
#

And all these typeName checks

#

Can go in the bin now

#

because params

#

catches them

earnest valve
#

@tough abyss yeah it'll definitely run a lot more faster with the above code you have written.

#

Give your code a test, though, to be sure it works. ๐Ÿ˜„

#

@spring kindle I am, yes. But I'm confused by what you mean by I used theres in a custom class O_o

spring kindle
#

I got a response from a dev finalyt thanks though

earnest valve
#

Np

thin pine
#

@cedar bay not sure if still needed but add if (is3DEN) exitwith {}; up top

#

On my phone so sorry if not relevant lol

tough abyss
#

Aren't objects in the editor already editable for the mission maker in 3den?

thin pine
#

"This is the only way how to add new editable entities toย Eden Editorย scenario"

little eagle
#

100 FPS in Eden

tough abyss
#

Does anyone know how to enable the cursor when showing something using RscTitles?

thin pine
#

CreateDialog

#

Or createDisplay

#

Not sure

tough abyss
#

Alright, thanks.

tough abyss
#

@MrSanchez#5319 I tried both and it doesn't work.

indigo snow
#

@tough abyss looking inside the sqm can be a pretty easy way of finding out

slate vale
#

Does anyone know a command that returns the skeletonBone of a model? Like let's say cursorObject "command" then I want in the watch field that it returns the door name, for example "Door_1". Is there anything like that? So it'll be easier to find out which door is what and where.

little eagle
#

no such command, but you can build something with intersect commands

#

lol. ignore L33

meager granite
#

@tough abyss I don't think you can interact with RscTitles with mouse at all

#

I'd suggest to hide your title and create copy of it as dialog

rotund cypress
#

Hey guys,

I have this ```
animTextureNormal = "gui\img\icon_messages.paa";
animTextureDisabled = "gui\img\icon_messages.paa";
animTextureOver = "gui\img\icon_messages.paa";
animTextureFocused = "gui\img\icon_messages.paa";
animTexturePressed = "gui\img\icon_messages.paa";
animTextureDefault = "gui\img\icon_messages.paa";

heavy plover
#

You want to resize the Icon?

rotund cypress
#

Yes @heavy plover

icy raft
#

No

meager granite
#

I don't think you can with ShortcutButton

rotund cypress
#

It's not a ShortcutButton? @meager granite

#

It's RscButtonMenu

meager granite
#

RscButtonMenu is CT_SHORTCUTBUTTON

rotund cypress
#

Oh my bad

meager granite
#

To have button with picture and resizable image try CT_ACTIVETEXT

#

Not sure if you can have text AND image there though

#

Double checked, I don't think you can, you specify your texture in text property so its just image with changable colors

#

But since you have same icon everywhere I assume you don't need text, just clickable resized image

#

So CT_ACTIVETEXT might suit you

rotund cypress
#

Ok thanks, but how would I resize image then?

meager granite
#

It gets resized by control size

#

Make sure you have style set to ST_PICTURE

#

of the active text control

rotund cypress
#

Ok thanks

#

And I use text = "pathtofile"; ?

#

@meager granite

meager granite
#

yes

#

(Warning, loud music)

rotund cypress
#

Yes, and also, I just use onButtonClick aswell right? @meager granite

meager granite
#

No, action

#

Actually you can have changable icons with onMouseEnter\Exit if you want

rotund cypress
#

so action = "[] call myfunc"; ? @meager granite

meager granite
#

yes

rotund cypress
#

Thanks a lot mate

meager granite
#

Actually in my case it is image then much bigger transparent active text on top of it

#

so you don't have to click right on the icon but anywhere near it

tough abyss
#

Thanks @meager granite!

rotund cypress
meager granite
#

You didn't set proper style

#

Should be ST_PICTURE (0x30)

rotund cypress
#
                idc = -1;

                style = ST_PICTURE;
                text = "gui\img\icon_messages.paa";
                tooltip = "Text Messaging";
                action = "[] call FLF_fnc_openPhone;";

                x = 0.654689 * safezoneW + safezoneX;
                y = 0.3218 * safezoneH + safezoneY;
                w = 0.0360937 * safezoneW;
                h = 0.055 * safezoneH;

                colorBackground[] = {0,0,0,0.8};
                colorBackgroundFocused[] = {0,0,0,0.9};

                class Attributes
                {
                    color = "#FFFFFF";
                    shadow = 0;
                    align = center;
                    font = "Purista";
                };
#

@meager granite

#

What did you mean by 0x30?

austere hawk
#

are there publically released functions for coordinate transformations somewhere? (e.g. 4x4 matrix multiplication with other 4x4 matrices, or 4x1 vectors, transpose 4x4 and 3x3 matrices, ...)

meager granite
#

Are you sure ST_PICTURE is defined as 0x30?

rotund cypress
#

How do I define it as 0x30 @meager granite

rancid ruin
#

#define ST_PICTURE 0x30

#

in a .hpp file

meager granite
#

you can put it into same config or just 0x30 instead of it

rotund cypress
#

oh ok thanks

vague hull
#

what would be a good place to define the onPreloadFinished EH ?

noble juniper
#

mission side, server side, client mod ?

vague hull
#

client mod

halcyon crypt
#

anywhere really

#

as long as it gets set before preloading happens

vague hull
#

nice, thanks !

frozen obsidian
#

Is it possible to create script to make waterfall os something like that?

#

Hmm even stuff like smoke machines that kind of effect would be awesome to have at some places

halcyon crypt
#

Waterfall, most likely not.

#

For smoke machines you can spawn a smoke grenade and that's about it ๐Ÿ˜›

#

unless you start modding

frozen obsidian
#

I asked for script is it possible to make it :) and ab waterfall couldnt we use same script with few changes ? Something like particle effect which i could place on map

#

Same like ground fog script but instead of covering whole map area make it permanent at small map areas

jade abyss
#

Short: Too many Particles = PerformanceKiller.

frozen obsidian
#

I am aware of it

tough abyss
jade abyss
#

Sadly.. Ponds ๐Ÿ˜ฆ

rotund cypress
#

I have major performance issues on my server. Is this what could cause it ? ```while {true} do
{
if ("ItemRadio" in assignedItems player) then {
player setVariable["comms-seized", false, true];
};
};

little eagle
#

yes

rotund cypress
#

Will a sleep 1; help?

little eagle
#

yes

#

you're currently asking ~1200 times a frame if you have that radio in your inventory

rotund cypress
#

Ah ok

little eagle
#

and even worse

#

you're creating 1200 times a frame that network traffic if you do have it

rotund cypress
#
while {true} do
{
    if ("ItemRadio" in assignedItems player) then {
        player setVariable["comms-seized", false, true];
    };
    sleep 1;
};
little eagle
#

probably red chaining the whole serverr

rotund cypress
#

THat iwll help?

little eagle
#

yeah, but you still do network traffic every second

#

with many players that is very bad

paper rain
rotund cypress
#
while {true} do {
    if (currentChannel isEqualTo 7 || currentChannel isEqualTo 6 || currentChannel isEqualTo 1) then {setCurrentChannel 5}; // -- Set channel to direct
    sleep 1; // -- Sleep 0.1 seconds
};
paper rain
#

and maybe "InventoryClosed" and "InventoryOpened" too

rotund cypress
#

I do it for that aswell

#

and then put and take or inventory events wont work

little eagle
#

well at least setCurrentChannel does not create network traffic

#

but it's stupid

#

just disable the channels

rotund cypress
#

There is ways to get around the disableChannels in description.ext

#

Sometimes it doesnt work

little eagle
#

yeah, you cannot disable the global channel on the server machine

#

and side channel on every machine

#

but your code can be cheated anyway

#

you just have to be quick enough

rotund cypress
#

Yeah

little eagle
#

ask BI to fix disabling side and global channel

#

if (currentChannel in [7,6,1]) then {setCurrentChannel 5};
less awkward

rotund cypress
#

ty

jade abyss
#
while {true} do
{
    if ("ItemRadio" in assignedItems player) then {
    if( (player getVariable "comms-seized"))then
        {
            player setVariable["comms-seized", false, true];
        };
    };
    sleep 1;
};```
@rotund cypress More like that.
rotund cypress
#

But will that really fixed the problems? Isn't it still checking a lot of times?

jade abyss
#

Clientside, every 1s. If its already set -> SetVariable won't be executed.

rotund cypress
#

So the setvariable is the problem with the traffic?

jade abyss
#

As @little eagle mentioned: You would send every 1s that Command over the Network (the "true" in setVariable means "Available for everyone" means sync with every client)

#

With the simple check before it (if its already false or not) -> You don't execute it again and again and again and again and again and again and again and again and again and again

rotund cypress
#

Ok thanks a lot

rancid ruin
#

I'm trying to add multiple ctrls to the map which function like map markers - staying at one spot on the map. This works for a single marker, but what would be the best way to do it for dynamically created ctrls?

#
    findDisplay 12 ctrlCreate ["RscButton",6558];
    findDisplay 12 displayCtrl 6558 ctrlSetPosition [-10, -10, 0.1, 0.1];
    findDisplay 12 displayCtrl 6558 ctrlCommit 0;
    findDisplay 12 displayCtrl 6558 ctrlSetText "player";
    
    findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["draw",{
        _xy = (findDisplay 12 displayCtrl 51) ctrlMapWorldToScreen position player;
        _w = (184 / 1920) * SafeZoneW;
        _h = (34.75 / 1080) * SafeZoneH;
        findDisplay 12 displayCtrl 6558 ctrlSetPosition [_xy select 0, _xy select 1, _w, _h];
        findDisplay 12 displayCtrl 6558 ctrlCommit 0;
    }];```
#

i'll need to use disableSerialization and store the dynamically created variable names somehow right?

jade abyss
#

_Btn1 = ctrlCreate blablubCreatestuff;
_Btn2 = ctrlCreate blablubCreatestuff2;

_Btn1 ctrlSetText "abc";
_Btn2 ctrlSetText "abc2";

?

rancid ruin
#

but then i can't refer to _Btn1 in the ctrlSetEventHandler bit

frozen obsidian
#

@tough abyss cheers for that ๐Ÿ˜‰ will try to remake it to use without the dam and for arma 3 :))

jade abyss
#

@rancid ruin Give it an ID

tough abyss
#

@rancid ruin If you don't know a lot about GUI this is one key thing you should know about it

#

The main part of your "GUI element" is the base class

#

which normally contains an IDD

#

This IDD then has IDCs

#

IDCs are the childclasses that are initialised along with the main parent IDD class

royal coral
#

Hey, Im trying to get a trigger to play a sound i have in my mission file. I can only seem to find online the play sound function witch requires description scripting. Anyway to trigger the sound directly? so on act: Playsound 0, "Soundhere.ogg"

young current
royal coral
#

i saw this... but im not looking to play in 3D, need it to play globaly. And not sure what the config is for pbo directorys.. (sorry, been away from arma for about a year. Feel like a noob)

#

was it like [0, "folder/sound"];

#

or something like that

young current
#

what kind of soud is it? can't you just pack it into addon? would be much simpler

royal coral
#

Ok figured it out. Thanks.

#

any idea why this isnt working? hint "10"; sleep 1; hint "9";

royal coral
#

in a trigger?

#

thanks for the help anyway

thin pine
#

@royal coral 0 = [] spawn { hint "10"; sleep 1; hint "9"; };

#

Triggers require handles when spawned or execVM is used. the 0 acts as the handle

royal coral
#

Thanks man, ill give it a shot

thin pine
#

Also if you plan on counting all the way down, perhaps a loop? Depends on how comfortable you are with scripting though ๐Ÿ˜› 0 = [] spawn { for "_i" from 10 to 1 step -1 do { hint str _i; sleep 1; }; hint "go"; };

royal coral
#

Not very.. not qouite yet. But thanks. I'll look into that too.

thin pine
#

Alright ^^

little eagle
#

Arma is so retarded for requiring the script in init boxes and triggers to report nil, but then does not complain about trying to use a number as variable name.

#

This is one thing I hoped would've been fixed by Eden

tribal crane
#

Numbers as variable names are perfectly valid.

#

๐Ÿ˜‰

lavish hamlet
#

Hi. Im new to Scripting.. and could use some help

Im trying to make a script that will allow a player to collect all gear from a Unconscious/dead player adding "xxx kg" to that player

and giving him an option to drop it again. when that happens it all needs to be stored in one Container (backpack if possible)

The getting part i was wondering if i could use getUnitLoadout and then use RemoveAll xx to clear the body/Unconscious player

Right now i dont have any idea how to get the Stored gear from the array into a box (dosent seem like setUnitLoadout will work on Crates/Backpacks) when the player decides to drop it

Any help is greatly appriciated and please dont just Write the entire code im trying to learn ๐Ÿ˜ƒ

little eagle
#

what you're trying to do will end up in a huge clusterfuck

#

because the inventory system in Arma 3 is still shit

#

especially on the scripting / modding side

#

Certain things are just impossible to get right. filled uniforms/vests/backpacks inside ground weapon holders

#

attachments on weapons

#

magazines on weapons

buoyant heath
#

It's really inconvenient to turn the arma inventory commands into a list that matches the inventory screen, but it's doable.

jade abyss
#

Not rly.

little eagle
#

filled uniforms/vests/backpacks inside ground weapon holders
attachments on weapons
magazines on weapons

#

these are impossible

jade abyss
#

Also: It's not possible to remove SingleItems from a GroundWeaponHolder/Vehicle. This will also end in a pita.

little eagle
#

true. many problems

jade abyss
#

Sadly.

buoyant heath
#

That's one of the biggest headaches, removing stuff

little eagle
#

Another issue with the clearing commands for gwh cargo space is that the gwh is deleted the next frame if you remove all items even if you add new ones

jade abyss
#

0.5s iirc

little eagle
#

you always have to add a safety dummy

#

Last time I tried it was deleted anyway

#

despite unscheduled env, so no time delay

jade abyss
#

Strange

buoyant heath
#

doesn't weaponsItemsCargo return the weapon and its attachments?

jade abyss
#

Still, inventory is a mess.

#

It does, but adding weapons incl. Attachments to it -> Nope.

buoyant heath
#

ah, adding

jade abyss
#

So either you "unbreak"/Deattach everything, that is attached to a Weapon (another Workaround) or you just leave it as it is.

buoyant heath
#

The inventory command names and lack of paired functions is frustrating

jade abyss
#

It is, yeah.

little eagle
#

addUniform: Arguments global
addBackpack: Arguments local
addHeadgear: Arguments global
addWeapon: Arguments local
addMagazine: Arguments local
addMagazine array: Arguments global

jade abyss
#

Even with addWeaponGlobal executed on the Server -> Nope, won't add it to the unit.

little eagle
#

oh yeah. that one is hilarious

#

This command is broken when used on dedicated server

#

thanks a lot

jade abyss
#

Yep.

little eagle
#

If you use addWeapon on a remote unit many times

#

the client that has that unit can end up with multiple primary weapons

#

drop one and you get a new one

#

it's funny

jade abyss
#

"funny"

little eagle
#

hey. it's cool to empty a weapon and throw it away to get a new one instead of reloading

jade abyss
#

Good for a COD-like shooter ๐Ÿ˜„

little eagle
#

The issues with the system keep getting worse in fact

#
Bohemia Interactive Forums

Page 57 of 57 - Scripting Discussion (dev branch) - posted in ARMA 3 - DEVELOPMENT BRANCH: Wrong? Wrong it was removed? I dont think so. Wrong it was duplicating functionality? This is why it was removed. You said: >playerControlled was added and removed because it was duplicating existing functionality. If I remember correctly you could get the same results with cameraOn. But the changelog says: >Arma 3 1.24: New command playerControlled (like the playe...

jade abyss
#

_string select [3] <-- ??? Why []?

little eagle
#

"abcde" select [3]
reports
"de"

#

that syntax is fine

#

but it's "broken" for arrays

jade abyss
#

AH!

little eagle
#

[0,1,2,3,4,5] select [3]
should be
[3,4,5]

#

but it errors

#

you have to write
[0,1,2,3,4,5] select [3, 1E7]

#

which is fugly

jade abyss
#

So you want
_a = [1,2,3,4,5,6];
_b = _a select [3]; //4,5,6 ?

#

Yeah, it is.

little eagle
#

yeah

#

It's really strange that the string syntax "length" parameter default to whatever the end of sting is

#

but the array "count" one needs to be explicit

#

doesn't default, you have to write something

#

fastest is 1E7

#

or any other bigger number

jade abyss
#

Instead of counting the Array, yeah.

#

_a = [1,2,3,4,5,6];
_b = _a select [3,(count(_a)-1)];

#

Oh boy, yeah... thats bs

little eagle
#

minus one technically

#

not plus

jade abyss
#

Misstyped

little eagle
#

that one is slower. just assuming 1E7 is the fastest

#

it's the array size limit we have now

jade abyss
#

Or just use 10000 ๐Ÿ˜„

little eagle
#

same speed and it wouldn't be safe for huge arrays

#

people where very conused about me using _string select [1]. they kept claiming the "length" parameter was required, just because the "count" one for arrays is. both syntaxes came out at about the same time

vague hull
#

well at least they are known... my game keeps crashing when I spawn a function via onLBDblClick ...

#

And it drives me crazy