#arma3_scripting

1 messages · Page 432 of 1

round blade
#

has anyone made a good guide for scripting from the context of adding scripts to addons with eventHandlers and the like?

still forum
#

guides for scripting exist yeah

#

"context of adding scripts to addons with eventhandlers" .. what?

#

CfgFunctions. Add eventhandlers at postInit.

round blade
#

Right, I appreciate that my question lacked clarity, but just throwing out words is not useful or encouraging. What I'm looking for is if anyone's made a guide that has some detail to the process you just described, ideally with some examples

still forum
#

That's what I gave you

#

CfgFunctions That's how you add scripts in addons and have them execute automatically at preInit or postInit. Google these. You'll find guides and examples.

spring dune
#

@still forum Thanks.

lusty canyon
#

i want to suspend a script for a bit


    _waitAfterInit = time + 30;
    waitUntil 
{
if ( (time > _waitAfterInit) AND (alive player) ) 
exitWith {true}; 
false
};
    hint str "30s elapsed";

i tried it on the debug console localexec but it wont wait at all, i tried adding uisleep 3000 sleep 3000 still nothing

lone glade
#

... thefuck

meager heart
#

⚆ _ ⚆

cyan pewter
#

What is createTeam supposed to do?

meager heart
#

@lusty canyon try this in the console...

0 spawn {
    _waitAfterInit = time + 30;
    waitUntil {
        sleep 1;
        (alive player) && 
        (time > _waitAfterInit)
    };
    hint "30s elapsed";
};
lusty canyon
#

@meager heart that worked, is this because debug console is unscheduled env?

lone glade
#

no

#

it's because you're missing a bracket

meager heart
#

^

lusty canyon
#

oh how shameful (i even had syntax highlights on)

#

but if the timer is in a spawn how do i suspend my actual respawn EH?

lone glade
#

wat

#

you... don't?

lusty canyon
#

well i do want to suspend code, but nvm i got it working

velvet merlin
#

is there a point in caching (in sqf land) (large or non large) arrays defined in config space?

still forum
#

yes

lone glade
#

@velvet merlin yes

#

config lookups are expensive

velvet merlin
#

thanks. at what point would you draw the line - read more than once?

still forum
#

yes

#

once or twice is okey

#

as long as you can still definetly count it. It's probably fine

#

If you have a loop that reads the same entry up to infinite times... Then cache

velvet merlin
#

cheers

#

use breaks defines/macros it seems

https://forums.bohemia.net/forums/topic/143930-general-discussion-dev-branch/?page=949&tab=comments#comment-3273639

lone glade
#

wow, who would've thought....

still forum
lone glade
#

I SAID IT BEFORE YOU

still forum
#

Can't find it raises fists

cedar kindle
#

imo just get rid of it

#

useless

#

we already have param

modern sand
#

Does anyone know how to get the selected player from a list box and then use that information to execute scripts with? so like _selectedPlayer = current selected player

#

So I can then do like _selectedPlayer getVariable "Variable";

still forum
#

You cannot select players in a list box

#

list boxes display text.

#

If you have the players name you could do something like
allPlayers param[(allPlayers apply {name _x}) find _theSelectedNameAsString, objNull]

modern sand
#

Well I'm currently using this to load all the players names into a list box (Found it online) SQF _Selected_Players = []; { _index = lbAdd [24, name _x]]; lbSetData [24, _index, _forEachIndex]; _Selected_Players pushBack _x; } forEach allPlayers; I assume there is a way to grab the current list box selection, and link to it a user in the _Selected_Players array?

still forum
#

So yeah. You have name

#

Oh yeah..

#

If you can get the index of the listbox entry then you can _selected_players select _selectedIndex

modern sand
#

Uhhh not entirely sure how I would do that. I just found this _player = _Selected_Players select (lbData [24, (lbCurSel 24)]); Do you reckon that would work?

#

nvm it comes back with Error Generic error in expression

cyan pewter
#

im trying to make ai split into smaller teams at the group level

#

doStop and doFollow didnt seem to do anything

unborn ether
#

@modern sand Why not lbSetData the UID of a player and use lbData when selected?

still forum
#

@cyan pewter They are not what you think they are. They were something BI started to implement but never finished.

#

Basically useless commands

lone glade
#

weeeeeell, for numbers they work

cyan pewter
#

hmm... i though they looked incomplete. any clever ideas on how to do this?

little eagle
#

Re:

0 spawn {
    _waitAfterInit = time + 30;
    waitUntil {
        sleep 1;
        (alive player) && 
        (time > _waitAfterInit)
    };
    hint "30s elapsed";
};

Different idea:

0 spawn {
    private _wait30 = 0 spawn {sleep 30};
    waitUntil {scriptDone _wait30 || alive player};
    hint "30s elapsed and player lives";
};
still forum
#

tries to find a throwable stone

little eagle
#

Why?

lone glade
#

BURN THE HERETIC

still forum
#

It's actually good code.. But...

lone glade
#

