#arma3_scripting

1 messages ยท Page 341 of 1

little eagle
#

So it's essentially what I wrote.

#

cptnick, I think it's asin z, not atan z.

indigo snow
#

probably

little eagle
#

tan is not with the hypotenuse. And that is 1.

indigo snow
#

yea youre right

little eagle
#

So you'd need two cathetuses (sp?)

indigo snow
#

uhm im not sure how to translate that

little eagle
#

Dunno either.

indigo snow
#

๐Ÿ˜›

little eagle
#

๐Ÿ˜‰

indigo snow
#

so asin(surfaceNormal _pos select 2)

#

... should work out without needing extra brackets right?

little eagle
#

Yes.

indigo snow
#

select always makes me nervous in cases like this

little eagle
#

select is fine. The problem is, that the binary + has a higher precedence than all other binary commands

#

So worry about +, not select.

indigo snow
#

also just reading up a bit, @pulsar anchor , ([0,0,0] vectorDistance _u) wouldt calculate ||_u||, that is, the length of _u. youd need vectorMagnitude

#

or does it

#

not sure, actually

pulsar anchor
#

Seems to be about the same ๐Ÿ˜ƒ

indigo snow
#

ah right its the trivial case

little eagle
#

It's the same, but unnecessarily complicated.

pulsar anchor
#

yes

indigo snow
#

just make a good drawing when dealing with vectors, always

#

makes it like 300 times easier

storm geyser
#

Any freelancing scripters looking for work?

peak plover
storm geyser
#

Mb thanks my dude

tough abyss
#

@little eagle: > select is fine
Noooo!

#

You must use ze magic command!

rotund cypress
#

^ tbh

#

I only ever use select for arrays etc nowadays

#

That came out wrong

#

Selecting by booleans, commands etc

thick sage
#

Need your help here. I am working out some defines to use atomic operations on an object. Currently, I have this

#define READ (if (!isNil "object_all") then {waitUntil {isNil "object_all"}})
#define WRITE (object_all = true)
#define END_WRITE (object_all = nil)

where object_all is only used for this. The way this is used to write

READ;
WRITE;
write, read operation
END_WRITE;

and to read

READ;
read operation

Does this make sense?

peak plover
#

Can you do code liek that with define ? Will that code work outside of .sqf?

still forum
#

I am using these in TFAR

#define MUTEX_INIT(name) name = false
#define MUTEX_LOCK(name) waitUntil {if (!name) exitWith {name = true; true};false;}
#define MUTEX_UNLOCK(name) name = false
#

What do you mean by "outside of .sqf" @peak plover

peak plover
#

description/config.cpp

still forum
#

Can you execute SQF code in a config?

thick sage
#

this is SQF only, so, do not worry about it ๐Ÿ˜›

peak plover
#

No...

still forum
#

Soo.. The answer is?

peak plover
#

...no

#

I see the lack of benefits of define in Golias's case

still forum
#

