#arma3_scripting

1 messages ยท Page 258 of 1

jade abyss
#

badumm tss

open vigil
#

That's Czech Mate

#

I win ๐Ÿ˜‰

jade abyss
#

rly? Oh boy^^

little eagle
#

FM is right

#

usti hlavne

nocturne bluff
#

that class thingy looks trippy as fuck

halcyon crypt
#

Intercept is what we need, not that macro mess. ๐Ÿ˜ฆ

spark phoenix
#

^

#

Alright this is going to be the most useless and time consuming idea I'll ever present.

If we wrote an external DLL that could parse a "project" folder containing .cs files and return a ton of sqf code that is compiled and ran in game we could do stuff like...

class Main {
    public static void Main(string[] args) {
        ArmA3.SetDamage(ArmA3.Player,1);
    };
};

---- this c# code block gets parsed into ----


Main__Main = {
    params["_args"];
    player setDamage 1;
};
#

Variables and functions could be formatted

Namespace_Class_Variable

#

Again, absolute waste of time, but it'd be cool lol

#

That or just writing a DLL that loads LUA into the game and makes calls to engine functions for scripting commands.

#

Having either, though useless, would open arma to more developers who have experience in other languages lol

jade abyss
#

Not that again t.t

spark phoenix
#

xD

#

I have a friend who started to do the Lua thing

jade abyss
#

There were also other guys, who did that before and stoped ๐Ÿ˜‰

spark phoenix
#

lol

jade abyss
#

Why? Not worth the effort.

spark phoenix
#

^ yeah i was being sarcastic lol

jade abyss
#

ah, kk.

spark phoenix
#

Maybe one day someone will waste 6 months of their life and do it

jade abyss
#

It needs a "Sarcasm"-Sign for Text.

#

And in the end, they will notice: I wasted 6 Months ๐Ÿ˜„

spark phoenix
#

I wonder why

jade abyss
#

$ <- better

spark phoenix
#

lol

jade abyss
#

ยง I wonder why ยง

broken mural
#

Any idea why a spawned NPC who is set to play a specific animation after an extremely short sleep would occasionally NOT play that animation?

#

_NPC disableAI "MOVE"; //wont move. sleep .1; _NPC switchMove "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; //hands behind head.

works, occassionaly. Executed server side on init.

native hemlock
#

Not sure if you missed something when copying it, but you have NPC in one place, and _NPC in another

broken mural
#

yeah its _NPC, missed the _ in copying.

#

the underscore*

#

.. so apparently underscore is a formatting thing lol. it's _NPC in all required places.

tough abyss
#

This is correct?

#

_objs = [
call compile "34623200# 19330: cargo_house_v2_f.p3d",
call compile "32b78f00# 117394: cargo_house_v2_f.p3d",
call compile "2c866400# 67508: cargo_house_v1_f.p3d",
call compile "2c83b900# 66500: cargo_house_v2_f.p3d",
call compile "2c7f0800# 66360: cargo_house_v1_f.p3d",
call compile "334c5600# 149655: i_stone_shed_v1_f.p3d",
call compile "29809600# 158269: slum_house01_f.p3d"
];

vapid frigate
#

probably not

#

that'll just error?

tough abyss
#

i converted objects to string and now want to transform then in real objects again and put then into a array.

#

for example this is an object in string format "29809600# 158269: slum_house01_f.p3d".

#

how can i turn it again to object type?

#

its an object native to the map

vapid frigate
#

call compile "[0,0,0] nearestObject 19330",

#

for the first one

#

i don't think it's a great way of doing it though because the IDs change when they update the maps

tough abyss
#

ok, so i will use the position of the building and its class

#

thankyou a lot

south storm
#

Can't you just use TypeOf @tough abyss

#

?

vapid frigate
#

depends if he wants the class names or the actual objects

#

i assumed the latter

south storm
#

Reason he wants the actual objects?

tough abyss
#

to store then in MySql

#

i will store position and class name

south storm
#

TypeOf()

tough abyss
#

easy to find after

south storm
#

Will get you the class name.

tough abyss
#

yes, thankyou

native hemlock
#

I think the best solution is to save the type and position, then you just need to look for the nearest object with those parameters.

south storm
#

typeOf("29809600# 158269: slum_house01_f.p3d") == class name

#

In string form.

native hemlock
#

I don't think you can do anything to convert the string for the object back to an object

south storm
#

createVehicle ?

#

from the typeOf ?

native hemlock
#

What I mean is, you can't do anything with "29809600# 158269: slum_house01_f.p3d" once it is a string

vapid frigate
#

yeh that won't work adjustmentteam, typeOf takes an object, not a string

south storm
#

Then get the data using nearestObjects

#

?

tough abyss
#

yes. thankyou a lot. i'm precalculating some things on my mod for specifc maps. so i need to store map objects

vapid frigate
#

@native hemlock you could use call compile "[0,0,0] nearestObject parseNumber ((((_string splitstring " ") select 1) splitstring ":") select 0),

#

to get the map object from a string

south storm
#

