#arma3_scripting

1 messages · Page 390 of 1

little eagle
#

Reminds me of that one alien from Men in Black.

subtle ore
#

Which one?

meager granite
#

(Ok, enough with weird screenshots)

subtle ore
#

Heheheheh

cloud thunder
#

The taffy monster ragdoll thing definately needs fixing. Been this way for very long time Not sure what is happening. For example sometimes with my suicide bomber as he moves towards you a satchel is spawned and attached to him then Allah Akbar, boom, Instant taffy monster. Locality never changes on bomber or charge. Its always on server. At least I think its not changing because all bomber and bomb is always created on server. Most of the time it doesn't happen but sometimes it does. Occurs more often when mods are running.
I've seen the thing with stiff straight arms when fps is very low.

compact maple
#

Hello guys, is there anyway i can screenshot every uniform in the arsenal ? working on a php panel so i need image according to classnames

lone glade
#

there's a function to "export" specific objects / vehicles

#

it basically spawn them in a gray box and screenshot it

compact maple
#

yep thanks, its working well for vehicles, but apparently not for uniform and all kind of gear, headgear

austere granite
#

@meager granite i use enableSimulation false on setUnconscious units

#

also used for dragging and so

#

to keep them in ragdoll. my old reviev sytsem also kept them as dead, but wasn't too happy with that either

#
        _unit setVariable ["Unconscious", true, true];
        _unit setUnconscious true;
        _unit spawn {
            waitUntil { (animationState _this) in ["unconsciousfaceleft", "unconsciousfaceright", "unconsciousfacedown", "unconsciousfaceup"] };
            if !(isNull (_this getVariable [QGVAR(draggedBy), objNull])) exitWith { }; // -- If being dragged right away do't disable sim
            _this enableSimulation false;
            ["enableSimulation", [_this, false]] call ClibFUNC(serverEvent);
        };

basically

#

overal the whole ragdoll state is one massive buggy mess though 😦

meager granite
#

Don't think simulation would help my case though

blissful wind
#

when I have problems like that I use the moto: "if you dont want them to see it, hide it" but thats for other games you all have tons more exp with arma engine then I do. But hiding, replacing it then unhide it who knows...

candid jay
#

all, i realize this is a generic question but what can cause a game crash if you click on respawn?

#

I have a mod that is super minimal.

#

it does have a while loop with a sleep in it. so minimal i don’t get it.

little eagle
#

Does it always crash?

candid jay
#

yes.

little eagle
#

createDisplay could crash the game.

candid jay
#

no display created.

little eagle
#

ACE spectator?!

candid jay
#

it has ACE as dependency but ACE alone does not make the game crash on respawn

little eagle
candid jay
#

no spectator. simple alive player in game clicks on ESC then respawn.

#

wth

little eagle
#

Freeze or ctd?

candid jay
#

back to desktop

little eagle
#

But only in that mission.

candid jay
#

only with this small mod.

#

ok i was hoping for something generic besides the obvious idiotic stuff

#

i’ll have to dig in then

#

thanks commy

austere granite
#

is there a scripted way of detecting which item in a listbox / treeview / etc you're doing a mouseover?

#

basically i wanna do different scripted tooltips

austere granite
#

Not what i want. The data is constantly going to change, and rather than making an event that updates all the tooltips all the time, i'd much rather just do something that would just run some code when the tooltip opens up, and then use that return fo that code to set tooltip on the fly

#

aka

#