@thick sage I can recommend using true/false instead of true/nil. Because the check for true might be a little faster (Never checked) and is more readable (which doesn't matter inside a macro)

thick sage
#

@peak plover because it is used tons of times in my code, and I do not need to call a function for each of these.

peak plover
#

Hmm, fair point. I've actually just made a function which is 2 lines and has a 10 line comment

#

Waste of kb, tbh

indigo snow
#

one of which is a params? ๐Ÿ˜›

peak plover
#

๐Ÿ˜„

thick sage
#

@still forum interesting. Well, I do use waitUntil within an if, which might be a bit faster than an if (never checked). But premature optimization in either cases IMO ๐Ÿ˜›

little eagle
#
// lbSetCurSel triggers the LBSelChanged event. Sometimes we don't want that.
// This is a mutex to exit the eventhandler code.
#define LOCK GVAR(lock) = true
#define UNLOCK GVAR(lock) = nil
#define EXIT_LOCKED if (!isNil QGVAR(lock)) exitWith {}

Mine.

still forum
#

That is not a mutex though

little eagle
#

Yeah. It's what I needed for my thing thou

still forum
#

well.. maybe a try_lock only mutex

peak plover
#

How much is macro worth in sqf?

little eagle
#

#350

thick sage
#

in any case, thanks @still forum and @little eagle for your input, much appreciated!

still forum
#

My mutex looks a little weird with the if inside the waituntil. Now that I look at it.

#

But I hade a reason to build it like that some day.

indigo snow
#

probably to also do the assignment?

thick sage
#

another question. Has anyone been able to implement a decorator in SQF. E.g. like in Python where you can just write

@bla 
def get_x()
indigo snow
#

uh i guess not

#

is this about modifying a function?

thick sage
indigo snow
#

that looks way too high level for sqf

little eagle
#

You'd do that with an if ๐Ÿ˜

thick sage
#

not really. For example, say you have the function X, and you want to implement a caching mechanism, where you store its result after the first call. In python, you define a function that sets up how you cache the result, and them use

@cache 
def X():
     ...

cache is a reusable component for every function, and you have not changed the function's code to achive what you wanted. (an example)

indigo snow
#

yea not in sqf

#

you might be able to approximate parts of it in other ways

#

e.g. a global variable that can be computed by a function:

private _myVar = missionNamespace getVariable ["myGlobalVar",call fncThatReturnsMyGlobalVar];```
or something
little eagle
#

This way you would always execute the function.

#

The array is evaluated before the getVariable.

indigo snow
#

ah of course. well some isNil parts after it, then

#

would defeat the whole point really

#

so i think the conclusion is no?

peak plover
#

[_this] params [["_button",true,[true,false]]];

Why does this give me a script error (type array expected bool)

indigo snow
#

what is [_this]

little eagle
#

Looks wrong.

indigo snow
#

also that accepted types array is uh wrong

little eagle
#

Why use false and true as examples for valid types?

indigo snow
#

true and false are both bools

little eagle
#

^

peak plover
#

one's enough? will that conflict?

indigo snow
#

what?

thick sage
#

what you want to do nigel?

#

express it in words

indigo snow
#

it defines allowed my variable types, not allowed values. both true and false are booleans. but that probably wouldnt case the error

peak plover
#

from
onButtonClick = "call menus_fnc_menusClose; false";
to

[_this] params [["_button",true,[true,false]]];
#

There is nothing before the call

still forum
#

@peak plover It want's types. not values

#

true/false are bools with different values

indigo snow
#

why do [_this]

#

itll be [[nil]]

#

and [nil] isnt a boolean, its an array

#

maybe not nil but

peak plover
#

without [_this]
type control expected boolean

little eagle
#

Yes, you expect a boolean. For some reason you wrote two...

#

What are you trying to do?

indigo snow
#

well yea you only allowed boolean types

peak plover
#

I want
onButtonClick = "call menus_fnc_menusClose; false";
toi default to true

little eagle
#

That's a string?

peak plover
#

Yea

#

in a button contorl

indigo snow
#

uh, change the false to true?

peak plover
#

Is that an issue?

little eagle
#

onButtonClick reports a control

#

_this = [_button]

peak plover
#

The attached button action is performed. When returned value is true, button's display remains opened.

#

but I did not _this call menus_fnc_menusClose; false";

little eagle
#

That has nothing to do with param or _this

peak plover
#

_this sneaks it's way into call menus_fnc_menusClose; false";

indigo snow
#

_this will carry over down the scope

#

its not sneaking at all

peak plover
#

aaaaaah

#

That's it

little eagle
#

The unary call does not overwrite the _this variable. It's carried over.

#

It's also not set to private.

peak plover
#

setting it private will help? doesn't that just mean it can't go back?

indigo snow
#

like what do you actually want to do with the params bit?

#

it sounds like you dont want to use _this at all

little eagle
#

[] call blah_fnc_blah

peak plover
#

That's what I was trying to avoid

little eagle
#

Why?

peak plover
#

no idea

#

I'll juse use false/true

little eagle
#
call {
    private "_this";
    call blah_fnc_blah;
};
#

The only alternative I can think of.

peak plover
#

I thought private worked the other way around. It's fine I can use false/true

#

Thanks anyway

little eagle
#

Still doesn't explain [true, false] as expected types. :/

peak plover
#

I figured, [] means array so I just use true,false so they are both included 100%

little eagle
#

That is not how it works.

#

You provide an example of a type

#

false and true are identical

peak plover
#

Yup, I get it now. Type is stolen from 1

#

That's enoguh

tough abyss
#

@little eagle: > false and true are identical

#

Wat.

still forum
#

@little eagle What was that? dialism? diathelism?

peak plover
#

commy2 said Today at 10:23 PM

cosmic kettle
#

that's false cues inception noise

still forum
#

not in this contect

tough abyss
#

Well yeah they're both booleans.

little eagle
#

dialetheism

#
_this = 0;
systemChat str ["A", _this];

_this call {
    _this = 1;
};
systemChat str ["B", _this];

call {
    _this = 2;
};
systemChat str ["C", _this];

call {
    private _this = 3;
};
systemChat str ["D", _this];

0, 0, 2, 2

peak plover
#

what??

tough abyss
#

@peak plover: that was also my reaction at first, but reading through it again - it makes sense.

peak plover
#

It does

little eagle
#

unary call != binary call
essentially

#

And while _this carries over into the scope of the unary call, it is not a magic variable there that is set to private automatically.

thick sage
#

Guys, super interesting issue I am getting:

When I do

X setVariable["a", 1, True]
y = X getVariable["a", []]

sometimes y is different from 1

#

in dedicated

#

has anyone crossed this problem?

indigo snow
#

JIPs?

thick sage
#

yes, and this is server side, called during init.sqf

little eagle
#

What is x?

thick sage
#

a LOGIC object

#

created via (createGroup sideLogic) createUnit ["LOGIC",[0, 0, 0] , [], 0, ""];

still forum
#

what is "y" if it is different?

thick sage
#

[], the default value

#

this is fixed by adding a sleep 0.5 in the middle

indigo snow
#

The object or the setvariable might notve synched over network properly

thick sage
#

notice that code runs on the same machine, the dedicated server

little eagle
#

Repro?

thick sage
#

I will try to provide a minimal code to repdocue the issue. was just to check if this ever happened to anyone.

#

interestingly, I cannot reproduce it with the same code in SP or non-dedicated MP, only in Dedicated.

still forum
#

Ohhh... I see..

#

Maybe it is not being set and it has to first sync back to itself ยฏ_(ใƒ„)_/ยฏ

halcyon crypt
#

could just use a local variable and transmit that instead ๐Ÿ˜›

#

(and reuse after the setVariable)

desert sentinel
#

I want to implement this dynamic blur effect for the spyglass in my mod (and animate it so it slides forward and back as you focus) -- any ideas how this is done? ( i pm'd him at arma forum but he doesnt seem to be active there anymore) https://www.youtube.com/watch?v=gJx0t-cHKTk

halcyon crypt
#

heh that's pretty cool

daring pawn
#

pretty neat

halcyon crypt
coarse olive
#

Question, I'm making a custom game for PvP, I've set up a trigger to set off an alarm after 5 minutes of OPFOR Present, how do I make it say "OPFOR is capturing (location name)" ?

#

same goes for Blufor\

indigo snow
#

Triggers fire their on activation code on all clients, so you can call a functiom from there, check the players side, and display the appropriate message

coarse olive
#

Would it make more sense to make two triggers? Seized by OPFOR, and Seized by BLUFOR?

#

How would I add check player sides and the message to display?

coarse olive
#

Thanks

#

Now just need to figure out how to change the marker colors when a different team takes them

#

if that's even possible

#

question

#

Why is the trigger not counting down 5 minutes?

#

It's set to countdown timer value 5 mins

#

if (side player == west) then ["<t color='#0000ff' size = '.8'>Warning!<br />Stop doing what you are doing</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText; if (side player == east) then ["<t color='#ff0000' size = '.8'>Warning!<br />Red has captured Warehouses</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;

#

I'm also getting element erros

#

do I need to do a line break?

#

woop I should add that to condition

#

or should I put that in on activation?

opaque topaz
robust hollow
#

yea mikero sells through maverick so its safe. u can also get mikero support via the maverick support tickets.

peak plover
#

Selling mods / scripts... HAHAH

#

๐Ÿค

#

When has money ever moved scripts / modding ahead and benefitted the majority? It always causes more issues and trouble...

peak plover
#

Anyway, I cannot find the control for text box (like debug console)

robust hollow
#

as in a text box in general or the one with the auto complete thing?

peak plover
#

Just a normal one

robust hollow
#

well this is the debug console:

        {
            style = 16;
            autocomplete = "scripting";
            shadow = 0;
            font = "EtelkaMonospacePro";
            idc = 12284;
            x = "0.5 *             (            ((safezoneW / safezoneH) min 1.2) / 40)";
            y = "1.7 *             (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
            w = "21 *             (            ((safezoneW / safezoneH) min 1.2) / 40)";
            h = "7 *             (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
            sizeEx = "0.7 *             (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
        };```
is that what u mean?
peak plover
#

Thank you, yeah Edit

#

That makes perfect sense now...

rancid ruin
#

@peak plover, @empty harbor doesn't sell mods and scripts, he sells tools, and i think most people agree they're worth the money

tough abyss
#

@rancid ruin +1 good stuff from him

peak plover
#

maverick applications sells altis life products (scripts)

rancid ruin
#

oh right, yeah i'm not sure how i feel about that

#

but mikero himself is legit

kindred lichen
#

Is it possible to create a module mid mission through scripts? or are modules an editor only thing?

gray sphinx
#

seems like they're editor only, but you can find the functions a module uses with the function viewer, and then call those functions manually to produce similar results

kindred lichen
#

ooooh

#

that might work, thanks man!

gray sphinx
#

np, hope it works out

peak plover
#

@kindred lichen Yes

#

You can create moduels all the time

#

What are you trying to create?

#
    _module = _group createUnit ["ModuleTimeMultiplier_F", [0,0,0],[],0.5,"NONE"];
    _module setVariable ["TimeMultiplier", mission_time_accel];
``` there is probobly a command for whatever you are trying to do. as well there is a command to change time multiplier
rancid ruin
#

modules are units? wut?

peak plover
#

yea

rancid ruin
#

wuuuuuuuuuut

peak plover
#

What did you think? that they are made out of magic ? ๐Ÿ˜„

kindred lichen
#

Well, I'm specifically trying to find a way to allow multiple zombie waypoints for the zombies and demons mod.,

peak plover
#

That would confuse the zombies

kindred lichen
#

currently the zeds go towards the last placed module in the editor.

#

Moving the module via SetPos doesn't seem to affect where they run to.

peak plover
#

Hmm

kindred lichen
#

So, looking at it in the config I think might be my best bet, I'm sure it just sets some kind of global variable on init that tells them where to go when idle, so If I open it up, and look maybe I can re-write that variablee.

peak plover
#
[_zombie, _waypointPos] remoteExecCall ["fnc_RyanZombies_DoMoveLocalized"];
#

They also go and follow units

kindred lichen
#

[WPObject] call RyanZM_fnc_rzfunctionwaypoint

#

Found that too. It'll make it so zombies go to that object by default

#

I'm guessing the waypoint modules are basically just

[this] call RyanZM_fnc_rzfunctionwaypoint;

#

That's exactly what I've been looking for for a LONG time

peak plover
#

Z&D is not designed to work that way

kindred lichen
#

been using this mod for like 3 years now.

#

And I can finally have the zombies "attack" different places during the same mission.

rancid ruin
#

what kind of missions do you make with that mod @kindred lichen ? i was thinking about making a wave defense zombie killing mission like killing floor one day for a laugh

kindred lichen
#

I usually make longer story missions.

rancid ruin
#

are the zombies better than the ones from arma 2 dayz? they were the last ones i experienced

kindred lichen
#

@rancid ruin I just posted in the video channel a video of us playing through one of my zombie missions

rancid ruin
#

cool i will have a look

kindred lichen
#

have a few others on my youtube channel as well

daring pawn
#

Chaps, the following

{side group _x == INDEPENDENT} count (allUnits inAreaArray _mkr) > 0)

works in an IF statement, however, does not in a waitUntil?

indigo snow
#

should work the same

#

assuming all variables are still defined (_mkr)

#

youre also missing a ( at the start in the copy paste above

daring pawn
#

Turns out I forgot to remove a )

#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

#

cheers ๐Ÿ˜›

peak plover
#

I want to return all items of lb(listbox). Is it possible? can't find a command for it

#

I guess I have to create an array and save all items I add there myself

pulsar anchor
#

sigh alright, trying for a long time now:

I want to achieve this:
http://i.imgur.com/Ir0YtOa.png
or in the end
http://www.grabin.at/uploads/tx_imagecycle/November_01.jpg

I got this:

fnc_WineAttach = {
_pos = player modelToWorldVisual offset;
_pos set [2,0];
Obj setposATL _pos;
Obj setVectordir ([(surfaceNormal _pos),90] call BIS_fnc_rotateVector2D);
Obj setVectorup ((surfaceNormal _pos));
};
Obj = createSimpleObject["a3\structures_f_argo\industrial\agriculture\vineyardfence_01_f.p3d",[0,0,0]];

offset = [0,7,0];
["1","onEachFrame",{call fnc_WineAttach}] call BIS_fnc_addStackedEventHandler;

But vectordir and vectorup are influencing each other so the fence pitch bank and dir is not right.
With only one of those commands it works properly.

PS: Yes I know about setVectordirandup, but there is no difference.
PSS: Yes, I also know about missioneventhandler oneachframe ๐Ÿ˜ƒ

indigo snow
#

can you explain a bit more what you actually want? align the vineyard fences along the slope?

pulsar anchor
#

yes

indigo snow
#

so you have solved the setVectorUp (which is surfaceNormal) but you need the vector that points along the slope?

#

(vectorDir)

#

because vectorDir should be (normal x [0,0,1]) x normal, where x is the vector cross product

pulsar anchor
#

Not sure. The problem is the combination of vectorUp and vectorDir. If I only use one of both it works (half).

#

I will try

indigo snow
#
private _vectorUp = surfaceNormal _pos;
private _vectorDir = (_vectorUp vectorCrossProduct [0,0,1]) vectorCrossProduct _vectorUp;
OBJECT setVectorDirAndUp [_vectorDir,_vectorUp];
#

the difficulty is it might sometimes point up the slope, instead of down the slope, so if that matters you need to do some extra checks

#

e.g.

if ((_vectorDir select 2) > 0) then {
    _vectorDir = _vectorDir vectorMultiply -1;
};
pulsar anchor
#

So after testing one roatation around of the vulcano of Tanoa it seems to work ๐Ÿ™ƒ big thanks.

indigo snow
#

np! read up on cross products if you dont understand the magic

still forum
#

Wow. You just answered what I was searching for TFAR for several weeks :D
I wish I had vectors in school..

indigo snow
#

you got vectors i got answers

#

@pulsar anchor you might get some bizzarro behaviour when the terrain is exactly flat, wont happen apart from the VR map tho, i guess

#

the following might be slightly faster if i did my cross products right:

private _vectorUp = surfaceNormal _pos;
_vectorUp params ["_nx","_ny","_nz"];
private _vectorDir = [-_nx*_nz, -_ny*_nz, _ny*_ny - _nx*_nx];
cosmic kettle
#

Hey guys, I'm working on adapting my chess mod to allow players to control the pieces using a hidden dialog, onButtonClick and worldToScreen / modelToWorld to map out the grid on the screen as per @little eagle 's suggestion.
https://youtu.be/-h1JPjRCePI?list=PLmCESSEABUXCf1fBRzGz5jByQobAiNc9W
I'm pretty sure there's probably a mathematical way to figure out in all directions where the user has clicked and thus get the correct square from all angles, that's why I'm asking anyone in here who's better at math than me.
The problem now is that it's all based on switch cases, each one dividing the square into half and thus narrowing down the location, third iteration gets the final square.
Integrating directions into this (comparing e.g. client direction vs chessboard direction) would result in a mess imo.

indigo snow
#

its possible but pretty math heavy

still forum
#

If you can get the on screen coordinates you can use screenToWorld to get the matching world position. Then you could do a lineIntersects to get the coordinates on the surface of the chess board and then deduce the field from that

#

Atleast I think lineIntersectSurfaces returns the relative coordinates of the board.. Might be wrong there

cosmic kettle
#

@indigo snow Yeah, that's what I thought, I'm not reakky that good at it, but if you could even point me in a direction I'd search further.

indigo snow
#

what dedmen said above it a good start to get coordinates w.r.t. the model

cosmic kettle
#

@still forum to use lineIntersectSurfaces, I would have to name all square selections, right?

indigo snow
#

you dont need selections since you get the ASL position of the intersect

#

you can translate those back to model coordinates

#

and go from there

cosmic kettle
#

Hmm, I'll give that a try. It'll surely be better than this mess of cases.

indigo snow
#

if you have the modelspace coordinate, you can move into a 2d system where you ignore the Z coordinate

#

and then its a question of strategically rounding the coordinates to get you results

still forum
#

You could also.. create a camera right above the chess field in the right orientation and move the players view into it

#

then you always have correct alignment

indigo snow
#

i like the 3d ness of it, tho

still forum
#

Well the camera doesn't have to be above

indigo snow
#

its not too hard just a bit of work figuring out the offsets

still forum
#

It just has to always be in the same location relative to the board

cosmic kettle
#

Then I'd still have to use the hacky way to integrate both directions.

indigo snow
#

the only issue is that screenToWorld is bad with sky background but that wouldnt be an issue in this case

cosmic kettle
#
for "_x" from 0 to 8 do {
    _val = _x;
    for "_x" from 0 to 8 do {
        _entry = worldToScreen (_curTarget modelToWorld [(-_cornerVal+(_x*0.123)),(_cornerVal - (_val*0.123)),_heightPos]);
        _positions pushBack _entry;
    };
};
still forum
#

squint

cosmic kettle
#

^Is how I get all positions of each square, and works perfectly.

still forum
#

why is worldToScreen not highlighting as a command ๐Ÿ˜ฎ

#

So you have a working way already... What did you need again?

cosmic kettle
#

This is based on the X/Y map

indigo snow
#

move into the modelspace of the board

cosmic kettle
#

so changing directions changes the X/Y map

#

I'm gonna give the suggestions a try anyway, thanks guys!

indigo snow
#

check out BIS_fnc_getIntersectionsUnderCursor

#

then grab the intersection with the chessboard, grab the ASL coord from that, worldToModel that into the modelspace of the chessboard

#

in the modelspace, just ignore the Z coord and you have correct x,y coords for the board

cosmic kettle
#

Hmm noted, am gonna try it all out anyway ๐Ÿ˜ƒ

indigo snow
#

yea just noting that if you manage to move into the modelspace of the object, you dont have to worry about rotation at all anymore

cosmic kettle
#

What exactly do you mean by that?

indigo snow
#

the modelspace of the objects already corrects for rotation

cosmic kettle
#

Oh, yeah.

indigo snow
#

e.g. imagine the surface of the chessboard is just a XY graph

#

youll get those XY coords

cosmic kettle
#

Like, _positions should be the same every time, that's what you mean?

#

In the above piece of code I mean.

indigo snow
#

maybe, havent looked at the snippet too much

cosmic kettle
#

Because that's the case indeed, the problem is me trying to figure out where the user clicked.

indigo snow
#

with the intersect

#

or the BI function, it uses lineIntersectsSurfaces

cosmic kettle
#

Checking BIS_fnc_getIntersectionsUnderCursor

indigo snow
#
// BIS_fnc_getIntersectionsUnderCursor, Author: Nelson Duarte
params
[
    ["_mouseX", 0.0, [0.0]],
    ["_mouseY", 0.0, [0.0]],
    ["_ignoredObject1", objNull, [objNull]],
    ["_ignoredObject2", objNull, [objNull]],
    ["_sortMode", true, [true]],
    ["_maxResults", 1, [0]],
    ["_primaryLOD", "VIEW", [""]],
    ["_secondaryLOD", "FIRE", [""]]
];

private ["_locationStart", "_locationEnd"];
_locationStart = AGLToASL positionCameraToWorld [0,0,0];
_locationEnd = AGLToASL screenToWorld [_mouseX, _mouseY];

// Do collision test
lineIntersectsSurfaces [_locationStart, _locationEnd, _ignoredObject1, _ignoredObject2, _sortMode, _maxResults];
still forum
#
private ["_locationStart", "_locationEnd"];
_locationStart = AGLToASL positionCameraToWorld [0,0,0];
_locationEnd = AGLToASL screenToWorld [_mouseX, _mouseY];

Ahhh my eyes!! They burn!

peak plover
#

Control setVariable reliable?

indigo snow
#

do you have issues with it?

peak plover
#

I've never used it. Wouldn't the variables go missing once control is closed?

still forum
#

Probably. yes

indigo snow
#

since you generally either create or delete them, sure

peak plover
#

sure

tough abyss
#

@still forum: it's a BIS function, what did you expect?

still forum
#

Perfection! I always expect that

indigo snow
#

its already got pretty params

tough abyss
#

I've learned a long time ago to only expect lazy code from BIS.

indigo snow
#

theres a very good chance this was written months before the keyword was introduced ๐Ÿ˜›

#

possibly years

sand pivot
#

i'm struggling to tune my vehicle's speed curve, is there a function/command to display current gear and/or rpm?

peak plover
#

would remoteExec ["myFunction",player]; cause any traffic (i am player)

#

I want to do remoteExec ["myFnc", _unit], where the unit can be player itself

still forum
#

I'd guess no. But not sure

peak plover
#

if I do remoteExec and the target is server. will clients get any traffic?

still forum
#

I'd guess no. But not sure. Would be really dumb though

peak plover
#

I don't know how remotExec works

#

I assume it adds the info to a packet, but can packets be directed to somone specially. I feel like they will be sent to everyone and then checked if it is for them

indigo snow
#

Not sent to everyone then checked

peak plover
#

can packets be directed to someone special?

tough abyss
#

I can go looking, but does anyone know how BI does the cutscenes where they disable controls but head movement and put the top/bottom borders on? (More interested in the disable stuff, other is easy)

indigo snow
#

You can have a client or object as target, @peak plover

#

@tough abyss, not sure but attachTo maybe?

#

Attach to invisible helper object

tough abyss
#

I'll have to open the campaign missions and see how they do it. I just want them to ride in a helicopter.

#

And not touch any of the buttons ๐Ÿ˜‰

peak plover
#

lock vehicle @tough abyss

tough abyss
#

lol that simplifies it ๐Ÿ˜›

#

Always overthinking things.

peak plover
#

Yeah, I'm just worried that If I do a bunch of remoteExec on all clients when it's unnessesary it's gonna cause network issues

#

I need a function that will remoteExec if not local

indigo snow
#

i mean thats trivial

#

if local _unit then {...} else {...}

peak plover
#

I probably need to function it because there's a lot that will use that

#

Just really wondering if that's worth it. I guess it could help not doing that all the time, and I reckon most of this traffic will be during postInit

#

It might cause problems there as there's plenty of data moving around that time anyway

still forum
#

I'd guess BI was so intelligent to make it so that local remoteExec doesn't go over network

peak plover
#

I've been suprised both ways

simple solstice
#

Hey, anyone having issues with the text in-game being pushed down after the update with chinese language?

indigo snow
#

yes its a bug thatll be fixed

simple solstice
#

Any workarounds for the timebeing?

still forum
#

If you are a modder use a different font

simple solstice
#

Thanks!

peak plover
#

How do I getVariable from local namespace ?

#

*local variabloes

still forum
#

what do you mean by local namespace ? _ variables?

peak plover
#

yea

#

because I want to use a string to retrive the variable name

#

_local getVariable ['_loclvar',true];

#

impossible?

#

I think I can just use missionNamespace instead if it is

indigo snow
#

no you cant

peak plover
#

okay. Hmmm

halcyon crypt
#

could use compile I guess

indigo snow
#

then you have no default value still

peak plover
#

if isNil

indigo snow
#

im more wondering how the hell you might lose your local variables

peak plover
#

But I think it might not work

indigo snow
#

if isNil "_var" then { _var = true}; ?

#

im 100% sure you can just make a better decision somewhere else and not run into this odd problem

peak plover
#

Yeah, I used that before I was blessed with something better

#

sure

indigo snow
#

[_var1, _var2, ...] params [["_var1",true] ,["_var2",true], ...] might be the most elegant way to solve this?

peak plover
#

What would happen if I do name player on the srver?

indigo snow
#

player is nil

peak plover
#

๐Ÿ˜ฆ

indigo snow
#

or objNull

#

that might need a test

peak plover
#

I'll do a condition for if it's a server

#

Thanks

#

crap... new issue

#

nvm

#

i was complicating this remotexec stuff

tardy yacht
#

Anyone have a tutorial or a more advanced documentation on RscControlsGroup? The official one lacks pretty much anything useful.

peak plover
#

I just used them

#

What issues are you having?

jovial nebula
#

Hi, I was taking a look at doFsm wiki page, but I didn't understand how to format the command properly.. I was wondering how could I refer to a custom fsm using a path

halcyon crypt
#

same as everywhere else

#

"x/my_mod/some/path/to/something.fsm"

#

relative probably works as well

jovial nebula
#

Weird,tried that and the fsm hasn't been loaded

tardy yacht
#

From what I understand my controls should be inside the Control's Group. I positioned it at the bottom right of the screen, but my controls haven't moved. They're still in the top left.

peak plover
#

What X and Y are you using for the controls inside the control group?

#
class menus_main_controlGroup: menus_template_group
{
      idc = 4100; // Control identification (without it, the control won't be displayed)

      x = GUI_GRID_X + (20 * GUI_GRID_W);
      y = GUI_GRID_Y + (2 * GUI_GRID_H);
      w = 19  * GUI_GRID_W;
      h = 21  * GUI_GRID_H;

      class controls
      {
        class menus_main_background: menus_template_background
        {
          idc = 4101;
          x = 0 + (0 * GUI_CTRL_W);
          y = 0 + (0 * GUI_CTRL_H);
          w = 18  * GUI_CTRL_W;
          h = 1  * GUI_CTRL_H;
          text = "Mission Menu";
        };
        class menus_main_background2: menus_template_background
        {
          idc = 4102;
          x = 0 + (0 * GUI_CTRL_W);
          y = 0 + (1 * GUI_CTRL_H);
          w = 18  * GUI_CTRL_W;
          h = 20  * GUI_CTRL_H;
          colorBackground[] = {0.3,0.3,0.3,1};
        };
};
tardy yacht
#

0 for both.

peak plover
#

So, you move the control group around and the controls don't follow?

#

How did you create the controls inside the group?

tardy yacht
#

Same way you did, in the controls {} class.

peak plover
#

Can you post your code

jovial nebula
#
sheep = createAgent ["Sheep_Random_F", position player, [], 0, "CAN_COLLIDE"];
sheep setVariable ["BIS_fnc_animalBehaviour_disable", true];
sheep doFSM ["test.fsm", position player, player];

What's wrong in this code? The fsm is not getting executed

still forum
#

doFSM tells the sheep to execute that FSM when it's done with it's current one I think

#

Which will be when it's dead probably

jovial nebula
#

@tough abyss i'm trying to execute moveTo low level command,execfsm is not suitable

tough abyss
#

if I pass an argument (e.g. _this) with remoteExec, how would I address the object in the RC'd script?

peak plover
#

[_this] remoteExec ["myfunc",_target];

indigo snow
#

you almost always would want to do _this remoteExec [...]

peak plover
#
private _unit_menu_items = [_unit,"unit_menu_items",[]] call seed_fnc_getVarsTarget;

I hope this is correct ๐Ÿ˜„

indigo snow
#

its syntactically correct

still forum
#

@tough abyss it will be in _this.

indigo snow
#

What do you mean with reference the object though?

#

The target set by RE?

tough abyss
#

tried sqf _object = _this; if (_object isKindOf "ModuleVehicleRespawnPositionWest_F") then { diag_log "A spawn point was placed!"; //respawn_insert = call Requiem_fnc_spawn_insert; } else { if (_object isKindOf _vehicle) then { diag_log "A vehicle was placed!"; } else { if (_object isKindOf _construction) then { diag_log "A construction was placed!"; }; }; }; nil but nothing appearing so I thought it didn't know what _this was

indigo snow
#

There will be no magic variable for it

#

Whats your remoteExecute line?

#

Replay fast and i wont comment on your indentation

tough abyss
#

_x addEventHandler ["CuratorObjectPlaced", { _this remoteExec ["Requiem_fnc_object_queue_insert", 2]; }];

#

you may comment whatever you wish to comment on

indigo snow
#

_this will be the array the EH provides

#

Its probably an array containing at least the object

tough abyss
#

ah so _object = _this select 0?

indigo snow
#

Look up the EH

#

Itll tell you

#

Also every instance of _this select n is surpassed by the params command

tough abyss
#

curator: object, entity: object

indigo snow
#

So [curatormodule,placedobject]

#

So youd do params ["_curator","_object"];

tough abyss
#

wouldn't the placed object also be an array with information about the object??

#

just for future scripting

indigo snow
#

It says its an object type in the eh description

#

Not an array containing other stuff

#

Besides you can get all that info from the object itself. Location etc

#

Thanks for the confirmation

tough abyss
#

okay so the information of the object can be retrieved from _object. Wouldn't that make it an array of information (technically)?

indigo snow
#

No

#

Its an object-type variable

#

There are commands that accept object-type variables and return information about that object

tough abyss
#

okay if I use getPos _object it'll grab the right object

#

not a similar one somewhere else on the map

indigo snow
#

Itll grab the position of the placed object since thats the one thats inside the variable

tough abyss
#

alright thanks for the confirmation ๐Ÿ˜ƒ

indigo snow
#

You can call it _djjddifodbah as well

#

Yea weve been over that yesterday :P

tough abyss
#

that'd be rather intense for code review ๐Ÿ˜›

indigo snow
#

1 is type Number, 'a' is type String, etc

little eagle
#

The curator module is always local to the same machine the assigned curator is, no?

jovial nebula
#

@still forum so how one can use that command if the underlying fsm is not getting any priority?

indigo snow
#

It should be, commy

#

And Dardo, those commands arent exactly in very common usage, i wouldnt be surprised if theyre mostly unusable.

still forum
#

Dunno Never use FSMs

indigo snow
#

execFSM works for sure

jovial nebula
#

It has been there for almost 10 years lol

#

How it is possible that is broken

indigo snow
#

Not broken, just not very fit for use. E.g. not being able to doFSM a new FSM before the current one ends.

jovial nebula
#

Yeah but using execfsm moveTo command won't work

peak plover
#

fsm does not provide any benefits

#

Other than cool readable flowgraph

still forum
#

fsm is a state machine. @peak plover

#

No it doesn't

indigo snow
#

I mean its for state management, it certainly has its uses

still forum
#

Yes. But no.

indigo snow
#

From what ive read yes and no

jovial nebula
#

it is unscheduled for statements and scheduled for conditions i think

still forum
#

it is executed before scheduled and counts to the 3ms scheduled time

peak plover
#

It should still be scheduled

still forum
#

no it's not @jovial nebula

#

might be the other way around though. Not sure. But I don't think so

peak plover
#

Damn, so if my FSM takes 3ms every frame, other scripts will never run?

still forum
#

I guess so..

#

Someone should try that

#

Though... I guess atleast one script is executed.. for atleast one instruction

indigo snow
#

Spawn lots of ai with danger.fsm active :P

peak plover
#

or you can just Use vcom

little eagle
#

in any case, I'm pretty skeptical of FSM ... SQF works fine for 99% of what people are using FSM for
this

tough abyss
#

I think something in the script is botching it up

indigo snow
#

diag_log everything

tough abyss
#

that's the problem

#

the diag_log isn't appearing

#

what...

peak plover
#

1 sqf loop that handles all the ai is so much better than fsm per ai squad/unit

tough abyss
#

how did that thing disappear

#

never mind

#

I swear to God I fixed that thing yesterday and it worked fine

indigo snow
#

Rip everything out, replace with diag_log, build back up

#

Enable the showscripterrors flag

#

Etc etc

tough abyss
#

if a curator places a respawn module, what module would that be? For intercepting purposes (determining the placed object was a respawn point)

#

I doubt my current tactic will actually work

indigo snow
#

Check the classname somehow

#

diag_log, allUnits, whatever

tough abyss
#

hmmm alright

#
20:40:52 Error in expression <{ params ["_curator","_object"]; };
if (_object isKindOf "ModuleVehicleRespawnPo>
20:40:52   Error position: <_object isKindOf "ModuleVehicleRespawnPo>
20:40:52   Error Undefined variable in expression: _object```
#

with the _object defined as

#

_this call { params ["_curator","_object"]; };

still forum
#

uhm

#

what.

#

please show full code

tough abyss
#
//-------------------------------------- Class names of Vehicles
_vehicles = ["Air", "Armored", "Autonomous", "Car", "Ship", "Static", "Support"];
//-------------------------------------- Class names of Construction
_cup = [];
_signs = ["cwa_signs", "Signs"];
_other = ["Flag", "Fortification", "Furniture", "Garbage", "Helpers", "Intel", "Items", "Lamps", "Market", "MedicalBed", "Military", "Military_With_Side", "Objects", "Objects_Airport", "Objects_Sports", "Objects_VR",
    "Ruins", "Shelters", "Small items", "Structures", "Structures_Airport", "Structures_Commercial", "Structures_Cultural", "Structures_Fences", "Structures_Industrial", "Structures_Infrastructure", "Structures_Military", 
        "Structures_Slums", "Structures_Sports", "Structures_Town", "Structures_Transport", "Structures_Village", "Structures_VR", "Structures_Walls", "Wreck", "Wreck_sub", "Wrecks"];
        
_construction = [_cup, _signs, _other];

_allowedobject = [_vehicles, _construction];

_this call { params ["_curator","_object"]; };
if (_object isKindOf "ModuleVehicleRespawnPositionWest_F") then
    { 
    diag_log "A spawn point was placed!";
    //respawn_insert = call Requiem_fnc_spawn_insert;
    }
else {
        if (_object isKindOf _vehicle) then {
        diag_log "A vehicle was placed!";
        }
        else {
        if (_object isKindOf _construction) then {
        diag_log "A construction was placed!";
        };
        };
};
nil```
still forum
#

DUDE

#

WTF

#

You don't understand what a private variable means. And you have no Idea how params works

tough abyss
#

that's how the example on the wiki put it

still forum
#

nope

#

definetly not

indigo snow
#

Params works inside the curent scope, not like that

peak plover
#
_this call { params ["_curator","_object"]; };
indigo snow
#
_this call {
    params ["_var"];
    You can use _var here
}; 
But not here
peak plover
#

๐Ÿคฆ ๐Ÿ˜‚ ๐Ÿ˜‚

#

Sorry, this is funny. Damn ... yeah, what nick said ๐Ÿ˜„

tough abyss
#

what would it be refererd to then outside the scope?

still forum
#

as nothing

#

because you can't

tough abyss
#

ah

#

okay

still forum
#

just move the params to the outside scope. Isntead of creating one for them

_this call { params ["_curator","_object"]; }; -> params ["_curator","_object"];

indigo snow
#

Youre in too deep a bit man, take a few small steps back

peak plover
#
/* ----------------------------------------------------------------------------
Function: menus_fnc_ctrlHider

Description:
    Toggles the controls on/off
    Force hide/show possible with 2nd element

Parameters:
0:    _display        - Display which contains the contorls
1:    _controls        - Array of control idd-s
Returns:
    nothing
Examples:
    // 4105 will be forced hidden
    [_display,[[4105,true],4106]] call menus_fnc_ctrlHider;

Author:
    nigel
---------------------------------------------------------------------------- */
// Code begins
// Serialization must be disabled because controls / displays are saved as variables
disableSerialization;
_this params ["_display",["_ctrls",[]]];
still forum
#

@peak plover no.

#

params uses _this by default. You don't need to pass it

peak plover
#

correct

indigo snow
#

Saves you 2ms

#

;)

peak plover
#

what about

/* ----------------------------------------------------------------------------
Function: menus_fnc_displayCloser

Description:
    Closes the displays if they are open based on the idd

Parameters:
0:    _displays        - Array of display idd-s
Returns:
    nothing
Examples:
    [303000,304000] call menus_fnc_displayCloser;

Author:
    nigel
---------------------------------------------------------------------------- */
// Code begins
// Serialization must be disabled because controls / displays are saved as variables
disableSerialization;
[_this] params [["_displays",[]]];
dusk sage
#

If that saves 2ms, then something is wrong

still forum
#

2ms is way to low.. I'd say 100 at least.

peak plover
#

it's required becaues default value in this case

still forum
#

depending on how fast of a typer you are

peak plover
#

Nice one!

dusk sage
#

๐Ÿ’ฉ !

peak plover
#

๐Ÿ‘

#

Thanks for shaving 0.002 ms โค

tough abyss
#

10 server FPS increase

peak plover
#

ofcourse!

still forum
#

You actually can't push the server FPS below 50 with scheduled scripts.

peak plover
#

Yes iI can

tough abyss
#

maybe we have ArmA 4 by that time

peak plover
#

I CAN

still forum
#

except if you do unscheduled stuff. Like configClasses call or similear

peak plover
#

lineintersect / nearestTerrainObjects 24/7

still forum
#

@peak plover You need a single call that takes >10ms

#

lineIntersect won't do that. nearestTerrainObject might..

#

@tough abyss The anti scheduled thingy is not because of performance stuffz.

peak plover
#

nearestTerrainObject took me a few seconds on malden with 5k distance. maybe it's faster on servers 'tho

still forum
#

If you need stuff to be executed now instead of in 10 minutes. then you need unscheduled.

#

yep

#

stuffz

#

Also don't wanna get into that debate now

peak plover
#

I feel like they both are good and have their uses

#

I was anti waitUntil before, but I've changed to like while now

still forum
#

You should always choose the right tool for the job.

peak plover
#

Exactly

still forum
#

If you need unscheduled then you do.

peak plover
#

Does it require less power to process or does it run faster?

#

Yes

still forum
#

and true is a script command that get's executed everytime... Which is dumb

peak plover
#

Good point

still forum
#

true/false really should be constants like numbers and strings

peak plover
#

But if I would use _x from 0 to 1 step 0.
I would put an IF in so I could quit if need be

still forum
#

Just make a macro

LOOP {code}

#

Then no one will complain that the for loop looks ugly and takes up more space

peak plover
#

What is LOOP?

still forum
#

as I said.. a macro

dusk sage
#

A macro for the for loop

peak plover
#

define LOOP

still forum
#

yes

#

like that

peak plover
#

@tough abyss , yes but that's same as evaluation while conditoon 'tho

#

Can you define me your LOOP

#

What's inside of it?

still forum
#

dude

#

the same as for the for loop

#

#define LOOP for '_x' from 0 to 1 step 0 do

peak plover
#

oohh

#

I thought it was seomthign else

still forum
#

Or if you prefer while

#define LOOP while {true}

peak plover
#

Intriguing, indeed ๐Ÿค”

#

๐Ÿ˜‚

tough abyss
#

I have a weird issue. I have found all classes and put them in an array to check the type of object using sqf if ({_object isKindOf _x} count _vehicles > 0) then { diag_log "A vehicle was placed!"; }; but for vehicles it does nothing, for buildings it says a vehicle was placed

#
_vehicles = ["Air", "Armored", "Autonomous", "Car", "Ship", "Static", "Support"];```
still forum
#

Try manually into which class your building fits

halcyon crypt
#

sounds more like what's in _object isn't what you're expecting to be there

#

also Armored doesn't sound like a class that exists in CfgVehicles

still forum
#

Change diag_log "A vehicle was placed!"; to diag_log ["A vehicle was placed!",_object];

indigo snow
#

This sounds like the editor categories tbh

rotund cypress
#

Question, which one is faster? count (array select {_x isEqualTo ""}) > 1 or {_x isEqualTo ""} count array > 1

halcyon crypt
#

@still forum since when does diag_log take an array ๐Ÿ˜ฎ

rotund cypress
#

I would assume count array > 1 since that is one less procedure?

#

format

#

or no

still forum
#

diag_log takes ANY

rotund cypress
#

Actually not needed

still forum
#

since ever

dusk sage
#

@halcyon crypt it can take anything

rotund cypress
#

Then it will even be printed if its undefined

dusk sage
#

Woops, didn't scroll down

halcyon crypt
#

jeeezz all that wasted time on typing formats ๐Ÿ˜

still forum
#

@rotund cypress The simpler one

rotund cypress
#

The second one then? @still forum

still forum
#

The simpler and more readable one.

tough abyss
#

@indigo snow I used the CfgVehicleClasses in the config viewer and those came out of it

rotund cypress
#

Which one do you mean?

still forum
#

Judge yourself

rotund cypress
#

The most readable one I would say is count

#

without select

#

But that might just be me

indigo snow
#

@tough abyss yea those arent the right ones

still forum
#

@rotund cypress Trust your inner feelings

rotund cypress
#

However I would think just count on its own is one command and not two commands so would be a faster operation

tough abyss
#

@indigo snow where should I be looking then to identify the objects?

still forum
#

array select also creates a new array and fills it.

#

count doesn't

rotund cypress
#

RPT

indigo snow
#

The baseclasses in cfgVehicles itself @tough abyss

rotund cypress
#

Oh okey

still forum
#

@tough abyss I told you a dozen times.

rotund cypress
#

So count

#

Cheers

still forum
#

Place vehicle in Eden. Right click. View in config browser

rotund cypress
#

Always used to use select without thinking about checking with count only

still forum
#

and check what the base classes are

#

also count was made for exactly that purpose

#

So thinking that using it for exactly what it was made for is a bad thing... Is not that... you know

rotund cypress
#

Well counting an array

#

Which I used in both examples

still forum
#

I mean the "count array" variant

rotund cypress
#

However one was without select and the other werent

still forum
#

well..

#

the one with code.

tough abyss
#

@indigo snow parents: ["RHS_UH1Y_FFAR","RHS_UH1Y","RHS_UH1Y_US_base","RHS_UH1Y_base","RHS_UH1_Base","Heli_light_03_base_F","Helicopter_Base_F","Helicopter","Air","AllVehicles","All"]

still forum
#

Man it's hard to define what command exactly ๐Ÿ˜„

tough abyss
#

which one do I use

rotund cypress
#

๐Ÿ˜‚

tough abyss
#

I just need the difference between buildings and vehicle

rotund cypress
#

check cnonfig browser for its category

indigo snow
#

If thats the only thing you might be better off checking its simulation type property

rotund cypress
#

it might not be the same as armas default vehicle if mod

indigo snow
#

Buildings should all fall under the House class iirc

still forum
#

@tough abyss "Air"

tough abyss
#

well yea that's what I used

still forum
#

Or "AllVehicles" might work too

tough abyss
#

but it said it wasn't known in the _vehicles array

still forum
#

check a building to see what classes it has

tough abyss
#

ah I found why it classifies as vehicle

#

["House_F","House","HouseBase","NonStrategic","Building","Static","All"]

#

whereas I thought "Static" would be static weapons

indigo snow
#

They might be under static, too ;)

