#arma3_scripting

1 messages ยท Page 350 of 1

digital pulsar
#

oh yeah, silly me

ivory vector
rancid ruin
#

oh man control groups are fun

#

i bet you're having a really nice time doing complicated UIs in arma

ivory vector
#

Does it not like controlsGroups being made over the top of ControlGroups ?

#

Yeah.... no xD

#

im going to take the main dialog out of a group, and see what happens.

#

im guess either idc issue or it doesnt like controlsGroups over controlsGroups.

rancid ruin
#

i could never get control groups working in the way i wanted

#

what i ended up always doing was just adding different controls to my own imaginary "group" via script and just animating them or whatever that way

ivory vector
#

Mine are working ok, the only thing i dont like is each message needs 2 controls ... so if i want 100 messages to be store... need 200 controls xD

rancid ruin
#

why? use pages

#

show 5 message templates at once or whatever, load in next 5 messages each time you click next page

#

that kinda thing

ivory vector
#

i just got mine scrolling xD

#

Im gunna do a notification system using the same idea as this messaging system tho ๐Ÿ˜ƒ

#

ok, so I have narrowed down the issue to 2 things.

#

Idc issue, or ControlsGroups over ControlsGroups

simple solstice
#

@indigo snow so does the example

lineIntersects [ eyePos player, aimPos chopper, player, chopper]
indigo snow
#

that would check if theres something between the player and the chopper

#

the command itself just checks if anything intersects the line between two positions

#

and you can give it up to two objects to ignore

#

it also wouldnt change output if you turn around in place, since eyePos would (almost) not change

#

I think what you actually want is if the player is looking directly at jerry's head, @simple solstice ?

ivory vector
#

Why i has to do mine hard way

#
_MessageBox = _display ctrlCreate ["Lega_Tablet_Messaging_MessagesGroup",9999];
``` why not use 

_MessageBox = _display displayCtrl 9999;

simple solstice
#

@indigo snow yes indeed

ivory vector
spice kayak
#

Slightly unrelated question; what music does everyone here listen to when scripting / mission making?

ivory vector
#

vocalDubstep

spice kayak
#

Any specific favorites / recommendations?

ivory vector
#

i usuall just find one , then let it roll ๐Ÿ˜ƒ

spice kayak
#

Ha, that's what I've been doing lately too.

ivory vector
#
ADT_RefreshList = {
  _display = uiNamespace getVariable ["Lega_CustomTablet_Messaging",displayNull];
  _MessageBox = _display displayCtrl 9999;
  _config = "true" configclasses(missionconfigfile >> "Lega_CustomTablet_Messaging" >> "Controls" >> "Lega_Tablet_Messageging" >> "controls" >> "Lega_Tablet_Messaging_MessagesGroup" >> "Controls");
  _CtrlAmount = count(_config);
  {
    _idc = getNumber(_x >> "idc");
    _ctrl = _MessageBox controlsGroupCtrl _idc;
    _ctrl ctrlSetStructuredText parseText "";
    _ctrl ctrlSetBackgroundColor [0,0,0,0];
  }forEach _config;
};
``` would there be a better way of clearing my controls ?
spice kayak
#

Sorry man, can't really help you there, but good luck!

#

Hmm, Land_PortableLight_Double_F wouldn't fall under Lamps_Base_F, would it? To add both portable lights, would PortableLight_Base_F work?

tepid pollen
#

Making a multiplayer script to find how many Independent-side players are in one of three zones (north, central, or south Stratis) every 3 minutes. What's the best way to do this? I am planning on finding locations of all Independent players with a server side script, then comparing the values to find which values put them in one of the three regions. I could probably do this client-side to make the code cleaner, but...

spice kayak
#

I mean, there is only two of them, so I can just add them both.

little eagle
#

@spice kayak

"PortableLight_Base_F" isKindOf "Lamps_Base_F"
ivory vector
#

@tepid pollen inArea

little eagle
#

This is how you can check.

tepid pollen
#

thank you! I think that is exactly what I am looking for

little eagle
#
private _indepUnits = [];

{
    _indepUnits append _x;
} forEach (allGroups select {side _x isEqualTo independent});

_indepUnits = _indepUnits inAreaArray _marker;
#

This will list all independant units in the markers area

spice kayak
#

Ah, thanks man. forgot about isKindOf.

ivory vector
#
Prefix_CheckInArea = {
  params ["_markerName","side"];
  _return = [];
  {if((_x inArea _markerName) && ((side _x) isEqualto _side))then{_return pushback _x}}foreach _playableUnits;
  _return;
};
#

Lightning, if you call that with a markerName it should return all the units in that area.

spice kayak
#

Wouldn't that be all units, not just the independents?

#

Sorry, typed that before seeing your last comment.

little eagle
#
private _indepUnits = allUnits inAreaArray _marker select {side group _x isEqualTo independent};

Can't beat this ^

ivory vector
#

Rip i didnt read that part

little eagle
#

I wish there was a

allUnitsSide west
allUnitsSide independent

etc. command

spice kayak
#

Huh, that worked. I figured I'd just load into the mission and use the EMP. If it turned out the lights, then they were part of the Lamps_Base_F group, and they turned off \o/

#

Oh god, yes.

#

I was looking for that last night.

little eagle
#
#define ALL_UNITS(var) call {private _r = []; {_r append _x;} forEach (allGroups select {side _x isEqualTo var}); _r}

ALL_UNITS(west)

You could use a macro.

spice kayak
#

One thing I hate about Arma is how lights shine 'through' things. Like, if there was a bright light on the other side of the building, it'll still illuminate the ground and everything on the other side of it.

little eagle
#

Yeah, it's pretty cheap.

indigo snow
#

Alpha lighting man

#

It was pretty

spice kayak
#

I actually don't remember that, even though I did play during the alpha.

#

One thing I do notice has changed would be Chemlights. Man, I remember when one of them could light up at least 3 or 4 meters. Now you'll be lucky to get half of one.

indigo snow
#

Throw smoke on them

simple solstice
#

Anyone knows the addAction priority for entering the vehicle?

spice kayak
#

Oh yeah, smoke on chem is amazing.

#

Actually took a standing break during one of our coop nights to admire how that looked.

simple solstice
#

found it 0 is get out

spice kayak
#

Like, we all just stopped what we were doing, ran into a shed, and just sat around chemlights / smoke grenades while the HQ /Zeus guys were asking what on earth we were doing. Was great fun.

ivory vector
#
_MessageBoxTextCtrl ctrlSetStructuredText parseText format["<t size='0.8px'>%1</t>",_struct];
    _newH = ctrlTextHeight _MessageBoxTextCtrl;
    _xPos = _MessageBoxTextCtrlPos select 0;
    _yPos = _MessageBoxTextCtrlPos select 1;
    _zPos = _MessageBoxTextCtrlPos select 2;

  if(_position == 0)then{
    _position =  (_23 + (10 * pixelH));
    _MessageBoxTextCtrl ctrlSetPosition [_xPos,_position,_zPos,_newH];
    _MessageBoxBackgroundCtrl ctrlSetPosition [_xPos,_position,_zPos,_newH];
  }else{
    _position = _position + _newH + (5 * pixelH);
    _MessageBoxTextCtrl ctrlSetPosition [_xPos,_position,_54,_newH];;
    _MessageBoxBackgroundCtrl ctrlSetPosition [_xPos,_position,_zPos,_newH];
  };
  _MessageBoxTextCtrl ctrlCommit 0;
  _MessageBoxBackgroundCtrl ctrlCommit 0;```
little eagle
#

_23 _34 _54
๐Ÿคข

ivory vector
#

xD just random vars xD

#

not sure which one was which xD

#

with smaller messages, it works fine, but with bigger messages, it bugs out

little eagle
#

Reminds me of Dedmen's number namespace

0 = "banana";

missionNamespace getVariable str 0 // "banana"
ivory vector
#

xD

#

better ๐Ÿ˜‰

#

oh i get it xD

#

X,Y,W,H

#

still no idea why its breaking

ivory vector
#
    //These shouldnt change.
    _yPos = _MessageBoxTextCtrlPos select 1;
    _width = _MessageBoxTextCtrlPos select 2;
    _newH = ctrlTextHeight _MessageBoxTextCtrl;

    //If there isnt already a message, we cant get the last message pos.
    if(_xposNew isEqualTo 0)then{
      _xPos = _MessageBoxTextCtrlPos select 0;
      _xPos = (_xPos + (10*pixelH));
    }else{
      _xpos = (_xposNew + (10*pixelH));
    };

    _MessageBoxTextCtrl ctrlSetPosition [_xPos,_yPos,_width,_newH];
    _MessageBoxBackgroundCtrl ctrlSetPosition [_xPos,_yPos,_width,_newH];
    _xposNew = (ctrlPosition _MessageBox)select 0;//Get the Xpos to calculate against next time
    _MessageBoxTextCtrl ctrlCommit 0;
    _MessageBoxBackgroundCtrl ctrlCommit 0;
``` is this better ?
slender halo
#