_control lbSetTooltipDynamic [0, { call FUNC(doSomething }];

little eagle
#

Currently hovered over lb item ...

austere granite
#

yep

#

and tv item

little eagle
#

I don't think that exists.

austere granite
#

I don't think so either, but i was hoping someone could prove me wrong

little eagle
#

But if the data changes constantly, you must be using lbSetData/Picture/Value anyway all the time, no?

austere granite
#

maybe there'ssome hacky way to do an onLoad or isNull check on tooltip control type....

#

nope

little eagle
#

So just the tooltip is supposed to change, but not the text and picture? That is a weird menu you're building.

austere granite
#

list of objects currently placed in object placement tool for terrains. The object placed/deleted isn't THAT fast... but when you're scrolling to change for example the scale of the object, that changes a lot and would be nice if i could just do getVariable on it

little eagle
#

Ah.

#

How many lb items will there be in the list?

austere granite
#

couple thousand

#

😄

little eagle
#

: (

#

Not possible without looping through them all afaik.

austere granite
#

i was going to just keep a namespace of which index an added object has in the list, but then if i delete one... it means adjusting everyting below it again

little eagle
#

The problem is that you can't tell which item is hovered over.

#

So you have to adjust all.

austere granite
#

yep

little eagle
#

Alternatively, adjust say 100 per frame and then every 10 frames the current one would update. Is still 3 times per second on 30 fps.

austere granite
#

i remember ages ago i did somethign with checking mouse position, then getting origin of listbox + the size ofan item.... but that doesn't work for anyhthign that will scroll

little eagle
#

Sadly you can't request the position of a scroll bar, I think.

austere granite
#

also true

little eagle
#

What about doing 100 each frame? scheduling the work.

#

Would mean perf is independent of the number of items.

austere granite
#

Yeah thanks for the suggestion. Wasn't planning on doing it directly anyway, will end up doing something like that

tough abyss
#

So is the General Vanilla Medical System still tricky and unreliable in a basic Form? its been a while since i had to script anything medical related.

jovial ivy
meager granite
#

Just what it says you have idc defined twice

little eagle
#

Twice....

jovial ivy
#

🤦 Thanks. I guess I didn't see that 😛

little eagle
#

Btw, this:

    movingEnable = false;
    enableSimulation = true;

Doesn't work. Use 0 and 1 or #define those booleans as 0 and 1.

tough abyss
#

if your using extdb2/3 extensions it can return time with offset etc

#

pretty sure there are some date functions aswell

austere granite
#

if < 0 then _time + 24

little eagle
#

Ever heard of modulo?

austere granite
#

modulo is your friend

restive matrix
#

is it possible for two players on the same side to be an assigned curator as long as they are assigned to seperate curator modules? im running into a bug where if one player is an assigned curator in zeus on module A, and I assign a curator on the same side to a dynamically created module B, player assigned to module A can sometimes get a black screen and be unable to close Zeus / must restart game

#

but it doesn't happen every time

warm gorge
#

Modulo?

#

Nevermind

restive matrix
#

I know that, im doing it via script and that also works, but sometimes a player already within Zeus will get stuck on a black screen if another player is assigned to a newly created curator module during runtime, as if the game no longer sees them as being a curator so they are unable to close the interface and it gets stuck

#

im assuming its some kind of bug because the issue is inconsistent

earnest ore
#

They should run fine assigned to two seperate modules. I ran a mission a few days ago though and had similar issues, along with being unable to cancel remote control of a unit. Are they able to reach the escape menu / debug console?

restive matrix
#

hmm not sure about the escape menu / console, ill have to check next time, ive gotten stuck in ArmA interfaces before and was unable to open either so id assume not

#

code wise im pretty much doing exactly what MCC Sandbox mod does, tell the server to create and setup a new logic group then spawn and assign a new curator module to it, then simply assign/unassign a player curator to it later in the game, so it should be compatible with missions that already have curator things setup

earnest ore
#

Well, zues interface is display* #312 / 49 iirc - you might be able to work around it by providing a key bind that does a closeDialog until its worked out.

spice crypt
#

has the minimap (gps) display changed since the 1.78 update?

#

the GPS shows as display 311 ctrl 101 'CA_MiniMap' for me... but the icon rendering does not work for some reason.

spice crypt
#

nevermind, got it working.

still forum
#

You want to go to top left but you are going to top right? I'd say.. turn around and go the right way.
The Indentation is terrible and the code is not that readable.

#

That I don't understand your question and can't read your code because the indentation is so terrible
And the functions description of " " doesn't really help understanding what that thing is supposed to do

compact maple
#

Play with CTRL setPosition

#

Until you got the right position

still forum
#

whoever made that script seems to have no idea about what he is doing..

compact maple
#

So for variables
Header
Text field
Ctrlheader
Ctrltext

Just change the parameters

still forum
#

Let's set the position. Then immediatly set it again without any delay to a slightly different value.. wtf?

compact maple
#

He want it to be top right

still forum
#

I think 78/79 move it

#

Well no... I don't know.. The indentation...

compact maple
#

Actually notif are spawning top left, he doesn't want theses to spawn here

#

Yes ind is terrible but it's easily readable if you jump some lines

still forum
#

Why can't people just use somewhat readable indentation and some code bin thingy site that supports SQF

#

(╯°□°)╯︵ ┻━┻

#

If you want to move from left to right you just need to change the X value of the position

#

So L 36/44/46/78/79 change the 0.005 to.. 0.8 or something

queen cargo
still forum
#

Sounds good!

still forum
main oriole
#

@still forum lol is there a channel for that 😂

jade abyss
#

@main oriole You can delete yours in here now

still forum
#

Cross posts are against the #rules how good that you can just delete messages in Discord... And how good that every second guy seems to be unable to delete messages.. Wait.. no.. that's not good
I bet most people just ignore #rules and so don't even know that cross posting is not allowed. Or when people tell them where to post.. They seem to think it's the fault of the guy that directed them elsewhere.

jade abyss
#

I guess some of them think "Uh, i am intellitentetetet. Me has no see this message, lolzroflpip, they never know, lolzroflpipfart."
A little thing they tend to forget: The Message will be deleted anyway (but in this case it's incl. them). ¯_(ツ)_/¯

compact maple
#

hello guys, if I create a eventhandler fired, and if i call a function with _this in param what am I able to get exactly ? The player who fired ? His guns ?

jade abyss
#

You get all the informations about all the EHs (incl. a list of "_this" entrys/outputs)

compact maple
#

Thanks you I already know the 1st page, but not the 2

compact maple
#

yep thx ! 😃

jade abyss
#

👍

little eagle
dim terrace
#

is it still part of UI?

little eagle
#

What do you mean?

#

It's a control (group) on display 46, but can be added to any other display.

dim terrace
#

and it's animated by hand or is it scripted?

little eagle
#

Scripted.

dim terrace
#

ah, thought you find a way to use those animation sources for compass

little eagle
#

I don't think that would work outside the zeus display.

#

This is meant for the ACE spectator.

#

Eventually.

proven crystal
#

what is QGVAR ?

austere granite
#

macrobois unite

#

it's a macro, when the function compliles it'll replace those by whatever it's set to

#

for example QGVAR(uwot) is <prefix>_<module>_uwot

#

in CBA it means QGVAR(uwot) within module foo it would translate to CBA_foo_uwot

#

it's a nice way of making sure everytihng is prefixed, both with your mod prefix and your module prefix (That way you can use the same variable names between modules, without needing to type it out yourself

proven crystal
#

ok, not sure if i understand that

#

im just trying to figure out hoe to best change the patrolarea of a group. i give them a searcharea with CBA tasksearcharea

#

but i am not sure if it just changes the area if i call it again a second time

#

or if it adds areas

#

now looking into the function i see that the searcharea function runs recursively and i might just able to change the used parameters

#

[_group] call CBA_fnc_clearWaypoints;
_group setVariable [QGVAR(taskSearch), _args];

#

and this is what CBA does during a recursive call

#

where _args, is the array of parameters .... so maybe i could just do these two steps in my script?

#

and not interrupt the recursive loop, or rund a secornd one....

#

again, im not sure if the first one gets interrupted if i call the function a second time on the same group

little eagle
#

What's the problem? Did you copy paste the code and it would crash?

proven crystal
#

no i didnt copy paste anything yet.

#

cuurrently i just run the cba function that is fine

#

im just not sure what happens if i call the function a seco´nd time (with a different area)

#

will that run a second recursive loop?

#

while  {(count (units _group)) > 0} do {
    _destinations = _group getVariable ["fez_group_destinations", fez_activeAOs];
    diag_log format ["FEZ AI_OPS: %1 is assigned to Areas %2",_group, _destinations];
    _destination = selectrandom _destinations;
    [_group, _destination, "AWARE", "YELLOW", "FULL", "STAG COLUMN", "", [3,6,9]] call CBA_fnc_taskSearchArea;
    
    
    //sleep 1800;
    for "_i" from 1 to 60 do {
        sleep 30;
        _wpindex = currentWaypoint _group;
        _wppos = waypointPosition [_group,_wpindex];

        if (surfaceIsWater _wppos) then {
            _nearestlocation = nearestLocation [_wppos,""];
            _wppos = locationPosition _nearestlocation; 
            [_group, _wpindex] setWaypointPosition [_wppos, 20];
        };    

        _newdestinations = _group getVariable ["fez_group_destinations", fez_activeAOs];
        if (!(_newdestinations isEqualto _destinations)) then {
            //deleteWaypoint [_group, 1];
            _destinations = _newdestinations;
            diag_log format ["FEZ AI_OPS: AREAS CHANGED! %1 is now assigned to Areas %2",_group, _destinations];
            _destination = selectrandom _destinations;
            [_group] call CBA_fnc_clearWaypoints;
            //_group setVariable [QGVAR(taskSearch), _args];
            [_group, _destination, "AWARE", "YELLOW", "FULL", "STAG COLUMN", "", [3,6,9]] call CBA_fnc_taskSearchArea;
        } else {
            diag_log format ["FEZ AI_OPS: AREAS UNCHANGED! %1 is still assigned to Areas %2",_group, _destinations];
        };
        
        
    };
};

little eagle
#

Good question, I think you're supposed to only use it once. Have you tried doing it twice and observed what happened?

proven crystal
#

fairly simple
there is a list of markers as a variable attached to each group

#

iitially i just used the first bit, and that seem to work. so a group with that script on would search an area, and after a while when the while loop repeats, a new destination would be chosen

#

up to then it seemed fine

little eagle
#

Ah, CBA_fnc_clearWaypoints first and then CBA_fnc_taskSearchArea again. That could work.

proven crystal
#

as the units would change the area after a while, but now im thinking, that that might just be consequence of a second loop running

#

yes, i just added that, will see if that doies anything

#

i noticed that someting is going wrong when i added a script that changes the assigned destinations

#

which does cause the if/then part to fire

#

but they did not change destination

little eagle
#

There are no loops in that cba function. The recursion happens with the waypoint statement, and deleting all waypoints deletes that statement too.

#

But I think I know what you mean.

#

The variable still persists and so QGVAR(taskSearch) will carry over from the previous search task.

#

right?

proven crystal
#

it appears that something does persist, at least i did not notice the change that i wanted to see

little eagle
#

Try this...

#

Replace:

//_group setVariable [QGVAR(taskSearch), _args];//

with:

_group setVariable ["cba_ai_taskSearch", nil];
proven crystal
#

as i now have it there towards the end. correct? i just added that, will see now if it works

#

oh

#

right ill do that in addition to deletewaypoints

little eagle
#

I think that means that you can also get rid of [_group] call CBA_fnc_clearWaypoints;, since taskSearch seems to already clear all old waypoints.

proven crystal
#

sometimes double effort seems to do the job ^^

#

thanks for the tip. will see if that works

little eagle
#

You can clear it thrice if you want to. But it won't make any diff.

proven crystal
#

your variable there looks like it would do the job alone indeed

#

not sure if the deleting waypoints does it alone

little eagle
#

Hmm, I'm not so sure anymore.

#

Looking at the function...

gleaming cedar
#

Is it possible to speed up the time on a single module?

little eagle
#

It is possible to speed up simulation time in SP. But that affects everything.

gleaming cedar
#

Yeah

#

Just wanne do a single AI

#

I want a smoke module to go faster

little eagle
#

Not possible.

gleaming cedar
#

Ok thanks u

proven crystal
#

so deleting did the job

little eagle
#

Really? Surprising to me. It should work without deleting the variable and without deleting the waypoints.

proven crystal
#

i did not delete the variable

little eagle
#

Well, setVar nil DOES delete the variable.

proven crystal
#

looking at the function again, it does not show up there at all, does it?

little eagle
#

What shows up?

proven crystal
#

i mean the variable. its nowhere in the function. so how would it stop the recursiveness of it if it is not checked?

#

or am i overlooking it?

little eagle
#

Sorry, what variable again? I'm now confused.

proven crystal
#

_group setVariable ["cba_ai_taskSearch", nil];

#

cant see cba_ai_taskSearch there

little eagle
proven crystal
#

ah so thats the thing wth the prefix

#

now i see that part at least :D

little eagle
#

QGVAR(blah)
->
"ADDON_COMPONENT_blah"

#

ADDON is clearly cba, and the COMPONENT is ai.

#

So:

#

"cba_ai_blah"

#

But again, in theory you don't need to touch this variable and it should work anyway.

proven crystal
#

well i didnt. just deleted the old waypoints now. matter of fact, that might just have resulted in me seeing the result much faster. it could have changed the search area, but i would only see that after the last waypoint from the last recursion is done. maybe i just didnt wait long enough before. that would be a bit surprising but possible

candid jay
#

does init.sqf get called again when a player respawns?

little eagle
#

No.

#

Do you want it to?

candid jay
#

no

#

but this is what i don't get. dunno if you remember i told you a little mod crashed yesterday

#

Well, I have a function called on postInit:

class init { postInit = 1; };
#

in there:

player addEventHandler ["respawn", { [] call mymod_fnc_init; }];
#

this causes a neverending loop when a player clicks on respawn

#

i don't understand why.

little eagle
#

respawnTime is 0 / unset?

candid jay
#

correct

little eagle
#

You do realize that eventhandlers carry over to respawned units, right?

#

Copied from the corpse.

candid jay
#

no, I do not.

#

I do now.

#

but so?

little eagle
#

I think you essentially added a repawn eventhandler while respawning appending the array of respawn eventhandlers indefinitely.

candid jay
#

if my understanding is correct, init gets called only on postInit and that's on mission start.

little eagle
#

True.

candid jay
#

ok

little eagle
#

But you also call it from that respawn eventhandler.

candid jay
#

so I do not need to reinitialize a respawned unit.

little eagle
#

You must not.

candid jay
#

thank you, well that's an easy fix.

little eagle
#

Did it work?

candid jay
#

have to try

#

I remember the docs stating "SOME EH are kept"

little eagle
#

All of them are in A3.

candid jay
#

here: "Multiplayer: Some event handlers are persistent (i.e. they stay attached to a unit, even after it dies and respawns)."

#

but since I could not find anywhere which ones, I wrongly assumed respawn wasn't one of them.

little eagle
#

In A3, all of them are persistent. This is just a persistent comment from A2.

candid jay
#

not a comment unfortunately

#

it's in the doc.

little eagle
#

Same diff.

candid jay
#

lol

#

thank you commy.

little eagle
#

The doc itself is seldom worth more than the average comment.

candid jay
#

yeah that's why i lol'ed

#

Do you happen to know if CBA_fnc_addEventHandler are also persistent?

little eagle
#

They add to the mission namespace, so they persist as long as the mission persists.

#

Including loaded savegames.

#

Independent from respawning objects.

candid jay
#

ok sounds great. thank you.

#

so i basically just need to get rid of the unnecessary re-initialization of EH

#

that'll fix it

little eagle
#

I think so.

proven crystal
#

still on this recursiveness. if i run the function multiple times on the same group, wont it recurse multiple times in parallel? even if it uses the same destination....

#

in theory i should then see waypoints hopping a few times, the more often the loop runs, no?

#

if (isNil {param [1]}) then {

little eagle
#

The recursion happened when you respawn any of them.

proven crystal
#

ah right. the waypoint does the execution...

#

i do see waypoints jumping though... something assigns new waypoints before they are fulfilled.... m script moves them off of water surfaces, but this is hopping over different locationson land...

#

but its only one group out of 30 at the moment doing that stuff...

#

and the guys are standing around there. looks like they are still discussing where exactly they want to go

#

it even counts up the waypoint number, without adding more waypoints. im now at waypoint 27 for that guy...

#

deleted the waypoints for the guy, lets see if goes back into business after a while

#

having it with a new unit. the guys freeze and count up move waypoints. this ne is at 21 already

candid jay
#

All, does anyone know of an issue with the time command. I read in the comments (https://community.bistudio.com/wiki/time):

On overloaded servers (below ~10 server FPS), time readings are unreliable. Seconds actually take longer. While the clients keep a steady tempo, server time lags behind, resulting in considerable offset between client and server time (easily 30 minutes for a 2 hour game). Client time is synchronised to server time during JIP, but other than that it runs independently.

#

that was 7 years ago though, so arma2.

little eagle
#

time is everywhere different. Doesn't have to be a slow server.

candid jay
#

i know it’s different. i just want to know if time computes seconds correctly

#

because we have a countdown timer that uses it, and sometimes the countdown takes longer for no reason.

#

for instance countdown of 60 minutes starts at 11:00, at 12:00 there are still 18 minutes remaining.

#

code is _minutesRemaining = _countdownTime - floor(time/60)

#

running on server only

#

then remaining time is published to clients

little eagle
#

time is based on the ingame simulation time, not the real world time. And the simulation depends on the fps. Since you're using CBA anyway, I'd suggest you use CBA_missionTime instead. It's based on the real world time (machine clock) and synched for everyone on mission start.

candid jay
#

not using CBA in this mod

little eagle
#

Then hack something together with diag_tickTime.

candid jay
#

ok but still

#

is this normal?

little eagle
#

It has been like this since Arma 1.

#

So I guess?

candid jay
#

i understand that it is based off simulation but wth

#

not 18 minutes on a 60 minutes countdown

little eagle
#

¯_(ツ)_/¯

candid jay
#

a few seconds, Ooook

#

right 😃

edgy dune
#

_this addEventHandler ["Dammaged",{"code"}];  
``` is this the correct way to use the dammaged EH?
little eagle
#

What's "code"?

edgy dune
#

wat ever the code is

#

gona be

little eagle
#

The code can't be in quote marks, otherwise lgtm.

edgy dune
#

is commets ```css
/commet/

#

oh no i know thats just a place holder ,like i ment```css
/code goes there/

#

but thx tho

proven crystal
#

fez_OPS_Groups = fez_OPS_Groups select {count (units _x) > 0};
would that throw an error if _x is not a group, or would that element just not be part of the resulting array?

little eagle
#

units works for objects and groups.

#

units player
for example is just shorthand for
units group player

proven crystal
#

so if i had an array initially that contained for whatever reason markers or so in addition, that might be a problem? or are markers objects too?

little eagle
#

For markers it would error.

units #_x 
type STRING, expected GROUP, OBJECT
proven crystal
#

thanks again! good to have you around

river meteor
#

Anyone know of a good extdb3 tutorial? The documentation for how to actually execute queries in sqf is elluding me looking at their wiki

tough abyss
#

Have a look at another using mission using extdb3 or have a look @ https://bitbucket.org/torndeco/extdb3/issues/69/set-of-functions-used-to-handle-extdb3-api

river meteor
#

Those are exactly what I was looking for, thanks.

cloud thunder
#

What is the setPlateNumber and getPlateNumber command syntax

little eagle
#

Pretty sure these don't exist.

proven crystal
#

would be cool though ^^

#

plate on the tank

little eagle
#

car setPlateNumber "012345"

#

getPlateNumber car // "012345"

#

That's what I think they would be.

proven crystal
#

_building = selectrandom (nearestObjects [_pos, ["House", "Building"], 500]);

#

seems to return all sorts of things

#

but no buildings so far ^^

#

i mainly hit the lights on airport runway with it, and powerlines

#

street lamps...

#

ok. i should be fine if i could exclude lighting devices and power lines from the result. any idea how i could go about that?

#

i did hit a few buildings now, so they are at least not excluded....

cloud thunder
#

Yeah, those plate commands don't do anything. Strange that it was mentioned as added in Sitrep today.

subtle ore
#

Are you sure Jigsor?

cloud thunder
#
16:12:56   Error position: <setPlateNumber "012345">
16:12:56   Error Missing ;```
little eagle
#

This clearly says that the commands don't exist.

#

Maybe dev branch.

cloud thunder
#

I'm not on DevBranch, Can anyone on DevBranch confirm?

proven crystal
#

it says missing ; not that it doesnt exist ^^

subtle ore
#

No the command doesn't exist in stable

proven crystal
#

more importantly, how can we identify actual buildings in the game

#

one way seems to be by figuring out wich ones are enterable.... but that would then be only a fraction

subtle ore
#

What do you mean by that?

proven crystal
#

_building = selectrandom (nearestObjects [_pos, ["House", "Building"], 500]);

#

does return buildings but also a LOT of bullshit

#

streetlamps, benches, powerlines...

#

i would like some actual buildings. those that at least look like something where humans could enter

subtle ore
#

@proven crystal

private _buildingList = nearestObjects[_pos,["House","Building"],500] apply {count (_x buildingPos -1) != 0};
private _selection = selectRandom _buildingList;
#

Fixed

proven crystal
#

That would include non-enterable buildings?

subtle ore
#

Meehh....maybe , because if I remember correctly there are still memory points defined for the steps of the non enterable buildings

proven crystal
#

I shall try that tomorrow. Thanks

subtle ore
#

Sure.

proven crystal
#

How is apply there different to select?

subtle ore
#

To be honest with you, I think the only difference is that apply executes the code to each item in the array, while select is only concerned with returning the element if it meets conditions. Though I'm not 100% sure, someone else could probably explain it better.

proven crystal
#

just looked at the wiki. looks like apply can do a bit more than select

#

but what you sent there should work with select as well

subtle ore
#

Indeed

proven crystal
#

thanks again and goodnight

subtle ore
#

yep

limpid pewter
#

Hi, i am working on an enemy AI vehicle spawning system and i was wondering if anyone knew the best way to retrieve a list of all indepent vehicles only and put them into an array. I assume this can be done with configFiles, but i can't remember how to retrieve such a list.

hallow spear
#

anyway to recover a .sqf file that returns boxes of null after power outage?

cedar kindle
#

@subtle ore apply creates a new array based on what the code returns. your code would return an array of true/false

#

you want select in that code to filter out bad stuff

subtle ore
#

@cedar kindle gotcha, thanks for the clarification

rugged umbra
#

Hi there,
I am having an issue with the functions "in" and "find". I am querying a database in Exile. The output returns a string.

The string being searched: [[""CUP_B_M1128_MGS_Desert_Slat""],[""CUP_B_FV510_GB_D_SLAT""]]
The string trying to find: CUP_B_M1128_MGS_Desert_Slat

I am getting either false or -1 when using in or find respectively. Do I need to remove the brackets and the quotation marks in order for this function to work properly?

Regards, Dane

chilly wigeon
#

Anyone have any tips for detecting if a fired missile is an A2A missile?

#

I was hoping that the ammo, magazine, or weapon would be based off some A2A specific base class

#

but they all appear to use generic base classes like MissileLauncher which is used by A2G missiles too

#

I imagine theres some sort of guidance property that I could use to detect it, but I don't know nearly enough about CfgAmmo

vivid locust
#

When I call a function like this:

_var1 call testFunction;

Does the script pause until the function is done (even if it returns nothing) or will it continue?

peak plover
#

it runs testFunction and won't continue until it's done. (does not matter if it returns anything)

vivid locust
#

Okay cool, so only spawn and execVM will keep the script running?

peak plover
#

Call will run testFunction on the same thread. Spawn will create a new thread and run the function on that.

vivid locust
#

Thanks for the quick response, will keep that in mind

jade abyss
#

@vivid locust

Fnc1 = {sleep 2;};
[] spawn
{
    systemchat "0s";
    call Fnc1;
    systemchat "2s";
};```
peak plover
#

@rugged umbra

The string trying to find: CUP_B_M1128_MGS_Desert_Slat

You have to string vs string with in.
You can use select and compare instead.
Why double quoutes?

I'll assume the array is bigger.

_arr =  [["CUP_B_M1128_MGS_Desert_Slat","car1"],["CUP_B_FV510_GB_D_SLAT","car2"]];
_target = "CUP_B_M1128_MGS_Desert_Slat";
_arr2 = (_arr select {(toLower (_x param [0])) isEqualTo (toLower _target)} param [0]);
systemChat str (_arr2 select 1);
// car1
rugged umbra
#

The double quotes isnt my choice, its how the query works to my knowledge

#

Ill try that

rugged umbra
#

@peak plover
Thank you for your help!

I changed the ouput type of my database query to an array.
The array appears to have the format: [1,[[CUP_B_M1128_MGS_Desert_Slat],[CUP_B_FV510_GB_D_SLAT]]]

I used the following:
_currentVehicles = format ["loadActiveVehicles:%1", (getPlayerUID _player)] call ExileServer_system_database_query_selectFull;
_activePrestige = format ["loadPrestigeVehicles:%1", (getPlayerUID _player)] call ExileServer_system_database_query_selectFull;
_matching = (_currentVehicles select {(toLower (_x param [0])) isEqualTo (toLower _DropSelection)} param [0]);
diag_log format ["SERVER - AAA - Matching Vehicle: %1", (_matching select 1)];

I get the following:
Error in expression <[1,[[CUP_B_M1128_MGS_Desert_Slat],[CUP_B_FV51>
20:32:52 Error position: <CUP_B_M1128_MGS_Desert_Slat],[CUP_B_FV51>
20:32:52 Error Undefined variable in expression: cup_b_m1128_mgs_desert_slat

The variable _DropSlection is a string that is selected by a user in a dialog.

south pasture
#

Hi
am i right to assume that waitUntil is run per-frame unscheduled? Could complex check bring FPS down? If it's scheduled, there is still 3ms rule applied

little eagle
#

No, and yes.

south pasture
#

apparently it's scheduled <- sleep is allowed

#

@little eagle , how can waituntil severely impact FPS if scheduled per-frame limit is ~3ms (until heavy native command is executed)

little eagle
#

Commands are still atomic, so if you use an expensive command, it's still done all in one frame.

#

find big array, copy big arry, allMissionObjects, isNil, nearObjects etc.

south pasture
#

@little eagle Thnx

still forum
#

but the code inside waitUntil is really scheduled. So 3ms limit applies to the code inside it

#

waitUntil doesn't have any more impact than any other script that you might run

still forum
#

without sleep command it's the same as a while loop with a sleep 0.00001 at the end

#

it's the same as a while loop with a sleep 0.00001 at the end

#

it should.

#

you mean being able to use the while loop to capture multiple times a frame instead of once a frame?

#

Can we please get a facepalm emoji for this incredible dumbness?

#

The game is only simulated once per frame. Meaning positions/velocities/everything only changes once per frame.
Why on earth would it make sense to record the same position and velocity multiple times? less than 3ms apart from eachother

little eagle
#

Then don't.

limpid pewter
#

Hey, im making a safezone script using markers. The safezone works well, but the user feedback doesn't. Using this code ```sqf
cusRadio = radioChannelCreate [[0.92,0.92,0.92,1],"","SAFEZONE",allUnits,false];

little eagle
#

Why not use:
index radioChannelAdd units
?

#

For the respawned units.

limpid pewter
#

ooo, ok i shall have a look at this command

little eagle
#

It's linked down there.

#

"See also"

limpid pewter
#

ooh, so the problem is that they don't re-add themselves when they respawn then.

little eagle
#

Apparently.

limpid pewter
#

ok thanks alot

little eagle
#

yw

limpid pewter
#

btw, it works thanks

strong shard
#

Hi, how to get references for all vanilla IGUI displays? I am found stance, weapon, custom panels, but not group bar and vehicle status....

little eagle
#

@strong shard RscStanceInfo / 303

#

Ah, group bar no idea.

strong shard
#

@little eagle also need vehicle status, support icons (On left side of the screen), and all helicopter gauge

little eagle
#

Pretty sure every helicopter has a different display for that (even though it uses the same assets).

#

RscUnitInfoType

austere granite
#

commandbar doesn't have any references

#
class cfgIngameUI {
    #include "CommandBar.hpp"

    /*class CfgWeaponModeTextures    {
        default = "#(argb,8,8,3)color(0,0,0,0)";
        semi = "\pr\frl\addons\interface\img\fireselector\mode_1.paa";
        dual = "\pr\frl\addons\interface\img\fireselector\mode_2.paa";
        burst = "\pr\frl\addons\interface\img\fireselector\mode_3.paa";
        fullAuto = "\pr\frl\addons\interface\img\fireselector\mode_5.paa";
        fastAuto = "\pr\frl\addons\interface\img\fireselector\mode_10.paa";
    };*/
};
little eagle
#

Do you want to hide it?

austere granite
#

cfgIngameUI { class CommandBar { // blabla } };

strong shard
#

@little eagle not hide, adjust transparency

austere granite
#

they're seperate sections of the UI, that you can't access through scripting

#

so you'd have to do a mod

little eagle
#

^ this I fear.

austere granite
#

vehicle status also has a bunch of hardcoded elements. The only way to do it is by recreating the UI for it in a mod, and giving it proper idc/idcs and set some vars to uiNamespace

#

that is all part of class rscIngameUI

strong shard
#

@Adanteh#0761 it already mod, if need modify config - ok

austere granite
#

(NOTE THE DIFFERENCE BETWEEN rscIngameUI and ctrlIngameUI

#

(and later as infantry the same for soldier)

blissful fractal
#

Hi 😃 I need some help to understand array. So let say I want to create a file where I get player's slot name. In this case "civ_1" and get it called into a funtion. Exsample. [player] call life_fnc_test;
How do I get this infomation I called into fnc_test? If you understand what I mean 😃

austere granite
#

params ["_unit"]

#

the **[1, 2, 3]** call

#

the array there is access through _this

#

if you you params without anything in front of it it'll be used as _this params

blissful fractal
#

In my test file I have a global variable and plus a new variable. That variable need to me the player variable

#

life_paintballspiller = life_paintballspiller - [player];

austere granite
#

then [1, 2, 3] params ["_one", "_two", "_three"]

blissful fractal
#

Let's just say I do this [player] call life_fnc_test;

#

how do I get that infomation in the life_fnc_test? 😃

little eagle
#

params

austere granite
#

i just told you

blissful fractal
#

Well I do not understand it then. 😛

#

Thanks for trying

little eagle
#

Read the wiki.

#

The page on params is actually decent.

austere granite
#

[player] call { params ["_player"]; (player == _player) };

atomic epoch
#

Hey all, what's the point of preprocessor commands? Do they have advantedges over SQF variables?

blissful fractal
#

Yea I already have and that is the reason i'm asking in here. I had seach on the otherfiles in my altislife mission I do not understand it therefor I ask here 😃

austere granite
#

QUE MACRO GOSPEL BY COMMY

#

(in caps)

little eagle
#

They are evaluated at compile time, not at execution time.

#

That's a benefit.

austere granite
#

@blissful fractal do you nderstand : [player] call { params ["_player"]; (player == _player) }; this line?

blissful fractal
#

Year I do. I think I got it now. I will make a test 😃 Thanks

atomic epoch
#

kewl

strong shard
#

@atomic epoch preprocessor also allow removing part of code at compile time

atomic epoch
#

How?

#

Lets say a condition is met... would that prevent the code from compiling?

strong shard
#

@atomic epoch
#ifndef BLA_BLA_BLA
hint "Hello World!"
#endif

#

or #ifdef

atomic epoch
#

Intresting. Have you ever needed to remove code from compile time?

little eagle
#

Debug code.

austere granite
#

its useful for debuggin, a single

#

a single define you put somewhere to add in extra logging/etc

#

basically you just #include the same file throughout all your functions, then with one #DEFINE turn on extra debugging all over

little eagle
#

Another example is constants. Lets say you do code with keybinding eventhandlers. And you want to check if the key is Tab. Instead of looking up the code, you include the library file (#include "\a3\ui_f\hpp\defineDIKCodes.inc" ) and write DIK_TAB

empty blade
#

so i heard there is a new numberplate command?

austere granite
atomic epoch
#

That's clever

little eagle
#

Not in 1.78, Heisen.

austere granite
#

my base macro file has the full path to my IDC location, and also full path to the dikcodes etc

empty blade
#

@little eagle which release it planned for RC ? dev branch?

austere granite
#

but it includes it only #IFDEF __INCLUDE_IDCS or #IFDEF __INCLUDE_DIK

little eagle
#

I don't know. It's probably in dev branch.

atomic epoch
#

I'm assuming this works best when you put all your debug function inside the SCRIPT folder, so it's available for all missions

subtle ore
#

Dev

strong shard
#

@atomic epoch each call of function request CPU time (Load code, move parameters and return value and etc) even you no need this, you can disable debug by variable (And chech this in debug function), but it is not remove call from all scripts, preprocessor - also remove call

atomic epoch
#

So:
Preprocessor debug - Does not request CPU after compile as it remove the call
Scripted debug - Takes up CPU after compile, as it calls a function
?

strong shard
#

Yes, scripted debug also need time for checking this variable

#

It is important in time critical scripts or in eachFrame/draw3D

atomic epoch
#

Nice, I feel smarter already 😄

#

Preprocessor in .fsm would be amazing then

strong shard
#

@atomic epoch In each fms-state you can call sqf functions, or call two different fsm (With debug and without) depending on defined constant 😃

atomic epoch
#

Is #Define local to a script, or is it global? (ie. Can what I defne in scriptOne.sqf can be used in scriptTwo.sqf)

little eagle
#

Local.

#

But you can define them in a common header file and #include that one in every script you need it.

subtle ore
#

How does #include work in terms of file structure?

little eagle
#

No leading slash = current folder, leading slash Addons folder.

#

backslash*

subtle ore
#

Okay gotcha, and ../ for lower directories?

strong shard
#
  • “..”
little eagle
#

Upper.

subtle ore
#

Why would that be upper though?

little eagle
#

Idk, for me "upper" means shorter path.

subtle ore
#

Hmm.

astral tendon
#

```[["weapons", "Minesweep","HintDetector"]] call BIS_fnc_advHint;````
The hint works but i recive a small error at the botton saying that is too long, any way to fix that?

meager heart
#
[["weapons", "Minesweep","HintDetector"],nil,nil,nil,nil,nil,true] spawn BIS_fnc_advHint;
#

no errors

little eagle
#

The warning at the bottom is only in the editor I believe.

meager heart
#

@astral tendon And with this ```sqf
[["weapons","Minesweep","HintDetector"], 15,"",35,"",false,false,false,true] spawn BIS_fnc_advHint; //--- Default params

astral tendon
#

still get that error

subtle ore
#

Are you sure it isn't from another fnc or script?

astral tendon
#

is just this one from the console

#

this is the error

austere granite
#

if someone is playing on very large UI setting it might be outside the screen

#

'it' being the text

#

hence the error but just ignore it

astral tendon
#

Well, thanks for the info.

#

Just a question, is the BIS_fnc_UnitPlay MP friendly? because in the next mission i am about to work there will be like 5 cars were players will be riding as gunners and other unit captured vehicles around.

tough abyss
#

How would I get the classname for the prowler but with the desert skin?

meager heart
tough abyss
#

@meager heart well you can't get the classname on there with the desert skin applied on it

meager heart
#

@tough abyss press ctrl+f in browser and past - prowler 😀

#
B_LSV_01_unarmed_sand_F ?
tough abyss
#

Lol I feel stupid now

meager heart
#

Don't worry I have the same "emotions" quite often in arma 😁

wispy lynx
#

I'm trying to make a helicopter landing script that will be addAction'd to the helo to allow the player to request a drop-off closest to current location. This is what I've created so far:

_aircraft = vehicle player;

_aircraftPilot = assignedDriver _aircraft;

_lzPos = [getPos _aircraft,0,500,15,0,0.2,0,[],[]] call BIS_fnc_findSafePos;

_lzPad setPos _lzPos;

_aircraftPilot move _lzPos;

sleep 3;

while {((alive _aircraftPilot) && !(unitReady _aircraftPilot))} do {sleep 1;};

if (alive _aircraftPilot) then {_aircraft land "Land";};

The problem I've encountered is that BIS_fnc_findSafePos only runs through a limited number of positions, skips over suitable areas, and doesn't return the closest one. I found through testing that running it multiple times increased the number of positions, but I don't know how to do it as one search, or adding multiple searches into one array, and I don't know how to get it to select the closest one. Any help?

meager heart
#

@wispy lynx Something like this ?

_pos = getPosATL _heli;
_pos set [2,0];
_safe_p = [_pos, 20, 500, 10, 0, 20, 0] call BIS_fnc_findSafePos; //--- Closest to heli
_heli move _safe_p; //--- Need helipad in there
wispy lynx
#

@meager heart can you explain what the line: _pos set [2,0]; does?

austere granite
#

changes height to 0

wispy lynx
#

so how does that increase the number of positions BIS_fnc_findSafePos finds? I'm new to this scripting, so trying to learn.

meager heart
#

yep

austere granite
#

it might not, safe position in general is not that reliable

meager heart
#

yep x2 😀

wispy lynx
#

is there a way to run several BIS_fnc_findSafePos, dump the returned positions into one array, then select the nearest?

meager heart
#

You can do it, but i don't get it why you need it this way ?

austere granite
#

private _array = []; _array append (_bla call BIS_fnc_safePos); _array = _array apply { [_something distance _x, x] }; _array sort true; _closest = _array select 0 select 0;

#

add linebreaks where needed 😄

wispy lynx
#

when I run my script as it is, the return from BIS_fnc_findSafePos randomly chooses a spot further away than an open spot right near the helo, or defaults and flies off to mapCenter default pos. Through testing, I found that if I ran multiple BIS_fnc_findSafePos in same area, multiple locations showed up. But I don't know how to cleanly script that multiple search into one line, and select the nearest one.

meager heart
#

Why not call bis_fnc_findSafePos on actual heli position and just adjust params min dist and max dist?
It can't be any closer...

#

Just drop z on returned atl position

wispy lynx
#

@Adanteh#0761 so as I understand it: create private array, from array search BIS_fnc_findSafePos, apply distances to array pos's, then select nearest pos in array?

#

@meager heart that is what I'm doing: _lzPos = [getPos _aircraft, 0,500,15,0,0.2,0,[],[]] call BIS_fnc_findSafePos; with "_aircraft"

meager heart
#

Your params min distance is 0 and max is 500

wispy lynx
#

yes, min dist from _aircraft = 0 or directly underneath it, out to 500 meters search

#

should the search distance min be a positive number?

meager heart
#

and i think >= 10

wispy lynx
#

@Adanteh#0761 @meager heart okay, I'll try it with 10. I'll also try the array method, thanks both of you for your help.

meager heart
#

gl

atomic epoch
#

Hey all, I have a bin file that I can't unbin with my tools. Do any of you want to help?

#

I'll send the file to you

ripe hearth
#

disableChannels[]={{0,false,true},{1,false,true}};

Is there anything wrong with this line of code? It is in my description.ext file and is saying there is a missing ';'. Am I missing some other .sqf file? I am just beginning to populate my mission folder with these files and I noticed some other lines of code started working, like the 'respawnDelay' in the description.ext started working when i simply created a blank respawn.sqf... What am I doing wrong here?

little eagle
#

#define false 0
#define true 1
at the top of the file?

south pasture
#

@ripe hearth, square brackets [] instead of curly ones {}

subtle ore
#

@ripe hearth looks fine

warm gorge
#

Ive been seeing unmodded servers with christmas decoration models around. How is this even possible without mods?

#

Didnt think p3d files could go into mission files

tough abyss
warm gorge
#

oh wow thats pretty cool, havent seen many servers do it

#

cheers

jade abyss
#

Didnt think p3d files could go into mission files
P3D can be inserted into the MissionFile itself. Only the config.cpp's can NOT be send over.

warm gorge
#

Ah yep cool. What about if you have textures for the p3d models, do they need to go in a certain path in the mission folder?

chilly hull
#

Can anyone explain to me how I build my addon when I #include files outside my addon?

#

Or, more accurately, I'm trying to build a series of addons (like how cba is a series of addons). One of these addons (named danger) has a .hpp file that has a #include of an hpp file from one of the other addons (named main). How do I set up my file structure and addonbuilder so that it can find what it needs.

south pasture
chilly hull
#

So it will look in the P drive for files, regardless of what I have set as the project directory?

south pasture
#

@chilly hull you define the addon with $PBOPREFIX$ containing \mydrive\mypath\myaddon - Arma remembers to map the content root of that addon to \mydrive\mypath\myaddon path. Next time #include "\mydrive\mypath\myaddon\mysubdir\myanothersubdir\finallymyfile.hpp" is met, preprocessor will start looking for resource mysubdir\myanothersubdir\finallymyfile.hpp from where corresponding \mydrive\mypath\myaddon was defined in $PBOPREFIX$.

chilly hull
#

I'm actually trying to binarize files in addonbuilder

#

I'll just turn off binarize for now

plucky willow
#

how do i make a function return something?

jade abyss
#
abc_fnc_bla =
{
    if(_Var == 0)then{_Var = 1;};
    _Var
};
_Var = 0;
systemchat str _Var;    //0
call abc_fnc_bla;        //Function sets _Var to 1, if it was 0
systemchat str _Var;    //1
plucky willow
#

so i need to end the function with the return value

#

did you forget the semicolon?

jade abyss
#

Nope

#

all fine

plucky willow
#

okay thanks

jade abyss
#

@plucky willow

abc_fnc_bla =
{
    if(_this select 0 == 0)then{_Var = 1;};
    _Var
};

_Var = 0;
systemchat str _Var;    //0
_Test = [_Var] call abc_fnc_bla;    //Function receives: "1" as answer
systemchat str _Test;    //1
systemchat str _Var;    //1    (Also "1", since it was changed in the "call" and defined before )
#

Another example, using a Variable to store the result directly

plucky willow
#
axle_spawn_patrol = {
    params ["_units","_wpSpawn","_wpDistance"];
    //EXAMPLE: [_array,"spawnWP",50] spawn axle_spawn_patrol;
    private _sq1 = [getmarkerpos _wpSpawn,EAST,_units,180] call BIS_fnc_spawnGroup;
    [_sq1] spawn axle_set_skill;
    [_sq1,getmarkerpos _wpSpawn,_wpDistance] call bis_fnc_taskPatrol;
    _sq1 //return _sq1
};


_group = [_units,"wpSpawn",50] spawn axle_spawn_patrol;
{
    _x setDamage 1;
}foreach units _group;
#

so it would look something like this?

jade abyss
#

erm, i think spawnonly returned the handle

#
Return Value:
Script Handle - can be used to determine (via scriptDone (also via isNull in Arma 3)) when the spawned script has finished. In Arma 3, the handle is also available inside the spawned script in _thisScript variable.```
little oxide
#

you need to call a function, if you want a return

plucky willow
#

so if my function has sleeps in it I have to use spawn, how can i achieve getting a return and having sleep?

jade abyss
#

Is the function called or spawned?

#

(Sheduled or unsheduled)

plucky willow
#

since the function uses sleep it has to be spawned

jade abyss
#

The function, where you spawn it in

#

I am talking about that codepart from above.

plucky willow
#

well that particular function could be called

jade abyss
#
_group = [_units,"wpSpawn",50] spawn axle_spawn_patrol;```
That part
plucky willow
#

ah

#

that was just example code

jade abyss
#

🤦

plucky willow
#

i see what you mean, it is called

jade abyss
#

kk, the you might have to split it up and do it inside axle_spawn_patrol (or call the rest from there)

half relic
#

@south pasture 👋🏻

south pasture
#

since the function uses sleep it has to be spawned
It only means that it should be executed in scheduled environment. during call environment is inherited from caller to callee.

plucky willow
#

can you give an example? i dont really understand

jade abyss
#
[] spawn {
_abc = [vars] call bla_fnc_blablub;
sleep 1;
hint str _abc;
};```
plucky willow
#

okay that makes sense

jade abyss
#

damn Discord... i clicked somewhere else -.- Was wondering why the text didn't appeared -.-

#

stupid pc

plucky willow
#

so would this be possible?

#
bla_fnc_blablub = {
    sleep 1;
};

[] call {
    _abc = [vars] spawn bla_fnc_blablub;
    hint str _abc;
};
jade abyss
#

No

#
bla_fnc_blablub = {
    sleep 1;
    true
};

[] spawn {
    _abc = [vars] call bla_fnc_blablub;
    hint str _abc;    //"true"
};```
plucky willow
#

oh okay i see what you mean about inheriting

jade abyss
#

👍

plucky willow
#

is SQF used anywhere else?

#

other than arma

jade abyss
#

Nope

#

You can see it as an mutilated inbred of C#, Java and some other languages.

#

A bit of this, a bit of that.

plucky willow
#

i only really know sql

jade abyss
#

And?

plucky willow
#

just sql lol

south pasture
#

@plucky willow do you have the idea of concurrency and multithreading? spawn actually is the thread creation (not really sure if it's native OS thread)

plucky willow
#

nope not really

#

got any resources i can look at?

astral tendon
#

what execute those actions?

#

inputAction only returns

still forum
#

@south pasture nothing in Arma is multithreaded. spawn doesn't create a real thread

south pasture
still forum
#

Yeah "Thread" is just a good word to talk about it. Scheduled Environment explains how "Thread"s work

jade abyss
#

nahhhh

#

rly only 0.001ms diff?

austere granite
#

i thought that was already known

slender halo
#

that's actually 0.0001ms ^^

timber ridge
#

hey guys, pretty unrelated, but is BIF working for you? I've been getting conn refused error this entire week... (lol it works when accessed through google, but not when the domain is entered directly in the browser...)

still forum
#

Yep all fine

#

you have to https

timber ridge
#

yeah, i see lol. looks like their server is badly configured... it should automatically pick up https.

still forum
#

yep... Just BI things 😄

proven crystal
#

is ther e something wrong with while {!isnil _marker} do {.....}?

#

doesnt seem to fire....

#

or wait... do i have to create effects on clients?

#

im trying to create smoke

still forum
#

_marker is the variable name of the marker as string?

#

and you delete the marker?

#

Just put a diag_log inside the loop to check if it's running

proven crystal
#

i call that script with the marker as parameter

subtle ore
#

The createMarker returns a string iirc though

proven crystal
#

yea didnt put in a log output... will check on that

subtle ore
#

So isNull -> String ?

still forum
#

yeah.. And I don't think that means there is a variable with that name

#

you can't isNull or isNil a marker name

subtle ore
#

I know, that's what i am saying

proven crystal
#

i would guess that if it was a problem with isnil-isnull, i would see an error message at least

austere granite
#

isNil "_marker" ?

still forum
#

no @Adanteh#0761

#

Discord......

austere granite
#

if you want to detect if a marker doesn't exist then getMarkerColor _marker != ""

#

I have special premium NO-MENTIONS-ALLOWED package 😉

subtle ore
#

Marker color lol

austere granite
#

you can also check if position is [0, 0, 0]... but what if a marker is really on there? 😄

still forum
proven crystal
#

hm thats a way too i guess. but that would also error if the marker doesnt exist, no?

jade abyss
#

erm, didn't you check Marker with their Names?

still forum
#

@proven crystal No. As he said. If it doesn't exist it returns ""

austere granite
#

@still forum but if i have 6 million markers that's slower 😉

still forum
#

true. My method is kinda terrible. Also thought of yours but didn't know if reliable

austere granite
#

so far i found it to work just fine

#

int he past i did check getMarkerPos _marker isEqualTo [0, 0, 0] but.... no ponit and well... what if it is 0? 😄

#

so

proven crystal
#

the script is starrted with an existing marker as parameter. and then it adjusts position in a loop. but marker might dissappear and then i want to leave the loop

austere granite
#

while { getMarkerColor _marker != "" } do { // enter hacks }

#

should work for your case then

proven crystal
#

at the moment i just get no output at all from that script. no error eirther.... so i do assume that the isnil bit does not cause a problem per se

austere granite
#

isNil checks if a variable is set to anything

#

private _testVar = nil;
isNil "_testvar" >> true

#

private _testVar = objNull;
isNull _testVar >> true

#

notice difference between quotation marks too

proven crystal
#

so ill try while {!isnil "_marker"} do {...} and add a diag log too...

jade abyss
#
while{ getMarkerType _markerName != "" };```
cosmic kettle
#

^the above would be preferred, since

while {!isnil _marker} do {...}

Would also return any objects with the same name.

little eagle
#

100 proposed solutions, and he goes with his own, and wrong, idea.

cosmic kettle
#

A while is really expensive for what is trying to be done here it seems.

still forum
#

He wants to adjust it's position in a while loop. How would you do that without a while loop?

cosmic kettle
#

So pleasy Commy enlighten us. What is the best way... 😃

little eagle
#

Should just execute whatever function he is waiting for from the script that deletes the marker.

austere granite
#

That tbh

tough abyss
#

Does camouflageCoef change during gameplay, or is it a constant value?

still forum
#

It's constant. But it isn't.

#

You should ask all the mods you are using

little eagle
#

The coef specifically doesn't change on it's own, but the value it's multiplying changes with your uniform.

tough abyss
#

(Assuming no mods).

still forum
#

const then

subtle ore
#

Commy, did you ever figure out how to transform into a ninja with that?

#

Completely silent weapons?

little eagle
#

You could just setCaptive yourself if you want that.

tough abyss
#

Right, so if camouflageCoef is 0, the uniform doesn't really matter? Because 0 * u = 0.

little eagle
#

Yes.

subtle ore
#

But then you couldnt rp like a real ninja commy

#

You gotta get the super sneaky sword

little eagle
#

True, camoCoef is more thrilling.

#

Because if you push them in their face, they'll shot.

tough abyss
#

@little eagle - yeah but there's a decent chance of setCaptive being used by a given mission, as you mentioned in your PR.

subtle ore
#

Unfortunately :(

little eagle
#

And they'll shoot back until you stop shooting and they loose you again.

subtle ore
#

Lol

proven crystal
#

while {!isnil "_marker"} do {...} works btw. it was just the ""

subtle ore
#

Punch bob and run away, works every time

proven crystal
#

interesting though that it did not throw an error without those

subtle ore
#

🤦

still forum
#

@proven crystal It works because it can never be nil. Meaning that's always true

#

Meanin. It doesn't actually work at all

proven crystal
#

wut?

still forum
#

_marker is never nil

austere granite
#

@proven crystal if you ask a question and people give you answers.... and even explain WHY the answer is the answer they give

#

then.... consider using it 😄

still forum
#

Half a dozen people gave you answers that will work. And you just ignore them and rig up your own solution that actually doesn't work at all

proven crystal
#

i did?

still forum
#

Yes.

proven crystal
#

the "" were part of the several suggestions or not?

austere granite
#

[5:41 PM] Adanteh: while { getMarkerColor _marker != "" } do { // enter hacks }
[5:41 PM] Adanteh: should work for your case then

still forum
#

Your problem was while (something) doesn't work. So you replaced it by while (true) Is that really what you want?

austere granite
#

no

#

the "" part was explaining on how isNil itself works and that you should always

#

okay lemme give you an example

#
private _marker = "thismarkerdoesntexist";
isNil "_marker"; // FALSE
rose notch
#

That is really funny

austere granite
#

why is that false?... because _marker is actually set to something

rose notch
#

Like comedy

austere granite
#

marker is "thismarkerdoesntexist"

#

... so sure it might not be a marker, but you're not asking if it's a marker, you're just asking if it's.... something

proven crystal
#

just to reply to Dedmen here, i am trying to learn from this and use the advise, i might just not understand it first try.

still forum
#

isNil only checks variables. Your marker is not a variable it's a string. Meaning you can't use isNil at all

#

So before you checked if something that is not a variable is a variable. Which is ofcause always false.

#

Now you check if _marker is a variable that contains something.. And yes. It contains the name of the marker

#

so that's always true

#

It's completly unrelated to the marker itself though. If you delete it then _marker still contains it's name. and still is not nil

#

Sadly there is no markerExists function

#

But you can use the other functions that get properties from the marker. If the marker doesn't exist they just return a default value instead.

austere granite
#

inb4 intercept

proven crystal
#

hmhmhm....

#

crap. so does that mean, that im using that isnil thing completeley the wrong way?

austere granite
#

yes

proven crystal
#

there are a few other scripts that i launch with a check

#

for example

#
    fez_CTO_zones = [];
};
austere granite
#

well that is correct

#

you're asking if the variable exists, and if it doesn't set it to an empty array

#

that's all isNil is, checking if a variable itself exists, not the value of the variable

#

so in that case it's usage is good

still forum
#
static auto _markerExists = host::registerFunction("markerExists"sv, "Checks if marker exists"sv, 
    [](uintptr_, game_value_parameter right) -> game_value {
        return sqf::get_marker_color(right).empty();
    }, GameDataType::BOOL ,GameDataType::STRING);

There ya go. You forced me!

proven crystal
#
if (!isServer) exitWith {};

_marker = _this select 0;
_create = false;

while {!isnil "_marker"} do {....```
#

still dont get why the thing would return something then when i delete the marrker

#

oh or could i just add a _marker=nil; in the end?

still forum
#

yes you can

#

if you set it to nil then it will be nil

proven crystal
#

ahh i think coin dropped now

#

not sure what took it so long

#

maybe i should eat soon

still forum
#

or sleep

proven crystal
#

6pm here

#

{_marker in allMapMarkers} should work too i guess

jade abyss
#

ffs? Still arguing about that?

proven crystal
#

no

jade abyss
#

Of course

proven crystal
#

im all good now thans for the patience

jade abyss
#

At least

little eagle
#

At last.

subtle ore
#

🤔

proven crystal
#

for the moment ... ;)

still forum
#

@proven crystal It would work. But you and I already got told the performance with that would be bad

#

Why do you keep searching for worse alternatives if you already have a perfectly working way.

little eagle
#

Hey, hey. Guys?
Should I use:

while {!isNil _marker} do {

???

still forum
#

Yes!

proven crystal
#

i used Dschas thing now seemed good

still forum
#

👍

subtle ore
#

Dedmens answer will always be intercept

still forum
#

Yeah. Intercept is already posted above

austere granite
#

i did inb4 it though, so it's fine

little eagle
#

QUESTION INCOMING

austere granite
#

what are the odds that it's a life question?

still forum
#

about 1/8th

#

we really don't get that much life questions.. They usually get bullied out before they can ask

little eagle
#

What's the meaning of life?

still forum
#

42

austere granite
#

HUEHUEHUF FORTYTWO EX DEE EX DDEEEEE

still forum
#

u so fny

little eagle
#

I read the first three chapters of that book and idk why people like it so much.

still forum
#

I didn't even watch the movie

austere granite
#

because so quirky and nerdy amirite guys

pure bluff
#

Hey, I'm new here, don't know if this is a scripting question, but as everything can be done via scripting I figure why not ask here.
I have a mission I'm making (just to learn different tools) where I have a helicopter flying over one inf who is only armed with a RPG-7. I want that inf to fire at the heli, but miss, and I'm so new to this, that I can't even get him to fire... plz send help

little eagle
#

I have a script exactly for this!

pure bluff
#

YES!

still forum
#

That's not thaaat easy.. I guess you ........ Commy is getting too good...

austere granite
#

wasn't there someone who basically asked just this somewhere within this week

still forum
#

I'd say last week

pure bluff
#

I found this chatroom today, very sorry if reposting!
How high is the bar for asking questions btw?

pure bluff
#

and is there an easy way to search for already answered questions?

little eagle
#

This goes into the init.sqf

#
[soldier1, heli1, 20] call commy_fnc_fireMissile;
still forum
#

The bar for asking questions is not high at all. As long as you correctly ask it and it's not a life/exile question. If it's life/exile question you'll get redirected to life/exile forums.
And stuff like
"My script no work! How fix?" you won't get a serious answer to.

little eagle
#

And this ^ fires the rocket from soldier1 to heli1, missing by 20 meters left or right randomly.

still forum
#

I fire the rocket? 😄

#

pew pew

little eagle
#

Nah, you just spam the chat with nonsense.

still forum
#

That hurts ._.

little eagle
#

Is true though.

#

I mean, this script is meant for tanks or infantry, so it might hit it anyway if it tries to miss and the heli has just the right speed in the right direction, but w/e.

#

Should work if the ai is directly underneath. I think.

pure bluff
#

Very helpfull commy! Thanks a lot!

little eagle
#

Rockets / missiles are so nice now in 1.78+ with their whistle sounds.

pure bluff
#

any tips on how to/where to learn the scripting language of arma?

jade abyss
#

Tip: Don't.

pure bluff
#

I'm so far down the highway of making bad decisions, so why not one more 😉

still forum
#

I never learned a language without using it.. so.. That's the only way I know.

#

Just a lot of google and reading

#

And after I had over a year of experience I went to ask the professionals for things

jade abyss
#

But since A3 is "slowly" reaching it's EOL... hm... you might learn to do some basic stuff, but... yeah, thats it^^

little eagle
#

I was born knowing sqf.

jade abyss
#

Noob

#

I was born SQS

still forum
#

But! knowing other programming languages makes SQF easier to understand and they are still useful after Arma 4

little eagle
#

SQF was my first programming language though.

#

Am I damaged forever now?

still forum
#

A little probably

austere granite
#

Same ;_;

jade abyss
#

@little eagle I certainly are

#

Okay, sqf mustn't be the cause of it... but it takes a huge part of it 😄

little eagle
#

I have headache all day, but made 13 pull requests anyway.

jade abyss
#

Masochism?

little eagle
#

Just ordinary insanity.

jade abyss
#

👍

#

BluemanGroup = You must be (to some degree) be mentaly ill

tame portal
#

@jade abyss sounds perfect lets go

tame portal
#

🇾 🇪 🇸

edgy dune
#

is there away to tell the AI to lower the gear

#

or raise it

inner swallow
#

no, i don't think explicit gear controls exist for either AI or the player

#

AI just has speed modes

#

I think you can tell them to go "fast forward" instead of just "forward"

edgy dune
#

rip

meager granite
#

Do you mean aircraft gear? 🤔

edgy dune
#

yes

#

well

edgy dune
#

u know the halo pelican

#

the ai doenst open the back door so I was trying to see if I could do so

#

now is there away to tell the ai to use a specific action that I add to a vic

meager granite
#

Only works on player controlled aircraft.
oh

queen cargo
#

no worries @jade abyss @little eagle
will have you covered once the exact specs for arma 4 get released (in regards of language)

#

you can continue coding in much loved SQF ❤
and a tool will convert it then

proven crystal
#

so......

#

hate to come back to you guys with this.....

austere granite
#

"_marker"

proven crystal
#

but without ""

#

if (!isServer) exitWith {};

_marker = _this select 0;
diag_log format ["FEZ smoke %1", _marker];

while {(getMarkerType _marker) != ""} do {
_pos = [_marker] call CBA_fnc_randPosArea;    
diag_log format ["FEZ smoke loop creating smoke for %2 around position %1", _pos, _marker];
};

#

it wont enter the loop

#

i see the first log, but not the second

austere granite
#

is _marker actually correct in the first log?

proven crystal
#

yep

#

there is more code in the while loop. but that log is the first line there and should show even if there were later errors

austere granite
#

if the code block itself is messed up it might not show that log

#

or execute it properly

#

so you probably wanna pastebin a bit more

proven crystal
#
if (!isServer) exitWith {};

_marker = _this select 0;
diag_log format ["FEZ smoke %1", _marker];

while { _marker in allMapMarkers} do {   // {(getMarkerType _marker) != ""} do {
    diag_log format ["FEZ smoke loop running %1", _marker];
    _pos = [_marker] call CBA_fnc_randPosArea;    
    _buildingList = nearestObjects[_pos,["House","Building"],100] select {count (_x buildingPos -1) != 0}; 
    
    if ((count _buildingList) != 0) then {
        diag_log format ["FEZ smoke loop creating smoke for %2 around position %1", _pos, _marker];
            
        _building = selectRandom _buildingList; 
        _object = "land_garbage_square3_f" createVehicle getpos _building;
        hideObjectGlobal _object;
        _smokeffect = selectrandom [1,2,3,4,5,6,7,8];
        _particlecources = [_smokeffect,_object] call Achilles_fnc_SpawnSmoke;
        sleep (60+ random 120);    
        deleteVehicle _object;     
        
        
    };
    sleep 60;
};
austere granite
#

yhmm that looks fine glancing at it

proven crystal
#

im just trying it with the allmapmarker thing.

austere granite
#

is it an area/shape marker or an icon?

proven crystal
#

its an area

austere granite
#

i wouldn't be surprised if getMarkerType is actually "" if it's shape

#

so one thing that's good to test, if you're just in the editor the watch fields

#

see what getMarkerType "yourmarkerName" does

proven crystal
#

just restarting the server. scond

austere granite
#

and check getMarkerColor "yourmarkername" too

proven crystal
#

weird....

#

so in the log i see "21:32:12 "FEZ smoke commander_area_EAST_1" and "21:32:12 "FEZ smoke commander_area_EAST_2"

that is correct and the names of 2 generated markers

#

but then there is nothing else....

#

even though _marker in allMapMarkers

#

no. does seem to work with the allMapMarkers. just forgot to save ^^

austere granite
#

yeah then it'll be because getMarkerType == "" if it's a ellipse/rectange marker i bet

#

aka

#

DSCHA WAS WRONG I WAS RIGHT NAANANAN

#

i hope

little eagle
#

haha

austere granite
#

hey @jade abyss

#

do i get a blue name now? ;_;

proven crystal
#

i have a new error now whooptydooo

austere granite
#

btw pls tell me you're not testing every line on a dedi restarting the thing

proven crystal
#

not everytime. i do bits and pieces locally but have to run the thing on the server eventually to see it all work together

#

so i did try out the spawnbit etc separately before and thought it should work....

#

Error Undefined variable in expression: achilles_fnc_spawnsmoke

#

that bit runs perfectly well if i just execute it in the mission

tulip cloud
#
        addMissionEventHandler ["Draw3D", {
            { 
                drawIcon3D ["a3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa",[1,1,1,1],(((_x modelToWorldVisual (_x selectionPosition "head")) vectorAdd [0,0,.2])), 0.8, 0.8, 0, "test", 1, 0.0315, "EtelkaMonospacePro"];    
            }forEach listOfObjects;   
        }]; 

If I try to use private variable it doesn't work. Is there a way to pass a private variable to addMissionEventHandler?

little eagle
#

BIS_fnc_addStackedEventHandler onEachFrame

tulip cloud
#

is that more cpu intensive?

little eagle
#

Don't know. Maybe, maybe not. Your eventhandler code with addMissionEH gets recompiled every frame, which doesn't happen for scripted eventhandlers like stacked.

tulip cloud
#

So if it isn't recompiled each frame, how would drawIcon3D update?

little eagle
#

BIS stacked saves the function and arguments in it's own global variable. addMission stores the function as string and recompiles it for every execution.

#

Recompile is turning string into executable sqf code.

#

With BIS stacked it stays CODE.

tulip cloud
#
["globalVar", "onEachFrame", 
{
    { 
        drawIcon3D ["a3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa",[1,1,1,1],(((_x modelToWorldVisual (_x selectionPosition "head")) vectorAdd [0,0,.2])), 0.8, 0.8, 0, "test", 1, 0.0315, "EtelkaMonospacePro"];    
    }forEach _this;
}, [fDrawList]] call BIS_fnc_addStackedEventHandler;

Something like that?

little eagle
#

Yes.

tulip cloud
#

hmm performance test time

winter dune
pure bluff
#

Why do you want, and how do you obtain a blue name @Adenteh

subtle ore
#

Why do you want
😂

little eagle
#

Hang out with the cool kids.

austere granite
#

tbh i just wanna be able to put reactions and embed links 😦

subtle ore
#

🐒 💨

little eagle
#

It's annoying sometimes when every link you post pops up with a preview.

austere granite
#

it would be good if you oculd turn it off yea

subtle ore
#

You can.

#

Settings -> Image -> Link preview

proven crystal
#

ill try tomorrow iand figure this out.... i find it a bit weird.
but @Adanteh#0761 getMarkerType of an area marker does return the shape. in my case ellipse

#

so in principle the thing should work.

#

it works now with the check if its allmapmarkers, but i dont like it

#

the next bit is that the entire code runs fine if i test it locally but on the server the achilles function has an error

subtle ore
#

Why are people so attached to achilles?

proven crystal
#

Error Undefined variable in expression: achilles_fnc_spawnsmoke

#

im not attached, just tried 2 things of it for the first time

lone glade
#

enum errors EVERYWHERE

subtle ore
#

You were given several smoke examples, and you choose a zeus functionality?

#

A function not designed for direct execution?

proven crystal
#

well i didnt know that. seemed to work fine

#

handy to use

little eagle
#

LOADCOEF

subtle ore
#

Ugh.....

proven crystal
#

what does it all mean?

lone glade
#

nearly all commands that take enums as arguments just throw errors, because you know, it miiiight be one.
Or not.

#

Next step is reporting all strings as possible errors, you never know

proven crystal
#

so i should rather make my own smoke function? be aware that i might try that...

austere granite
#

honestly what i recommend is just writing a game from scratch

#

starting by writing a GUI in visual basic to track the IP

lone glade
#

The others gave you a good example, use it

#

I would avoid using ares as one, it's useful but hastily written.

proven crystal
#

writing game from scratch certainly sounds fun too, but id be happy with some smoke in some areas

little eagle
#

Have you tried createVehicle'ing some smoke grenades?

proven crystal
#

wanted it more permanent. i just stumled across that achilles thing and thought that looks good, also with a few variations

plucky beacon
#

My brain is a little ENUM right now

little eagle
#

ERROR FOREIGN ERROR LOADCOEF

proven crystal
#

i dont know what ENUM is, but it apparently ruins my evening :(

#

whatever it does, it is not doing it well apparently

lone glade
#

also quicksilver

#

LEARN TO WRITE COMMIT MESSAGES

austere granite
#

This commit will <commit message>

#

ez

lone glade
#

less than 72 chars too if possible

austere granite
#

just use a client like gitkraken, so you got a seperate line for 72 char commit message + then below description

lone glade
#

oh god no, not gitkraken

#

or github for windows, it's terrible

austere granite
#

i kinda like gitkraken

#

dont bully me

lone glade
#

I liked the first version ever, then it turned to shit version after version

austere granite
#

i hate theeir style of advertising, it's like they're speaking to toddlers, but outside that it's oaky

little eagle
#

You have to use the right ones. Clearly all of these are caused by CBA.

wispy lynx
#

Help request: Can someone explain how to select a position from and array? I am searching an area for positions, putting those positions into an array, then sorting the positions by distance. But when I try to getPos the nearest one, I get an error that the selected position is a number, not an object or location.

meager granite
#

You already have position, you don't need getPos

#

_position = _arrayOfPositions select 0;

wispy lynx
#

_safePosSearchCenter = "Sign_Sphere200cm_F" createVehicle [1655.75,5488.876,0];

private _array = [];

_array append ([getPos _safePosSearchCenter,0,500,15,0,0.2,0,[],[]] call BIS_fnc_findSafePos);

_array = _array apply { [_safePosSearchCenter distance _array] };

_array sort true;

_closest = _array select 0 select 0;

_safePosVisual = "Sign_Arrow_Large_Yellow_F" createVehicle [0,0,0];

_safePosVisual setPos _closest;

_safePosVisual setVectorUp [0,0,1];

lone glade
#

@tough abyss nope, just saw it on reddit

#

I need to do the arsenal documentation before release or people will spread misinformation / drive me insane

#

triggering initiated

meager granite
#

@wispy lynx You're losing original array with positions by replacing it with array of distances

little eagle
#

The whole script doesn't work.

#

Not just that detail.

meager granite
#
_array = [getPos _safePosSearchCenter,0,500,15,0,0.2,0,[],[]] call BIS_fnc_findSafePos;
_array = _array apply {[_safePosSearchCenter distance _x, _x]};
_array sort true;
_closest = _array select 0 select 1;
little eagle
#

BIS_fnc_findSafePos only reports one position.

meager granite
#

Oh really, didnt use it in years

wispy lynx
#

I tried using the "distance _x, _x]};" but it wouldn't take it?

little eagle
#

Because _array is just one position and it's elements are numbers.

meager granite
#

Well with findSafePos returning single position your entire approach is wrong.

little eagle
#

distance fails on numbers.

meager granite
#

When position cannot be found at all, default map center position is returned, which will be in format [x,y,0]
Wow, what a useful feature /s

wispy lynx
#

Okay, so what I'm trying to do is have BIS_fnc_findSafePos run several times, put the return into an array, then search the array for the closest, then getPos the closest... better appraoch?

subtle ore
#

sounds like a safe place to me Sa Matra

little eagle
#

What if you're in a bad spot and trying to escape to a safe position?

subtle ore
#

😄

wispy lynx
#

BIS_fnc_findSafePos seems to skip over "safe places" and selects default pos, but thru testing I found running it several times on same area, it does better. I just don't know how to put the multiple searches together and select the nearest one.

little eagle
#

for loop and pushBack

subtle ore
#
for "_i" from 0 to 5 do 
{

}: //etc
meager granite
#

If it wasn't for this "default map center position" detail, you could just increase distance until you had position returned

lone glade
#

@wispy lynx use selectBestPlaces

#

it's your best shot instead of using the BIS funcs

wispy lynx
#

@subtle ore Tried that, but when I try to select a pos from the returns, I get the "number, not an object or location...."

meager granite
#

Actually findSafePos uses isFlatEmpty

subtle ore
#

Well yes, ebcause it's going to return _i , not your special variable _x

wispy lynx
#

@alganthe#8904 I looked at that, but it says that it is slow and hangs up game while searching "should not be used in areas larger than 50m"

lone glade
#

it's intensive, but whomever left that comment is wrong

#

unless you require 100% precision then yes, but that's stupid

wispy lynx
#

@alganthe#8904 oaky, I'll revisit, just need ballpark.

lone glade
#

60% precision with 10 sources is pretty good

little eagle
#

Man, this all sound so bad. I'd just go for terrain vector and line intersect checks.

#

Is this for heli?

lone glade
#

selectBestPlaces would be more efficient

wispy lynx
#

Trying to find helo landing area when flying over trees/forest, so needs to be 15m from nearest trees (rotor blades) and gradient not exceeding 0.2

#

K, I'm off to try selectBestPlaces, thanks for the help everyone.

meager granite
#

Look into findSafePos code to see how it works too

drowsy axle
#

Hey guys, I'm looking to see how I can have a foreach loop for a variable, which checks any sqf varName_x (_x is 1,2,3,4,5,6,7,8,9,etc...)

tulip cloud
#

That is a comparison of those 2 methods

#

Left side is crappy laptop and right side is high-end pc

jovial ivy
#
_hasGodmode = player getVariable "DS_var_godmode"; //1=on,0=off
_status = (_hasGodmode == 1) ? "(On)" : "(Off)";
``` Is that a thing? Or do I have to manually use a if/then statement.
lone glade
#

you do realize you can use true / false @jovial ivy ?

jovial ivy
#

I do, that was just an example.

lone glade
#

and no, unfortunately you can't do that

#

you can however have:
private _myLocalVar = if (condition block) then {something} else {something else};

jovial ivy
#

That'll do it. Thanks

lone glade
#

the return value semicolon rule apply there btw

#
private _myLocalVar = if (condition block) then {
    "weee"
} else {
    "wooo"
};
#

you can also have a switch, a foreach, a count, a for forvar and I must be forgetting others after the =, same principle

dusk sage
#

Closest you can get to ternary is probably

["Off", "On"] select (_hasGodmode == 1)

@jovial ivy

ionic anchor
#

is there a way to display different pip 'camera' views on each seperate monitor

/*
    File: fn_fedCamDisplay.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Turns on and displays a security cam like feed via PiP to the laptop display.
*/
_laptop = _this select 0;
_mode = _this select 3;

if (!isPiPEnabled) exitWith {hint localize "STR_Cop_EnablePiP";};
if (isNil "life_fed_scam") then {
    life_fed_scam = "camera" camCreate [0,0,0];
    life_fed_scam camSetFov 0.5;
    life_fed_scam camCommit 0;
    "rendertarget0" setPiPEffect [0];
    life_fed_scam cameraEffect ["INTERNAL", "BACK", "rendertarget0"];
    _laptop setObjectTexture [0,"#(argb,512,512,1)r2t(rendertarget0,1.0)"];
};

switch (_mode) do {
    case "side": {
        life_fed_scam camSetPos [16029.1,16938.9,3.08817];
        life_fed_scam camSetTarget [16034.9,16930.6,0.00146008];
        life_fed_scam camCommit 0;
    };

    case "vault": {
        life_fed_scam camSetPos [16031.1,16936.6,10.287];
        life_fed_scam camSetTarget [16017.1,16957.3,0.597221];
        life_fed_scam camCommit 0;
    };

    case "front": {
        life_fed_scam camSetPos [16084.3,16997.8,23.6492] ;
        life_fed_scam camSetTarget [16037.8,16966.7,0.00145817];
        life_fed_scam camCommit 0;
    };

    case "back": {
        life_fed_scam camSetPos [16002,16904.9,5.71753];
        life_fed_scam camSetTarget [15998.7,16939.7,0.00146866];
        life_fed_scam camCommit 0;
    };
    
    case "off" :{
        life_fed_scam cameraEffect ["terminate", "back"];
        camDestroy life_fed_scam;
        _laptop setObjectTexture [0,""];
        life_fed_scam = nil;
    };
};```