tough abyss
#

surprise surprise ["AT_01_base_F","StaticMGWeapon","StaticWeapon","LandVehicle","Land","AllVehicles","All"]

#

for the static AT

still forum
#

Static. as I guessed

#

so you probably can juse use AllVehicles it seems

tough abyss
#

diag_logged all Vehicles, returned any

indigo snow
#

You misunderstood

still forum
#

wat

#

that can't be correct

#

they can't all be nil

#

also not one nil

indigo snow
#

He used it as command, dedmen

still forum
#

there would be multiple

indigo snow
#

Not as config entry

still forum
#

dedmen*

#

I'm sure he didn't do that again. He already did that and I told him that doesn't work.

indigo snow
#

You cant do diag_log allVehicles

tough abyss
#

I didn't xD

indigo snow
#

What then

still forum
#

See! No one can be that dumb

tough abyss
#

will use "Static" for buildings, for now

#

is it possible to insert a line break in a diag_log entry? Forgot the keyword for the kind of text to google it

still forum
#

endl ?

indigo snow
#

diag_log only accepts string like output, so no \n or <br/> afaik

still forum
#

endl.

#

put a endl into the array

indigo snow
#

huh it does

#

neat

tough abyss
#

that's very useful to extensive logging, thanks!

peak plover
#
_old = [["eh","ayy","dude"],["eh","ayy","dude"]];
_new = _old select {_x pushback "lol";true}```

Will my _new have a "lol" in every element now?
still forum
#

yes

#

why don't you just try in debug console ^^

peak plover
#

downloading updates, it does not want to launch ๐Ÿ˜„

#

Thanks

still forum
#

We need a online debug console that can check expressions like that ๐Ÿ˜„

peak plover
#

what about

_old = [["eh","ayy","dude"],["eh","ayy","dude"]];
_new = _old select {_x = ["eh","lol"];true};
#

Ohh yes pls

indigo snow
#

learn to apply

still forum
#

@peak plover no

rotund cypress
#

Tbh, would be very possible @still forum

little eagle
#

apply does what I think you're trying to do.

rotund cypress
#

Would take a bit of time however

still forum
#

because you don't modify a reference. you overwrite the variable

indigo snow
#

The reference is a pointer inside the array tho

#

Ah i understand

#

You create a new copy

#

So it doesnt work

still forum
#

= is overwriting the variable inside _x. You want to modify it instead of overwriting

indigo snow
#

Ye my bad

peak plover
#

_menu_items_current_new = _menu_items select {
    private _item = _x;
    _item params ["_itemName","_function",["_conditions",[{true},{false}]],["_admin",false]];
    _conditions params [["_conditionDisplay",{true}],["_conditionRemove",{false}]];
    // Call so we can exitWith
    call {
        // if condition to remove is true exitWith
        if (call _conditionRemove) exitWith {
            // If item is a mission item, remove it from mission items
            if (_item in _mission_menu_items) then {
                [[_itemName],[""]] call menus_fnc_removeItem;
            };
            // If item is player item remove it from player items
            if (_item in _unit_menu_items) then {
                [[_itemName],[player]] call menus_fnc_removeItem;
            };
            // exitWith false so it's not added back to the list
            false
        };
        // if displaying condition is true
        if (call _conditionDisplay) then {
            // Check if item is already in item list (displayed) and exit if so
            if (_item in _menu_items_current) exitWith {

                true
            };
            // If _admin is true select adminlist, else mission list
            private _addToList = [_list,_adminList] select _admin;
            // Add the item to the chosen list
            private _index = _addToList lbAdd _itemName;
            // Set the data (function for dialog) for the item we just added
            _addToList lbSetData [_index, _function];
            _x pushback

        } else { // if we are not to display the item
            // if item is not currently displayed exitwith false so it's not added to the list
            if !(_item in _menu_items_current) exitWith {false};
            // Remove item from list
            _control lbDelete 
        };
    };
};
missionNamespace setVariable ["menu_items_current",_menu_items_current_new];
#

I'm stuck on what to return for _menu_items_current_new. it should be something along the lines of [["_itemName",_index]];

#

Apply looks nice

#

resize โค

vital onyx
#

hey all

#

does someone knows is there is kind of garbage collector for unreferenced arrays?

still forum
#

it is deleted as soon as the last reference is lost

vital onyx
#

nice, thanks

#

ok, its time to push some new releases)

#

have not launched arma for almost 6 months

peak plover
#

Will there need to be a thing such as garbage collacter for scripts/variables/arrays?

little eagle
#

No.

peak plover
#

That's what I thought...

#

I ended up using resize 1 and pushback

#

        private _existsArray = _menu_items_current select {(_x select 0) isEqualTo _itemName};
        private _itemExists = [false,true] select (_exists isEqualTo []);
#

I feel like this is wrong 'tho

little eagle
#

This line:

private _itemExists = [false,true] select (_exists isEqualTo []);

could be written as:

private _itemExists = _exists isEqualTo [];
peak plover
#

๐Ÿ‘Œ

#

thaks

tame portal
#

Just realized it basically says if you're true, return true ๐Ÿ˜„

peak plover
#

overthinking that one there

little eagle
#

Yeah. It's a rare form of that oh so common. if () then {true} else {false}.

coarse olive
#

I'm trying to script a trigger to countdown 5 minutes, activate saying "(East/West) has captured (Zone)"

#

I've gotten this far

#

if (side player == west) then ["<t color='#0000ff' size = '.8'>Warning!<br />Blue Team has captured Warehouses</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;
if (side player == east) then ["<t color='#ff0000' size = '.8'>Warning!<br />Red has captured Warehouses</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;

#

Do I put this in activation or Condition?

coarse olive
#

well better yet because i realized theres a fuckin sector control module, how do I make blufor AI pop up and defend the zone?

#

And also add a respawn position to it

subtle ore
#

there is an aI module in the same editor category as the sector module

coarse olive
#

Ok

#

cause I'm doing show / hide object modify

#

what category was it?

#

Theres only sector, sector dummy, respawn position, vehicle position

subtle ore
#

actually

#

other - > Spawn AI : Sector Tactic

#

don't sync it, it'll automatically index the AI and have them attack the sectors

coarse olive
#

ah thanks

#

Is there a way of setting custom spawns to it?

#

I'm making an Arma 3 version of halo warzone, so when the zone gets captured by Blue team, blue marines spawn, etc for Red team

subtle ore
#

Ah cool. Yes your Spawn AI module does just that

coarse olive
#

Theres no options to edit on there

#

hm

subtle ore
#

You can select the faction

coarse olive
#

What I was attempting with the show / hide was the blue team guys show when BLUFOR capture

#

but that didn't work out

subtle ore
#

hiding the sector or the units? I don't think show / hide would work with units but I could be wrong

coarse olive
#

Theres also no faction for the unit's I'm using, well they're made with OPTRE units arsenaled with their respective gear

subtle ore
#

I recommend you spawn them in script. the ai module for sector control will still work

#

bis_fnc_spawnGroup works vey nicely with such

#

you can set the direction, skill range, rank range, etc.

coarse olive
#

Let's see how much I fuck that up lol.

subtle ore
#

There are plenty of these AI spawn scripts

coarse olive
#

where do I put that script?

#

The expression box in the spawn AI?

subtle ore
#

Oh no, definitely not.

coarse olive
#

Ok

subtle ore
#

are you familiar with making sqf files?

coarse olive
#

Basically I want Blue team to spawn with blue team, red team with red team, and yes I am

subtle ore
#

Easy enough, just grab a respawn markers position where you want it, and based on respawn tickets you can do something like this:

if(count ([west] call bis_fnc_respawnTickets) > 0) then {
    for "X" from 0 to random 10 do {{_x doMove (getPos sector_1);} forEach units([getMarkerPos "respawn_west",WEST,5] call bis_fnc_spawnGroup; };
};
#

Not sure if that works or not

#

but it's worth a shot

coarse olive
#

Ok

subtle ore
#

And there are group definitions for OPTRE

#

configFile >> "CfgGroups"

coarse olive
#

I wouldn't want to use the ticket system

#

only reason why is because the AI are there just to guard

#

so if it's a 2 v 2 fight, theres AI to fight back and defend a capture position

subtle ore
#

well the sector ai module will always be on the offensive.

#

Unless scripted manually

coarse olive
#

Ok

#

I won't worry about the independent AI that get tossed into the arena yet

subtle ore
#

It's kind of cool to see the three factions fight it out

coarse olive
#

where in that script do I put the cfgGroups

#

Well this is the goal: Independent control the areas first

subtle ore
#

the CfgGroups contains config entries. I was reffering to the usage of bis_fnc_spawnGroup with it

coarse olive
#

I didn't set tickets because I want game match to be all sectors controlled

#

either blue team or red team capture once green team is taken out

#

then the respective AI take over to defend against the opposite team

subtle ore
#

So a one time capture?

coarse olive
#

yeah

#

It's set in Limni marshlands

subtle ore
#

That's easily done, just destroy the module when you're done with it

coarse olive
#

so it's a pretty big area

subtle ore
#

indeed

coarse olive
#

lol cfgGroups isn't in the config viewer. Tolda ya I'd fuck it up quick

subtle ore
#

Yes it is....?

coarse olive
#

however I got this

#

OPCAN_WZ_R as the AI name

subtle ore
coarse olive
#

Ah got it

subtle ore
#

that's a CfgVehicles entry. The CfgGroups covers a certain squad size and unit collection

coarse olive
#

Could I create my own cfgGroup?

subtle ore
#

unless of course you're manually creating these units and adding them to a group, which seems a little redundant if you are going to have a similarly sized squad as it is

#

CfgGroups are all config entries

#

to create a group however

#

createGroup

#

createGroup east; createGroup west; etc.

coarse olive
#

Ok lets go find this!

#

welp

#

Theres no CFGgroup for the Warzone red or Warzone Blue guys

subtle ore
#

doesn't have to be

#

the units still exist

coarse olive
#

I can't find the createGroup area. Least I'm learning how to do so

subtle ore
#

createGroup is a command

#

not a module

coarse olive
#

Ok, where do I put that command?

#

I got the name for the independents at least, they aren't a arsenaled unit

subtle ore
#

In a sqf file? A script?

#

Assign it to a variable

coarse olive
#

oh ok

#

So put in the sqf file

#

Creategroup east; (Group name)

subtle ore
#
_group = createGroup west;

#
MyHaloDude joinSilent _group
coarse olive
#

ok

subtle ore
#

Incorrect syntax hold on

coarse olive
#

Blue_group = createGroup west;

subtle ore
#

[myHaloDude] joinSilent _group

coarse olive
#

Ok so it's Blue_group now, how do I designate the AI to be Blue)group

subtle ore
#

Look above

#

Command only accepts arrays

coarse olive
#

[dirtyblues] joinBlue_group = createGroup west;

#

That's in the Sqf

#

What do I put in the inits of the AI?

subtle ore
#

Here. Letme construct a working example for you here.

coarse olive
#

ok

subtle ore
#
params["_unit"];
[_unit] joinSilent (createGroup(side _unit));
#

Then in the units init

#
[this] call compile "yourScriptName.sqf"
coarse olive
#

ok

#

I got the top one in the sqf

#

the bottom one is going into the units Init now

#

the _unit will be the group name yes?

#

well the otherside of the _unit

#

like DirtyBlues_unit

subtle ore
#

Nope, _unit references the passed unit in the script when it is called

coarse olive
#

ok

#

Now to make them spawn out I'd have to use the spawn AI correct?

subtle ore
#

Hence when you pass the unit in the units init with the this reference in [this] call compile "script.sqf"

coarse olive
#

ok

subtle ore
#

In the spawn ai module they are automatically assigned groups

#

Not sure which method you are trying to use here

coarse olive
#

ok

#

I got this going:

#

SpawnAI : Spawnpoint

#

SpawnAI : Sector Tactic

#

and a Spawn AI

#

How would I make that new group spawn when BLUFOR capture the area

subtle ore
#

@coarse olive you can get the side from a sector and check when the side capture changes. Sector getVariable "owner"

coarse olive
#

ok

coarse olive
#

I'll tackle it tomorrow with a clear head. I got mixed up with everything

#

thanks though!

still forum
#

@peak plover I say that everything is deleted once the last reference is lost as a reply to "is there some kind of garbage collector". And the next message after that is you asking if we need a garbage collector..

little eagle
#

It's

call compile preprocessFileLineNumbers "script.sqf"

You missed the preprocessFileLineNumbers.

still forum
#

or could just use execVM

subtle ore
#

@still forum ๐Ÿ˜‚

#

@little eagle Welp.

little eagle
#

;^)

tough abyss
#

slight surprise here, the even handler CuratorObjectPlaced passes a curator and entity perfectly fine, but the CuratorObjectDeleted passes <NULL-object>

#

for the entity

still forum
#

On the server?

tough abyss
#

yea

still forum
#

It doesn't

#

It passes the object. But when the message arrives it was already deleted

tough abyss
#

ah shit.. any way to save the object somewhere so it can be used even after it's been deleted?

still forum
#

no

#

you can extract the data you need and send that over instead

tough abyss
#

which would need to be client side

still forum
#

yes

#

you could also try the "Deleted" eventhandler on server

tough abyss
#

hmm that would require the event handler to be assigned to the object when it is created, if I am reading this correctly

indigo snow
#

some time after creation and before getting deleted

tough abyss
#

would this succeed in that? sqf { _x addEventHandler ["CuratorObjectPlaced", { _this remoteExec ["Requiem_fnc_object_queue_insert", 2]; _this addEventHandler ["Deleted", { _this remoteExec ["Requiem_fnc_object_queue_delete", 2]; }];};]; _x addEventHandler ["CuratorObjectEdited", { _this remoteExec ["Requiem_fnc_object_queue_update", 2]; }]; _x addEventHandler ["CuratorMarkerPlaced", { _this remoteExec ["Requiem_fnc_marker_queue_insert", 2]; _this addEventHandler ["Deleted", { _this remoteExec ["Requiem_fnc_marker_queue_delete", 2]; }];};]; _x addEventHandler ["CuratorMarkerEdited", { _this remoteExec ["Requiem_fnc_marker_queue_update", 2]; }]; } forEach AllCurators; diag_log "Curators initiated";

#

(in init.sqf)

still forum
#

Dude

#

Did you miss what we were trying to solve?

#

The problem was that after the CuratorObjectDeleted eventhandler remoteExecs on the server, the object was already deleted. So your solution is to
Add the Deleted eventhandler that when it remoteExecs on the server, the object was already deleted.

tough abyss
#

doesn't it do that just before the object is deleted?

still forum
#

You apparently didn't understand the problem

#

CuratorObjectDeleted also executes before the object is deleted

tough abyss
#

hmm okay thanks

#

so I could add to the curator event handler a client side script to grab the data and then send that to server? IIRC Exile has no data acquisition situated on the client mod?

still forum
#

Or you register the Deleted eventhandler on the server. As I recommended before

#

And yes you could also grab the data clientside and send it to the server. Which I also recommended

tough abyss
#

the deleted event handler would work server side? IIRC the curator version already didn't fire server side

#

but I'll see if it works out ๐Ÿ˜„

indigo snow
#

have you checked the wiki? it tells you

still forum
#

It is something completly different.

tough abyss
#

okay so as global, it can be deleted client and handler fired server. How would one add the event handler to the specific object or write a script that adds it to every object in the mission?

still forum
#

throws ๐Ÿช around the room

#

@tough abyss You already have a script get executed as soon as a object is placed

tough abyss
#

that is only client

#

so then if I apply an event handler that fires global

still forum
#

No it's not

#

remoteExec to the server is not "only client"

tough abyss
#

the event handler I meant, not remoteExec

still forum
#

I said "You already have a script get executed as soon as a object is placed"

tough abyss
#

and in there I should apply the event handler?

still forum
#

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

tough abyss
#

How does one do that stick figure? (mobile)

still forum
#

./shrug

tough abyss
#

Oeehhhh thanks

tough abyss
#

so in that insert EH I extract the object. To that object I assign the event handler. Do I use call for the delete script or paste the delete script code into the event handler scope??

#

(currently trying out a call)

#

which.... didn't work

#

tried direct with code

params ["_curator","_object"];

//-------------------------------------- Assign deletion event handler

_object addEventHandler ["Deleted", { diag_log ["Object was deleted: ", _object]; }];```
with results ```sqf
14:00:44 ["The vehicle ",25159a6a040# 638423: cup_m270.p3d,"was placed!"]
14:00:45 ["Object was deleted: ",any]```
#