what are you trying to achieve ?

atomic epoch
#

how to do the code box in discrod?

peak plover
#

```sqf
//code
```

indigo snow
#

Should be pinned or channel description

atomic epoch
#

'''
Im doing sqf ๐Ÿ˜Ž
'''

#

D:

slender halo
#

^^ nope

atomic epoch
#

no im not

indigo snow
#

Wrong backticks

peak plover
#

under escape, the tilde key

atomic epoch
#
Now im doing sqf :sunglasses: 
peak plover
#

```sqf
private _imDoing = sqf;
```

atomic epoch
#

๐Ÿ˜Ž

indigo snow
#

You didnt define sqf! Fool!

peak plover
#
private _imDoing = sqf;
atomic epoch
#
private _imDoing = "sqf";
private _emjoi = "sunglasses";
peak plover
#

```sqf
private _imDoing = "sqf";
```

#

Copy paste that

atomic epoch
#
_sqfV2 = "Highlighting";
tame portal
#
public static class SQF {
        public static void Run(string code) {
                Exception up = new Exception("Learn C#");
                throw up;
        }
}
atomic epoch
#
super_complex_fnc = {systemChat 'I'm the best'};
little eagle
#

You fucked up, Renz.

simple solstice
#

wow

atomic epoch
#
Error: Expected string
little eagle
#

GENERIC

#

ERROR

#

IN

#

EXPRESSION

simple solstice
#

" '?

tame portal
#

I like it when you do something like this

#
private _a = 1:
#

it will say

#

ERROR IN EXPRESSION, EXPECTED switch

#

:(

ivory vector
#

xD

#

I think i got it this time,

#

after some tinkering in debug

atomic epoch
#
_code = format ["side %1", player];

will not work, since it returns "side B Alpha 1-1:1 (Renz)"
Any ideas?

ivory vector
#

?

subtle ore
#

anyone know if setPlayable is working in a3 yet?

waxen tide
#

can i detect by script if a player is looking thru his scope?

subtle ore
#

"GUNNER"

waxen tide
#

works for rifle optics?

copper raven
waxen tide
#

thanks Midnight!

copper raven
#

@atomic epoch

_code = format ["side %1", side player];
subtle ore
#

@copper raven is this exclusively for the teamswitch mechanisim or is it for playable as well?

#

@waxen tide no problem

#

"SP Only? ๐Ÿ˜›

copper raven
#

what are you trying to do?

atomic epoch
#

@copper raven Thanks, but that's not what im looking for

subtle ore
#

Create Player Object - > Set Playable - > Flexable max players

atomic epoch
#

I've already solved it

subtle ore
copper raven
#

yeah i see

atomic epoch
#
GlobalVar = player;
_code = format ["side  GlobalVar" ];

Returns code I can compile

subtle ore
#

just because it doesn't have a underscore doesn't mean it's global by the way.

tame portal
#

@subtle ore Example?

slender halo
#

have you ever experienced controls closing your dialog on click, without MouseButtonClick EH ?

#

no script error, no log

ivory vector
#

just another quick one, is there a way of searching through listboxes and changing the text whilst the dialog is open, or would i need to refresh the list ?

slender halo
#

in Surface Painter i made a search field, i did it by refreshing the list and it works fine

#

it crawls the CfgVehicles config instantly

runic surge
#
_modelInfo = getModelInfo _x;
_modelName = _modelInfo select 0;
_modelClass = "BTHBC_A3EM_" + _modelName;
_modelArray = _modelClass splitString ".";
_modelString = _modelArray select 0; 
hint str _modelString;

I have managed to get this so far with my goal of removing ".p3d" from a model name and adding the prefix to it.
Are there any obvious issues I am missing?

indigo snow
#

you can drop most of the assignments since you never use them again. the last str before the hint is also kinda uneccesary

runic surge
#

I just couldn't figure out how to use splitstring properly so I just did it in a way I actually understand lol

indigo snow
#

_string = format ["BTHBC_A3EM_%1",getModelInfo _x select 0 splitString "." select 0]

#

but yea i cant think of a more direct way of doing it so youre not missing anything

runic surge
#

ahh, thanks

#

Just tested it and it works as intended

indigo snow
#

its basically just putting all of your lines into 1 long line

ivory vector
#

@slender halo I can make a function to refresh the list, so I dont need to have 15~ lines of code in each file that i need to refresh it in ๐Ÿ˜ƒ

#

Thanks ๐Ÿ˜„

subtle ore
#

@tame portal Woops, made a mistake. I thought this was supposed to be broadcasted to all clients.

tame portal
#

@subtle ore I thought you meant global across the namespace, didn't know the context was global aka over network

subtle ore
#

@tame portal In any script, variables without an underscore will be global to anything on that machine afaik. I thought the intentions was global over every machine on the network. Not sure ๐Ÿคท

indigo snow
#

global != public

#

... unless its a command with global arguments and global effect ๐Ÿ˜„

delicate totem
#

What is the difference between local and global arguments. I understand effect but not arguments.

indigo snow
#

If the object is local to another client, the command wont work

#

Every object is local to either a client or the server

#

So player objects are local to the players client, and say they drive a vehicle the vehicle is local to them, too

#

Global argument doesnt care if its on another client, at all

tough abyss
#

Stupid and overly complicated.

delicate totem
#

Ah got it, thanks.

waxen tide
#

how do i get a plane to fly in a straight line where i want it? i've tried AI commands, waypoints, setdir, setpos in various combinations for 2 hours.

peak plover
#

vectoradd maybe?

waxen tide
#

I don't need AI it is just a 5 second intro i want to script to look good.

#

will try nigel

indigo snow
#

I think he means looping a setVectorDirAndUp for those 5 seconds

waxen tide
#

oh.

#

so like once per frame

indigo snow
#

gonna look very jittery in MP though

waxen tide
#

i'll run it local?

indigo snow
#

you can always try, i havent really hear anyone doing ti that way, though

indigo snow
#

i know for sure that had issues in MP

waxen tide
#

i see

peak plover
#

You want a plane to do a 5 second fly-by?

#

setposATL

#

Then enableSimulationGlobal false

indigo snow
#

I mean for 5 secs, how much is it gonna deviate?

waxen tide
#

and then setvelocity, nigel?

peak plover
#

Yeah, or use a pilot

#

set to careless

#

disable autocombat

waxen tide
#

i tried that

#

he pulls up

peak plover
#

fuel as 0

waxen tide
#

fuel as 0 ?

peak plover
#

setfuel 0

#

Can't pull up from that one ๐Ÿ˜„

waxen tide
#

well i would like engine sound

peak plover
#

try flyinheight

#

works well on helis

#

not sure about plane

slender halo
#

@indigo snow i know for sure that had issues in MP

#

since i made a lot of test on this function, here are two ways to get it to work in MP

#
  1. createVehicleLocal then BIS_fnc_unitPlay on every machines
    problem: if players get in the vehicle there are pos sync glitchs
#
  1. transfer the ownership of the group of the driver of the vehicle to a player then BIS_fnc_unitPlay on owner's machine, this way players can get in the vehicle without positions glitch
indigo snow
#

thanks for sharing

manic sigil
#

How would i script a plane to lay out a gun run? DoFire and ForceWeaponFire do a single burst with almost no accuracy (doTarget TGT), while FireAtTarget doesnt seem to work at all.

indigo snow
waxen tide
#

could it be that align = 'left' and valign = 'bottom' don't work at all for BIS_fnc_dynamicText

#

BIS_fnc_ambientFlyBy

#

good to know.

atomic epoch
#

Any ideas into detecting an incapacitated player with an eventhandler?

long trail
#

Try animChanged

indigo snow
#

what are they incapacitated by?

atomic epoch
#

Anything that puts someone into incapcitated state

indigo snow
#

is this with the new A3 revive system added with Tanoa?

atomic epoch
#

@long trail I was hoping to avoid animChagned. I guess its the way to go

#

if there's no other option :/

still forum
atomic epoch
#

Yup

#

I prefer eventhandlers tbh

long trail
#

You could use "hit" with a check for lifeState as suggested

#

Fires after damage is dealt so might catch the change in lifestate. Not sure though, not tried it personally

atomic epoch
#
isUnconcious = false;
player addEventHandler ["Hit", {    
    last_instigator = (_this select 3);
    if (lifeState player == "INCAPACITATED" && !isUnconcious) then {
        isUnconcious = true;
    };
}];

player addEventHandler ["KILLED", {isUnconcious = false}];

it works ๐Ÿ˜„

long trail
#

Cool beans ๐Ÿ˜ƒ

#

I was messing about with dynamic Simulation and on wiki it says there's some debug modes. I can't see them in debug console. Is this on the diagnostic dev branch build?

subtle ore
#

@indigo snow public across the network? That wouldn't make sense, especially when something is executed locally, unless of course like you said it has global effects versus the client only changes.

indigo snow
#

public as in publicVariable, or the public flag of setVariable

subtle ore
#

Wait a sec, is it automatically a public variable if not specified? 0_0

#

no usage of setVariable in that piece of code anyways.

indigo snow
#

im not sure what youre talking about anymore

#

you talked about global as in across client, i was making the point thats normally referred to as public

subtle ore
#

I see what you are saying now, sorry for the confusion.

indigo snow
#

array = array pushback (array deleteAt 0)?

#

Could even append and save an assignment

#

array append [array deleteAt 0]

waxen tide
#

Is there a list of icons drawIcons accepts?

young current
#

drawicon3d accepts "path\filename.paa"

#

Id presume the drawIcon accepts it too

#

there is a list somewhere too I think

#

but couldnt find it with quick search

polar folio
#

is RscLine a line you can draw from one 2d position to another? and if so, does anybody know the commands for that type fo control?

waxen tide
#

thanks HorribleGoat

rancid ruin
tame portal
#

Any reliable method to prevent death of a player?

#

I'd assume handledamage does the job, however does anyone know what critical parts of the player will result in death?

rancid ruin
#

what do you mean by what critical parts of the player will result in death??

#

damage EH checking if dealt damage will kill unit - that works fine yeah

#

afaik death in arma just happens when your damage hits 1.00, that's it

tame portal
#

Yeah, but your damage consists of all your different body parts

#

I know that I can prevent death of a player by not letting his overall damage reach 1

#

but the question is which specific body parts have to stay < 1 to not make the player die

#

I'd guess head, neck, torso

#

I just need to make the player not die ^^

rancid ruin
#

ah, i see. good question

#

i'm sure i read a post about this once, or maybe it was just a long conversation in this channel

long trail
#

@indigo snow Thanks for the move to back array stuff. Very nice.

peak plover
#

Is there a setVehicleVarName alternative for groups?

#

In mission sqm it says


            class Attributes
            {
                name="blu_1";
            };
#

And How do I retrive the name of the group?

#

*varName

peak plover
#

allGroups does a good job at keeping the groups, BUT, I have no way to check if the group would have playable units in it...

#

Is there a way to check unit ID based on missionSQM

#

...

#

does postInit have any ordering at all?

#

or are all scripts spawned ?

#

is postInit in 1 thread, or are all functions with postInit = 1 in separate threads?

robust hollow
#

im pretty sure post init functions are called from within a scheduled script, and they execute in the order they are in the cfg.

peak plover
#

๐Ÿ‘ That's perfect

#

I require that this script runs after groups are initialized, but before everything in postInit

tiny elm
#

hey guys, just wondering... is it possible to use "waitUntil" in a loop whilst the rest of the script continues on?

peak plover
#

yes and no

tiny elm
#

because I don't want to have to use a while loop

peak plover
#

while {true} do {
    if (myBool) then {
        [] spawn {
            waitUntil {myBool2};
            //stuff after waitUntil
        };
    };
    //stuff now
};
#

if we use sleep 1; in both, waitUntil takes more resources

#

in theory

tiny elm
#

yes my thoughts exactly

peak plover
#

They have separate uses/functionality

tiny elm
#

basically I'm wanting to write a small snippet to refuel a UAV every 4 hours

peak plover
#

a 4 hour loop?

tiny elm
#

using waitUntil instead of while. thannks for that snippet, will help heaps

#

im not sure how else I will do it

#

im not sure how else I will be able to do it

peak plover
#

if you want to just refule,when empty. But if you want a reful every 4 hours..

tiny elm
#

I looked at that event handler... if it refuels when empty won't it crash still?

peak plover
#

Why would it?

tiny elm
#

I just haven't tested it yet, I was under the assumption it would just go for a dive bomb

peak plover
#

if you have an ai in a helicopter, cursorObject spawn {_this setFuel 0;sleep 3; _this setFuel 1;}

tiny elm
#

whereas refuelling it before it is empty will keep it on a continuous waypoint?

peak plover
#

And since it's a eventhandler, it means that it runs instantly, when event fires, so it would be exactly like this:{_this setFuel 0; _this setFuel 1;}

tiny elm
#

ah I see

peak plover
#

running out of fuel should not affect waypoints

#

I remember playing a mission and couldn't finish it in 3 hours, left mission running on server, tried again next day, ALL ai had run out of fuel ๐Ÿ˜„

tiny elm
#

yeah well I need th UAV to run for about 2 weeks non stop lol

#

a bit exaggerated, but you know what I mean lol

peak plover
#

Yeah ๐Ÿ˜„

#

MultiSessionOps

#

How are you handling persistance?

tiny elm
#

^^ im obviously missing something else lol.... what do you mean?

peak plover
#

ops in progress, 1 week in (2 weeks total) > ACE3 updates > server out of date > how do you save progress in order to restart server?

tiny elm
#

oh no, this only being run inside the wire

#

so updates have no effect whatsoever

peak plover
#

"inside the wire"
Inside the what now?

tiny elm
#

as in its not being run online

peak plover
#

aah ๐Ÿ˜„

tiny elm
#

sorry just diff terminology :/

peak plover
#

I still need to find a way to setVehicleVarName alternative for groups

tiny elm
#

ummm I think i may have something for that

#

ill check

peak plover
#

groupID kind of works, but not exactly...

tiny elm
#

oh thought I had come accross that problem already... seems I haven't unless my seaching skills through my scipts are bad tonight

little eagle
#

@indigo snow
You made a mistake:

array = array pushback (array deleteAt 0)

pushBack manipulates the array just like append and afterwards reports the size of the array.
It should be:

array pushBack (array deleteAt 0);

Which is slightly better than append [...].
I think you confused pushBack with +.

indigo snow
#

Well, it was during a 3am toilet visit ๐Ÿ˜…

little eagle
#

This is also how you can shuffle an array.

for "_" from 1 to count _array do {
    _array pushBack (_array deleteAt floor random count _array);
};
simple solstice
#

returning to my yesterday's issue, how do I check if player is looking at a given position?

#

linesintersect didn't really work for me

little eagle
#

Any player or the local player?

simple solstice
#

local

indigo snow
#

Worldtoscreen the position and check the distance to screen center in screen coords?

little eagle
#
screenToWorld [0.5,0.5];
#

Reports AGL

indigo snow
#

That has issues if the background isnt ground, though

little eagle
#

But ignores (terrain) objects.

#

Well if it reports nothing or whatever the fallback is, then you know that the player isn't looking at whatever position.

#

i.e. looking into the sky

simple solstice
#

I need to check if player is looking at a wheel for example

#

I get the selection position, modeltoworld and then use screentoworld

#

am I thinking right?

little eagle
#

That will be very difficult, because a wheel could have any selection / proxy name depending on what vehicle.

#

It will be different for any vehicle class.

simple solstice
#

after checking with many mods they usually have wheel_1_1_unhide/hide

indigo snow
#

Dont they need hardcoded names because physX, or are they just convention?

little eagle
#

I can't remember

simple solstice
#

haven't seen anything other than wheel_*

little eagle
#

RHS is weird is all I'm saying.

simple solstice
#

not using it :D

little eagle
#

Is this for changing tyres?

simple solstice
#

yes

#

via bis fnc holdactionadd

little eagle
#

This is the best I could cook up in the past to get the wheel selections.

simple solstice
#

oh, thanks!

little eagle
#

There is no line intersect etc. here, because that is all done by the interaction menu.

#

But it should give you the selectionName stuff.

simple solstice
#

thanks, will experiment with screen to world

simple solstice
#
position player inArea [(van modelToWorldWorld (van selectionPosition "wheel_1_1_hide")),1.5, 2, 45, false]
indigo snow
#

At that point you should just use distance

simple solstice
#

oh.. right

waxen tide
#

Is there an elegant way or a function even to draw icons on a map that are highlighted on mouseover and give me a return on click?

cinder night
#

Hey all, is it possible to turn Jet radar off via script without the use of mods ?

simple solstice
#

Ohh this is giving me a headache. After destroying the wheel, the selectionposition changes.

#

To the center of the car. WTF

long trail
simple solstice
#

How do I select values from both arrays in a multi-array in forEach?

#
[["HitLFWheel","HitLF2Wheel","HitRFWheel","HitRF2Wheel"],["wheel_1_1_steering","wheel_1_2_steering","wheel_2_1_steering","wheel_2_2_steering"]]
young current
#

Does anyone happen to know where one would find the inner workings of the ArtilleryComputer?

waxen tide
#

@simple solstice maybe like that but if both arrays aren't the same length you will have issues

#
_wheel_array = [["HitLFWheel","HitLF2Wheel","HitRFWheel","HitRF2Wheel"],["wheel_1_1_steering","wheel_1_2_steering","wheel_2_1_steering","wheel_2_2_steering"]];

{
    _x = _item1; // item from subarray 1
    ((_wheel_array select 1) select _foreachIndex) = item2; // item from subarray 2
} forEach (_wheel_array select 0);
simple solstice
#

they always will be same lenght, thanks

#

also, _item should be at the begging ๐Ÿ˜„

waxen tide
#

ehh its early morning cut me some slack

tiny elm
#

would it be easy enough to get the code and add more to it/customize more or?

indigo snow
#

Thats not a mod, its the A3 high command system

tough abyss
#

@little eagle - how much did you hate Arma from 1 to 10 while writing that?

slender halo
#

i just solved my problem so i'll drop the solution here in case it happens to someone someday

#

never use 1 or 2 as IDC, they are reserved and will close your dialog on click

dusty fiber
#

Looking for help to use Ace3 slide show module. Can't seem to get it to work. Anyone know how to use it?

digital pulsar
#

i cant get systemChat to work in briefing screen, has that changed recently?

peak plover
#

Works for me, use uiSleep 1 to make sure you don't call it too early

#

Because systemchat seems to clense at one point

digital pulsar
#

ah nvm, got it now

#

i'll try uisleep to make it more consistent though

peak plover
#

Why do you need it?

#

You could use diag_log if debug

#

I

#

I've used AI DONE SPAWNING and just use sqf [] spawn {uiSleep 1;systemChat 'AI DONE SPAWNING' }

#

Otherwise it would make loading screen longer if using uiSleep

cold pebble
#

If I have an array, and I want to pushBack another array, which I set a var as true, is it done like this?
myarray pushBack [my_var = true;, my_othervar = false;];

#

Sorry for no proper sqf syntax, on my phone so can't get the right symbols

peak plover
indigo snow
#

You cant do assignments like that, nor use == with true or false

peak plover
#

or append

#

you have to use [{my_var = true;},{my_othervar = false;}]

#
myArray append [{my_var = true;},{my_othervar = false;}];```
indigo snow
#

Those semicolons are superfluous and eat milliseconds during compile time ;)

#

Except for the final one, of course

cold pebble
#

I didn't think it would work honestly, but thanks, and nick you mean the ; found in Nigel's {}?

indigo snow
#

Ye

cold pebble
#

Aight thanks, getting those millisecond performance boosts lol

indigo snow
#

Its mostly me poking fun at nigel

#

It sounds a bit wierd what youre soing there tho, what are you trying to do?

cold pebble
#

And say I wanna pop another array at the back, just popping ,my_otherarray

#

For now it's just me messing with stuff, if I finish it when I'm home at my PC I'll be back here ๐Ÿ˜‰

#

On my phone so it's a bit awkward to do all this

indigo snow
#

Glueing arrays together is normal, i was just very confused by whats in them

peak plover
#

*0.001 ms ๐Ÿ‘Œ

cold pebble
#

Yeah I'm just messing about trying a few things

#

Hence the questions ๐Ÿ˜‰

indigo snow
#

Yes but i was unsure if the question was about glueing arrays or the contents you showed

cold pebble
#

Glueing an array, then popping a variable at the end ๐Ÿ˜‰

#

Or variables in my first case

indigo snow
#

What do you mean with popping? Either way, the assignment operator = doesnt return the assigned value in arma, if thats closer to your question about that

#

So you have to assign first and then put them into your array

cold pebble
#

Popping meant putting ๐Ÿ˜‰ never mind for now lol

#

Thanks for the help ๐Ÿ˜ƒ

little eagle
#

@tough abyss
I LOVED EVERY MINUTE OF IT.

digital pulsar
#

[getPosATL MYT_startPoint] remoteExec ["MYT_fnc_setPlayerPos", 0, true]; this doesn't have any effect when called on dedi from init.sqf (within if (isServer) then {}) but it works just fine if I execute it on the server from console a few seconds later

#

any idea why would that be?

tough abyss
#

@little eagle - late stage SQF.

little eagle
#

@digital pulsar The remote script is executed before the players exist

digital pulsar
#

the function spawns a piece of code with waitUntil {!isNull player} shouldn't that mitigate it?

little eagle
#

Maybe you can't set the position of the player at mission start, because the game or another script resets it.

#

Why is this remoteExec'd anyway? Please don't tell me this is another one of these server only mods.

digital pulsar
#

works in hosted though

#

MYT_startPoint is randomized

#

alternatively i could just pubVar this variable and handle the rest locally

#

which sounds much simpler

little eagle
#

I was about to suggest that.

#

Timing on dedi vs local hosted is very different, because the server in loca hosted has to do all the client / interface stuff too.

waxen tide
#

is there a way to remove the "take" action on items that can be picked up?

peak plover
#

What is your end-goal?

#

Remove the action completely?

waxen tide
#

yeah

digital pulsar
#

simple object / disable simulation?

waxen tide
#

i don't want a player to pick it up

#

action still shows even with simulation off

#

hmm any way to place simple object in editor or put a script on it to turn it into simple object?

peak plover
#

    class TakeItem: None
    {
        textDefault="<br/>";
        textSimple="<br/>";
        showIn3D=0;
        showWindow=0;
    };

This for ex. gets rid of the action from the middle of screen, but you could also disable it completly like this
But requires mod

digital pulsar
#

theres a tick box in special states, not sure if thats for every object

waxen tide
#

thanks

#

turns out if you set ammo and health of the gun to 0% it doesn't show

rotund cypress
#

Or just use onnextaction etc evhs

waxen tide
#

A buddy of mine is building stuff in the editor for the same project i'm writing scripts for and he asked me, so if he can just do it in editor - the better. But thanks i'll remember for later.

waxen tide
#

quiet channel today. scary.

winter rose
#

BOO!

waxen tide
#

AHHHH

#

are there more handlers, or is "draw" the only one?

#

I can't find a list

#

Also event handlers confuse me.

#

okay i somehow looked at this page like 20 times today and managed to ignore the yellow box.

subtle ore
#

๐Ÿคฆ

waxen tide
#

i'm sure someone added it seconds ago.

subtle ore
#

do you mean the user interface event handlers? Lol.

#

Pretty sure they've been there for a while

waxen tide
#

well the "onDraw" text didn't make too much sense to me, hence i thought that list is for something different.

subtle ore
#

When the control is drawn?

waxen tide
#

well i found example code and was trying to figure out exactly what is going on and i somehow expected ctrlAddEventHandler ["Draw", ... to do something else than fire on map drawn.

#

i'm entirely de-confused now.

subtle ore
#

Yep.

waxen tide
#
_deploy_marker1 = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler
    ["Draw", "_this select 0 drawIcon ['iconVehicle',[0.25,0.7,0.25,1],[26250,25450],30,30,0,'DEPLOY',1,0.06,'TahomaB','right']"];

waitUntil {!(isNull (findDisplay 12))};
openMap [true, false];
_index = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler
[
"MouseMoving",
{
    _map_coor = (_this select 0) ctrlMapScreenToWorld [_this select 1,_this select 2];
    _size = 50;
    if (
            ((_map_coor select 0) > 26200) && ((_map_coor select 0) < 26300) &&
            ((_map_coor select 1) > 25400) && ((_map_coor select 1) < 25500)
        ) then {hintSilent str "Molos";
                ((findDisplay 12) displayCtrl 51) ctrlRemoveEventHandler ["Draw", _deploy_marker1];
                _deploy_marker1 = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler
                ["Draw", "_this select 0 drawIcon ['iconVehicle',[1,0.25,0.25,1],[26250,25450],30,30,0,'DEPLOY',1,0.06,'TahomaB','right']"];
        }
        else
        {
            _deploy_marker1 = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler
            ["Draw", "_this select 0 drawIcon ['iconVehicle',[0.25,0.7,0.25,1],[26250,25450],30,30,0,'DEPLOY',1,0.06,'TahomaB','right']"];
        };
}
];

sleep 20;
((findDisplay 12) displayCtrl 51) ctrlRemoveEventHandler ["Draw", _deploy_marker1];
((findDisplay 12) displayCtrl 51) ctrlRemoveEventHandler ["Draw", _index];
#
'...los";
((findDisplay 12) displayCtrl 51) |#|ctrlRemoveEventHandler ["Draw", _deploy_...'
Error Type Any, expected Number
#

the code to draw the icon works, the code to delete the event handler works, too. I think me nesting it inside that if is the problem? variable in wrong scope? but i don't know how to fix it. if i put the code block to delete the evh in the very bottom only, works like a charm and deletes them after the sleep 20;

robust hollow
#

yea it wont know the private variable cause its inside the evh code

waxen tide
#

just so i get that correctly, it will not know _deploy_marker1, yes?

robust hollow
#

correct

waxen tide
#

is there an elegant solution to this?

robust hollow
#

the easiest way is to use global variables instead.

waxen tide
#

maybe if i create it right in the eventhandler?

#

then it should be in the correct scope

robust hollow
#

no that wouldnt work. i dont know how to explain it properly but ill try.

every time the evh code is called its in its own scope stack. so it wont know any local variables set before the evh was set and wont share any variables it sets inside the evh between calls.

waxen tide
#

i see

#

but if i create and delete the evh "_deploy_marker1" inside the evh code block of the mousemoving evh?

robust hollow
#

you would need to define _deploy_marker1 inside mousemoving to delete it. if you set it in one evh call it wont know it on the next.
is why i say global variable would be easier

waxen tide
#

this is a script i intend to run shortly on the client only, to give the player an option to pick one of a few pre-defined map locations and send that to the server. idk how dangerous a global var is in that context.

robust hollow
#

i wouldnt think itd be that bad, its just a number.
you set the global var at the start when you first set the draw evh outside of mouse moving. you use that same var inside mosuemoving and again at the end of your script. then set it to nil after it removes the evh if you're worried about it just sitting there.

waxen tide
#

okay. thanks!

noble pond
#

so is anyone else aware that select command is capable of returning null, even if the index is supposedly out of range?

#

but only by + 1

#

if you try + 2 then it will throw index out of range error

#

wonder if there is BIS code relying on this quirk.

waxen tide
#

Now i got it semi-working, but i can only see one of the 3 icons i draw. it is like i overwrite the others ... can't i draw 3 icons in parallel with 3 different event handlers?

#

if i remove the 3 if with the ctrlSetEventHandler , it draws all 3 icons just fine

#

my systemchat and hint stuff fires as it should

#

The whole purpose of this is to draw 3 icons on the map that change color on mouseover

robust hollow
#
    if (_once) then
    {
        _once = false;```
what is the point of this?
rancid ruin
#

nobody can tell you if you only post 4 lines of a bigger script

robust hollow
#

its in his pastebin

rancid ruin
#

oh, it looks quite pointless

daring pawn
#

chaps is there a way to waitUntil on a function? For example I need to make sure the function has completed before continuing? I could try just time it with a sleep but its not ideal.

#

I considered a variable in it, but the function runs on the server and can be run by multiple clients simultaenously

robust hollow
#
waituntil {scriptdone _s};```
daring pawn
#

If i did this for example:

_s = [] spawn {[_objet] remoteExecCall ["ObjectFromDB",2];};

is that going to correctly wait until the function it calls is done or wait until its spawned the function?

robust hollow
#

no, itl wait until the remoteexeccall finishes, not the code it is remote executing.

#

if that makes sense

daring pawn
#

Yea it does. problem now is how can I get my _objet to exist inside the [] spawn scope

robust hollow
#

[_objet] spawn ...?

daring pawn
#

-_- oh yea... no shit ๐Ÿ˜›

#

fuck

#

aha yea okay cheers

waxen tide
#

woops

#

i think thats a leftover from a brainfart connor

#

ah, no.

#

I wanted to draw the icons once, and then just set them. but i just realise, thats oneachframe in the evh basically?

#

i'm an idiot.

#

doesn't change the function tho.

#

it only draws and sets marker 2

#

it ignores 1 and 3

rancid ruin
#

the way i think of it is: event handlers are for calling some code when an event happens, and the event for eachframe EH's happens each frame.

waxen tide
#

i think i understood that and changed my code accordingly, still behaves unintended

waxen tide
#

works just fine, but my god is it ugly.

#

looks decent tho

winter rose
#

you could use "_cursorPos distance _markerPos" since your marker is round?

robust hollow
#

distance would differ depending on the map zoom i would think

rancid ruin
#

yeah wait, wtf is this

    if (((_map_coor select 0) > 26100) && ((_map_coor select 0) < 26400) &&
        ((_map_coor select 1) > 25300) && ((_map_coor select 1) < 25600)
        ) then {hintSilent str "Molos";
#

you can just use distance like you would with any positions

#

ctrlMapScreenToWorld converts the position of your mouse in a map ctrl to a world position

robust hollow
#

Hypothetically: if you remoteexec to a target that is local, does it still send over the network?

still forum
#

Theoretically no. But I'm not sure if that is prooven/tested

little eagle
#

you can just use distance like you would with any positions
Weak. The correct way is to turn your coordinates into a polynomial, obviously.

_map_coor params ["_x", "_y"];

if ((_x - 26100) * (_x - 26400) <= 0 && {(_y - 25300) * (_y - 25600) <= 0}) then {
rancid ruin
#

๐Ÿ‘Œ๐Ÿฟ

ionic orchid
#

I wish vectorXXX functions let me use arrays of 2 elements

little eagle
#

Oh fuck yes this ^

#

Set z to 0. Still worth it compared to doing the math.

ionic orchid
#

Yeah, good call

#

adds a //TODO

little eagle
#
if (_map_coor inArea [[26250, 25450], 150, 150, 0, true]) then {
peak plover
#

Would inarea be a good replacement for distance

little eagle
#

Well, this is for a rectangle, so...

peak plover
#

Yea, but in theory. It coudl be a circle

little eagle
#

Idk, distance seems very simple. But isn't it also using AGL? This one is purely 2D with z being omitted.

peak plover
#

Hmm, good point, I'm thinking far into future, I want to redo some of my ai script

#

and it's obviously running in a endless loop, so constantly checking shit, so every 0.0001 ms ACTUALLY matters

little eagle
#

so every 0.0001 ms ACTUALLY matters
I don't believe you. If it did, then you actually would replace all ; with ,

peak plover
#

I will actually consider that...

#

I coul do a replace function wit npp

still forum
#

If every millisecond matters.. You would stop using SQF and save yourself years of time

peak plover
#

replace all ; with newline with ,

#

lmao

little eagle
#

All

{a} else {b}

be

[{a},{b}]
still forum
#

That is actually a reasonable thing to do.

peak plover
#

More context?

little eagle
#

All

while {true} do

be

for "_" from 0 to 1 step 0 do
peak plover
#

if () [{a},{b}];

little eagle
#

missing then

peak plover
#

ohhshit

#

that's nice

#

didn't even nows

little eagle
#
loop = for "_" from 0 to 1 step 0;

0 spawn {
    loop do {
        sleep 1;
        systemChat str time;
    };
};
peak plover
#

I'll convert some of my physical notepad notes to computer notes and add those ^

little eagle
#

Should make a gist of all the stupid SQF shit I can think of.

peak plover
#

๐Ÿ˜‰

tiny elm
#

ahhhh

#

so frustrating! I can not for the life of me get my functions library to work -_-

indigo snow
#

Check the file names and the folder theyre in

#

If you placed your functions into a functions folder you need to specify it

#

Etc

waxen tide
#

yawns

#

so where you guys joking, or is inarea zee fastest?

little eagle
#

Considering the other options and distance not working for cartesian coordinates - yes, inArea is the fastest for this problem.

slender halo
#

Should make a gist of all the stupid SQF shit I can think of.

#
private _ternary = ["if false", "if true"] select (_var > 13);
#

@little eagle what do you think about this one ?

little eagle
#

inArea basically says, here is one SQF command instead of ~8 and do this all in C++ land instead.

#

zgmrvn, weak

private _ternary = "if " + str (_var > 13);
slender halo
#

yeah, i mean in this case it fits, but according to BIS, this is faster than a

private _ternary = if (_var > 13) then {"if true"} else {"if false"};
little eagle
#

Sure, the problem is that if-then-else only executes the code blocks if the condition is true. With select BOOL, the two array elements are always executed.

#

So it only works for simple assignments.

slender halo
#

sure

little eagle
#

I like it and try to use it when possible. It's way nicer than _var = if

slender halo
#

same

#
X_remote_client = [0, -2] select isDedicated;
little eagle
#

B-but headless client.

still forum
#

What? Where is my head?! *runs around looking for his head*

little eagle
#

hasInterfaceeeee

#

oh

#

interFACE

#

HEADlessClient

still forum
#

Found my Head. But the Face is missing!

#

HEADFACE

little eagle
#

Suspicious.

still forum
#

interlessClient

peak plover
#

The Faceless Men

vague hull
#

interFaceClientlessHead

waxen jacinth
#

is it somehow possible to add/remove radar/sensor to vehicles like in a way adding weapons, magazines to a vehicle? ```C

_vehicleObject removeWeaponTurret ["missiles_DAR",[-1]];
_vehicleObject addWeaponTurret ["LMG_Minigun_Transport",[0]];```

little eagle
#

is it somehow possible to add/remove radar/sensor to vehicles
maybe

#

like in a way adding weapons, magazines to a vehicle?
certainly not like this

#

this?

indigo snow
#

i think that only enables existing sensors

#

like it turns the sensor on

little eagle
waxen jacinth
#

yeh was tryin it thru enableVehicleSensor bust sadly not working, dang. Config not a option, since it's not possible to define in description.ext yet, huwm?

indigo snow
#

no

little eagle
#

config.cpp

#

mod

drifting barn
#

@robust hollow if you remoteExec to a target that is local, it does indeed send it over to the network; if you set BE's remoteexec.txt to 5 "" and do [] remoteExec ["stuff", player], you get kicked.

still forum
#

Atleast with BE enabled.
If you have BE enabled any script that is executed on your PC is sent over the Network.
So if you want to optimize Network usage.. disable BE.

drifting barn
#

๐Ÿ˜‚

little eagle
#

This is because this stuff is done with the same logic the owner command uses. Everything has to go through the server, because only the server knows which object belongs to which machine.

#

The clients only know what they own, but that shortcut is not taken by remoteExec.

drifting barn
#

the shortcut is not taken because the command string still has to be filtered thru the server's CfgRemoteExec

little eagle
#

Nah.

#

The remoteExec thing is used to execute stuff on other machines, so this shortcut would be pointless. Clients don't know which machine it is. All messages must go through the server.

drifting barn
#

as silly as it sounds, the Debug console's Local Exec button relies on remoteExec, this is what the button does: [[], _inputCode] spawn {_this remoteExec ["call", [player, clientOwner] select isNull player]}, so it's not always used to execute stuff on other machines

little eagle
#

That's just because KK tinkered with it.

#

He thinks this is a good idea to force unscheduled. It just doesn't matter for the debug console, because no one uses it in actual missions.

peak plover
#

no one
I do

little eagle
#

u r a no 1

peak plover
#

Got me there ๐Ÿ˜ญ

little eagle
#

โ–ช

tough abyss
#

โ–ซ

still forum
#

โ—ฝ

peak plover
#

๐Ÿ‘๐Ÿฟ

little eagle
#

Wash your hands.

peak plover
#

๐Ÿ‘Œ

#

whoa

little eagle
#

Jaundice.

tough abyss
#

๐Ÿ‘๐Ÿ‘„๐Ÿ‘

little eagle
#

I've seen that face somewhere...

peak plover
#

@still forum I can't figure out which function gives the default radios to players...

#

TFAR_fnc_requestRadios ?

still forum
#

I think the serverside of requestRadios.. actually

#

TFAR_fnc_radioToRequestCount
TFAR_fnc_getDefaultRadioClasses

peak plover
#

My goal is to have a button for admin menu that allows to set another players radios to whatever they were supposed to start with

still forum
#

I like cookies ยฏ_(ใƒ„)_/ยฏ

peak plover
#

I thought I culd just run a function that's like tfar_fnc_addDefRadios

#

I'll just write my own func for that

still forum
#

TFAR_fnc_radioToRequestCount just reads from modifyable variables

#

TFAR_DefaultRadio_<Personal/Backpack/Rifleman/Airborne>_<West/East/Independent>

peak plover
#

Yeah, so for example on respawn, player is given default radio (vanilla), it's converted into ^

still forum
#

Into what ever is inside that variable

peak plover
#

godcha

tough abyss
indigo snow
#

You need to define _time24 in the main scope

#

Local vars travel down scopes, but not up

tough abyss
#

thanks lol

queen cargo
#

@native cypress fyi
a private "_time24 is enough

#

best would be: private ["_hour", "_minute", "_time24"]

#

to ensure all those variables never can leak to an upper scope

tough abyss
#

@little eagle - in the mirror?

indigo snow
#

@queen cargo please private ARRAY is superseded with the keyword variant for _hour and _minute

queen cargo
#

so what?

indigo snow
#

So why say thats best / recommend it?

queen cargo
#

less mixing stuff

indigo snow
#

/shrug maybe

tough abyss
#

Is there a way to pre-set the size of an array?
As an example in Java,

int[] x = new int[size]();
queen cargo
tough abyss
#

Thank you.

weary turret
#

I would like to make a mission about lifting containers in the ocean that fell off from a passing cargo vessel. How do you make containers stay afloat in water? I've tried some solutions with above sea level with no joy.

subtle ore
#

@weary turret setVelocity ?

#

seems like a better solution to setVelocity in that case

weary turret
#

containers just sink with the door side going down first

subtle ore
#

yeah take a look at the first syntax of setVelocityTransformation.

weary turret
#

I tried setPosASL

subtle ore
#

Sure, but this will keep pushing it over the water line

weary turret
#

hopefully. it goes by the center point of the prim box. I'll give it a go

#

just need it so I can air lift containers

#

I also tried this setPosASL [getposASL this select 0, getposASL this select 1, 0]

subtle ore
#

@weary turret have you just tried doing that in a loop?

weary turret
#

yeah, nothing

subtle ore
#

once set initially, it's free to roam after it'sb een set

warm gorge
#

Is there any way to return a controls base class? ctrlClassName can return what you name a control's class, but not the base class like RscEdit or whatever

long trail
#

Try inheritsFrom, or bis_fnc_returnParents

young current
#

@weary turret attach it to something that floats and make the floater invisible

indigo snow
#

setMass!!!

sullen willow
#

Quick question. Let's say I want to have a vehicle run a script until the vehicle is destroyed. Is that possible?

peak plover
#

Yea

sullen willow
#

Specifically I need it to call a function every 10 seconds

#

(I'm a serious noob at this.)

How would I have it initialize the script when you get into the vehicle?

indigo snow
#

look up event handlers

#

specifically getIn

sullen willow
#

Oh god yes

#

That makes things much easier

indigo snow
#

then you can have a while loop that checks if the vic is alive and the player inside and sleeps for 10 seconds

peak plover
#

spawn your loop and then add a event handler mpKilled and terminate the loop, that you spawned earlier

indigo snow
#

if you use a while loop, it keeps it simpler

#

id recommend that

#

especially for someone relatively new

peak plover
#

But some code inside the loop might rely on the vehicle being alive and error

#

Doing alive check after every line might not always be good

indigo snow
#

hence checking that state in the while condition

peak plover
#

depends on what you are doing

indigo snow
#

ah i get what you mean

#

obviously a CBA_directCall inside it ๐Ÿ˜‰

#

in unscheduled itd error silently and kill itself when it errors anyway iirc

peak plover
#

It ususally is not an issue when it dies, rather when it's deleted.
Ohh yes, that would work as well.

@sullen willow I hope you are getting all of this ๐Ÿ˜‚

indigo snow
#

yes no more asking questions now!!! ๐Ÿ˜‰

sullen willow
#

I'm not. I mean, I know WHAT I should be doing, but not how to flesh it out. When I said I'm a noob, I meant it. Lol.

indigo snow
#

its cool you can ask shit

sullen willow
#

This is my first real mission and so far it's been a really wild ride lol.

peak plover
#

Ok, have you done any coding before or used google ?

indigo snow
#

maybe bing

sullen willow
#

I can google lol. I'm reading up on Event Handlers right now

peak plover
#

very good, you will get far

indigo snow
#

yea start with that. just a simple thing that gives a hint when you get inside the vehicle

#

then extend from there

sullen willow
#

That might make things a bit easier

indigo snow
#

its how i code too and ive written thousands of lines by now

#

get something small working asap so you have less chance of going mental ๐Ÿ˜„

sullen willow
#

I dun fugged up

#

Show me where I went wrong, O Masters

#

this addEventHandler GetIn systemChat "Test.";

indigo snow
#

syntax

#

look at the wiki page for addEventHandler, the right side of it

#

especially example 1

daring pawn
#

Quick load order question, would a server initialized missionEventerHandler call before OnPlayerRespawn.sqf or after? How would one find load order of this sort of thing?

#

Basically is the PlayerConnected eventhandler going to load before or after OnPlayerRespawn? The answer should be obvious but i'd like to check if theres some load order heirachy somewhere for similar things?

indigo snow
daring pawn
#

Ah I thought that page existed, I couldn't damn find it

#

cheers

indigo snow
#

keep in mind server initialization is very fuzzy

daring pawn
#

But it doesn't mention a mission eventhandler . Object event handlers are mentioned however

sullen willow
#

This is what I came out with on 2nd attempt, said something about expecting a string

#

this addEventHandler [GetIn, systemChat "Test."];

daring pawn
#

Yea this is assuming the mission/server is already going

indigo snow
#

@sullen willow still not the right syntax

#

the brackets are all wrong

sullen willow
#

Dangit

indigo snow
#

["getIn", {systemChat "test"}];

#

observe the differences and the wiki

#

it should be obvious

#

{ ... } contain code

#

"..." is a string, or text

#

all 'words' not inside "" are commands or variables

sullen willow
#

๐Ÿคฆ๐Ÿผ I don't know how I didn't see that

indigo snow
#

so the array [ ... ] first contains a string with the type of event handler and then a bit of code to execute

#

@daring pawn You'll have to test it or hope someone with some more experience chimes in. I'd personally guess the order isn't guaranteed.

sullen willow
#

Gonna play around with this a little, will report back if I hit a brick wall.

daring pawn
#

@indigo snow yea no worries, cheers mate

indigo snow
#

It's tricky because they both fire so early

sullen willow
#

All right. So. Say I want the event handler to call a script.

["getIn", {ExecVM "xyz.sqf"}]; ?

indigo snow
#

that's the syntax for execVM, yes

#

you probably want to pass over the vehicle the player is getting into, however

#

so _this execVM "myScript.sqf"

#

and then there will be a bunch of handy values in _this

#

which is a magic variable passed along

sullen willow
#

Fuck me this gets deep

indigo snow
#

stacking bricks

sullen willow
#

yep

#

rofl

#

what would be the syntax for the vehicle being alive

#

not alive LandVehicle, right?

indigo snow
#

yes but i prefer ! instead of not

#

has the systemChat been working, btw?

peak plover
#
for '_i' from 0 to 1000000 do {
not(true)
};
//517.5 ms
for '_i' from 0 to 1000000 do {
!(true)
};
//480.333 ms
sullen willow
#

sleep 5; hint "You gain 500 USD";
[500,0] call HG_fnc_addOrSubCash;```
#

I don't need the systemchat, but yes, it did work.

#

What I have there so far doesn't seem to be working

indigo snow
#

is landVehicle the name of the car?

sullen willow
#

Oh

#

shit

#

no

indigo snow
#

youre also missing a bracket in there

sullen willow
#

Does it need a unique name?

indigo snow
#

the vehicle will be in _this

#

from the event handler

#

_this contains: the vehicle, the position, the unit getting in, and the turret theyre getting in

sullen willow
#

sleep 5; hint "You gain 500 USD";
[500,0] call HG_fnc_addOrSubCash;```
#

?

#

I feel like I'm an inch away from getting it

#

getting an error about an undefined variable in line 1

peak plover
#

_this is undefined

simple solstice
#

you need to pass the vehicle to the script

sullen willow
#

I know how to do that

#

pokerface.jpg

#

I

indigo snow
#

show us what you event handler code looks like atm?

sullen willow
#

replaced _this with the variable name

#

and it's working.

indigo snow
#

yea but ideally this would work for any arbitrary vehicle right?

peak plover
#

I think Harmont goofed

#

Prove me wrong!

sullen willow
#

sleep 5; 
systemChat "You gain 500 USD";
[500,0] call HG_fnc_addOrSubCash;

},
#

It's working just fine.

peak plover
#

Put the sleep to the end

sullen willow
#

Ok

peak plover
#

actually nvm

sullen willow
#

Also

peak plover
#

it does not matter in that case

indigo snow
#

add this before the while-line:
params ["_vehicle"];, then you can use _vehicle for the vehicle name

sullen willow
#

Now I need it to stop the script when the vehicle dies.

indigo snow
#

your while already does that

sullen willow
#

Oh, gotcha.

indigo snow
#

when its dead it stops

sullen willow
#

Oh, duh. While alive.

#

I'll take my dipshit trophy now, thanks.

indigo snow
#

you can waitUntil it's !alive, too ๐Ÿ˜›

sullen willow
#

I learned a shitload today

peak plover
#
myLoop = [] spawn {
    while {alive car1} do {

    sleep 5; 
    systemChat "You gain 500 USD";
    [500,0] call HG_fnc_addOrSubCash;

    },
},

then you do

terminate myLoop;
#

For educational purposes

#

But yea, it stops if car is dead so, this is not needed

sullen willow
#

This is pretty damn sexy.

peak plover
#

You should probably do

while {!isNil "car1" && {!isNull car1} && {alive car1}} do {

Because if someone deletes the car, your script will throw an error

#

Or somethingdeletes it

indigo snow
#

isNull isnt needed

#

check alive objNull ๐Ÿ˜‰

sullen willow
#

They shouldn't be able to delete it

#

Unless destroying counts as deleting

peak plover
#

Ohh nice @indigo snow

indigo snow
#

i still propose you dont hardcode the car name for further learning but thats up to you

sullen willow
#

Oh, shit.

#

Yeah I didn't think of this.

#

I need the script to stop when I get out.

grand berry
#

Is the difference between remoteExec and remoteExecCall the fact the one is in the unscheduled environment and the other in scheduled.?

warm gorge
grand berry
#

Cheers ๐Ÿ˜ƒ

astral tendon
#

is there a trigger to detect if a player join in a vehicle as a gunner?

robust hollow
#

a litteral trigger or would an evh do? you can use the getinman evh to see what seat someone got into (im pretty sure)

little eagle
#

remoteExecCall and remoteExec are the same for commands, but different for functions.

astral tendon
#

yes a trigger, i need the vehicles to start move when all 4 of they have gunners

little eagle
#

@astral tendon

// initPlayerLocal.sqf
params ["_unit"];

_unit addEventHandler ["GetInMan", {
    systemChat str _this;
}];
#

hmm

#

Roque, what vehicle? They usually only have 1 gunner each.

robust hollow
#

yea hes saying he has 4 vehicles and each needs a gunner before they move out

little eagle
#

Oh

#

Any unit or specific ones?

#

trigger condition field:

{isNull gunner _x} count [tank1, tank2, tank3, tank4] == 0
astral tendon
#

another thng, this is a coop setup, that means i may not have all 4 players in the server, so i still can make this trigger work even with less players?

little eagle
#

With a bit of algebra and logic...

robust hollow
#

if its a max of 4 players couldnt you do something to the effect of

{isNull gunner _x} count [tank1, tank2, tank3, tank4] == (4-count playableunits)```
#

oh i dont think thats right

little eagle
#

This is confusing to put in one line xP

#
{isNull gunner _x} count [tank1, tank2, tank3, tank4] <= (4 - count playableUnits) max 0
#

???

indigo snow
#

{!isNull gunner _x} count [tank1,2,3,4] = (count ([switchableUnits, playableUnits] select isMultiplayer)) min 4?

#

Its toss up i guess

grand berry
#

If this was a script that is run by an addAction, would this just run on the person who used the action?

_display = [params... ] remoteExec ["BIS_fnc_StrategicMapOpen", clientOwner, false];
robust hollow
#

yea that would be run only by the person using the action, although remoteexecuting that wouldnt return a display, and you're sending it to yourself so is there any sense in remoteexecuting it at all?

little eagle
#

@grand berry Yes*. But then the whole remoteExec setup would be pointless.

#
  • not in a resumed local hosted MP game, because clientOwner is bugged.
grand berry
#

It's for a dedi - using the Strat Map as quick travel around the base. Why would the remote exec be pointless?

little eagle
#

Because

#

[params... ] call BIS_fnc_StrategicMapOpen

robust hollow
#

cause you're executing it on yourself. might as well just call it

little eagle
#

Would be the same

#

Also, remoteExec does not return a display. It returns nothing, so _display will be undefined.

robust hollow
#

it returns a string actually, still not a display tho.

#

nil if it errors

little eagle
#

Only the JIP version reports a string no? This is the not-JIP version (false as arg2)

grand berry
#

Yea ok thanks, that all makes sense.

robust hollow
#

no jip is empty string

little eagle
#

ok

grand berry
#

Related question - if a script is run on a client that spawns new AI units does that client then take the overhead for the AI?

indigo snow
#

Yes

#

Thats how a HC works

grand berry
#

So in that case using remoteExec to spawn the AI on the sever would be the correct thing to do.

indigo snow
#

Yes unless you immediately set the owner to be the server but thats buggy iirc

#

grpOfAI setOwner 2 or something

#

Breaks the danger.fsm or something

grand berry
#

To avoid that can I not just run the code that initially spawns them on the server or is that what breaks it? As opposed to setting owner after spawn.

robust hollow
#

yea spawning them from the server would avoid that problem.

indigo snow
#

Spawning on server would be ideal yes

#

You could even check for connected HCs

grand berry
#

[] remoteExec ["spawn here", 2]; So that would work and not break the FSM?

indigo snow
#

Since locality never gets transferred, sure

grand berry
#

Awesome, thanks for the help guys.

sullen willow
#

@indigo snow How do I get my earlier script to terminate if I exit the vehicle?

rotund cypress
#

terminate scriptHandle @sullen willow

#

scriptHandle = "" spawn {};

little eagle
#

SimZor, bad advice.

nil spawn {...};

does nothing. If a command receives nil / undefined as input, it is ignored.

rotund cypress
#

Hmm alright

sullen willow
#
this addEventHandler ["GetOut",{terminatescript "CPM.sqf"}];```
rotund cypress
#

(edited)

sullen willow
#

Does that look about right?

rotund cypress
#

No

little eagle
#

Should be:

0 spawn {...};

or

[] spawn {...};

Because the argument is mandatory for spawn (but not execVM).

rotund cypress
#

Well it could be a string as well then

#

Didn't realise nil wouldn't work however

little eagle
#

You have to terminate the script handle (SCRIPT type) and not a filepath.

rotund cypress
#

Don't understand why people keep using execVM

#

@sullen willow ```sqf
myHandle = execVM "scriptPath.sqf";
terminate myHandle;

little eagle
#

Yeah, and terminate is the command name, not "terminateScript".

rotund cypress
#

However, I do recommend you to make a function variable

#

And then spawn that (if you want to run scheduled)

#

Keep in mind, that execVM always creates a new thread @sullen willow

sullen willow
#

Doesn't terminate it when I exit the vehicle.

rotund cypress
#

Code snippet? @sullen willow

sullen willow
#

sleep 5; 
systemChat "You gain 500 USD";
[500,0] call HG_fnc_addOrSubCash;

},
rotund cypress
#
vehicleVar addEventHandler ["GetIn", {Harmont_scriptHandle = [] spawn Harmont_myScriptVar}];
vehicleVar addEventHandler ["GetOut", {terminate Harmont_scriptHandle}];
#

That should work

#

@sullen willow

little eagle
#

That event has to be added to a vehicle. You're thinking of getInMan

rotund cypress
#

Oh yea^^

#

(edited)

sullen willow
#

What's with my name being in it

rotund cypress
#

Good practise to have a OFPEC tag

#

Like HMT_ or whatever

#

Keep it short

#

The BIS functions uses BIS_fnc_whateverFnc

sullen willow
#

That's not seeming to work

robust hollow
#

you could just exit the loop with the condition?

sullen willow
#

๐Ÿคท๐Ÿผ I don't know enough of about any of this to figure that out. I'm still a nooblet.

#

I thought I had it figured out how to terminate something but I was wrong.

rotund cypress
#

What are you trying to terminate?

robust hollow
#
while {alive car1 && {vehicle player isequalto car1}} do {```
if you're just wanting that loop to end try this^
sullen willow
#

I want it to end when I step out of the vehicle

#

The script fires when you get in

#

I need it to terminate when you get out

robust hollow
#

yea, try that while condition then. it would probs still pay you once more cause your sleep is at the start of the loop, but that would end the loop once you get out

sullen willow
#

where do I place that

robust hollow
#
while {alive car1 && {vehicle player isequalto car1}} do {

sleep 5; 
if !(vehicle player isequalto car1) exitwith {};
systemChat "You gain 500 USD";
[500,0] call HG_fnc_addOrSubCash;

},```
#

its the condition at the top

still forum
#

@peak plover give diag_codePerformance a higher iteration count. the for loop removing a lot of precision.

warm gorge
#

Anyone else had issues with ctrlSetBackgroundColor not working for some controls? Ie RscListBox and RscButton

still forum
#

I know that there was stuff about button.

warm gorge
#

Yeah just found a bug report for that, but am experiencing it with lists now ๐Ÿ˜ฆ

peak plover
#

Yeah, button does not work

simple solstice
#

Is there something like a wildcard for strings in Arma?

warm gorge
#

@still forum Just saw your note on the command saying ""Only affects Comboboxes, Static Text, Structured Text or Maps. " Which really sucks. I could put a feedback ticket up, but what are the chances of it getting fixed lol. Someone already did 3 years ago

little eagle
#

@simple solstice Depends on what you're trying to do. Most likely no.

simple solstice
#

@little eagle yeah, that would be too beautiful

astral tendon
#

do you guys know how to use the follow waypoint?

#

i put a car to follow another but he just dont move

subtle ore
#

@astral tendon doesnt work afaik

astral tendon
#

wait, it never did?

tiny elm
#

mmmm

#

brain fart lol

#

trying to figure out how to generate a hypotenuse output

#

from an aircraft to the ground (slant range)... like as in how to build it to get measurements from aicraft to ground and the point on the ground which the camera is looking at....

indigo snow
#

Theres the distance command

#

You have two positions

tiny elm
#

distance command doesn't calculate slant range

#

as in it doesn't take altitude into consideration

indigo snow
#

Thats distance2D

tiny elm
#

I swear "distance" gave me the wrong readout

#

hmm

#

ill do it again lol

indigo snow
#

Check picture

#

Else theres vectorDistance but that seems fairly identical

little eagle
#

Distance uses the AGL format, so it's weird depending on what you do.

#

Z=0 has a different position depending on the height of the map at X,Y.

sand pivot
#

i'm trying to use drawIcon to put an icon on an object on a map and change said icon based on properties selected in said dialog. I have this working with drawIcon3D as it works within an onEachFrame EH but drawIcon doesn't play nice in that EH, it apparently needs to be in a "Draw" control event handler.

Issue here is I can't pass an argument (the properties that dictate icon style) in ctrlAddEventHandler as you can with other event handlers , am I wrong? Is there another way?

indigo snow
#

ctrlAddEventHandler ["Draw",{call myFnc}] and then in your myFnc use the drawIcon command.

sand pivot
#

and then i can pass arguments to the function. nice, thanks that should do it.

#

i'm working on coding this now to give it a try still, but as i think of it, I'm affraid the passed variable may be out of scope of the EH and not pass properly to the function.

little eagle
#
_control setVariable ["commy_args", _args];
_control ctrlAddEventHandler ["Draw", {
    params ["_control"];
    (_control getVariable "commy_args") params ["_arg1", "_arg2"];
}];

Does this help?

sand pivot
#

yes

#

should have thought of that, i can just set a variable on the map control that i already am manipulating. thanks dude

little eagle
#

Alternatively:

[_control, "draw", {
    systemChat str _thisArgs;
}, _args] call CBA_fnc_addBISEventHandler;
#

Which does essentially the same.

tiny elm
#

oooooo ^^^^ I'm saving that... interesting

queen cargo
#

@indigo snow no need to call the fnc in the code
ctrlAddEventHandler ["Draw", myFnc] is enough

indigo snow
#

Something something then the entire function ends up in there and that takes up more space

#

Because the function ends up in there as a string in the engine

peak plover
#

are spawned scripts added to any lists?

#

I guess I need to do that manuelly ๐Ÿ˜ญ

#

I want to see if all my scripts that are looping have any performance impact ๐Ÿ˜„

simple solstice
#

I was wondering how do I solve the issue of locality and setHitPointDamage. The vehicle has to be local to the client issuing the command, so that means no other player can repair the vehicle. Is there any way that a non-local player to the vehicle could issue this command with effects?

tough abyss
#

Use remoteexec and use the vehicle has the target

little eagle
#

It's better to use

ctrlAddEventHandler ["Draw", {call myFnc}]

over

ctrlAddEventHandler ["Draw", myFnc]

Especially for Draw and EachFrame handlers, because the game stores the functions as strings and has to recompile them for every execution.
myFnc could be very long while {call myFnc} is probably as short as you can get.

sullen willow
#

Well, my mission is like 90% done. That script is still kicking my ass in multiple different fashions, though.

little eagle
#
// init.sqf
0 spawn {
    while {true} do {
        sleep 5;
        if (player in car1) then {
            systemChat "You gain 500 USD";
            [500,0] call HG_fnc_addOrSubCash;
        };
    };
};

???

#

forgot the loop part.

#

Why not like this?

sullen willow
#

There was another problem as well

little eagle
#

And what?

#

I fail to see the issue here. This is very straight forward.

sullen willow
#

The other problem is that the script is firing for everyone on the server rather than just the person entering the vehicle.

waxen tide
#

I'm writing a script that lets each player vote, so i need to send the vote result to the server. instead of sending lots of public vars, can't i just attach the vote to the player as a var and then fetch it from the server?

little eagle
#

Do it like I said and it will work. GetIn doesn't seem to be the right approach for this imo

#

I have an idea that may make this very easy, asdfghj

#

Do you use any mods?

quasi rover
#

Is there a way to detect who destroyed building when the addMissionEventHandler :"buildingChanged" is used ?

sullen willow
#

@little eagle what you posted up there, does go in the vehicle's init?

little eagle
#

init.sqf

#

It's a file in the mission.

#

If it doesn't exist, just make it.

queen cargo
#

could one quickly check what happens when one does this: "foo" == []

little eagle
#

error

polar folio
#

yea prob type bla expected bla type of error

little eagle
#

^

queen cargo
#

probably is not knowing

little eagle
#

And a long list of stuff that == accepts. Everything besides BOOL and ARRAY and some weird ones

polar folio
#

i never use this so i dont know exactly. maybe just go look it up yourself later?

#

never use because it doesn't work

little eagle
#

It reports nothing and writes an error to the RPT file.

queen cargo
#

because it doesn't work that is the reason i need to know :3

little eagle
#

isNil {"" == []}

#

-> true

polar folio
#

you got your answer. i jsut added "prob" so you nerds dfont shit all over me if i'm wrong ๐Ÿ˜‰

sullen willow
#

@little eagle I have 6 cars to do this for. Would I just repeat that for each of them with their respective name?

queen cargo
#

stupidity in arma ... check types first, then handle each type separate

little eagle
#
19:32:08 Error in expression <isNil {"" == []}>
19:32:08   Error position: <== []}>
19:32:08   Error ==: Type Array, expected Number,String,Not a Number,Object,Side,Group,Text,Config entry,Display (dialog),Control,Network Object,Team member,Task,Location
simple solstice
#

@tough abyss remoteexec on every client (-2)?

tough abyss
#

Nope you pass the vehicle object as the target. it will get remove executed were its local

little eagle
#
if (vehicle player in [car1, car2, etc]) then {
sullen willow
#

Gotcha

polar folio
#

what is "not a number"? nil but expected number?

little eagle
#

Nan is a type for infinte etc.

simple solstice
#

@tough abyss oh wow, thanks!

little eagle
#

undefined

#

Like

log -1
#

Arma is too weak for complex numbers.

#

lol, Arma

sqrt -1 == 0