Feed it into _arry = []; {[_array pushBack typeOf(_x,getPosATL(_x); true;} count(nearestObkects);

vapid frigate
#

but it would break when BIS updates the map

native hemlock
#

Yes, so that's not viable

south storm
#

Double element array [Type,pos];

#

Not sure about ExtDB would handle it Donnovan

tough abyss
#

yes it handle

#

i do some heavy calculations that result in a array of map objects. i will store those objects in Mysql or in a sqf file so dont need to calculate on every server start

south storm
#

_arry = [];
{
_array pushBack [typeOf(_x),getPosATL(_x)]
true;
} count(nearestObkects);

tough abyss
#

i go sleep

south storm
#

That should handle it

tough abyss
#

thankyou

south storm
#

np

south storm
#

Nice

#

Thumbs up

#

@velvet merlin Will we be getting an updated MP scripting tutorial anytime soon?

#

A lot has changed since PV days

#

And information about the subject is scattered?

velvet merlin
#

not by me sorry

lethal cave
#

what is the safest way to know if something is a helicopter? will it always have simulation type "helicopterrtd" or can it be something else?

vapid frigate
#

isKindOf "helicopter" should be safe.. but there is the possibility of people making them without any base classes (although I don't think anyeone does)

#

I think RTD is something to do with advanced flight model, so there's probably at least one more simulation type (maybe just helicopter or something)

lethal cave
#

isKindOf "helicopter" should work

#

according to the config dump simulation can be just "helicopter" too

#

isKindOf "helicopter" returns true for parachutes

velvet merlin
#

@tough abyss no idea. my bet would BI is using them for Eden or some other stuff; other possibility its a fancy exercise for some of their scripters

halcyon crypt
#

[12:54 AM] Quiksilver: @halcyon crypt i dont think we need a scripting language for a scripting language
@tough abyss How is Intercept/C++ a scripting language for a scripting language?

#

Intercept sits between A3's native functions behind the SQF commands and your own native code.

#

Only downside is that it's sort of dead at the moment but it is/was functional for the biggest part.

vapid frigate
#

yeah it sounded awesome, gave you the ability to bypass sqf altogether

#

i'd also try it if it was complete (and would somehow be supported in new arma versions.. don't know if it is already)

little eagle
#

@lethal cave I think you might want to use Helicopter_Base_F to exclude parachutes.
See:

    class ParachuteBase: Helicopter {
    class Helicopter_Base_F: Helicopter {
#

Also, even Helicopter_Base_F includes quadrocopter UAVs

    class UAV_01_base_F: Helicopter_Base_F {
    class UAV_03_base_F: Helicopter_Base_F {
#

UAV 03 is the KH-3A Fenghuang drone, which doesn't even have rotors.

#

nvm. it's apparently a cute helicopter like drone

lethal cave
#

ta, i'll try that one

broken mural
#

Is there ever a reason to set the lower levels of a multidimensional array as global if the parent is global? IE:
globalArr = [_localGroup1, __localGroup2]
vs
globalArry [group1, group2]
where values in group 1 and 2 would be modified regularly and acted on server side?

velvet merlin
#

in case anyone gets also freezes he cannot explain in dev branch recently..

[Dev branch] Game freezes on pushBack command
https://feedback.bistudio.com/T120748

seems from string escaping or sth related to pushBack

little eagle
#

@broken mural no. globalArr will be a global variable containing both groups either way. there is no difference, because the variables only represent their values inside the script. Properties of the variable (home scope or global) have no influence of the value.

broken mural
#

@little eagle sounds like you're saying is that as long as globalArr is in the global space it's value(s) can be modified anywhere in the mission file and it will be updated?

little eagle
#

yes

#

doesn't matter what it was originally composed of

broken mural
#

@little eagle so if I add the string "1" to one of the sub arrays and then in a completely different script and call, I can check that index and get back "1"?

spark phoenix
#

The _get and _set functions would work with your globalArr as well. Again it just shows the idea, not in your exact circumstance

dusk sage
#

Argh

#

Be gone with you

#

You used params once, but not the second time

#

๐Ÿ‘บ

little eagle
#

@broken mural I don't see any sub arrays in your example (globalArr = [_localGroup1, __localGroup2])

dusk sage
#

@spark phoenix
On the same client, yeh, but in his scenario it would just be easier to edit a global array, because he doesn't need to hide shit ๐Ÿ˜‰ However, he needs it editing server side

broken mural
#

@little eagle yeah sorry I was in a rush this morning. The multidimensional array structure would be similar to this;
allArrays = [group1, group 2, group3] Group1 = [subgroup1, subgroup2, subgroup3] Subgroup1 = [โ€œ1โ€, โ€œ2โ€, โ€œ3โ€];

the catch being the array is added to on initServer and items within the subgroups would be removed throughout the mission.

NOTE: This is ignoring all syntax and is not a representation of how I would like to globally state all of these. Just not sure, outside of allArrays what needs to be stated in global space, or if the global attribute applies to all elements of allArrays variable.

little eagle
#

what needs to be stated in global space
nothing does, except the "allArrays" variable

#

or if the global attribute applies to all elements of allArrays variable.
there is no such thing as a global attribute for array elements. the array variable can be global or not, but the elements are only values. variables != values

#

god dam the wiki for arrays is awful

dusk sage
#

Has anyone got access to these bitwise functions to look at?

broken mural
#

Could definitely benefit from user contributions. I'm gonna go with what you recommended. Its really just a division of arrays that contain strings. Nothing ground shaking.

south storm
#

@little eagle Anyone ever tried to implement data-structures in arma 3?

#

Other than arrays?

#

E.g Queues, Stacks, Deques,

little eagle
#

Stack ... wouldn't that just be an array where you use pushBack and deleteAt 0 on ?

south storm
#

No. FIrst in First out datastructure Queue would be that

#

As a pushBack pushes it back to the beginning

#

_array = []; _array pushBack _otherdata;

little eagle
#

reverse _array; _array pushBach _thing; reverse _array;

south storm
#

Thats a queue

#

That works.

#

What about linked lists?

little eagle
#

I have to look up these terms. I'm not a god damn hacker

south storm
#

Computer scientist.

#

Nor am I

#

It's a hobby.

#

Linked lists made using functions would probably be comparable to C

tough abyss
#

You won't find any fancy structures in arma.
At best someone abstracted it to either use arrays / or set/getVariables etc

south storm
#

Could you use a C function via callExtension?

little eagle
#

yes, but you can only pass strings, numbers (floats) and arrays

tough abyss
#

callExtensions take a string & return a c string.
Each callExtension use also has a timer check, that you can't disable.

south storm
#

Thats not really a problem if you can type convert the strings to whatever other type

little eagle
#

timeout?

#

serializing objects is a pita though

south storm
#

pita?

#

oh I get it

little eagle
#

pain in the rear

south storm
#

nvm

#

Yea

#

A question is callExtension single threaded like call? in unscheduled?

little eagle
#

yes

#

but apparently there is a time out

#

Torndeco just said that

tough abyss
#

No timeout, its just a time check. Outputs warning in RPT, you can't disable the time constructor/ diff check

south storm
#

Ah rightio. so timeout as in if it takes to long to complete it is terminated?

tough abyss
#

Nope read above

little eagle
#

idk I never had this "problem"

#

But extensions are so so

#

They are essential for ACRE and TFAR

#

but everything else... meh

south storm
#

ACRE is so much math...

#

I am suprised arma 3 doesn't cry with all that differential calculus going on

little eagle
#

it's to communicate with teamspeak

#

this is where the true purpose is

#

everything else will just annoy you as dev

#

every update the anti vir programs will block it

south storm
#

ACRE calculates god damn, Free space loss...

little eagle
#

and when battle eye is offline yet again, you get a ton of usless issue reports too

#

idk what ACRE does calculate

#

but without DLL it wouldn't work at all

south storm
#

I looked at the .pbo

little eagle
#

cause it has to communicate with TS

south storm
#

It's got so many formulas going on it's not funny

#

When you send a radio transmission

#

It is so computationally intensive it must drop peoples frames a lot..

#

Way more than TFAR

little eagle
#

sure

#

I don't think linked lists will make much sense in Arma

#

I mean. If they were implemented natively

#

Just like those new bit operator functions. useless

#

Although I guess the bit operator functions do help to work with stuff like the radar types from config

#

or those ai ammo usage flags

south storm
#

I want to know something completely, is it better to execVM? spawn or call?

#

In the past I functions as files everything I wrote

#

And still do.

#

Which is best @little eagle ?

little eagle
#

probably spawn or call

#

at least mid mission you should never use execVM

#

because it's better to precompile at game (or at least mission) start

#

I guess it doesn't make much difference for puny 10 liner scripts from mission makers

#

I don't use the scheduler much personally, so all I ever use is call

#

too unpredictable

#

caused too many issues in the past

#

and it's annoying that you can't reference undefined variables in scheduled env

#

and it's way slower : (

#

too much overhead from constant run time delta checks after each freaking command

south storm
#

I've used spawn {} to manage certain things within unscheduled environment

#

as suspending is sometimes needed or timing issues happen

little eagle
#

the problem is that any shitty mission maker can break your addon

#

we had that problem all the time with AGM

#

mod wouldn't work with...

#

"heavily scripted" missions

#

...

south storm
#

Most missions are now heavily scripted?

little eagle
#

And since I only make mods, I can't trust any mission maker

#

no, but there are some

#

it only needs one for you to get a ton of error reports

south storm
#

Although I don't see a lot of missions, using FSMs anymore.

little eagle
#

FSMs are just a pain to work with

south storm
#

Even though they have one key thing function calls and spawns don't. They run completely unscheduled.

little eagle
#

shitty editor

#

the conditions run unscheduled

#

the states run scheduled

south storm
#

Ahhh now thats a distinction that isn't on the BI wiki

little eagle
#

and you have to compile and load from disc every time you start a new FSM with execFSM

south storm
#

whats your opinion on the use of call compile preprocessfielinenumbers ?

#

to 1 single SQF script?

little eagle
#

don't do that mid mission either

#

CBA has a system where you compile preprocessfielinenumbers on game start

#

and on mission start the cached variables get loaded into mission namespace

south storm
#

so my method of using cfgFunctions.hpp is good?

little eagle
#

basically CfgFunctions where you can actually add and change the recompiling at every point

#

cfgFunctions is good, but the PREP system can actvate recompiling at any time

#

because it doesn't need config in the first place

#

CfgFunctions is fine though if you don't dig too deep

#

it's nice that it has the ingame functions viewer

south storm
#

How can I test the locality of mission scripts in debugging?

#

I've been having that as a problem recently.

little eagle
#

what you mean by locality?

#

that your function works in MP? only by testing

south storm
#

no is there a way to return the context in which it's existing?

#

say if I put isServer in a script and assign it to a variable

#

will it tell me the execution context?

little eagle
#

do you mean the script handle from spawn/execVM ?

south storm
#

No the script it self will it say true or false if the script is run say from initServer.sqf etc?

little eagle
#

if a script is called from initServer.sqf it will only exist on the server

south storm
#

Can you tell code run from the initServer.sqf?

#

to run on the client using hasInterface ?

little eagle
#

you want to remote execute a function?

#

from the server to all clients?

south storm
#

Yes

little eagle
#

works with everything in CfgFunctions

#

it has some white / black listing shenanigans

south storm
#

Should I ever use publicVariables still?

little eagle
#

not sure how that all works

#

Should I ever use publicVariables still?
probably not

#

I mean again. remoteExec is fine

#

which builds on publicVariable

#

publicVariable itself would be a pain to set up every time

#

Problem with remoteExec is similar to the scheduler

#

missions and other addons break it

#

due to the whitelisting

#

and stuff

#

It wasn't very reliable when it was introduced too

#

no idea if it's all fixed by now

#

I think there is a problem with huge overhead in certain cicumstances

south storm
#

Yeah I was told by someone to use a message passing design

#

where I use remoteExec or remoteExecCall on commands only

#

not functions.

#

say for example setting rain would be

little eagle
#

remoteExec is equivalent to remoteExecCall when used with commands

south storm
#

[60,1] remoteExec ["setRain",-2,false];

little eagle
#

it only makes a difference for functions

#

why -2 here?

#

-2 means it won't work on the local host in local hosted MP

south storm
#

What should I use?

#

if it's executing for all clients only

little eagle
#

[60,1] remoteExec ["setRain"]

south storm
#

Don't need to specify the number?

little eagle
#

no. default is everywhere

#

which is what you want

#

and the JIP flag is default off

#

it wouldn't make sense with this command

south storm
#

The reason I used -2 was so the server never ran the weather update

#

only the clients

#

so state was only stored server-side as a number

#

the actual effect was sent to clients

#

I saw no need for the server to receive weather updates

#

It has no display...

#

@little eagle stupid idea?

little eagle
#

it breaks local hosted and it doesn't really achive anything by leaving out the server

south storm
#

At all?

little eagle
#

I don't see what

#

why not execute it everywhere?

south storm
#

Reduce load on server?

little eagle
#

setRain is negligibly

#

you might even be creating more overhead by specifying the target as -2 lol

tough abyss
#

Those ACRE calcs are done in a dll?

little eagle
#

idk about ACRE, but the FCS from AGM/ACE is made via extension

#

the projectile ballistics aren't that bad, but recursive functions, iterations

#

SQF is too slow for that

#

hah. 600 iterations with that DLL. SQF did choke on 11

tough abyss
#

may be the new engine script language could be fast. its not compatible with SQF

#

but what could be so different...

south storm
#

New scripting engine I peeked at the PBO

#

I know bad me.

#

It's more akin to C++

#

and it also supports OOP

#

The DayZ Standalone

#

@tough abyss It's nothing like SQF

#

@little eagle Was it illegal for me to do that?

tough abyss
#

@south storm you believe it will be hard to port actual code to the new script language?

south storm
#

A lot hard yeah...

tough abyss
#

Why?

south storm
#

It's very different the way it works

#

There is actual OOP concepts inside it...

tough abyss
#

config classes arent OOP?

south storm
#

SQF has no OOP

tough abyss
#

ah, ok.

south storm
#

Not sure what to describe the new language as..

#

C++ and C + Java had a baby?

tough abyss
#

C, C+, C++, C#, Cbi

south storm
#

It's definitely more readable than SQF

tough abyss
#

What we can do with OOP that we can't do actually?

south storm
#

Encapsulation,

#

Secret variables

#

methods

#

Class definitions

#

inheritence

tough abyss
#

Change or create or delete classes on fly?

south storm
#

secret variables as in protected

#

Can't be accessed outside the script

#

s scope

tough abyss
#

Nice!

south storm
#

Or classes definition

#

so once the class is finished running

#

The variable is inaccess outside the class

#

Which can be further abstracted inside methods

#

where a method means you can protect a variable inside that method only

#

which the outside can not even access the interior

tough abyss
#

But OOP will be more suitable for content creation?

south storm
#

Maybe.

tough abyss
#

I mostlly do functions.

#

that do stuff.

#

I create no content.

#

One teleport function.

#

Menu function.

#

Sell function.

#

May be mostlly not change. Lets see.

south storm
#

I wrote my own weather script system

#

using remoteExec etc

tough abyss
#

nice.

clear tendon
#

Okay quick one: how do you respawn a killed unit in it's position in a vehicle?

south storm
#

createUnit

#

then moveIn whatever position?

tough abyss
#

Jay, the unit have a assigned vehicle?

clear tendon
#

it's editor placed

#

vehicle + units

tough abyss
#

Because if the unit enter another vehicle, it will be assigned to this vehicle.

#

You can use "assignedVehicle _unit;" to get the assigned vehcle.

clear tendon
#

maybe let me rephrase

#

Okay quick one: how do you respawn a killed ai unit in it's position in a vehicle?

tough abyss
#

and "assignedVehicleRole _unit" to get the unit role in the vehicle

#

He died inside the vehicle?

#

or he died anywere?

clear tendon
#

died in the vehicle (gunner)

#

i have 3den enhanced + ace things, so i have the ability to run something ' on killed '

#

in the unit attributes

tough abyss
#

you need a Killed event handler that set the vehicle and position of the unit with "_unit setVariable " when he dies.

#

And after the unit respawn, if those variables exists on the unit, you move the unit to the vehicle and position (gunner, driver).

clear tendon
#

it ads an ' On Killed' execution to attributs

tough abyss
#

i edited above.

clear tendon
#

hmm

tough abyss
#

But if take some time to spawn, the position can get ocupied by another unit

clear tendon
#

not really, there's no backup

#

๐Ÿ˜‰ just want that one unit to respawn in it's place

#

vehicle is locked for players anyways

south storm
#

Add a killed even handler

#

listen for it put AI in the vehicle when the unit dies

clear tendon
#

could i not use the ' on killed ' part from the 3den enhanced for that?

#

it already looks for a killed eventhandler on that unit with that, i think

south storm
#

Not familiar with 3DEN enhanced so.

clear tendon
#

so just spawn a new ai in the vehicle's position would be easier

#

ugh, need to thin kclear for this, time to hit the bed

#

gn folks

tough abyss
#

//on killed
_veh = vehicle _this;
if (_this != _veh) then {
_this setVariable ["r_veh",[_veh,assignedVehicleRole _this]];
} else {
_this setVariable ["r_veh",[]];
};

//on respawn
_r_veh = _this getVariable ["r_veh",[]];
if (count _r_veh > 0) then {
_r_veh params ["_veh","_roleArr"];
_role = _roleArr select 0;
if (_role = "DRIVER") then {
_this moveInDriver _veh;
} else {
if (_role = "COMMANDER") then {
_this moveInCommander _veh;
} else {
if (_role = "CARGO") then {
_this moveInCargo _veh;
} else {
if (_role = "TURRET") then {
_path = _roleArr select 1;
_this moveInTurret [_veh,_path];
};
};
};
};
};

#

@clear tendon

south storm
#

the handler as far as I know

#

returns servreal things

#

not sure vehicle _ this would work

#

Yeah @tough abyss the addEventHandler ["Killed",{ } ]; returns 3 values

#

this

#

init area of vehicle:
_veh = vehicle _this; if (_this != _veh) then { _this setVariable ["r_veh",[_veh,assignedVehicleRole _this]]; } else { _this setVariable ["r_veh",[]]; };

#

..

#

need a [code] take for Discord..

#

tag*

little eagle
#

Was it illegal for me to do that?
yes. punishment awaits

south storm
#

@little eagle Please tell me your joking?

#

:/

#

?

vapid frigate
#

the code tag is 3 backticks ` ` `

south storm
#

Thanks for that lecks

vapid frigate
#

without the spaces

south storm
#

@clear tendon

vapid frigate
#

you can edit your message

south storm
#

Oh thats cool

#
{
    _veh = vehicle _this select 0; 
    if (_this != _veh) then { 
        (_this select 0) setVariable ["r_veh",[_veh,assignedVehicleRole _this]]; 
    } else { 
        (_this select 0) setVariable ["r_veh",[]]; 
    }; 
}];

this addEventHandler ["Respawn",
{
_r_veh = (_this select 0) getVariable ["r_veh",[]]; 
if (count _r_veh > 0) then { 
    _r_veh params ["_veh","_roleArr"];
    _role = _roleArr select 0; 
    
    if (_role = "DRIVER") then {
        (_this select 0) moveInDriver _veh;
        
    } else { 
    
        if (_role = "COMMANDER") then { 
            (_this select 0) moveInCommander _veh; 
    
        } else { 
            
                if (_role = "CARGO") then { 
                    (_this select 0) moveInCargo _veh; 
                    
                } else {
                
                    if (_role = "TURRET") then { 
                        _path = _roleArr select 1; 
                        ((_this select 0) select 0) moveInTurret [_veh,_path]; 
                    }; 
                }; 
            }; 
        }; 
    };
}]; 

@clear tendon

#

I'm a littel OCD with the (_this select 0) sometimes

#

oops

#

Fixed

#

A question for you @little eagle when a variable is setVariable to an object?

#

is that local to the object only?

vapid frigate
#

it's local where you set it

#

unless you use the 'public' parameter

#

ie (_this select 0) setVariable ["r_veh",[], true];

#

^ that true at the end would make it broadcast, including working JIP

south storm
#

Whats the benefits of using setVariable publically vs publicVariable?

vapid frigate
#

i guess the main one is publicVariable only works for missionnamespace variables

#

setvariable can set vars on objects, etc

south storm
#

So publicVariable is now deprecated?

vapid frigate
#

not sure if you can have like a 'publicVariableEventHandler' for setVariable though

#

the event handlers are they only thing i can think of that you can do with publicvariable but not setvariable

#

not sure about the performance implications of them though (don't know which is faster)

south storm
#

Interesting

tough abyss
#

I know its a little trick, but wich code will write a not empty array on the chat area?

#

systemChat str ((getPosWorld _obj) nearObjects [typeOf _obj,0.001]);
systemChat str ((getPosASL _obj) nearObjects [typeOf _obj,0.001]);
systemChat str ((getPosATL _obj) nearObjects [typeOf _obj,0.001]);
systemChat str ((getPos _obj) nearObjects [typeOf _obj,0.001]);
systemChat str ((position _obj) nearObjects [typeOf _obj,0.001]);

#

_obj is a building.

#

Answer is... ****

#

Answer is none....

#

Strange dont?

#

what position in object nearObjects use?

#

pris relpi!

#

this return the array with the object: systemChat str (_obj nearObjects [typeOf _obj,0.001]);

#

HAAAAAAAAAAAAAAAA! Solution:

#

systemChat str ((ASLToATL getPosWorld _obj) nearObjects [typeOf _obj,0.001]);

#

I will comemorate with food. Sorry for fllod!

#

you can even use 0 instead of 0.001!

#

64 bits precision!

south storm
#

Also @tough abyss Why were you using 0.001?

#

for the radius?

#

The radius is in meters

#

so 0.001M = 0.1 centimeters

#

or 1 millimeter

#

So you were giving it a bad radius

#

should have just done nearObjects [typeOf _obj,1];

#

As the smallest search radius

weak tiger
#

can anyone help with a UI question? Im trying to work out how the order is determined ie what is rendered on top and what is behind.. changing the order of the items in the GUI editor with Ctrl-L seems to make no difference

south storm
#

I believe it's ordered by ID

#

idc and idd

#

So your primary GUI is made using an idd

#

and your sub-elements IDCs

#

I am not sure but I think thats how it works

#

It also depends on them being a backgroundControl {} or a control {}

weak tiger
#

I see

#

good info thanks ๐Ÿ˜ƒ

#

yep idc is what I needed ๐Ÿ˜ƒ

south storm
#

All GUI stuff falls back to sort of OOP

#

stuff

#

IDD's inherit all the data of IDCs

#

IDDs are the parent classes

#

IDCs are the child classes

#

Each one inherits from the next.

weak tiger
#

for anyone paying attention.. moving it to controlsBackground {} ended up much better than relying on IDC as "active" controls are brought to the front when you click on them

final vessel
#

Hey! Is there a way to list all mods running (with -mod=) command line parameters with the path to those mods on the disk? (in SQF)
In theory, there is a way to find the mod names but if a mod has been enabled by -mod=c:\mySecretLocation\@Mod I won't be able to guess that location by the mod name alone.

halcyon crypt
#

As far as I know it's not possible to do so with SQF

#

For example, ACRE(2) uses an extension that gets the list of open handles by the A3 process and gets the path to the loaded .wrp from there

#

If I understood correctly

final vessel
#

Wow, what a hack! ๐Ÿ˜„

halcyon crypt
#

Getting the path of all the loaded mods is probably easier since you should be able to get the arguments for a process fairly easy, but still requires an extension

final vessel
#

I'm afraid that this won't be as straightforward because if you run it with -config (I think), then you would have to open that file and parse it yourself. That's not really hard, either, (just additional work) but I don't know how many other ways I'm still missing.

#

Anyway, I'm working on a python extension that would enable mods to run scripts in CPython (not IronPython, I know about armaext) and I would like to make it so the mods could have a directory python_code, for example, where those scripts would be stored.

#

So when my extension would be running, it would need to get a list of all the mods to look for the directory in their locations.

#

Anyway, thank you @halcyon crypt

halcyon crypt
#

that's the code that finds all loaded PBOs

#

apparently

weak tiger
#

is there some kind of event I can listen to for when the player has loaded a save?

halcyon crypt
#

Mission load should be regarded as a savegame load

tough abyss
#

@native hemlock the correct position to store is "ASLToATL getPosWorld _building;".

#

Since this is the exact position used to calculate distance on nearObjects, you just need to store the position, and not the building class, it will be quite unconnom to find the wrong building with that precision.

#

This will return a array with the building _obj: (ASLToATL getPosWorld _obj) nearObjects 0;

#

So i store the result of "str (ASLToATL getPosWorld _obj)".

#

Just not sure if str will lower the position precision.

dusk sage
#

It won't, no

tough abyss
#

@dusk sage thanks.

little eagle
#

yes it will

#

str converts the number to a string with a maximum of 6 digits after the comma

#

the floats are more precise than that

#

there is a method to convert numbers into strings with keeping those "hidden digits"

dusk sage
#

No, str just converts it to a string. The number is rounded regardless @little eagle

little eagle
#

that's wrong, BoGuu

#

yes, the debug console only displays a certain amount of digits

#

but the value can be more accurate

#

FLOAT_TO_STRING(num) IS more accurate than str

#

There even is a post about this on KKs blog

dusk sage
#

Your function will still be rounded

little eagle
#

If you think he is more credible

dusk sage
#

If you stick 1.523523523523523 into it

little eagle
#

Yes it will

dusk sage
#

It's not going to keep precision

little eagle
#

But it's more accurate

#

Yes it will keep precision

#

as precise as FLOATs are

#

str introduces even more inaccuracy by cutting of a number of digits

dusk sage
#

You'll lose a slight amount of precision using str. And in the case of getPos, you'll certainly not lose any

little eagle
#

if you want to serialize numbers without loosing precision, str is not enough

#

You'll lose a slight amount of precision using str. And in the case of getPos, you'll certainly not lose any

#

?

dusk sage
#

If you did

#
str (ASLToATL getPosWorld player)
#

I would bet you lose nothing

little eagle
#

yes you will

#

it's the same thing with arrays

dusk sage
#

Hold on

little eagle
#

if that weren't the case, floatToString could be simplified

#

I trust what nou is doing

dusk sage
#

[2409.31,6468.13,0.00143909]

south storm
#

What would be the reason for wanting this level of precision BoGuu?

dusk sage
#

Somebody was trying to store positions as strings, read above

#

There will be no issues with precision in this case, especially

little eagle
#

what is str [100.12345678]?

south storm
#

Yeah I was thinking that too @little eagle Add the precision info yourself

little eagle
#

Pardon?

dusk sage
#

eh hold on

#

loading back up

#

100.123 I'd imagine

little eagle
#

But that would be less accurate than FLOAT_TO_STRING() then

south storm
#

ArmA 3 doesn't even support 32bit precision numbers.

#

...

little eagle
#

The str command doesn't

#

and the debug console doesn't display it (probably using str internally)

#

But with tricks like the one I posted, you don't lose any precision

#

Do you need that? Maybe, idk

#

But the question was, do you lose precision with str

#

And the answer is yes, there are better methods

south storm
#

@BuGoo [2409.31,6468.13,0.00143909] the 0.000143909 is a little over a 16bit (half precision numbr)

little eagle
#

the z value is a bad example though

#

it's very close to zero

#

But cutting off the third decimal at 2000,2000 can be a decimeter difference

south storm
#

.31 means it's accuracy is between 1 - 100 CM

#

Does that difference matteer?

little eagle
#

Depends on what you're doing I guess

#

If you draw map markers, then no

#

if you place objects... they might bonk into each other thanks to splendid physx

south storm
#

well Donnovan was using nearObjects and was using 0.0001 as the radius

#

and as far as I know that only supports hole M numbers?

#

or whole integers in meters?

little eagle
#

Don't think so

south storm
#

Well he found that 0.0001 wouldn't work

#

he had to use 0

#

So the level of precision it supports must be very low

#

Well that kind of makes sense. I guess more precision means more computation?

dusk sage
#

Sorry had to tend to food, .123 yep

south storm
#

.123 worked?

dusk sage
#

?

south storm
#

The getPos returns a position thats accurate to 2 decimal places or between 1 - 100CM

#

See what I said a few posts ago

#

Weirdly enough the Z axis has close to a little bit more than 16 bit precision

little eagle
#

now try:

_fnc_fts = {str parseNumber (str (_this%_this) + str floor abs _this) + "." + (str (abs _this-floor abs _this) select [2]) + "0";};

[100.12345678 call _fnc_fts]
dusk sage
#

It should be alot more precise than that ๐Ÿ˜„

#

Yeh, I see @little eagle. Yet again more disappointment

#

:/

south storm
#

Do you guys know if we can directly invoke scripting commands via C++ ?

little eagle
#

yo. it's pretty bad

#

yes, Intercept does that

dusk sage
#

It's always 6 significant figures

zealous solstice
#

@little eagle did you ever tested str [float]?

south storm
#

@little eagle How the hell did intercept find out how to interface with them?

zealous solstice
#

is there the percision the same as str float?

little eagle
#

we were just discussing that

dusk sage
#

Still 6 S.F @zealous solstice

little eagle
#

BoGuu tested it

#

Same problem

zealous solstice
#

ok ๐Ÿ˜„

little eagle
#

format ["%1", 100.12345678];
I wonder

south storm
dusk sage
#

Will be exactly the same

south storm
#

...

#

This problem has persisted for a long time

dusk sage
#

Seem any loss of precision will only become an issue with values >= 1000 tbh

south storm
#

parseNumber works

#

according to KK

little eagle
#

Yes, but maps are kilometers large

dusk sage
#

You need a string for that first ๐Ÿ˜„

little eagle
#

parseNumber is backwards

#

The problem isn't FLOATs either like the ticket suggests

#

the problem is str, format etc. being extra shitty

tough abyss
#

Hey, on my side its easily fixed using "nearObjects 0.1" or even "nearObjects 1" instead of "nearObjects 0". you guys are discusing something a lot deeper.

little eagle
#

that's always how it goes with this channel and discussions like these

south storm
#

Thats what I said Donnovan

#

1 would probably work as well as 0

#

Biggest issue though nearObjects 0

#

I think would return every single one?

tough abyss
#

the "nearObjects 0" was just a way to prove i found the exact object point used to measure distances in nearObjects function.

south storm
#

KK's solution obviously works but why do we have to go through all that trouble?

#

with precision

#

It's dirty....

tough abyss
#

They are discussing about precision, i also like that, just wanted to say the problem is solved for me.

south storm
#

Yeah we're trying to understand why we don't get full 32bit precision

#

with every operation.

#

It'd be nice if they gave you a choice to control the precision

#

Make simple scripting command

#

that says (converToHPrecision (getPos))

tough abyss
#

@little eagle sorry to interfer, just wanted to say i got the solution by changing 0 to 0.1.

#

You and BoGuu discunsion is a very nice read.

dusk sage
#

You shouldn't have any issues finding buildings with what you've got ๐Ÿ˜ƒ

south storm
#

@little eagle I mean how hard would it be to add a high precision command?

#

They've added array operators among other things.

little eagle
#

idk

south storm
#

High precision float command shouldn't be too dificult?

tough abyss
#

@south storm thanks for the info about getPos "The getPos returns a position thats accurate to 2 decimal places or between 1 - 100CM"

little eagle
#

I remember that there actually was something on dev branch

#

not documented on the wiki

#

maybe I dreamed it

south storm
#

Wonder how hard it would be to make an expression parser in A3

little eagle
#

searching for "ftoa arma"

south storm
#

I only found parseNumber with that.

dusk sage
#

getPos doesn't return something accurate to 2 d.p

little eagle
#

but all the shitty search engines "correct" ftoa to some shitty words of some back woods languges

south storm
#

Would parseNumber format ["%1",getPos]; work?

little eagle
#

no, that would always report 0

south storm
#

@dusk sage what does it return as?

dusk sage
#

As normal

south storm
#

is it 2 D.P or sigfigs?

dusk sage
#

I only said that str returns 6 SF

bright coral
#

Todays 1.64 performance binaries disable xx setVariable ["", somevalue]. You can no longer assign a value with setVariable to an empty string. CBA for example throws an error now.

weak tiger
#

could anyone help me with my addon server keys? seems no matter what I do with DSSign a dedi server will hang or CTD at mission selection or just after... unless I verifySignatures=0

#

I am signing all PBOs with my key, including that key with the addon, and putting that key inside the keys folder on server as I do with other addons

#

not the private key the bikey

halcyon crypt
zealous solstice
#

yeah but it is in Dev currently ๐Ÿ˜„

little eagle
#

@bright coral I know. Fixed already on master

#

Thank you @halcyon crypt . That was what I was looking for

#

I knew there was something. javascript huh. I swear it was ftoa from C++

clear tendon
#
randVehicle = ["ESCORT_1","ESCORT_2","HVT_1","HVT_2","HVT_3"] call BIS_fnc_selectRandom;
smoketheEngine = "SmokeShell" createVehicle (position _randVehicle);  smoketheEngine attachto [_randVehicle, [0,0,-1]];

Gives an error: error position: type String, expected Object,location
it should add a smokeshell to a random selected from the array

vapid frigate
#

_randvehicle is a string

#

maybe you meant

#

[ESCORT_1,ESCORT_2,HVT_1,HVT_2,HVT_3] call BIS_fnc_selectRandom;

clear tendon
#

why cant it use the "" in that array?

vapid frigate
#

you can, but then you get strings, not objects

clear tendon
#

has been educated again

vapid frigate
#

you could do

#

_randVehicleName = ["ESCORT_1","ESCORT_2","HVT_1","HVT_2","HVT_3"] call BIS_fnc_selectRandom;

#

_randVehicle = missionNamespace getVariable _randVehicleName;

clear tendon
#

ah, turn the string into a var

little eagle
clear tendon
#

what's the difference?

little eagle
#

quicker

#

and less words

broken mural
#

Can you add an empty array to a multidimensional array? For example, say I initialize an array to originally have zero elements, and foreach object in an area I want to add an array for later use; That array hasn't gotten values just yet, though! The problem: The objects refer to a specific index in that array, so if I start with object that points to index 3, I need to create 3 empty arrays in the array.

#

for the record; it doesnt like the syntax arr pushback [] or arr pushback [nil];

#

also doesn't like _var = []; arr pushback _var for.. obvious reasons. Generic error in expression given for pushback in all cases.

vapid frigate
#

@broken mural this works fine? arr = []; arr pushBack [];

broken mural
#

arr becomes [[]]? Im not getting that result

vapid frigate
#

yeah

#

same with using _var

#
_var = [];
arr pushBack _var;```
broken mural
#

welp that points to a different problem

vapid frigate
#

maybe arr is nil

#

that'd give you that error i think

broken mural
#

huh.. okay then. Its in a for loop to meet the count; so index of 3, whatever the difference is between the count and 3, pushback [] so [] becomes [ [], [], []]

#

testing a change..

#

alright this worked. I changed the for loop parts around and it appears to have fixed the issue.

south storm
#

Add a padding check

#

if (isNil "_array") exitWith {};

#

or tell it to goto another then block

#

if (count > 0 && < 3) then { _array pushBack []; }:

#

That sort of thing?

#

@broken mural

#

if (count > 0 && count < 3) then { }

broken mural
#

I actually went with this;
@south storm
if (count _array < _objectNumber) then { for [{count _array},{count _array < _objectNumber},{count _array}] do { _array pushback []; }; };

but there's a bit of a problem with this propegating to different indexes that I'm gonna work out tomorrow.

vapid frigate
#

could simplify that to for [{},{count _array < _objectNumber},{}] do { _array pushback []; };

velvet merlin
#

is that correct? from what i remember BI made it a mix of weight and size

vapid frigate
#

I don't think there's any official equation, but that's what most things use

south storm
#

@broken mural

little eagle
#

@broken mural

Can you add an empty array to a multidimensional array? For example, say I initialize an array to originally have zero elements, and foreach object in an area I want to add an array for later use; That array hasn't gotten values just yet, though! The problem: The objects refer to a specific index in that array, so if I start with object that points to index 3, I need to create 3 empty arrays in the array.

private _array = [];
_array resize 3;
_array = _array apply {[]};
#

result: [[],[],[]]

shadow sapphire
#

Does anyone know the most simple way to script in waypoints based on another unit's waypoint?

For example, if I had an AI group that I called PlatoonHQ, and I had AI groups FirstSquad, SecondSquad, and ThirdSquad, and PlatoonHQ was set to use BIS_fnc_tskPatrol or whatever when it spawned, how could I have the other three AI groups get HQ's waypoint every time it was created, and then create their own waypoints based on it.

halcyon crypt
final vessel
#

@halcyon crypt
I searched a bit more, and found the original code for enumerating open file handles that the ACRE guys have reused in their code.
I'm posting it here in case someone might be interested.

Enumerating windows handles:
http://forum.sysinternals.com/howto-enumerate-handles_topic18892.html
Full sample code attached at the bottom of the article.

#

Thanks again for pointing me into the right direction.

halcyon crypt
#

Nice ๐Ÿ˜ƒ

final vessel
#

That's the code without all the stuff the ACRE guys have added

halcyon crypt
#

Might come in handy at some point

thin pine
#

Shower thought here, what happens to a global marker (createMarker) but you use the xxxLocal family of commands? Will it only adjust the attributes of the global marker locally (as somewhat expected) or is there undefined behaviour?

icy raft
#

Let me check

#

I'm messing with callExtension right now anyways

#

one thing I hate is that it takes forever to actually load the game -.-

#

Yep, empty string

#

And doesn't get logged

#

Seems it just ignores it

dusk sage
#

yep just empty string ^

#

annoying as hell

icy raft
#

What u trying to do anyways?

#

Hey guys! I need some help!

#

Someone here? ๐Ÿ˜ƒ

#

Well, I've got some sort of problems dealing with object intersections

#

Okay, I have this teleport script,

[] spawn {
    //Let's asume... This vars aren't like this but lets set them here for clarity's sake...
    last_teleport = 0;
    teleport_delay = 5;


    if(last_teleport + teleport_delay < time) then {
        _origin = (eyePos player);  //Get origin
        _multiply = 30;                //Teleport distance (in meters)
        _delta = (eyeDirection player) vectorMultiply _multiply; //Get direction to teleport XY (height get's ignored IDK why)
        /* And below is the problem.
         * I'm trying to block teleports through objects, trying to detect an intersection and setting the point of intersection
         * as the maximum teleport target, but 'lineIntersectsObjs' DOESN'T want to deliver. It get or random objects or
         * none at all. 
         */
        while {(count lineIntersectsObjs [_origin,_delta,objNull,objNull,true,32]) > 0 && _multiply > 0} do {
            _multiply = _multiply - 1;
            _delta = (eyeDirection player) vectorMultiply _multiply;
        };
        if(_multiply <= 0) then { hint "Can't teleport. Collision";};
        player setPos (_origin vectorAdd _delta);
        last_teleport = time;
};
#

Sorry, missing one closure }

#

I've commented the problem inside, I been at it a few hours but can't get a way to avoid teleporting through collidables

#

And the thing is that this code actually triggers the "Can't teleport" condition but still teleports 30 meters front, 30 meters up (and kills you)

#

I shouldn't do that, as delta vector is multiplied by 0

#

Can't, it's supposedly an hability you could use anywhere, but it's too great of an ability

#

So it should be limited to visual contact

#

(Btw, this is a stripped down script that summarices everything)

#

It's trigged by a displayEH["KeyDown"]

#

Okay, thanks anyway ๐Ÿ˜ƒ

dusk sage
#

@icy raft
Try this

#

The first problem you talk about:

And the thing is that this code actually triggers the "Can't teleport" condition but still teleports 30 meters front, 30 meters up (and kills you)

#

Is because you haven't privated your _delta variable. The changes made to it in the while loop, will not reflect in the if parent scope, hence _delta still uses the 30 multiplier.

This is a consequence of not exiting when multiply <= 0, you instead just hinted, then execution continues

icy raft
#

Going to try...

#

Thanks!

dusk sage
#

Also, the reason you're teleporting in the sky, is due to the fact eyePos returns PositionASL (above sea level), whereas setPos will use PositionATL (while on land), which in this case will teleport you z metres above the ground

icy raft
#

I sounds possible that's the problem, I just asumed _delta would become 0 so didn't bother doing an exitWith

#

Yeah! That one I just figured it out!

dusk sage
icy raft
#

Just addeda ASLtoAGL a few minutes ago and worked (sort of)

#

Still teleports about a meter over the floor, but no problems, will be fixed

dusk sage
#

You can just stick the z component of the position to 0, which when used in setPos will just set you at ground level

#

like in the hastebin

icy raft
#

Hmm.. The thing is that I want them to be able to get to roofs and that kind of thing

dusk sage
#

Then converting it is the way to go

#

I forsee some quite unfortunate accidents though ๐Ÿ˜‰

icy raft
#

Nah, I did manage to do a //jetpack// script a few months ago

#

Managed to avoid death (most of the time)

#

Hey BoGuu, I love you

#

I did work

#

It actually fixed everything, fucking scopes

#

It does avoid teleporting through objects

dusk sage
#

๐Ÿ˜‰

icy raft
#

Well... Most of the time.

dusk sage
#

These bunch of commands are always iffy

icy raft
#

Yep, and rotation is even worse

#

I managed to rotate a cube once... And physics arround it rotated with it

#

Like, you put you crosshair straight to it and it just aligned with his updir

steep matrix
#

onChildDestroyed = " _nextMission = uinamespace getvariable ['RscDisplaySingleMission_nextMission',''];_nextMission call bis_fnc_log; if (ctrlidd (_this select 1) == 50 && _nextMission != '') then {(_this select 0) closedisplay 2; playMission['',_nextMission];}; ";

#

is that onChildDestroyed new?

#
        class Bitwise
            file = "A3\functions_f\Bitwise";
            class bitwiseAND
            class bitwiseOR
            class bitwiseXOR
            class bitwiseNOT
            class bitflagsSet
            class bitflagsUnset
            class bitflagsFlip
            class bitflagsCheck
            class bitflagsToArray
        class Combat
            class fireSupportCluster
                description = "Virtual fire support - cluster shell.";
        class Inventory
            class limitAmmunition
            class limitItems
            class limitWeaponItems
        class Objects
            class attachToRelative
        class Vectors
            file = "A3\functions_f\Vectors";
            class vectorDirAndUpRelative
            class weaponDirectionRelative

removed

#

so maybe sqf cmds for bitwise after all?

little eagle
#

Question for the hackers here

#

Would these btwise operators even work on signed floats?

#

With that I mean

#

Would the numerical representation be predictable?

little eagle
clear tendon
#

am i nuts?

#
_veh = vehicle this;
hint format ["Vehicle is %1",_veh]; 
_returnRoadPos = roadAt getPosATL (_veh); 
vector_x = ((getpos (_veh select 0)) + random(round 30)) * cos (getDir(_returnRoadPos)); 
vector_y = ((getpos (_veh select 1)) + random(round 30)) * sin (getDir(_returnRoadPos)); 
_veh setPosATL (vector_x,vector_y,(getPosATL (_veh select 2)));

it still complains that at the last line _veh is an undefined variable

icy raft
#

Error?

clear tendon
#

yes

icy raft
#

Rpt

clear tendon
#
'|#|_veh setPosATL (vector_x,vector_x,(getPo...
Error Undefined variable in expression _veh
icy raft
#

BTW, what is 'this' in the first line?

#

What does it refer to?

clear tendon
#

script is called; this addEventHandler ["killed", {_this exec "scripts\deleteme.sqf"}]

icy raft
#

Change 'this' for '_this select 0'

#

Maybe's that

#

Cos it seems that this without underscore is nothing

neat ridge
#

so something like

_veh = _this select 0;
hint format ["Vehicle is %1",_veh]; 
_returnRoadPos = roadAt getPosATL (_veh); 
vector_x = ((getpos (_vehicle select 0)) + random(round 30)) * cos (getDir(_returnRoadPos)); 
vector_y = ((getpos (_vehicle select 1)) + random(round 30)) * sin (getDir(_returnRoadPos)); 
_veh setPosATL (vector_x,vector_y,(getPosATL (_veh select 2)));
clear tendon
#

i think he meant the this in the addevent

#

or am i wrong

neat ridge
#

could try either, really

icy raft
#

Is both

#

as Berntsen say

#

oh no wait

clear tendon
#

well atleast the hint correct now

#

still gives the error w/ just the edit from bernts

icy raft
#

How is this supposed to be? --> 'this' addEventHandler ["killed", {_this exec "scripts\deleteme.sqf"}]

clear tendon
#

it's on the vehicle's init

icy raft
#

ah ok

clear tendon
#

let me try to add this select 0 in the init

icy raft
#

this addEventHandler ["killed", {_this exec "scripts\deleteme.sqf"}]; should work as it declares de object in 'this' without underscore

clear tendon
#

yeah, that worked, still get the error it doesn't know what _veh is

neat ridge
#

try _veh = (_this select 0);

#

or maybe _veh = vehicle (_this select 0);

#

im not sure, tbh

clear tendon
#

the last makes more sense to me

#

now it doesn't know what vector_x is

#

what the hell

icy raft
#

Hmm...

neat ridge
#

hahaha

#

oh

#

that's cause it's defined as _vehicle, and not _veh I think

icy raft
#

vector_x = ((getpos (_veh select 0)) + random(round 30)) * cos (getDir(_returnRoadPos));
vector_y = ((getpos (_veh select 1)) + random(round 30)) * sin (getDir(_returnRoadPos));

neat ridge
#

๐Ÿ‘†

clear tendon
#

_veh setPoATL (|#|vector_x,....

error undef var in exrp. vector_x

icy raft
#

yeah...

#

What are you trying to achieve with vecto_x/y?

clear tendon
#

Arma VooDooโ„ข

neat ridge
#

ยฌ_ยฌ

clear tendon
#

it's a random move to x/y to 'move' it of the road on killed

#

else the escort - stupid ai - wont continue as the road is blocked..

neat ridge
#

should probably have a sleep on it, so that it waits a few seconds before moving it

icy raft
#
vector_x = ((getpos (_veh)) select 0) + random(round 30)) * cos (getDir(_returnRoadPos)); 
vector_y = ((getpos (_veh)) select 1) + random(round 30)) * sin (getDir(_returnRoadPos));
```
little eagle
#

this script looks totally wrong

icy raft
#
vector_x = (((getpos (_veh)) select 0) + random(round 30)) * cos (getDir(_returnRoadPos)); 
vector_y = (((getpos (_veh)) select 1) + random(round 30)) * sin (getDir(_returnRoadPos));
#

sorry, missed one parenthesis

neat ridge
#

@little eagle any input is welcome

clear tendon
#

@little eagle i believe so, as long as it works

icy raft
#

Wanna see some random cr*p?

little eagle
#

for example

#

wtf is round 30 supposed to do?

icy raft
#

hahahahaha

little eagle
#

there is:
origin getPos [distance, heading]

#

so:

#

private _pos = _veh getPos [30, getDir _returnRoadPos];

#

round 30 does nothing

#

meant to be round random 30 ?

clear tendon
#

yeah that might be it

little eagle
#

but why only use full meters for this?

#

makes no sense

clear tendon
#

then what makes sense

little eagle
#

every line is wrong and the script makes no sense : (

clear tendon
#

Vehicle go boom

#

move vehicle if on the road

#

by random x/y

#

jay is happy

#

make sure it's not 'on' the road

little eagle
#

step one

#

rename the script

#

it doesn't describe what it does

clear tendon
#

i wouldn't renamed it to thisisabananscsript.sqf

little eagle
#

"deleteme" has nothing to do with moving wrecks off the road

#

well

#

you have to make clear what you're doing

#

that way it's much easier to find errors

clear tendon
#

sure, after it works.. ๐Ÿ˜ƒ

#

but fine, ill rename it

little eagle
#

wrong approach mate

#

totally wrong

#

I'm trying to help you

#

not bother you

clear tendon
#

really, really dont care about the naming aproach, im testing one code, if that works. rename it.

#

might not be ideal, im sure.

little eagle
#

you are doing it wrong

clear tendon
#

#riot

little eagle
#

I'm telling you that this mindset is your problem

clear tendon
#

you're kinda sticking it to me as it's a set rule to do for a single script mate. I'm not making an arma mod here. Just a script. No need to go holy on naming approaches or way of doing namings. Hell, maybe i like bananas and name my script banana_on_the_road_MOVE.sqf...

icy raft
#

--.--

little eagle
#

wrong mindset

icy raft
#

chill ppl

#

dont fight

little eagle
#

and insulting people won't get you help

#

just an advice

icy raft
#

what the hell...?

#

he didnt do that...

#

omg

clear tendon
#

^

little eagle
#

sorry

#

mocking me with bananas

icy raft
#

OMG

little eagle
#

I'm not dumb

clear tendon
#

it's the name. you care about the name of the script

icy raft
#

That's it, mute

little eagle
#

Again, you are wrong

clear tendon
#

i mean, if i call it myponiesareawesome.sqf, why is that a problem

little eagle
#

No, I do not care about the script name

icy raft
#

I'd suggest u just to block him, he's on a toxic rage

little eagle
#

Name it whatever you want, but I'm telling you that it should describe what you're doing

#

because you seem to have problems with it

clear tendon
#

sure, i will.

#

can we now move on?

icy raft
#

Yep

#

Thanks

foggy pike
#

that was like stage 5 autism right there

little eagle
#

thanks

icy raft
#

๐Ÿค 

lusty hearth
#

So is this where shit sqf scripts get obliterated by commy

#

Where the scripts go die

south storm
#

This is the formula he is using @little eagle

#
_returnRoadPos = roadAt getPosATL (_veh); 
_vehicle_3DPos = getPosATL _veh;
_vehicle_xPos = _vehicle_3DPos select 0;
_vehicle_yPos = _vehicle_3DPos select 1;
_vehicle_zPos = _vehicle_3DPos select 2;
_RoadDir = getDir(_returnRoadPos);
vector_x = _vehicle_xPos + random(round 30) * cos _RoadDir; 
vector_y = _vehicle_xPos + random(round 30) * sin _RoadDir; 
_veh setPosATL [vector_x,vector_y,_vehicle_zPos];
#

calculates the vector_x and vector_y displacement

#

I wrote it.

#

I also agree with @little eagle @clear tendon Script descriptions is best.

#

I normally name them what they're actually doing.

foggy pike
#

name the script what you initially intend it to do, write code, test, refactor

south storm
#

set or get naming

#

or "onSomething"

foggy pike
#

yeah

#

and CRUD

clear tendon
#

i agree the name isn't conventional, but really, as a generic non-coder here, making a single script, it just goes beyond me why the first thing that gets pointed out is the name of the script, and not the script itself...

little eagle
#

If the script were easier to understand, it would be easier to fix

south storm
#

^

icy raft
#

The one I sent to him is:

    _veh = vehicle (_this select 0);
    _pos = getPosATL _veh;

    hint format ["Vehicle is %1",_veh];

    _returnRoadPos = roadAt _pos;

    vectorXYZ = [
        (round random(30)) * cos (_pos getDir _returnRoadPos),
        (round random(30)) * sin (_pos getDir _returnRoadPos),
        0
    ] vectorAdd _pos;

    _markerstr = createMarker ["markername",vectorXYZ];
    _markerstr setMarkerShape "ICON";
    _markerstr setMarkerType "hd_dot";

    _veh setPosATL vectorXYZ;
    _markerstr setMarkerText "The vehicle should be here!";
#

The marker thingy is just for debugging

#

but still does somekind of error

clear tendon
#

second to last line: vectorXYZ not defined

little eagle
#

hmm

#

should be a local variable

little eagle
#

otherwise two vehicles dieing would make it possible for both script instances to interfere with each other

clear tendon
#

makes sense

icy raft
#

I let it that way for debbuging

south storm
#

the getDir wouldn't work properly.

icy raft
#

but yeah, should remove markers and make vector private for production

little eagle
#

So _vectorXYZ or vectorXYZ is undefined

south storm
#

As the way road data is returned is it's aligned a specific way.

icy raft
#

hmm

little eagle
#

I guess it does the same error for the line above then?

south storm
#

I learned that one the hardway.

clear tendon
#

@little eagle commy, yes

#

undef. var. in expr. vectorxyz

south storm
#

vectoxyz is becoming undefined

icy raft
#
wreckKill = {
    _veh = vehicle (_this select 0);
    _pos = getPosATL _veh;

    hint format ["Vehicle is %1",_veh];

    _returnRoadPos = roadAt _pos;

    vectorXYZ = [
        (round random(30)) * cos ((_pos vectorFromTo _returnRoadPos) select 0),
        (round random(30)) * sin ((_pos vectorFromTo _returnRoadPos) select 1),
        0
    ] vectorAdd _pos;

    _markerstr = createMarker ["markername",vectorXYZ];
    _markerstr setMarkerShape "ICON";
    _markerstr setMarkerType "hd_dot";

    _veh setPosATL vectorXYZ;
    _markerstr setMarkerText "The vehicle should be here!";
};

cursorTarget addEventHandler ["Killed", wreckKill];
clear tendon
#

@south storm hit up on the arrowkeys to edit your last message ๐Ÿ˜‰

little eagle
#

then this expression:

[
        (round random(30)) * cos (_pos getDir _returnRoadPos),
        (round random(30)) * sin (_pos getDir _returnRoadPos),
        0
    ] vectorAdd _pos;
#

returns nil

icy raft
#

Try with (var1 vectorFromTo var2) select 0/1

#

Nope

#

wait

south storm
#

Ew ew.

#

Almost as bad as doing this in python.

icy raft
#
wreckKill = {
    _veh = vehicle (_this select 0);
    _pos = getPosATL _veh;

    hint format ["Vehicle is %1",_veh];

    _returnRoadPos = roadAt _pos;

    vectorXYZ = [
        (round random(30)) * cos ((vectorNormalized (_pos vectorFromTo _returnRoadPos)) select 0),
        (round random(30)) * sin ((vectorNormalized (_pos vectorFromTo _returnRoadPos)) select 1),
        0
    ] vectorAdd _pos;

    _markerstr = createMarker ["markername",vectorXYZ];
    _markerstr setMarkerShape "ICON";
    _markerstr setMarkerType "hd_dot";

    _veh setPosATL vectorXYZ;
    _markerstr setMarkerText "The vehicle should be here!";
};

cursorTarget addEventHandler ["Killed", wreckKill];
#

๐Ÿค” ๐Ÿ”ซ

south storm
#

Just personal preference here. I separate my functions and other stuff into lots of separate files using cfgFunctions.hpp

icy raft
#

This is for realtime testing

little eagle
#

I still think
origin getPos [distance, heading]
would make this way easier

icy raft
#

I have my own compiling method

little eagle
#

it reports ATL too

clear tendon
#

how would that be implented there @little eagle

south storm
#

Never knew about that one commy

little eagle
#

it's newish and shiny

#

oh. apperently it reports AGL

#

nothing AGLToASL can't fix

icy raft
#

Since Arma 3 v1.55.133361

south storm
#

Yeah pretty new

little eagle
#

yes

icy raft
#

I missed that one

little eagle
#

origin getPos [distance, heading]

origin is the vehicle

#

distance that 30 meters

icy raft
#

But still, you would have to calculate the direction

little eagle
#

heading is vectorFromTo wreck -> road

#

ohh

icy raft
#

Heading is number ๐Ÿ˜ฆ

little eagle
#

You have to get off the road

south storm
#

So you'd use the road as the origin point.

#

roadAt gives you the pos

little eagle
#

yeah

#

and then go perpendicular (?) to the roads direction

clear tendon
#

preferably

little eagle
#

how to get the _roadDir though?

south storm
#

90* in the road direction

#

is relative to the road piece

clear tendon
#

i should just move the wreck on kill, away from the road so the stupid ai can keep moving hahaha

little eagle
#

yup

south storm
#

So it will align it to the actual road

little eagle
#

but how to get _roadDir in the first place?

icy raft
#

Wouldn't be easier to just nuke the wreck.........?

little eagle
#

but not as fun

clear tendon
#

mission realism, the wreck stays there

#

just nudges out of the way for ai to keep moving

icy raft
#

a floatting wreck hahaha

little eagle
#

I think writing a function to get the "roads direction" would be step 1

#

the moving stuff is easy with the new getPos

#

also, the script should probably do nothing if the vehicle is killed in the open field

clear tendon
#

they're hard stuck on the road through 3den enhanced

little eagle
#

direction of the road (as in the real road not the segments) would be _road1 getDir _road2

#

_road1 and _road2 are the first two objects in roadsConnectedTo _road0

#

and _road0 would be roadAt position _wreck

#

exit if _road0 is a null object

#

add 90 or - 90 degree randomly

#

setPosASL with that new getPos

#

done

south storm
#

use isEqualType to check the data type

clear tendon
#

#overmyhead

south storm
#

then you can use roadAt

#

if it returns an array

#

then I'd use apply to sort the data

#

for the closest point to the car

little eagle
#

doesn't sound too bad tbh

south storm
#

@little eagle Although the way apply works I am not sure of

#

Can you elaborate?

little eagle
#

how apply works?

south storm
#

I mean I've used it to replace count is that bad?

#

{ _x } apply array;

little eagle
#

array apply {_x} you mean

south storm
#

Yeah

little eagle
#

apply returns an array and the elements of it are made of the return values of your code

#

[1,2,3] apply {0};
-> [0,0,0]

south storm
#

does sort when applied to an array

#

muck with the order?

little eagle
#

?

south storm
#

well I wanted to sort a location for the closest location to an origin point

#

When it returns the x,y,z

#

does it screw with the x,y,z and make it e.g x,z,y