0 spawn {

still forum
#

throws stone

lone glade
#

BURRRRN

little eagle
#

I mean. It takes getting used to, but it's so much nicer to work with.

lone glade
#

we've lost him, ded, start CPR

little eagle
#

The || should be a &&.

fossil yew
#

is there an arma/cba event on mission end?

severe solstice
#

how does "do while" affect the performance

little eagle
#

Negatively?

severe solstice
#

ye

lone glade
#

like every loop ever, just on different levels 😄

still forum
#

"do while" doesn't.. As it doesn't exist

#

@fossil yew yes. MissionEnded XEH

severe solstice
#
case 2:     
                { 
                    _lootHolder addWeaponCargoGlobal [_itemClassName, 1]; 
                    if !(_itemClassName isKindOf ["Exile_Melee_Abstract", configFile >> "CfgWeapons"]) then
                    {
                        _magazineClassNames = getArray(configFile >> "CfgWeapons" >> _itemClassName >> "magazines");
                        if (count(_magazineClassNames) > 0) then
                        {
                            // Start Removal of BetaC Mags
                            _removeBetaCMags = ["CUP_100Rnd_556x45_BetaCMag","CUP_100Rnd_TE1_Red_Tracer_556x45_BetaCMag","CUP_100Rnd_TE1_Green_Tracer_556x45_BetaCMag","CUP_100Rnd_TE1_Yellow_Tracer_556x45_BetaCMag"];
                            { _magazineClassNames = _magazineClassNames - [_x]; } forEach _removeBetaCMags;
                            // End Removal of BetaC Mags
                            _magazineClassName = selectRandom _magazineClassNames;
                             // Start Spawn Less Ammo
                            _numberOfMagazines = 1 + floor(random 2);
                             // End Spawn Less Ammo
                            _lootHolder addMagazineCargoGlobal [_magazineClassName, _numberOfMagazines];
                            _spawnedItemClassNames pushBack _magazineClassName;
                        };
                    }; 
fossil yew
#

thanks guys

still forum
#

I found the normal arma eventhandler to be extremly unreliable

little eagle
#

True, but it exists.

lone glade
#

because it's unreliable as fuck

still forum
lone glade
#

same for ending the mission "manually"

little eagle
#

Otherwise idk if there is a way to know a mission ended and execute code thereafter.

lone glade
#

it's very inconsistent

fossil yew
#

works sometimes?

still forum
#

Depends on how the mission ends

severe solstice
#

do while doesnt exist?

little eagle
#

Dedmen, the mission display is not always unloaded if the mission ends. E.g. loading a safegame.

#

while do does exist

#

do while doesn't.

still forum
#

do whole Doesn't exist no. do while also doesn't. while do does.

little eagle
#

ha!

lone glade
#

reminds me of that issue I never fixed with ACE Arsenal, the display is a child of display 46 (mission) but SOMEHOW someone was still playing a "previous" mission and still in arsenal while the mission restarted

fossil yew
#

uh

still forum
#

@lone glade Same thought as I found TFAR PFH's running after mission end AFTER leaving the server..

little eagle
#

savegame, not safegame. I'm still tired.

lone glade
#

no reports, means no repro hehehehehehhe

little eagle
#

I have the same issue with my lobby script. Local hosted only though. If the host ends the mission, the client still in the lobby doesn't leave the mission.

severe solstice
#

how does it affect the server performance deadmen

little eagle
#

Because it's a display on the mission display.

severe solstice
#

is it ok to use

still forum
#

deadmen? Who is that guy?

severe solstice
#

😃

#

u

fossil yew
#

interesting there is loaded event but no saved

still forum
#

No I'm not deadmen

severe solstice
#

ded*

still forum
#

😄

severe solstice
#

😄

still forum
#

It affects server performance just like any other script command you might run.

little eagle
#

The code snippet you posted has no while loop.

#

Or any loop.

still forum
#

Well slightly different in unscheduled... But... Don't use while loops in unscheduled 🗞

severe solstice
#

k

#

ty

lone glade
#

oh, fun thing to do, little sqf fun:
How many scopes down (minimum, doesn't need to be exact) is _magazineClassNames = _magazineClassNames - [_x];

#

i'd say at least 6, according to the arma wiki: 1
huehuehuehuehuehue

still forum
#

scopes down?

#

squint

lone glade
#

I can't english today

little eagle
#

scopes down :thonk:

lone glade
#

I meant to say how many parent scopes does it have

#

at a bare minimum, according to the wiki 1, or 0

still forum
#

How would I know?

#

Theoretically could be... oh shit

#

1

lone glade
#

well, func, switch, case, a few ifs and foreach.

#

my new favorite page of the wiki

#

Variables may store certain values. The kind of the value specifies the type of the variable. Different operators and commands require variables to be of different types.
Read the article Data Types for more information about variable types.

little eagle
#

I love the question though. Essentially "How bad will my code wreck the server?" while posting a code snippet that could be executed once and wouldn't affect the server at all.

lone glade
#

nothing beats:

_a = call {_a};
call _a;

anyways

#

peak performance right there

little eagle
#

That just crashes.

lone glade
#

lies

#

it gives you infinite frames

#

"the one code snippet #arma3_scripting doesn't want you to know about, COMMY HATES IT"

little eagle
#

Doesn't mean much. I'm picky and probably would poke holes in stuff I'd post myself one day later.

still forum
#

_magazineClassNames = _magazineClassNames - [_x]; I'd say minimum number of parent scopes is 1

#

because of CallStackItemSimple always being the parent of any scripts

lone glade
#

that's cheating ded

little eagle
#

_x implies forEach, so yes, most likely one parent scope at least.

still forum
#

But if SallStackItemSimple is the actual script.. Instead of it's parent

little eagle
#

This convo is tupid.

still forum
#

_X doesn't imply forEach though

lone glade
#

ofc it is

still forum
#

You can use _x where you want ^^

little eagle
#

Well, weak verson of "imply".

#

What was the word...

#

"infers"?

#

_x infers forEach

lone glade
#

no

little eagle
#

I'm going with that.

lone glade
#

apply and select code use it

cedar kindle
#

”Ended” MEH doesn’t fire when using #missions iirc

lone glade
#

AH HA !

#

runs away before he gets the newspaper

little eagle
#

Well, then alganthe, - [_x] infers forEach.

still forum
#

Yeah. that. And atleast one other case too. Like when you ALT-F4 too I think.

lone glade
#

crashing the game with the debug console > alt F4

little eagle
#
{ _magazineClassNames = _magazineClassNames - [_x]; } forEach _removeBetaCMags;

This line is so stupid btw.

#
_magazineClassNames = _magazineClassNames - _removeBetaCMags;
#

There. Makes so much more sense now.

#

¯_(ツ)_/¯

still forum
#

Actually no... If you look at the bigger picture

_magazineClassNames = _magazines + _removeBetaCMags;
{ _magazineClassNames = _magazineClassNames - [_x]; } forEach _removeBetaCMags;

->

_magazineClassNames = _magazines;
little eagle
#

I think this isn't supposed to handle duplicates as it does atm.

#

Like, only remove one "mag1" if only one "mag1" is in _removeBetaCMags instead of all 3.

#
{
    _magazineClassNames deleteAt (_removeBetaCMags find _x);
} forEach _removeBetaCMags;
#

There. Now handles duplicates correctly*.

#

*assumed

meager heart
#

@little eagle about "Re:" and waitUntil i do loops that way, something like this...

_fnc_coolLoop = {
    private _script = [] spawn {/* some code */};
    waitUntil {scriptDone _script};
    sleep 10;
    [] spawn _fnc_coolLoop;
};

not sure is it better vs while {true} do {};

little eagle
#

It's not.

lone glade
#

the reason why I don't like while true loops is that people abuse them and then you end up with never-ending loops everywhere.

meager heart
#

¯_(ツ)_/¯

meager heart
unborn ether
#

😐

winter rose
#

I am... not so shocked? Should I feel ashamed then

meager heart
winter rose
#

refactor refactor refactor

still forum
#

You need a editor that supports UTF-8

winter rose
#

^ and that too

meager heart
#

lol

lone glade
#

I think i'm gonna puke

meager heart
#

You need a editor that supports UTF-8
that was uploaded in one discord server 😀

meager heart
#

ok then... you won 😂

still forum
#

That's like the number 1 example. No one can beat that

meager heart
#

Line: 7057 > hint parseText 'Uho! It appears something has gone wrong. Please report this error code to staff:<br/><br/>456<br/><br/>Thank you for your assistance.';

little eagle
#

I love it when the indentations get so bad the code wanders off the right side of the screen.

unborn ether
#

This fn_clientcore.sqf is like having the same amount of code like infistar body do. 😐

#

No sorry, infistar has less.

unborn ether
#

👌

meager heart
#

maybe he was trying to draw a snake with the code 🐉

still forum
#

I would write such code too. If I had to have a else statement with different code for each

#

But that....

#

We need a helper that executes code when a variable goes out of scope 😄

little eagle
#

If I turn my screen 90 degree and start autoscrolling, it does look like watching the waves.

unborn ether
#

307344 characters

little eagle
#

I think SQF will fail to compile it if you reach 10^7 chars, because that's the maximum a string can hold.

#

So it's only ~30% there.

unborn ether
#

I've actually never thought about that before this script.

still forum
#

10^7 ?

#

r_string buffer size variable is a signed 32bit integer

#

Which means max 2147483648

little eagle
#

There are integers inbetween that cannot be represented.

#

Just because there is a largest doesn't mean the list is gapless.

still forum
#

What?

#

Integers in a integer that a integer can't represent?

little eagle
#

From Arma 3 v1.55.133789 strings are limited to maximum of 9,999,999 (sometimes 10,000,000) characters

still forum
#

Are you mixing up float/int?

little eagle
#

There are no integers in sqf.

still forum
#

No

#

But strings are not SQF

#

They are backend

#

SQF just points to the string in the backend

little eagle
#

True, but then explain why they put a limit on strings.

still forum
#

and the backend string has a 32bit integer as buffersize

#

I don't know actually

little eagle
#

That happens to be about what you can index with floats.

still forum
#

I even looked for that limit but couldn't find it

#

How do you get that? is readFile limited too? That returns a string and could read a huge file theoretically

little eagle
#

readFile?

#

You mean loadFile?

still forum
#

yeah

little eagle
#

Possibly. Don't know.

still forum
#

If there is a limit then it's just artificial. And not because "they can't hold more".
Basically like the + operator checking if left.size+right.size > 10 million then fail

unborn ether
#

Nice phrase being spoken about this Arma just doesn't

tough abyss
#

running this code sqf _fnc_uavinit = { diag_log "Running Init"; private ["_uav"]; _uav = _this; if (isNil "UavFogLoop") then {UavFogLoop = _uav spawn _fnc_uavrange}; _uav setVariable ["UavInSight",[],true]; _uav setVariable ["Active",true,true]; _uav spawn _fnc_uavpos; while {Alive _uav && fuel _uav > 0.05} do { _uav spawn _fnc_uavinsight; sleep SIGINT_sleep; }; diag_log "Exiting Init"; }; Returns two errors for existing functions _fnc_uavrangem _fnc_uavpos and _fnc_uavinsight. All functions are declared the same way as above function. What have I done wrong this time 😄

unborn ether
#

Any RPT log with errors?

still forum
#

two errors... What errors?

#
    private ["_uav"];
    _uav = _this;

->
private _uav = _this;
or better
params ["_uav"];

tough abyss
#

oh shit didn't know that was possible with the params. No, it claims that the _fnc_XXX functions don't exist

still forum
#

It probably doesn't exist then 😄

tough abyss
#

just your regular undefined error

ruby breach
#

No tags?

still forum
#

How do you call that function

tough abyss
#

_x spawn _fnc_uavinit;

still forum
#

Well yeah..

#

The variable is undefined.

tough abyss
#

and it doesn't complain about the UAV init function

still forum
#

It's a local variable

#

local variables don't carry over to new script instances

tough abyss
#

the function is defined right under it

still forum
#

under it?

#

Even better

#

the function doesn't even exist when you spawn it

tough abyss
#

does it need to be listed above?

still forum
#

The function needs to exist before you use it yes.

#

And as I said. Local variables don't carry over into new scripts.

#

Use global variables and use a tag

tough abyss
#

even if it's all in the same sqf file?

still forum
#

totally irrelevant

tough abyss
#

hmm fair enough

meager heart
#

_uav = _this; > _this params ["_uav"]; ?

still forum
#

>
no the string is clearly smaller. So no it's not bigger

tough abyss
#

is a _fnc_XXX = { lot of code }; a variable or a function?

still forum
#

@tough abyss Both

#

A variable of code

#

which people usually call "a function"

tough abyss
#

okay, will keep that in mind

ruby breach
#

You also don’t need to do _this params

#

Just params as _this is params’ default argument

tough abyss
#

saves a lot in _this select X; with large arrays

meager heart
#

no need _this there at all, use params

still forum
#

Also private doesn't make sense in a script without any parent scopes

meager heart
#

and private <array> and private <string> are deprecated...

valid arch
#

how do I get two squads to join together in the editor?

still forum
tough abyss
#

GroupTo or something? Right Mouse click on the group

#

then sync with the other squad

valid arch
#

sorry i wasn't clear enough, when one squad gets close to another in the mission, how do I do that?

tough abyss
#

check distance between group leaders and if smaller than a certain distance, group the teams?

little eagle
#

even if it's all in the same sqf file?
I find this amusingly naive.

velvet merlin
#

how to optimize this? cache player player position and only change when distance > 1? anything else?

        while {DEV_MiniMapActive} do
        {
            ctrlMapAnimClear _miniMapControl;
            _miniMapControl ctrlMapAnimAdd[0,Dev_MiniMapZoomLevel,getPos player];
            ctrlMapAnimCommit _miniMapControl;
            _miniMapControl ctrlCommit 0;
            waitUntil {ctrlCommitted _miniMapControl};

            sleep 0.1;
        };```
lone glade
#

nah

#

it's good enough, you're overthinking it

velvet merlin
#

well diag_captureFrame says it lasts/runs for 0.13466 ms (second most in my current situation)

#

that said this is my main prob: 3.00083;"<spawn>#line 1 "DevCon\s\showUnitMapMarkers.sqf"

still forum
#

add a bigger sleep. But.. a local variable to check if changes are required would also help I guess

#

I don't see a need to optimize it though

velvet merlin
#

whats the most optimized map makers solution these days - something from ACE?

#

0.1 is used trying to keep it smooth during movement - i guess the main problem is that i have it running in scheduled env

#

so if mission scripts take to much of the scripting VM, it gets slowed down or stuck - especially when in fast movers like cars or planes

still forum
#

yeah. Scheduled makes all scripts slower in general

#

And yeah.. Sleep in scheduled will lag

winter rose
#

is it something to do about the 0.3s cycle?

still forum
#

0.3s ?

#

scheduler cycle time is 3ms. Not 300

winter rose
#

or 3ms, idk
something like "this script will have CPU for x time" yes

#

yup ^

velvet merlin
#

@still forum would it be possible to have diag_captureFrame filter to only the scripting VM?

#

@winter rose do you mean running in unscheduled env instead?

still forum
#

yeah

#

you can use scr .. eh.. What's it called?

velvet merlin
still forum
#

scrVM?

#

the scope in the profiler output

velvet merlin
#

scrsi and scrVM i think

still forum
#

you can filter diag_captureSlowFrame and I think it will only show that filtered area then

velvet merlin
#

yeah seems so. ty - testing

inner swallow
winter rose
#

@velvet merlin yup, sched vs unsched
so it's sensors I think that are 0.3s, that and/or Arma 2 modules that are "set in stone" after this delay

valid arch
#

@inner swallow thanks

velvet merlin
#

triggers have 0.5s cycle time for the condition from what i recall

#

@still forum unfortunately the parameter in diag_captureSlowFrame makes it only trigger for the said subset but still shows all of them in the dialog

still forum
#

Maybe it sometimes bugs out and only shows the subset 😄 I think I got it to do that a couple times. Maybe just by accident

velvet merlin
#

the BIS_noCoreConversations is no longer used in A3, right?

winter rose
#

I would say not used indeed

#

same could go for disableConversation

hot jay
#

Currently trying to use the GUI editor on our server but cannot export. We have tried Ctrl + Shift + S but cannot paste the output anywhere. Anyone have any Ideas what the problem may be?

austere granite
#

Yes

#

copyToClipboard command is disabled in multiplayer

#

So the script can't copy it

#

Also GUI editor sucks

hot jay
#

is there any way to enable it?

austere granite
#

No

hot jay
#

Or any suggestions on what to use instead?

austere granite
#

Not sure why you want to GUI edit in MP anyway

#

Just do it in SP

#

And instead of GUI editor, learn how configs are setup for UI

hot jay
#

Fair Play. Thanks for your help 😃

austere granite
#

GUI editor you usually end up with very crazy configs that are hard to maintain and edit

#

Instead you should learn using controlsGroupCtrl

#

Important thing there is that within a ctrlGroup, x and y coordinates are relative to the group, but w and h are still based on everything

#

One of these days i should write an updated UI tutorial, it improved A LOT in A3 (still not great) and i think the latest tutorial on it is ancient (And not very good imo)

spring dune
#

Uhm, guys i can't find right String...
If displayName shows main name of item's classname (in VR arsenal list for example) then which one would show 'on mouse hover' tip (additional info)?

fossil yew
unborn ether
#

@spring dune This one?

descriptionShort = "Light Machine Gun
Caliber: 6.5x39 mm";
spring dune
#

Yeah, i saw that.

#

Thanks, will try

fossil yew
#

can property of the object be of type CODE?

still forum
#

"property" ?

#

What is a "property"

fossil yew
#

someObject setVariable ["propertyName", value];

#

it's a namespace but I guess they wanted to do attribute/property emulation

still forum
#

What?

#

setVariable

#

It's a Variable.

#

You are asking if a Variable behaves just like any other Variable.

#

Yes. It's a variable. It behaves like a variable.

#

Because it's a variable.

inner swallow
#

i.e. "propertyName" is the name of a variable

#

it's not some predefined property of an object

#

you could have well written someObject setVariable ["fortehlulz", 2]; and then you'd have a variable called forthelulz with the value 2 within the namespace defined for/by the object someObject

tough abyss
#

how to detected UID of the player that received X item and make sure he can't give it to anyone else?

still forum
#

getPlayerUID
Make sure he can't give it to anyone else... Uh.. Well..

#

Eventhandler for Drop and if he drops the item.. Kill him

austere granite
#

execVM an .sqf file with non-existant #include 😃

#

#include "dont_drop_the_fucking_items_you_fucker.hpp"

#

ez

still forum
#

Remove all UI eventhandlers in a UI eventhandler

#

Boom

manic sigil
#

Any unit enters a trigger setcaptive, any units who leave the area setcaptive false, for multiplayer.

I can get the effect I want on entering, but I'm trying to wrap my head around the effect on leaving;. I could just have it setcaptive false on all units constantly, but I want the safe zone to be really safe, not, "AI flipped out and shot you in the tick between being safe and not safe".

!thislist seems to not be an option for a foreach command :/

little eagle
#

I wouldn't use a trigger for that. Way too annoying compared to a simple script.

manic sigil
#

Scripting isn't an option unfortunately, has to be the long run - admin console commands.

little eagle
#

Well, you cannot use setcaptive without scripting.

#
// SERVER EXEC
0 spawn {
    private _previousUnits = [];

    while {
        private _currentUnits = allUnits inAreaArray "zone_marker";

        private _unitsThatEnteredZone = _currentUnits - _previousUnits;
        private _unitsThatLeftZone = _previousUnits - _currentUnits;

        {
            [_x, true] remoteExec ["setCaptive"];
        } forEach _unitsThatEnteredZone;

        {
            [_x, false] remoteExec ["setCaptive"];
        } forEach _unitsThatLeftZone;

        _previousUnits = _currentUnits;
        sleep 5;
        true
    } do {};
};
#

Dunno, this is how I'd do this. But I'm weird.

manic sigil
#

Yeah, that's actually what I was looking at - allUnits - thisList for those who are free.

little eagle
#

thisList
As I said, triggers are annoying and cumbersome to work with compared to scripts.

manic sigil
#

They are, but the official Zeus server's admin consoles kinda preclude using external scripts.

little eagle
#

People use them because they lack imagination. And aren't used to inAreaArray.

#

I don't know what "admin console" refers to. I only know the debug console.

manic sigil
#

Same thing, more or less - fair enough, should call it what it is.

little eagle
#

Well the debug console can be used to execute e.g. my script. Of course you'd have to create the marker named "zone_marker" too somehow.

manic sigil
#

Markers and such are easy to add. Honestly, I kinda enjoy scripting around the console input; you can't rely on calling on external files.

#

What's the difference between inAreaArray and thislist? o.0

little eagle
#

thisList is a local variable in trigger scripts.

#

inAreaArray is a command that can be used anywhere.

manic sigil
#

Ooooh.

#

Yeah. I've said it before every time I ask, but locality is my great weakness :/

little eagle
#

A local variable has nothing to do with locality.

#

It's just an unfortunate name.

manic sigil
#

.... and the fact that I thought it does is also kinda telling t_t

little eagle
#

Yep.

manic sigil
#

Local as in, only for scripting in that trigger, right?

#

Same as saying _thisList?

little eagle
#

Local as in only exists in this script instance.

#

Well, usually local variables start with _

#

This one is a magic one (defined by some internals instead of a script) and therefore has a different name.

#

But it's a local variable.

knotty mantle
#

@little eagle why are you doing the stuff above in the while condition and not the do {} block?

little eagle
#

Because I could, so I did.

knotty mantle
#

ah. so no performance difference?

little eagle
#

No. That would be the for step 0 thingy probably.

#
for "_" from 0 to 1 step 0 do {
    // looped code
   sleep 5;
};

This one should have the least overhead.

#

Otherwise:

waitUntil {
    // code
    sleep 5;
    false
};
#

But tbh, it's all the same and preference.

knotty mantle
#

so basically there is no situation where while {true} do {// code} should be used?

#

Okay reading the last sentence before pressing enter might have helped 😄

little eagle
#

It's kinda expensive because it has two code blocks, and one of them is a waste.

#

So if you want to optimize it then there are the alternatives I wrote.

knotty mantle
#

is there a known reason why the while has a code block as condition? Was wondering that ever since i saw that construct.

little eagle
#

Probably because the condition is a piece of code that itself is executed over and over again. It's just how the scripting language was designed.

#

In C it's parenthesis for the while "block", but curly brackets have a different meaning there and are less "strong"(?)

knotty mantle
#

Yeah i learned Java a bit and starting with sqf i was really thrown of with the different syntax for the condition in while or if. But as always thanks for the anwsers 😃

little eagle
#

In SQF curly brackets are essentially quote marks for code snippets. The while CODE1 do CODE2 doesn't execute CODE1 before the do command. Only after there is a while and a do code block defined the control structure evaluates the CODE1 / condition block.

#

I think you could for example put:

while {hint str 1};

everywhere into your script and they would just be ignored. Not tested though.

compact galleon
#

@little eagle Well, not ignored. But they won't be called

little eagle
#

Same diff?

queen cargo
#

@little eagle that while without a do would essentialy be an expensive comment command

fleet wind
#

Can arma check if a player is scrolling (mouse wheel)?

strange urchin
#

Are you talking about the scrolling through the action menu?

meager heart
fleet wind
#

Thanks @meager heart

hot ember
#

Hey all, I was hoping someone could help me with this issue I'm facing. I'm spawning a bunch of UGV stompers around the map, when an enemy comes into view of them, they turn on and aim at the enemy but do not shoot. I'm hoping to get the stompers to patrol areas and engage any enemy as soon as they see them.

_vehicle enableAI "ALL";
group _vehicle setCombatMode "RED";
_aiSide = side group _vehicle;
// [group _vehicle, getPos _vehicle, 100] call bis_fnc_taskPatrol
// _vehicle setBehaviour "SAFE";
[_vehicle, _aiSide, true] call fn_createCrewUAV```

I'm fairly new to Arma scripting, so any and all pointers here are appreciated.
meager heart
#

@hot ember

hot ember
#

Thanks @meager heart , the setVehicleAmmo makes much more sense, surprised I missed that one. However the stompers still aren't shooting.
I also changed the setBehaviour to the group of the vehicle, thanks for that.
However, do you mind explaning why you pointed out the enableAI and the createCrew call?

createCrew: https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/3c2260d7c99c437bbf934d4e62b1a90182006df6/server/functions/fn_createCrewUAV.sqf

Also, any idea as to why the bis_fnc_taskPatrol wouldn't work here?

meager heart
#

However, do you mind explaning why you pointed out the enableAI and the createCrew call?

unit enableAI skilltype unit != vehicle

that file fn_createCrewUAV.sqf from link above defined in cfgFunctions

class CfgFunctions
{
    class someTag
    {
        class someCategory
        {
            file = "path_to_folder_with_function_files"; //--- there is `fn_createCrewUAV.sqf`
            class functionName {};
        };
    };
};
#

@hot ember

#

you can execVM that file, not call it

ornate pawn
#

Can someone tell me why this addAction wont work in MP?

#
[    
  player,    
  "Abrir Puerta",    
  "images\take_ca.paa",    
  "images\take_ca.paa",    
  "_target distance laptop < 2",   
  "_target distance laptop < 2",   
  {},    
  {},    
  {                                                                 
  sleep 0.1;  
 _target playaction "Putdown";    
 door_1=true;
  },    
  {},    
  [],    
  3,    
  1000,    
  false,    
  false    
] call BIS_fnc_holdActionAdd;

hot ember
#

@meager heart Calling fn_createCrewUAV was working, even before I added it to CfgFunctions. Without it the stompers weren't being spawned.
I got taskPatrol to work, but still for the life of my I'm not sure what would be causing the stompers to not be firing. The side relations are fine, I'm giving it ammo, setting an agressive combat behaviour etc.

meager heart
#

¯_(ツ)_/¯

strange urchin
#

Might have to do with default values of params for that function. Why are you using it, anyway?

#

You could do createVehicleCrew _vehicle and have the AI join your group and be done with it

meager heart
#

@ornate pawn paste it in debug console, press local exec
if it will work, then possible "locality issues" check from where and how you call it...
and if that from player init scripts, you can add b4 that call waitUntil {!isNull player}; or waitUntil {time > 0};

ornate pawn
#

Okay thank you

little eagle
#

Except just as expensive as comment.

hot ember
#

@strange urchin Honestly only using it because I'm still learning how Arma scripting works, I'll definitely give your suggestion a shot though 👍

river meteor
#

I have a problem someone might be able to help me with. I'm using a Control Table, and the command ctAddRow to add rows to this table. https://community.bistudio.com/wiki/ctAddRow When I add the first row and modify the controls, I see them in the UI. However, any subsequent row after the first one will not display. The array returned does contain the proper index and controls, but when I modify the text of these controls, they just don't show up on the UI. Very frustrated with this.

warm gorge
#

Is there are helper BIS function to return an item's config parent? For example for a primary weapon CfgWeapons, or a magazine CfgMagazines

little eagle
#
configName inheritsFrom (configFile >> "CfgWeapons" >> _item)

Will not work for glasses and backpacks.

lusty canyon
#

how can i get a specific players object and run a fnc on that players machine?
i can cursortarget someone, but that would mean it will only be a localexec from my own machine right?

this locality stuff is hurting my porn filled walnut brain >.<

little eagle
#

You mean get the player object by name?

#

Because you have to have something tangible and usually it already is the player's avatar.

lusty canyon
#

say i want to do getUnitLoadout player

little eagle
#

Well player reports the local player.

lusty canyon
#

yeah i want the player i can see in front of me

little eagle
#

cursorTarget

#

But that may not necessarily be a person.

#

Could also be an empty vehicle.

lusty canyon
#

but that localexec? say i want to give that player a EH?

little eagle
#

Or something else entirely.

#

So your script runs on machine A. cursorTarget happens to be the avatar of machine B.

#

And now you want to execute code on the machine B from a script on machine A?

lusty canyon
#

yeah

#

i tired cursortarget but it seems its not reliable

little eagle
#
private _target = cursorTarget;
private _script = {
    hint "hello world";
};

_script remoteExec ["BIS_fnc_call", _target];
lusty canyon
#

i tried doing cursortarget enablestamina false; (localexec debug console) but the player report stamina is still on

little eagle
#

Will print "hello world" only on the machine where the target is local, not necessarily the machine that execute this script.

#

Well, LOCAL EXEC in the debug console runs the code on the machine of the person that pressed LOCAL EXEC.

#

Therefore LOCAL EXEC.

#

enableStamina has to run on the machine that owns the unit.

#

"Local arguments". At least iirc.

#

Therefore you have to remotely execute the command on the machine that owns the unit.

lusty canyon
#

so the cursortarget in ur code above is run localexec (since the source is my own player?)
then the remoteexec command will then run everything on the target players machine?

little eagle
#

Sounds right.

#

E.g:

private _target = cursorTarget;
private _script = {
    player enableStamina false;
};

_script remoteExec ["BIS_fnc_call", _target];
lusty canyon
#

i should run that as localexec in debug console?

little eagle
#

Yeah.

#

Or shorter:

private _target = cursorTarget;
[_target, false] remoteExec ["enableStamina", _target];
#

First example again, your locally executed script will relegate _script to the machine that owns _target.

#

And execute it there.

lusty canyon
#

how can i run that _script on all players except myself, dedicated, and HC?

#

allplayers array - something?

little eagle
#

_target in remoteExec can be an array of objects, so sure.

#
private _targets = allPlayers - [player];
private _script = {
    player enableStamina false;
};

_script remoteExec ["BIS_fnc_call", _targets];
#

Note how the first line player is execute on the local machine, and the third line player on every other machine (except stuff like the server or hc).

lusty canyon
#

wont that still be added to the HC? i notice some of my player add EH have also been applied to the invisible HC entity

little eagle
#

Is that a problem?

lusty canyon
#

yeah i can see in game the HC near my mission base has stuff it shouldnt have

little eagle
#
private _targets = allPlayers - [player];
private _script = {
    if (hasInterface) then {
        // do stuff
    };
};

_script remoteExec ["BIS_fnc_call", _targets];
#

Well that's what hasInterface is for.

lusty canyon
#

oh nice

little eagle
#

I guess you could simplify this by removing _targets all together and just executing the code everywhere for simplicity.

#
{
    if (hasInterface) then {
        // do stuff
    };
} remoteExec ["BIS_fnc_call"];
#

There. Much nicer.

cedar kindle
#

HC's running around? 😄

lusty canyon
#

i can see an invis HC inside the mission is that normal?

little eagle
#

It's not normal to see something invisible.

cedar kindle
#

you're using a script or mod that adds all entities

lusty canyon
#

if i do globalexec, player entity on the dedicated server also applies?

cedar kindle
#

it doesn't exist

#

player is objNull for dedi

little eagle
#

On a dedicated server, player is <null> and most commands, e.g. enableStamina or addEventHandler just fail silently if used on <null>.

lusty canyon
#

ok so i dont have to worry about them, say if the HC player dies somehow does that mean it will stop processing AI?

#

(better yet how can i even know the HC is actually doing its job?)

little eagle
#

Doubt it. I think the dummy just exists for the HC to slot in.

cedar kindle
#

it doesn't care, don't know if it even can die

little eagle
#

Well duh. You missspelled allDeadMen.

#

allDeadMan is an undefined global variable.

#

allUnits + nil // nil

#

nil select {...} // nil

#

Now check the time again.

meager heart
#

😄

little eagle
#

😉

meager heart
#

problem solved

#

anyway it faster with allDeadMen 😂

sick sorrel
#

https://codeshare.io/a3xr4D

Found these scripts after quite a lot of Googling, and they work fine in SP and local MP. Will they also work in dedi MP? Can they be improved / cleaned up in any way?

lusty canyon
#

is there a way to make player objects clip through all objects terrain etc while still enable simulation? (can still aim shoot atleast)

little eagle
#

The script runs scheduled, so you could easily still place markers by just increasing your view distance so your game lags and never closes the display before you hit enter to place the marker.

proven crystal
#

would anyone knoe how i can change the delay for those excercise targets to pop up again?

little eagle
#

is there a way to make player objects clip through all objects terrain etc while still enable simulation? (can still aim shoot atleast)
No.

proven crystal
#

oh i just found this ``` // target individual settings [DEV. VERSION ONLY!]
_target setVariable ["nopop", true];
_target setVariable ["popDelay", 10];

// handle target hit event
_target addEventHandler ["Hit", {
systemChat format ["Target %1 hit by unit %2", _this select 0, _this select 1]}]; ``` will try

tough abyss
#

Read it as poop delay at first.

little eagle
#

If you do your regular morning poop, you have a healthy 24 hour poop delay.

compact maple
#

Hello guys, i am trying to call a function like this.

[cursorObject] call myfunc;

this func is supposed to be called on sqm objects.
in my function, i want to get the variable name of the object, do you know how can i do this ?

still forum
#

What is a sqm object

compact maple
#

an object i placed on the mission sqm

still forum
#

Do you mean a init script? When you double click the unit in Editor and put it in there?

compact maple
#

Not the init, but the variable of the object

still forum
#

What?

#

Where do you run the script?

inner swallow
#

he placed a unit in the editor

#

and then named it something

compact maple
still forum
#

And now he wants to get the variable name out of thin air and have the game magically know which unit he wants?

compact maple
#

i'm calling the function with cursorObject

still forum
#

What is that screenshot supposed to tell me?

#

Why are you calling it with cursorObject?

inner swallow
#

from the debug console while in-game?

compact maple
#

Cause this is the only way i found to get the name of the object

still forum
#

Can you answer my other question

#

Where do you run the script?

#

Where do you want to do that?

#

init.sqf or trigger script or.. what?

compact maple
#

it will be used in keyHandler, and console debug

still forum
#

Do you always want the same object?

compact maple
#

Nope, it can be multiples objects, depend on what the players is loooking at

still forum
#

Or.. Do you want to get the variable name of the cursorObject?

compact maple
#

yes this is it

#

i want the variable name of the cursorObject

still forum
#

If it has a variable set to it in the editor then just str cursorObject will return you the variable as text

compact maple
#

hm i tried this it didnts work, i must have missed something, thanks

inner swallow
#

you have to actually look at the object

compact maple
#

I know

inner swallow
#

ok

velvet star
#

Anyone know how to stop the AI moving their heads? Trying to do some screenshots but they keep turning their heads!

drowsy axle
#

disable their simulation @velvet star .

#

Anyone able to help me out with params?

init.sqf```
["player","T0",["Attack Civilian","Attack the civilian, infront of you, he's committed war crimes!"],Civ_00,"CREATED",1,true,"attack",true] execVM "taskCreate.sqf";

taskCreate.sqf```
params [
    private _taskOwner,
    private _taskNumber,
    [
        private _taskShortDescription,
        private _taskLongDescription
    ],
    private _taskObject,
    private _taskState,
    private _taskPriority,
    private _taskNotify,
    private _taskType,
    private _alwaysVisible
];

[
    _taskOwner,
    _taskNumber,
    [
        _taskShortDescription,
        _taskLongDescription
    ],
    _taskObject,
    _taskState,
    _taskPriority,
    _taskNotify,
    _taskType,
    _alwaysVisible
] call bis_fnc_taskCreate;```
velvet star
#

Thank you Capwell!

still forum
#

@drowsy axle params takes array of strings. not array of variables and syntax errors

#

Read params wiki page

compact maple
#

Do you guys use BIS_fnc_guiMessage ?

cosmic kettle
#

Hey @compact maple , yes, I guess BIS_fnc_guiMessage is well-used. Try rephrasing your question to be more specific and provide examples if needed.
Anyway, glad to see you found your way here. Any script-related questions you can ask here, this is the best part of A3 discord 👌🏿

compact maple
#

@cosmic kettle Hey, i am using it in a function. This function is called in the keyHandler, when the player press win+F1.

It sends to the function, one argument, cursorObject, so with the cursorObject, im creating a BIS_fnc_guiMessage , the problem is, the box is created 10 times instead of one. I mean when i press a button, the display is still here. And i have to spam click to make it disapear. I didnt make a while or something, its called one time with the keyhandler

cosmic kettle
#

Oh, I assume it's just executing the keyhandler for the duration you press windows F1

#

you might see it as 1 press, but it might have seen it as 'the last 10 frames user pressed win+F1'

compact maple
#

Oh, you're probably right, i quickly quickly pressed win+f1 and it created only 2 box

#

instead of 10

cosmic kettle
#

😉

compact maple
#

But i do not know how to execute it just one time

little eagle
#

Abort the function that opens the menu if the menu is already shown.

cosmic kettle
#

☝🏿

compact maple
#

Thanks you commy

#

will give a try

marble flare
#

Hey gents, how would I steer a vehicle via user action without being the driver of the vehicle?

little eagle
#

I don't think that is possible outside of commanding an AI driver.

marble flare
#

Well I guess a better way of phrasing it is how would I set the steering angle?

little eagle
#

With scripts? No such command.

marble flare
#

To illustrate what I'm trying to do is I have a ship that's moving forward and I'm trying to turn the wheel, thus turning the rudder without being the driver since apparently ArmA doesn't let you get in as the driver of a vehicle while it is moving

little eagle
#

Unless it's your model, so you can add User source/controller animations and then use animate it doesn't seem possible to me.

marble flare
#

it is my model

little eagle
#

Well, animate is how you can do animations that are defined as User source.

marble flare
#

can you use a user animation to change the "drivingwheel" animation source?

little eagle
#

No, it has to be User.

#

Unless it's a simple object, but those can't drive anyway.

marble flare
#

ugh

little eagle
#

It sounds to me like it would be simpler to just add a user action to the boat that mimics the base games "Get In blah" stuff.

peak plover
#

And locking it?

#

Wait

#

u can't get in as driver if it's mopving?

marble flare
#

to be honest I kind of want to avoid the whole get-in thing

peak plover
#

how would I steer a vehicle via user action without being the driver of the vehicle
setvelocity?

marble flare
#

no, you can't get into a ship while it's moving

peak plover
subtle ore
#
player stuffHeadInsideVehicle _veh;
peak plover
#

I like how the boats keep moving indefenetly

#

If u don't stop them

subtle ore
#

^ Not necessarily true

#

Throttle is up if that is the case

peak plover
#

last I tried they did

subtle ore
#

You can move to the passenger seat after maxing out the speed and it'll maintain the same speed

peak plover
#

&

#

^

#

Yeah

#

And if you get out when it's moving

#

It sometimes keeps going forever

marble flare
#

passenger seats? lol my ship don't need no stinking passenger seat lol

subtle ore
#

Where do you put your weapons and beer then tim? 😄

marble flare
#

still working on that lol

subtle ore
#

and if you get out when it's moving
The question is still: is the throttle up?

marble flare
#

lets say yes

subtle ore
#

I've never had them go on forever if I slowed it all the way down

subtle ore
#

404

marble flare
#

this is the wheel I'm trying to turn while moving

#

oops

subtle ore
#

Does it behave like it does on say a regular boat like the RHIB or does it have it's own swimming model 😛

marble flare
#

I don't want the ship to turn while it's still...atleast not noticeably, but when moving forward...since rudders generally only work while going forward.

subtle ore
#

So this is a static prop? 😄

marble flare
#

What do you mean? It's a ship that moves

subtle ore
#

Well shit, that's pretty cool. I dunno what you're talking about necessarily though. You don't want the ship to turn when moving forward?

marble flare
#

I want it to turn while moving forward if I turn the wheel

young current
#

invisible AI driver that you give action commands

marble flare
#

The AI is too stupid

subtle ore
#

^ Not true

young current
#

the wheel controls the AIs commanding

marble flare
#

how would I tell the AI to only turn the wheel 0.5 to the left?

subtle ore
#

Well, you could say "Hey, turn the thingy until I say stop" then once it reaches 0.5 , "Hey AI dude, stop turning"

#

it may not give you 100% accurate results (which I don't think it ever will). But close enough?

marble flare
#

Doesn't the AI steer where ever it wants to? I notice while standing on the ship while it's moving the AI things it's going to hit me and steers all crazy

subtle ore
#

Make the ai an agent and just have it move directly to the left (which should translate into a wide left turning motion on the ship?) until you think it's appropriate then have it stop

marble flare
#

what's the scripting command to make the ai turn left or right?

subtle ore
#

There is no "turn left" or "turn right" commands.

#

moveTo and doMove

#

literally just have them move left

#

left of the ship

marble flare
#

I see what you're saying but that's not what I'm trying to do.

ornate pawn
#

Anybody knows how to open and close doors manually?

#

with a command ofc

#

lol

subtle ore
#

@ornate pawn building will have animation sources, use animate or animateSource with given animation source name and supply the number which will indicate the phase from 0 to 1

ornate pawn
#

ty

young current
#

@marble flare did you check out the addTroque Nigel suggested?

marble flare
#

no, I'm not good with scripting but I'll give it a shot.

little eagle
#

No one here is good at it.

subtle ore
#

🍌

still forum
#

triggered

little eagle
#

Dedmen is okayish at best.

still forum
#

🙇

little eagle
#

Wouldn't call it "good" tho.

subtle ore
#

And you are what exactly commy?

#

godlike?

#

😛

marble flare
#

ok, yea, if nobody here is good at it then I really suck

#

so I tried it and it does turn the ship momentarily, but not like what the rudder would

subtle ore
#

Make adjustments 🤷

marble flare
#

this is particularly important because the rudder acted like a trim on a sail ship to compensate for lateral drift

#

I suppose if I was more experienced I could figure out something

subtle ore
#

I think you're too caught on the notion of "I have lack of experience, thus I can't do X".
It's literally just command based, utilize t he addTorque command and adjust your given values

marble flare
#

I suppose I could come up with a user action that constantly applies torque to the ship based on the position of the wheel/rudder and relative to the speed of the ship

little eagle
#

And you are what exactly commy?
Always right. Even if it turns out to be wrong in the end, it was right at the time.

subtle ore
#

@marble flare Why add that to a user action? You could loop it for as long as you want and then exit when position conditions are met

marble flare
#

well I guess loop the action

subtle ore
#

loop the action
Huh?

marble flare
#

"huh?" is exactly what goes through my mind when I think of this stuff

strange urchin
#

You can probably guess what he means

subtle ore
#

No, I don't. You can loop something inside the executed code when adding an action

#

But other than that it doesn't make sense.

marble flare
#

I guess it would be a loop, something like "ship addtorque [0,0,(ship animationphase "rudder") * speed ship]"?

subtle ore
#
#define LEFT_EXIT (sailors_ship getVariable "LEFT_START")
while{alive sailors_ship} do
{
  if !(LEFT_EXIT) exitWith {};
  sailors_ship addTorque[0,0,(sailors_ship animationPhase "rudder") * speed sailors_ship];
};

I really don't know how far left yo uwant it, so 🤷 . Guess this could work

marble flare
#

ok...where would I put this?

subtle ore
#

Slap that in a script and call compile preProcessFile "yourScript.sqf" it, or register it in cfgFunctions and spawn it.

#

there isn't any suspension, so if you want that -> Scheduled

still forum
#

That while loop wouldn't make sense in unscheduled..

subtle ore
#

Why would that be?

marble flare
#

not sure what you mean, but I suppose the script can stop or pause when the ship isn't moving at all

subtle ore
#
while{alive sailors_ship} do
{
    sleep 0.33; // suspends for 0.33 seconds
};
marble flare
#

I suppose I could add a little torque to the vertical axis to simulate listing to one side during a turn?

still forum
#

Because he will never die

#

unscheduled executes the script till end.

#

LEFT_EXIT will never change. alive state also won't

lone glade
#

This function will freeze the game for a second then the func will be killed

marble flare
#

never die? 0_o the ship can die

#

In fact if the rudder is shot away then no steering

lone glade
#

loops have a limited number of runs in unscheduled

still forum
#

It can't die while that script runs if that script executed in unscheduled

lone glade
#

also sleep in unscheduled just causes a syntax error

subtle ore
#

that's exactly what I said above ^^

marble flare
#

I'm sure glad you guys have an idea of what you're talking about. I feel like someone watching the spanish channel. Either way I'm sure this will point us in the right direction.

#

Thanks for your help guys!

drowsy axle
#

I'd like your opinion on the following:
Initial Coding```sqf
northStand_1 addAction ["<t color='#44bd32'>Open</t>",{northWall setPos [4191,6800,2.204]}];
southStand_1 addAction ["<t color='#44bd32'>Open</t>",{southWall setPos [4191,6768,2.204]}];
eastStand_1 addAction ["<t color='#44bd32'>Open</t>",{eastWall setPos [4176,6785,2.204]}];
westStand_1 addAction ["<t color='#44bd32'>Open</t>",{westWall setPos [4208,6785,2.204]}];

northStand_2 addAction ["<t color='#44bd32'>Open</t>",{northWall setPos [4191,6800,2.204]}];
southStand_2 addAction ["<t color='#44bd32'>Open</t>",{southWall setPos [4191,6768,2.204]}];
eastStand_2 addAction ["<t color='#44bd32'>Open</t>",{eastWall setPos [4176,6785,2.204]}];
westStand_2 addAction ["<t color='#44bd32'>Open</t>",{westWall setPos [4208,6785,2.204]}];

northStand_1 addAction ["<t color='#e84118'>Close</t>",{northWall setPos [4191,6800,0.204]}];
southStand_1 addAction ["<t color='#e84118'>Close</t>",{southWall setPos [4191,6768,0.204]}];
eastStand_1 addAction ["<t color='#e84118'>Close</t>",{eastWall setPos [4176,6785,0.204]}];
westStand_1 addAction ["<t color='#e84118'>Close</t>",{westWall setPos [4208,6785,0.204]}];

northStand_2 addAction ["<t color='#e84118'>Close</t>",{northWall setPos [4191,6800,0.204]}];
southStand_2 addAction ["<t color='#e84118'>Close</t>",{southWall setPos [4191,6768,0.204]}];
eastStand_2 addAction ["<t color='#e84118'>Close</t>",{eastWall setPos [4176,6785,0.204]}];
westStand_2 addAction ["<t color='#e84118'>Close</t>",{westWall setPos [4208,6785,0.204]}];```

#

OR

Refined Coding: ```sqf
_stands = [
"northStand_1",
"northStand_2",
"southStand_1",
"southStand_2",
"eastStand_1",
"eastStand_2",
"westStand_1",
"westStand_2"
];

[
if (_x = "northStand_1" || "northStand_2") then {_wallSetPosOpen = northWall setPos [4191,6800,2.204]};
if (_x = "southStand_1" || "southStand_2") then {_wallSetPosOpen = southWall setPos [4191,6768,2.204]};
if (_x = "eastStand_1" || "eastStand_2") then {_wallSetPosOpen = eastWall setPos [4176,6785,2.204]};
if (_x = "westStand_1" || "westStand_2") then {_wallSetPosOpen = westWall setPos [4208,6785,2.204]};
_x addAction [
"<t color='#44bd32'>Open</t>",
{
_wallSetPosOpen
}
];
if (_x = "northStand_1" || "northStand_2") then {_wallSetPosClose = northWall setPos [4191,6800,0.204]};
if (_x = "southStand_1" || "southStand_2") then {_wallSetPosClose = southWall setPos [4191,6768,0.204]};
if (_x = "eastStand_1" || "eastStand_2") then {_wallSetPosClose = eastWall setPos [4176,6785,0.204]};
if (_x = "westStand_1" || "westStand_2") then {_wallSetPosClose = westWall setPos [4208,6785,0.204]};
_x addAction [
"<t color='#e84118'>Close</t>",
{
_wallSetPosClose
}
];
] forEach _stands;```

errant jasper
#

Is there any current bugs with ACE Arsenal? I am running, now only CBA and ACE, and [this, true] call ace_arsenal_fnc_initBox; does not work on a box.

drowsy axle
#

@errant jasper You have to change to: sqf [_this, true] call ace_arsenal_fnc_initBox;

subtle ore
#

not in a init box

errant jasper
#

@drowsy axle Right now I am just testing it through init box

subtle ore
#

this is a reference to the object the init box belongs to

errant jasper
#

like Midnight says

drowsy axle
#
[BoxName, true] call ace_arsenal_fnc_initBox;
#

This is called outside of the BoxName "Init. Field" say a function or init.sqf

#

Anyone have any opinions on my above script post?

errant jasper
#

Nvm. I am stupid. It seems it has been changed to the interaction menu now, rather than the scroll-action-list.

drowsy axle
#

Yes. It has... I wondered what your problem/bug was. 😃

subtle ore
#

personally, I feel using a switch do control structure instead of multile if statements is better. Despite what others may have to say.

switch _yourVar do
{
    case "value_1" :
    {
        //code
    };
};
drowsy axle
#

So... like this?

#
switch _wallSetPosOpen do
{
    case "northStand_1" :
    {
        northWall setPos [4191,6800,2.204]
    };
};```
subtle ore
#

Sure, your case check can be anything. Including the variable you are checking.

switch _var + 1 do { };  //can't do
switch (_var + 1) do 
{
    case 2 :
    {
        //can
    };
};
drowsy axle
#

sweet

#

@subtle ore Doesn't seem to work..

subtle ore
#
{
    switch _x do
    {
        case "northStand_1":
        {
        };
    };
} forEach _stands
drowsy axle
#
{
    switch _wallSetPosOpen do
    {
        case "northStand_1":
        {
            northWall setPos [4191,6800,2.204]
        };
        case "northStand_2":
        {
            northWall setPos [4191,6800,2.204]
        };
        case "southStand_1":
        {
            southWall setPos [4191,6768,2.204]
        };
        case "southStand_2":
        {
            southWall setPos [4191,6768,2.204]
        };
        case "eastStand_1":
        {
            eastWall setPos [4176,6785,2.204]
        };
        case "eastStand_2":
        {
            eastWall setPos [4176,6785,2.204]
        };
        case "westStand_1":
        {
            westWall setPos [4208,6785,2.204]
        };
        case "westStand_2":
        {
            westWall setPos [4208,6785,2.204]
        };
    };

    switch _wallSetPosClose do
    {
        case "northStand_1":
        {
            northWall setPos [4191,6800,0.204]
        };
        case "northStand_2":
        {
            northWall setPos [4191,6800,0.204]
        };
        case "southStand_1":
        {
            southWall setPos [4191,6768,0.204]
        };
        case "southStand_2":
        {
            southWall setPos [4191,6768,0.204]
        };
        case "eastStand_1":
        {
            eastWall setPos [4176,6785,0.204]
        };
        case "eastStand_2":
        {
            eastWall setPos [4176,6785,0.204]
        };
        case "westStand_1":
        {
            westWall setPos [4208,6785,0.204]
        };
        case "westStand_2":
        {
            westWall setPos [4208,6785,0.204]
        };
    };

    _x addAction [
        "<t color='#44bd32'>Open</t>",
        {
        _wallSetPosOpen
        }
    ];

    _x addAction [
        "<t color='#e84118'>Close</t>",
        {
        _wallSetPosClose
        }
    ];
} forEach _stands;```
#

ah {}

subtle ore
#

put a space between your case and string as well

drowsy axle
#

hmm the _wallSetPosOpen/Close switch doesn't like the addaction

subtle ore
#

Also, none of those addActions work with outside variables unless you pass them in:

_x addAction["Close",
{
    _action  = (_this select 3) select 0;
    hintSilent format["Action variable: %1",_action];
},[_action]];
drowsy axle
#

_action is the Open/Close ?

subtle ore
#
_x addAction["<t color='#e84118'>Close</t>",
{
    _wallSetPosClose = (_this select 3) select 0;
},[_wallSetPosClose]];
wary vine
#

just so i dont mess up... can I do callbacks with an exitWith...

subtle ore
#

you mean?

if(var) exitWith
{
    [] call fn_yourVar; 
};
drowsy axle
#

@subtle ore Fixed above.

wary vine
#

i.e _bool = [] call function

if (true) exitWith {
something = true;
something;
};
subtle ore
#

Still nothing working Capwell?

drowsy axle
little eagle
#

Yes you can. Except when the return value is for eventhandlers like HandleDamage or KeyDown and you're in the main scope.

subtle ore
#

_wallSetPosOpen isn't defined 🤷

wary vine
#

@commy its litteraly just to stop the code looping through the rest of the conditions.

subtle ore
#

in your code, it has no idea what _wallSetPosOpen is.

little eagle
#

Post the whole code maybe.

wary vine
#
  if (_itemCategory == "equipped") then {
    if ((_itemClassname == (uniform player)) && (!(_itemRemoved))) then {removeUniform player;_itemRemoved = true};
    if ((_itemClassname == (vest player)) && (!(_itemRemoved))) then {removeVest player;_itemRemoved = true};
    if ((_itemClassname == (backpack player)) && (!(_itemRemoved))) then {removeBackpack player;_itemRemoved = true};
    if ((_itemClassname == (headGear player)) && (!(_itemRemoved))) then {removeHeadgear player;_itemRemoved = true};
    if ((_itemClassname == (goggles player)) && (!(_itemRemoved))) then {removeGoggles player;_itemRemoved = true};
    if ((_itemClassname == (primaryWeapon player)) && (!(_itemRemoved))) then {player removeWeapon _itemClassname;_itemRemoved = true};
    if ((_itemClassname == (secondaryweapon player)) && (!(_itemRemoved))) then {player removeWeapon _itemClassname;_itemRemoved = true};
    if ((_itemClassname == (handgunWeapon player)) && (!(_itemRemoved))) then {player removeWeapon _itemClassname;_itemRemoved = true};
    if ((_itemClassname in (assigneditems player)) && (!(_itemRemoved))) then {player unassignItem _itemClassname;player removeItem _itemClassname;_itemRemoved = true};
  };
``` basically so i can tidy this up xD
drowsy axle
#
switch _wallSetPosClose do
    {
        case "northStand_1":
        {
            _wallSetPosClose = northWall setPos [4191,6800,0.204]
        };
        case "northStand_2":
        {
            _wallSetPosClose = northWall setPos [4191,6800,0.204]
        };
        case "southStand_1":
        {
            _wallSetPosClose = southWall setPos [4191,6768,0.204]
        };
        case "southStand_2":
        {
            _wallSetPosClose = southWall setPos [4191,6768,0.204]
        };
        case "eastStand_1":
        {
            _wallSetPosClose = eastWall setPos [4176,6785,0.204]
        };
        case "eastStand_2":
        {
            _wallSetPosClose = eastWall setPos [4176,6785,0.204]
        };
        case "westStand_1":
        {
            _wallSetPosClose = westWall setPos [4208,6785,0.204]
        };
        case "westStand_2":
        {
            _wallSetPosClose = westWall setPos [4208,6785,0.204]
        };
    };``` Would that solve it?
wary vine
#

case sensitivity ?

subtle ore
#

No...it still has no idea what _wallSetPosOpen is. Does _x contain your strings you are checking for?

wary vine
#

I always use toLower(_string) and put lower case on all my switch cases now

drowsy axle
#

@subtle ore ```sqf
_stands = [
"northStand_1",
"northStand_2",
"southStand_1",
"southStand_2",
"eastStand_1",
"eastStand_2",
"westStand_1",
"westStand_2"
];

{
// code
} forEach _stands;```

wary vine
#

// code is the code your having issue with ?

subtle ore
#

gonna pastebin

wary vine
#
_stands = [
  "northStand_1",
  "northStand_2",
  "southStand_1",
  "southStand_2",
  "eastStand_1",
  "eastStand_2",
  "westStand_1",
  "westStand_2"
];

{
  switch (toLower _x) do
  {
      case ("northstand_1") : {northWall setPos [4191,6800,0.204]};
      case ("northstand_2") : {northWall setPos [4191,6800,0.204]};
      case ("southstand_1") : {southWall setPos [4191,6768,0.204]};
      case ("southstand_2") : {southWall setPos [4191,6768,0.204]};
      case ("eaststand_1") : {eastWall setPos [4176,6785,0.204]};
      case ("eaststand_2") : {eastWall setPos [4176,6785,0.204]};
      case ("weststand_1") : {westWall setPos [4208,6785,0.204]};
      case ("weststand_2") : {westWall setPos [4208,6785,0.204]};
  };
}forEach _stands;
#

is that what you mean ?

subtle ore
#

No need for the brackets around your strings, not evaluating anything. Sort of like that yeah

wary vine
#

balls

#

I always do it .. xD

#

just to keep them all the same xD

subtle ore
wary vine
#

thats more lines then it needs to be 😛

#

I try to condense my switches if i can xD

#

just looks cleaner

drowsy axle
#

The stuff before LINE 22 works

#

The stuff after LINE 30 doesn't work

#

I just want to condense the code.

wary vine
#

o.o

#

sec

#

your trying to add an addaction on a string ?

drowsy axle
#

Variable.

wary vine
#

nope

subtle ore
#

Looks better than 20 lines of

if(true)then{};
if(true)then{};
if(true)then{};
wary vine
#

"eastStand_1",

#

is a tring

drowsy axle
#

Oh shit. I keep doing that

#

fuck me

wary vine
#

call (compile _x)

#

should turn it into a variable.

drowsy axle
#

??

wary vine
#

sec

#

in debug console watch

#

do

#

call (compile "southStand_2")

#

should return the object

#

even better

player setpos (getpos (call (compile "southStand_2")))
#

should tp you to the object.

#

@little eagle ```sqf
if (_itemCategory == "equipped") then {
if (_itemClassname == (uniform player)) exitWith {removeUniform player;true};
if (_itemClassname == (vest player)) exitWith {removeVest player;true};
if (_itemClassname == (backpack player)) exitWith {removeBackpack player;true};
if (_itemClassname == (headGear player)) exitWith {removeHeadgear player;true};
if (_itemClassname == (goggles player)) exitWith {removeGoggles player;true};
if (_itemClassname == (primaryWeapon player)) exitWith {player removeWeapon _itemClassname;true};
if (_itemClassname == (secondaryweapon player)) exitWith {player removeWeapon _itemClassname;true};
if (_itemClassname == (handgunWeapon player)) exitWith {player removeWeapon _itemClassname;true};
if (_itemClassname in (assigneditems player)) exitWith {player unassignItem _itemClassname;player removeItem _itemClassname;true};
};

drowsy axle
#

I'm not tping to it

#

Want me to show a gif?

knotty mantle
#

@drowsy axle in your pastebin you are also switching variables that havent been declared. wallSetPosOpen and wallSetPosClose arent declared.

drowsy axle
#

I don't need to... I'm declaring them in the switch cases

#

Oh wait

#

wtf

#

Just double checked the pastebin.

knotty mantle
#

you cant declare something you want to check for :D. I think. At least declare it as "".

drowsy axle
#

Nothing..

knotty mantle
#

Otherwise it is Nil

drowsy axle
#

Okay

wary vine
#

have you got the object variables set at those in the array ?

drowsy axle
#
_wallSetPosClose = "";
_wallSetPosOpen = "";```
#

this: sqf _stands = [ northStand_1, northStand_2, southStand_1, southStand_2, eastStand_1, eastStand_2, westStand_1, westStand_2 ];

#

or this: ```sqf
_stands = [
"northStand_1",
"northStand_2",
"southStand_1",
"southStand_2",
"eastStand_1",
"eastStand_2",
"westStand_1",
"westStand_2
];

#

They are variables (objs) in game

knotty mantle
#

Yeah but that whole thing makes no sense imo.

#

_wallSetPosClose = northWall setPos [4191,6800,0.204]

drowsy axle
#

Okay.. let me start from the top

knotty mantle
#

setPos doesnt return anything

drowsy axle
#

Not meant to

#
northStand_1  addAction ["<t color='#44bd32'>Open</t>",{northWall setPos [4191,6800,2.204]}];
southStand_1 addAction ["<t color='#44bd32'>Open</t>",{southWall setPos [4191,6768,2.204]}];
eastStand_1 addAction ["<t color='#44bd32'>Open</t>",{eastWall setPos [4176,6785,2.204]}];
westStand_1 addAction ["<t color='#44bd32'>Open</t>",{westWall setPos [4208,6785,2.204]}];

northStand_2 addAction ["<t color='#44bd32'>Open</t>",{northWall setPos [4191,6800,2.204]}];
southStand_2 addAction ["<t color='#44bd32'>Open</t>",{southWall setPos [4191,6768,2.204]}];
eastStand_2 addAction ["<t color='#44bd32'>Open</t>",{eastWall setPos [4176,6785,2.204]}];
westStand_2 addAction ["<t color='#44bd32'>Open</t>",{westWall setPos [4208,6785,2.204]}];

northStand_1 addAction ["<t color='#e84118'>Close</t>",{northWall setPos [4191,6800,0.204]}];
southStand_1 addAction ["<t color='#e84118'>Close</t>",{southWall setPos [4191,6768,0.204]}];
eastStand_1 addAction ["<t color='#e84118'>Close</t>",{eastWall setPos [4176,6785,0.204]}];
westStand_1 addAction ["<t color='#e84118'>Close</t>",{westWall setPos [4208,6785,0.204]}];

northStand_2 addAction ["<t color='#e84118'>Close</t>",{northWall setPos [4191,6800,0.204]}];
southStand_2 addAction ["<t color='#e84118'>Close</t>",{southWall setPos [4191,6768,0.204]}];
eastStand_2 addAction ["<t color='#e84118'>Close</t>",{eastWall setPos [4176,6785,0.204]}];
westStand_2 addAction ["<t color='#e84118'>Close</t>",{westWall setPos [4208,6785,0.204]}];``` this above WORKS.
knotty mantle
#

yep.

drowsy axle
#

However, I want to simplify it. So I can add more "DOORS".

#

I just want what i've got at the moment. In a more "adaptable" version.

#

I've tried the foreach

knotty mantle
#

Basically you have 8 "stands" and each of them shall be open- and closeable?

drowsy axle
#

The stand is the object that the player addactions. The *Wall is the object it's moving 2 up or 2 down. to either open or close.

knotty mantle
#

yeah. But is there a limit how many can be open?

drowsy axle
#

Nope

knotty mantle
#

Or is it just a switch that there should be an action if it is currently open then you can close it and the other way round?

wary vine
#

fnc_someFunction  = {
  params ["_str"];
  switch (_str) do
  {
      case ("northstand_1_open") : {northWall setPos [4191,6800,0.204]};
      case ("northstand_2_open") : {northWall setPos [4191,6800,0.204]};
      case ("southstand_1_open") : {southWall setPos [4191,6768,0.204]};
      case ("southstand_2_open") : {southWall setPos [4191,6768,0.204]};
      case ("eaststand_1_open") : {eastWall setPos [4176,6785,0.204]};
      case ("eaststand_2_open") : {eastWall setPos [4176,6785,0.204]};
      case ("westStand_1_open") : {westWall setPos [4208,6785,0.204]};
      case ("westStand_2_open") : {westWall setPos [4208,6785,0.204]};
      case ("northstand_1_close") : {northWall setPos [4191,6800,0.204]};
      case ("northstand_2_close") : {northWall setPos [4191,6800,0.204]};
      case ("southstand_1_close") : {southWall setPos [4191,6768,0.204]};
      case ("southstand_2_close") : {southWall setPos [4191,6768,0.204]};
      case ("eaststand_1_close") : {eastWall setPos [4176,6785,0.204]};
      case ("eaststand_2_close") : {eastWall setPos [4176,6785,0.204]};
      case ("westStand_1_close") : {westWall setPos [4208,6785,0.204]};
      case ("westStand_2_close") : {westWall setPos [4208,6785,0.204]};    
  };
};


_stands = [
  northStand_1,
  northStand_2,
  southStand_1,
  southStand_2,
  eastStand_1,
  eastStand_2,
  westStand_1,
  westStand_2
];

{
  _varAsStr = str _x;
  _x addAction ["<t color='#44bd32'>Open</t>","[format ['%1_open',_varAsStr]] call fnc_someFunction"];
  _x addAction ["<t color='#e84118'>Close</t>","[format ['%1_close',_varAsStr]] call fnc_someFunction"];
}forEach _stands;
#

oh shit wait

#

you will have to edit the positions.

#

im not sure what they are supposed to be...

#

just ry that.

drowsy axle
#

What do you mean @knotty mantle

knotty mantle
#

Just a sec. Why do you have two stands each with exactly same positions?

wary vine
#

i didnt do all the position, not sure where he needs all of them

drowsy axle
#

I'll do you guys a gif. One sec.

knotty mantle
#

It is basically getPos select 2 +- 2

#

Nothing else changes on positions 😃

#

That would be great 😃

drowsy axle
#

Yeah. but I know the pos... so no need to get it. Because if someone open/closes too quick it bugs out.

wary vine
#

would be better if you did a nice animation 😉 so it slides open and close instead of just snapping 😉

drowsy axle
knotty mantle
#

lets give him what he wants first and THEN improve what he got 😄

drowsy axle
#

Yup

#

I can do it 0.05 to 2

#

to make it "smooth"

knotty mantle
#

Ah and you got 8 of those little boards. But only 4 walls?

drowsy axle
#

Eight Stands... Each side of the four walls

wary vine
#

no i mean send the door through to a function, that slowly moves it up and down, only prob would be it might cause strain 😉

drowsy axle
#

northWall northStand_1 northstand_2 x 4

wary vine
#

you would also want to put a condition on the door, so it cant be closed whilst it is already closed

drowsy axle
#

Doesn't matter @wary vine

#

If it's closed. it closes

wary vine
#

that might be the buggyness you described

little eagle
#

I would've just placed them all and then hid or shown them using hideObject.

drowsy axle
#

@little eagle Yeah... might do that for a secret door 😉

#

bookcase addaction

#

😛

#

@wary vine The bug was that it would move as the game sends the pos of object to 0,0,0 for a "tick"

#

and the way I first done it was that it got the pos of the object and just moved it down.

#

After multiple "bugs" it would be inside the other walls

#

@knotty mantle Did you like my gif?

knotty mantle
#

yeah i am writing something currently. Might be PMing you shortly 😃

#

Does it start opened or closed?

drowsy axle
#

closed

#

open i mean

#

open

knotty mantle
#

check.

subtle ore
#

That's a lot of planks..

drowsy axle
#

Yup all simple objects and no simulation

#

100m x 100m of pallets 😛

#

pallets are actually not square 😦

subtle ore
#

?

wary vine
#

wanna take a look at what i got ?

drowsy axle
#

What you got?

wary vine
#

sec

drowsy axle
#

Oh that's cool

#

too slow but cool

wary vine
#
fnc_animateDoor1 = {

  params [
    ["_door",objNull,[objNull]],
    ["_anim","open", [""]]
  ];

  private _startHeight = ((getpos _door) select 2);
  private _steps = 1000;
  private _distancePerStep = (2 / _steps);
  private _finalHeight = 0;
  private _calc = {};
  
  systemChat str _anim;
  
  switch (toLower _anim) do {
    case "open" : {
      _finalHeight = _startHeight - 2;
      _calc = {((getpos _door) select 2) - _distancePerStep};
    };
    case "close" : {
      _finalHeight = _startHeight + 2;
      _calc = {((getpos _door) select 2) + _distancePerStep};
    };
  };

  for "_i" from 1 to _steps do {
      private _z = call _calc;
      private _x = (getpos _door) select 0; 
      private _y = (getpos _door) select 1; 
      _door setPos [_x,_y,_z];
      sleep 0.01;
  };
};

[testWall,"open"] spawn fnc_animateDoor1;
#

not great

#

but works

drowsy axle
#

What do I change to make it go down further?

#

oh wait nvm

wary vine
#

it should already be 2

#
testWall,"open"] spawn fnc_animateDoor1;
#

that should be the call for it.

#

so with yours istead of set pos, use [doorVar,"open/close"] spawn fnc_animateDoor;

drowsy axle
#

hmm that's good

wary vine
#

gimmie 5, ill try to do the whole lot

knotty mantle
#

This:

for "_i" from 1 to _steps do {
      private _z = call _calc;
      private _x = (getpos _door) select 0; 
      private _y = (getpos _door) select 1; 
      _door setPos [_x,_y,_z];
      sleep 0.01;
  };

Might be easier as

for "_i" from 1 to _steps do {
      _door setPos ((getPos _door) vectorAdd [0,0,(call _calc)]);
      sleep 0.01;
  };
drowsy axle
#
northStand_1 addAction [northWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
northStand_2 addAction [northWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
southStand_1 addAction [southWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
southStand_2 addAction [southWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
eastStand_1 addAction [eastWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
eastStand_2 addAction [eastWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
westStand_1 addAction [westWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
westStand_2 addAction [westWall,"<t color='#44bd32'>Open</t>"] spawn fnc_animateDoor1;
///                                                                                  \\\
northStand_1 addAction [northWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;
northStand_2 addAction [northWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;
southStand_1 addAction [southWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;
southStand_2 addAction [southWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;
eastStand_1 addAction [eastWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;
eastStand_2 addAction [eastWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;
westStand_1 addAction [westWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;
westStand_2 addAction [westWall,"<t color='#e84118'>Close</t>"] spawn fnc_animateDoor1;```
#

The "" with open / close is the case yes.

#

is it the whole "" or just if open / close are found

#
switch (toLower _anim) do {
    case "Open" : {
      _finalHeight = _startHeight - 2;
      _calc = {((getpos _door) select 2) - _distancePerStep};
    };
    case "Close" : {
      _finalHeight = _startHeight + 2;
      _calc = {((getpos _door) select 2) + _distancePerStep};
    };
  };```
wary vine
#

just run that in debug console.

#

or put in an init.sqf

#

tell me if it works.

drowsy axle
#

what's that about? fnc_openDoor

wary vine
#

it uses a switch case to launch the animate function on the right door.

drowsy axle
#

Okay

wary vine
#

if it doesnt work for you, zip up your mission.

#

and ill take a look

knotty mantle
#

@wary vine you have to set the "inUse" as false at the end :p

wary vine
#

oh balls/.

#

I new i forgot something

#

@drowsy axle wait.

knotty mantle
#

Aaaand _door setPos ((getPos _door) vectorAdd [0,0,(call _calc)]); that might be a bit better in the last for loop 😃

drowsy axle
#

i'm waiting 😛

wary vine
drowsy axle
#

What did you forget?

#

_varAsStr = str _x;

wary vine
#

yup

#

turning the variable of the stand into a string, so I can use it in the switch case for open and close 😉

knotty mantle
#

@wary vine you know what the problem with your idea is?

wary vine
#

laaaaaaaaag

knotty mantle
#

He has two boards 😄 and by doing it anim style you dont have absolute positions.

#

Which means. If he opens it 3 times. it goes through the roof 😄

wary vine
#

shh

#

xD

#

ill do another var for that xD

#

wait wut ?

#

dafuq

#

i tested that bit o.O

knotty mantle
#

yeah i was working on it as well. Even was showing only the open OR close action that he couldnt do it twice. But then i remembered the second stand.

#

That was the time i gave up and just started looking over your code xD

wary vine
#

@knotty mantle NearestObjects 😉

knotty mantle
#

nah missionnamespace getVariable [((str _x) + "status"), "opened"] 😄

drowsy axle
#

huh?

wary vine
#

gotta love arma

drowsy axle
#

_stands aren't "" they're vars

wary vine
#

var > string > var > string > var

drowsy axle
#

??

knotty mantle
#

that´s why you str them. in your code

drowsy axle
#

so why is varAsStr failing?

wary vine
#

do me a solid

knotty mantle
#

@drowsy axle put a _varAsStr = ""; above the foreach.

drowsy axle
#

What's this? case ("northstand_1_open")

#

I done still same issue.

wary vine
#
_stands = [
  northStand_1,
  northStand_2,
  southStand_1,
  southStand_2,
  eastStand_1,
  eastStand_2,
  westStand_1,
  westStand_2
];

{
  _varAsStr = str _x;
  systemchat _varAsStr;
}forEach _stands;
#

run in debug console.

drowsy axle
#

no north

#

however it's SP so I can't scroll up

wary vine
#

do they output strings ?

drowsy axle
#

Yes

#

I guess if the systemChat works

wary vine
#

nope

#

i think i know the issue

drowsy axle
#

I see

#

it's the "" with open and close

#

because the

#

"<t color='#e84118'>Close</t>","[format ['%1_close',_varAsStr]]

#

oh wait nvm

#

Couldn't you change _varAsStr = str _x; to _varAsStr = _x; _x str;

#

_varAsStr = (str _x);

wary vine
#

are the doors the only object of that type nearby ?

drowsy axle
#

Yes

#

Oh wait no

wary vine
#

feck

drowsy axle
#

Oh yeah sorry

#

Sorry im getting mixed up. There no other objects like that. that aren't defined with a var

#

all objects of the door are var'd up

#

however, there are multiple doors.

#

name PositionWall

knotty mantle
#

How do i exit a whole script instead of just the scope i am in?

#

@wary vine have a look at this. Made small changes to your anim switches. should prevent further opening of opened doors.

#

Ooooh and you might have mixed up the +/- 😄 Cause the open case actually reduces the z variable 😄

drowsy axle
#

still the varStr exception

wary vine
#

im working on it.

drowsy axle
#

Okay.

wary vine
#

RIGHT

#

feck

#

sec

#

that workd

#

once you have tested, you can remove the systemChats

little eagle
#

@knotty mantle

scopeName "main"

call {
    call {
        127 breakOut "main";
    };
};
#

Makes the function return 127 and works like the return command in other languages.

knotty mantle
#

Thanks 😃

#

@wary vine you are not setting a status of the door anywhere. And you dont need the _finalheight var

wary vine
#
  if (_itemCategory == "equipped") then {
    if (_itemClassname == (uniform player)) exitWith {removeUniform player;true};
    if (_itemClassname == (vest player)) exitWith {removeVest player;true};
    if (_itemClassname == (backpack player)) exitWith {removeBackpack player;true};
    if (_itemClassname == (headGear player)) exitWith {removeHeadgear player;true};
    if (_itemClassname == (goggles player)) exitWith {removeGoggles player;true};
    if (_itemClassname == (primaryWeapon player)) exitWith {player removeWeapon _itemClassname;true};
    if (_itemClassname == (secondaryweapon player)) exitWith {player removeWeapon _itemClassname;true};
    if (_itemClassname == (handgunWeapon player)) exitWith {player removeWeapon _itemClassname;true};
    if (_itemClassname in (assigneditems player)) exitWith {player unassignItem _itemClassname;player removeItem _itemClassname;true};
  };
``` commy that should work right ? in regards to my question earlier ?
#

meeeeh

ornate pawn
#

Hey guys does anybody knows how to make this addAction only to appear in the scroll menu when I'm close to another object?

#
[
  player,
  "Preparation",
  "images\take_ca.paa",
  "images\take_ca.paa",
  "_target distance player < 2",
  "_target distance player < 2",
  {},
  {},
  {
    p2 switchMove "Acts_JetsCrewaidL_idle_m";
    sleep 3;
   
    p2 switchMove "Acts_JetsCrewaidFCrouch_in";
    sleep 2.9;

    p2 switchMove "Acts_JetsCrewaidFCrouch_loop";
    sleep 2;

    p2 switchMove "Acts_JetsCrewaidFCrouchThumbup_in";
    sleep 2;

    p2 switchMove "Acts_JetsCrewaidFCrouchThumbup_out";
    sleep 1;

    p2 switchMove "Acts_JetsCrewaidFCrouch_out";
  },
  {},
  [],
  0.5,
  1000,
  false,
  false
] call BIS_fnc_holdActionAdd;
drowsy axle
#

Doesn't close the door.

knotty mantle
#

oh and you still have +/- mixed up 😄

#

close action opens the door and other way round 😄

wary vine
#

thats the way he wants it i think

drowsy axle
#

neither worked

wary vine
#

dafuq

#

zip up your mission, and send to me

ornate pawn
#

Only display the addAction in the scroll menu if the player or designated target is close to a box or whatever object i just dont wanna have the addAction all the time in my scroll menu.

drowsy axle
#

Done @wary vine

knotty mantle
#

@ornate pawn _target refers to the unit the action is added to. So "_target distance player < 2" is basically "player distance player < 2" and that is always true

ornate pawn
#

I need the addAction ONLY to appear if the player is close to an object that im going to assign

knotty mantle
#

so either add the action to the box you mentioned or switch the player in the condition to something you want to check for

ornate pawn
#

what i mean is if i'm not close to that object I don't want the addAction to be visible in my scroll menu

#

is for marshalling Area

knotty mantle
#

yeah. That is what i said.

ornate pawn
#

I've done it and the action still appears.

knotty mantle
#

Either add the action to the object you want yourself to be close by or check in the condition if the object is nearby

ornate pawn
#

okay

#

i will mess around with the script again.

wary vine
#

@drowsy axle do the doors come up or down ?

knotty mantle
#

"_target distance _yourBoxHere < 2" should work.

ornate pawn
#

I want the action only to appear in the scroll menu only if im inside the Marshalling area

wary vine
#

im confused.

drowsy axle
#

down @wary vine

#

@ornate pawn Have a trigger.

ornate pawn
#

a trigger for what?

sick sorrel
#

would this in the init file of the object work? "_this distance _target < 2"

ornate pawn
#

I have everything in an sqf file i don't wanna mess with init boxes

drowsy axle
#

How big is your area?

ornate pawn
#

i can designate an area

#

prob 10 m

knotty mantle
#

nah i am talking about the function he is using. Not an initbox or something else. But. Bullseye do you have the area with a marker?

drowsy axle
#

Place a marker in the center then do sqf player distance marker_12948273948234 <= 10

ornate pawn
#

No i was thinking about a marker

#

prob place the marker in the middle

drowsy axle
#

I just said that... 🤦🏻

ornate pawn
#

Can i change player to Marshall_Dude_1 or something like that yeah? so the rest of the crew doesn't get thos addActions in the scroll menu

knotty mantle
#

maybe he didnt read it yet. Not so harsh mate 😃

ornate pawn
#

i see that Capwell

knotty mantle
#

Yep