so the object was already deleted when executing the code

#

or doesn't know what the object was

still forum
#

w00t.

tough abyss
#

must be confusing something

still forum
#

inside the eventhandler it should still exist... The eventhandler fires just before object was deleted.. atleast it should

tough abyss
#

yea that's what I thought

indigo snow
#

the local var doesnt exist tho

#

_object

tough abyss
#

but _object is not null either

indigo snow
#

you need to extract that from the passed _this first

tough abyss
#

params does that, doesn't it?

indigo snow
#

i see no params inside the EH code

#

that has a separate scope, like youd use spawn

tough abyss
#

oooh inside the EH okay

indigo snow
#

yea that code executes in its own separate scope

tough abyss
#

now would it possible to call a functio before the _object is deleted? Instead of full code inside an event handler scope

indigo snow
#

you can call a function from inside there?

#

EHs are unscheduled so you have as long as youd like

tough abyss
#

okay must've done something wrong in the function itself then

indigo snow
#

just wacth out with things that execute scheduled or are remoteExecuted

tough abyss
#

not using RC, as it's all happening server anyway ๐Ÿ˜ƒ

#
_object addEventHandler ["Deleted", { params ["_curator","_object"]; diag_log ["Object was deleted: ", _object]; }];```

still yields ```sqf
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]
14:13:39 ["Object was deleted: ",any]```
#

or use it as sqf _this call { params ["_curator","_object"]; };

still forum
#

DUDE

#

READ

#

Why would _this inside a Deleted eh contain a _curator ?

#

Right. No reason and it doesn't.

tough abyss
#

eh yea forgot it's not curator related

still forum
#

I'm hungry

tough abyss
#

hahaha

#

get some food then

tough abyss
#

You're not you when you're hungry.

subtle ore
#

@still forum want a cookie? ๐Ÿช

#

@tough abyss have a snickers

still forum
#

nibbles on the cookie

warm gorge
#

Any idea why after I hide a control (such as a listbox) with ctrlEnable and ctrlShow, and then re-enable it, I cant click on the lists anymore as though its still disabled?

#

^ to add on to this, RscEdit seems to work fine again but the list boxes and structured text with controls group doesnt work

subtle ore
#

Is this your control or someone else's? Im pretty sure unless the command is broken or you are using incorrect syntax everything should be fine.

warm gorge
#

@subtle ore Its my own. Basically ive got a few buttons at the top, which can be used to switch between different menus. And im using a method of just hiding and disabling controls to show different ones, but this is the issue im having.

#

This is how i'm re-enabling them:

#
    private _toShow = [1501,1502,1401,1100,1101,2300,2301,1801,1802,1803,1804];

    {
        private _control = _dialog displayCtrl _x;
        _control ctrlEnable true;
        _control ctrlShow true;
    } forEach _toShow;
subtle ore
#

Is _dialog defined?

warm gorge
#

Yes. It makes the controls visible completely fine. Like the visibility stuff works fine, the only issue is I cant actually interact with some of the controls

subtle ore
#

Which makes me wonder if they are ever re enabled in the first place

warm gorge
#

They definitely are. I can show the full code if it makes it easier to spot the issue

subtle ore
#

If you feel it is necessary, sure.

warm gorge
#

This script is called when these top buttons are clicked. Currently it just has 2 buttons, one to show the main menu controls, the other for the logs control.

#

@subtle ore Found the issue. Turns out it was the RscFrames I had around the other controls that was causing issue. Sounds like some sort of focus issue. I guess ill have to remove the frames, even know I wanted frames around the list boxes ๐Ÿ˜ฆ

limpid pewter
#

hi, i was wondering if anyone could help me with an issue im having with object placement. Im making a multiplayer mission where i want players to be able to place charges down and then later using an action, blow it up.
Currently i am using remoteExec to run this on the server ```sqf
_index = _c4 pushBack ("DemoCharge_Remote_Ammo_Scripted" createVehicle _objPos);
(_c4 select _index) setPosASL _objPos;

digital pulsar
#

why remoteExec createVehicle and setPosASL?

#

do all that on the server and then if you need others to access the array, use publicVariable

warm gorge
#

Yeah, createVehicle is global, and setPosASL has a global effect too

limpid pewter
#

ok, so the player needs to call the function because i want it so they have control over when it is placed.

#

yeah, that wat i thought ranger, but for some reason, it works for one person yet the charge is in a complety different affect for everyone else

warm gorge
#

Well id start off by not remoteExecuting it, and see if you still have the issue, let us know if you do

limpid pewter
#

that's the way i had it initally, but then i thought maybe running it on the server may help

#

pretty much i had the same code, but run locally on the client pc

warm gorge
#

That should be all you need to do, run it locally on the client

spice kayak
#

Hey all, is there any way to hide a task's destination? Say I have it so the task shows up when you're within 1km of the objective. How would I get it to disappear when you're outside of the 1km? Obviously I'd use a trigger for that, but I'm not sure on the task destination removal thing.

limpid pewter
#

@warm gorge ok ranger thanks, maybe it is an issue with position formating then (ASL to ATL or whatever)

warm gorge
#

What format is _objPos?

limpid pewter
#

ASL as far is i know

#

but i need to dooobly check it

digital pulsar
subtle ore
#

That would just disable the fading

warm gorge
#

@limpid pewter When working with positions and making them work nicely over water and land, I like to use ASLToATL so like

_vehicle setPosATL (ASLToATL (getPosASL player));
``` for example
limpid pewter
#

yeah maybe, i shall try. But i still don't understand why i works fine for the person who placed it, but for everyone else it is floating like 5 meters in the air :\

#

Trial and Error i guess ๐Ÿ˜›

warm gorge
#

Not sure, id also create the vehicle at [0,0,0] and then set its position rather than both. Faster if you spawn it at [0,0,0] as if you dont it does all this funky positioning stuff

#
_index = _c4 pushBack ("DemoCharge_Remote_Ammo_Scripted" createVehicle [0,0,0]);
(_c4 select _index) setPosASL _objPos;
limpid pewter
#

ahh awesome, great tip

spice kayak
#

Sorry, @digital pulsar - I had figured out my issue, but got stuck into another one - thanks though!

#

Got it!

tardy yacht
#

I see the onLBDblClick event returns the IDC and Data of the double clicked entry. I'm trying to create a dialog on double click and call a script that'll update the list in said dialog. How can I send the return of the onLBDblClick to my next dialog?

#
onLBDblClick = { createDialog ""phone_messages"" };
#

"phone_messages" needs to somehow receive the return of onLBDblClick.

cold pebble
#

Pretty sure a dialog alone can't take the return

little eagle
#

Is this config? Why the curly brackets? Looks suspiciously wrong.

tardy yacht
#

Yeah that's in a HPP. When I create my new dialog (without using closeDialog on the previous one) can I still access the data in a list that was in the first dialog even if I can't see it?

little eagle
#

It's wrong whether or not it's used in a hpp.

spice kayak
#

So, sadly I've hit a wall again, with an issue that I really don't think should be an issue.

#

Anyone mind if I put the multi-lined code here? I'm just having issues getting a Task Destination Module to go somewhere via an sqf file, but it just isn't, no matter what I try.

rancid ruin
#

go ahead man, nobody minds

#

in fact someone may even help you fix it

spice kayak
#

Well, I hope so!

#
    while{alive vSmuggleTruck1} do {
        if (triggerActivated trkSmuggleTruck1) then {
            systemchat "Something!";
            modTrack1Pos setPos (getPos vSmuggleTruck1); //This is not working
            vTrack1 = "Detected!";
        } else {
            systemChat "Nothing!";
            vTrack1 = "Not Detected!";
        };
        sleep 60;
        vTrackTimer = 60;
    };
};```