#arma3_scripting

1 messages ยท Page 455 of 1

winter rose
#

sometimes, you have to believe

unborn ether
#

Why do people never use tag entry in CfgFunctions, like every paste i've seen is missing that one.

little eagle
#

It serves no purpose.

#

Tag already is the classname of the superclass. So why overdefine your stuff?

unborn ether
#
class CfgFunctions
{
    class Backend 
    {
        tag = "DT";
        class Init {
            file = "\somepbo\functions";
            class functionOne {};
        };
    };
    class GUI 
    {
        tag = "DTUI";
        class Init {
            file = "\somepbo\functions";
            class functionTwo {};
        };
    };    
};
#

Seems a bit better for me

#

maybe just my own purpose

winter rose
#

then it's more than a tag!

little eagle
#

Bad idea, The classname has no tag.

#

Backend could conflict with other mods.

#

Or mission.

thorn saffron
#

Ok progress, now I get generic error in expression

_weaponPrice = [_weaponClass] call taro_fnc_weaponPrices;```
#
lnbClear _weaponList;
{    
    _weaponClass = (_taroShopInventoryWeapons select 0) select _forEachIndex;
    _weaponCount = str ((_taroShopInventoryWeapons select 1) select _forEachIndex);
    _weaponPrice = [_weaponClass] call taro_fnc_weaponPrices;
    _weaponPriceDisplay = format ["$ %1",_weaponPrice];
    _displayName = (getText(configFile >> "cfgWeapons" >> _weaponClass >> "displayName"));
    _picture = (getText(configFile >> "cfgWeapons" >> _weaponClass >> "picture"));
    
    _weaponList lnbData [[(lbSize _weaponList)-1,  1], _weaponClass];
    _weaponList lnbData [[(lbSize _weaponList)-1,  2], _weaponCount];
    
    _weaponList lnbAddRow [_displayName, _weaponPriceDisplay, _weaponCount];
    _weaponList lnbSetPicture [[_foreachindex,0],_picture];
    
} forEach (_taroShopInventoryWeapons select 0);```
little eagle
#

Isn't (_taroShopInventoryWeapons select 0) select _forEachIndex just _x?

unborn ether
#

Well ok, you can just wrap Backend and GUI in parent class and continue with my variant

#

So still just propably my own way of managing

little eagle
#

Well if what you posted is what you're doing, then you're missing the tags for the classnames. Problems like this is why I would stay away from such experiments.

astral tendon
#

Is there a way to change or remove smoke granades effect?

thorn saffron
#

@little eagle The thing works as it is except for _weaponPrice = [_weaponClass] call taro_fnc_weaponPrices; with is a new addition

#

@astral tendon Its config stuff, particles to be exact

little eagle
#

Yeah, but still. Why not write:

_weaponClass = _x;
astral tendon
#

No way to change by script?

thorn saffron
#

nope

astral tendon
#

Rip

thorn saffron
#

@little eagle cause I dumb at scripting. Still it works, I just want to run my prices function and pass the parameter to that.

little eagle
#

Can you copy paste the error message from RPT?

thorn saffron
#

generic error in expression

#

give me a moment, I need to enable logs

#
17:30:29 Error in expression < 1) select _forEachIndex);
_weaponPrice = [_weaponClass] call taro_fnc_weaponPri>
17:30:29   Error position: <= [_weaponClass] call taro_fnc_weaponPri>
17:30:29   Error Generic error in expression
17:30:29 File taro_shop\functions\fn_showGunShopDialog.sqf [taro_fnc_showGunShopDialog], line 41```
still forum
#

your function probably returns an assignment

#

can you show the taro_fnc_weaponPrices function?

thorn saffron
#

the prices function:

    params ["_priceClass"];

    // Prices set for specific weapons
    _specificWeaponPrices = [ 
        "arifle_MX_F",100,
        "arifle_MX_GL_F",200, 
        "arifle_MX_SW_F",300, 
        "launch_B_Titan_short_F",400, 
        "launch_NLAW_F",500 
    ];

    // Prices set for general groups of weapons, in case the weapon that we try to find does not have specific price set
    _genericWeaponPrices = [
        150, // type = 1, RIFLE
        50, //type = 2, HANDGUN
        350  //type = 4, LAUNCHER
    ];

    // We check the specific prices array to see if a price was set for our weapon
    _index = _specificWeaponPrices find _priceClass;

    // The index will return the position weapon's class name if it was defined in the _specificWeaponPrices array, if not it will return -1
    if (_index == -1) then {
        // Things got complicated and the weapon has no specific price set. In this case we need to check what type the weapon is and then use a value from our generic prices array
        _type = (getNumber(configFile >> "cfgWeapons" >> _priceClass >> "type"));
        switch (_type) do {
            case 1: { _price = _genericWeaponPrices select 0 }; // Price set to generic rifle price
            case 2: { _price = _genericWeaponPrices select 1 }; // Price set to generic handgun price
            case 4: { _price = _genericWeaponPrices select 2 }; // Price set to generic launcher price
        };
    } else {
        // Specific price found, we now set the price to the value was set by pointing the script to the position next to the class name that returned the hit, thats where is the price for our weapon
        _price = _specificWeaponPrices select (_index + 1);
    };```
still forum
#

yeah. _price = _specificWeaponPrices select (_index + 1); you are not returning anything

#

you aren't even returning nil you just return nothing which is invalid in SQF

#

you probably want a _price at the end

thorn saffron
#

Just like that?

_price;```
still forum
#

ye

gleaming oyster
#

I always thought you could always do:

_coolNumber = 10 + 2;
//returm should be 12 without _coolNumber at end of file?
thorn saffron
#

ok, that one is fixed, next error :D, it seems that the price is not set for some reason

17:47:05   Error position: <_price;>
17:47:05   Error Undefined variable in expression: _price
17:47:05 File taro_shop\functions\fn_weaponPrices.sqf [taro_fnc_weaponPrices], line 35
17:47:05 Error in expression <;

_weaponPriceDisplay = format ["$ %1",_weaponPrice];
_displayName = (getText(c>
17:47:05   Error position: <_weaponPrice];
_displayName = (getText(c>
17:47:05   Error Undefined variable in expression: _weaponprice
17:47:05 File taro_shop\functions\fn_showGunShopDialog.sqf [taro_fnc_showGunShopDialog], line 43```
#
params ["_priceClass"];

// Prices set for specific weapons
_specificWeaponPrices = [ 
    "arifle_MX_F",100,
    "arifle_MX_GL_F",200, 
    "arifle_MX_SW_F",300, 
    "launch_B_Titan_short_F",400, 
    "launch_NLAW_F",500 
];

// Prices set for general groups of weapons, in case the weapon that we try to find does not have specific price set
_genericWeaponPrices = [
    150, // type = 1, RIFLE
    50, //type = 2, HANDGUN
    350  //type = 4, LAUNCHER
];

// We check the specific prices array to see if a price was set for our weapon
_index = _specificWeaponPrices find _priceClass;

// The index will return the position weapon's class name if it was defined in the _specificWeaponPrices array, if not it will return -1
if (_index == -1) then {
    // Things got complicated and the weapon has no specific price set. In this case we need to check what type the weapon is and then use a value from our generic prices array
    _type = (getNumber(configFile >> "cfgWeapons" >> _priceClass >> "type"));
    switch (_type) do {
        case 1: { _price = _genericWeaponPrices select 0 }; // Price set to generic rifle price
        case 2: { _price = _genericWeaponPrices select 1 }; // Price set to generic handgun price
        case 4: { _price = _genericWeaponPrices select 2 }; // Price set to generic launcher price
    };
} else {
    // Specific price found, we now set the price to the value was set by pointing the script to the position next to the class name that returned the hit, thats where is the price for our weapon
    _price = _specificWeaponPrices select (_index + 1);
};
_price;```
#

I understand that something goes wrong in the weapon prices and the _price value is not returned with causes error in the display later on

meager heart
#
params ["_priceClass"];

private _specificWeaponPrices = [ 
    "arifle_MX_F",100,
    "arifle_MX_GL_F",200, 
    "arifle_MX_SW_F",300, 
    "launch_B_Titan_short_F",400, 
    "launch_NLAW_F",500 
];

private _price = 0; 
private _genericWeaponPrices = [150, 50, 350];
private _index = _specificWeaponPrices find _priceClass;

if (_index == -1) then {
    private _type = (getNumber(configFile >> "cfgWeapons" >> _priceClass >> "type"));
    switch (_type) do {
        case 1: {_price = _genericWeaponPrices select 0}; 
        case 2: {_price = _genericWeaponPrices select 1}; 
        case 4: {_price = _genericWeaponPrices select 2}; 
    };
} else {
    _price = _specificWeaponPrices select (_index + 1); 
};

_price 

๐Ÿค”

thorn saffron
#

@meager heart Thanks, that did the tick

meager heart
#

nice

little eagle
edgy dune
#

@still forum about the missionNamespace setVariable ["someVariable","some String"];, if say that it is ran client side,will it broadcast it globally so that everyones "someVarialbe" gets updated to "some String"?

still forum
#

no

#

you can add a "true" at the end to do that

#

which would be same as using publicVariable

edgy dune
#

oh so if I do this, missionNamespace setVariable ["someVariable","some String",true]; client side,then it updates for everyone on the serve?

little eagle
#

Yes, it's called "setVariable public".

#

The true/third argument is the public flag and by default set to false = local only.

edgy dune
#

cool thx bby

still forum
molten folio
#

hello guys , i got this script of weapon list sqf disableSerialization; tag_curSpawnList = "Weapon"; _display = findDisplay 385300; _list = _display displayCtrl 2222; lbClear _list; _weaponTypes = ["AssaultRifle","GrenadeLauncher","Handgun","Launcher","MachineGun","MissileLauncher","RocketLauncher","Shotgun","Rifle","SubmachineGun","SniperRifle"]; { _thisWeaponInfo = [(configName _x)] call BIS_fnc_itemType; _thisWeaponType = _thisWeaponInfo select 1; if (_thisWeaponType in _weaponTypes) then { _index = _list lbAdd (getText (_x >> "displayName")); _pic = getText (_x >> "Picture"); _list lbSetPicture [(lbsize _list)-1,_pic]; _list lbSetData [(_index)-1,(configname _x)]; }; }forEach ("true" configClasses (configFile >> "CfgWeapons")); and i was wondering if its possible to get the mags with the weapon when spawned in

little eagle
#

Yes, it is.

molten folio
#

but do i put the script in the button function or the one at the top

little eagle
#

๐Ÿค”

#

Either is fine I guess.

meager heart
#

nice examples with randomness ๐Ÿ‘ keep that blog going guys

molten folio
#

How would i start with the script?

obsidian kiln
#

profilenamespace in dedicated server returns the server profile?

#

it needs filepatching?

little eagle
#

Yes. No.

molten folio
#

@little eagle could u help?

little eagle
#

Sure.

molten folio
#

i got told that its impossible to do it on the player it has to be on the flooor

little eagle
#

By whom?

molten folio
#

ud9d

little eagle
#

What a noob.

molten folio
#

lol

little eagle
#

haha

molten folio
#

so how is this made

#

("true" configClasses (configFile >> "CfgMagazines"));

#

will that be used?

little eagle
#

That reports all magazine classes, including stuff like mines and handgrenades.

molten folio
#

_MagTypes = ["Bullet "];

#

guess that would only be MAgs?

little eagle
#

Rogue space. That won't work.

molten folio
#

ty for helping

astral tendon
#

I am getting negative values with smoke grandes speed, wth

little eagle
#

That seems impossible. How to repro?

still forum
#

let time run backwards

little eagle
#

But even negative numbers are positive when squared.

astral tendon
#
 player addEventHandler ["Fired", {
if ((_this select 4) == "SmokeShell") then {
_GasShell = (_this select 6);

_GasShell spawn {
sleep 3;
_GasShell = _this;
waitUntil {speed _GasShell < 1}; /// how it was before
systemChat str (speed _GasShell);
_emitter = "#particlesource" createVehicleLocal (getPosATL _GasShell); 
_emitter setParticleClass "MortarFired1";
_unitsArounGas = _emitter nearEntities ["Man", 10];
_GasShellEyes = eyePos _emitter;
_GasShellPos = getPosATL _emitter;
_timer = 20;
deleteVehicle _GasShell;
while {_timer >=0} do{
_GasShellEyes = eyePos _emitter;
_unitsArounGas = _emitter nearEntities ["Man", 10];
{ if ([objNull, "VIEW"] checkVisibility [eyePos _x, _GasShellEyes] > 0 AND isnil {_X getVariable "Gased"}) then {[_x] execVM "GasEffect.sqf"}} forEach _unitsArounGas;
_timer = (_timer - 1);
sleep 1;
       };
deleteVehicle _this;
deleteVehicle _emitter;
   };
  };
}];
still forum
#

where is the "speed" in there?

astral tendon
#

my goal before was to debug the smoke granda speed

little eagle
#

systemChat str (speed _GasShell);

astral tendon
#

i want the script to start when the smoke shell have stoped or it would fire in mid air

little eagle
#

Does that report a negative number? That's hilarious.

astral tendon
#

i edit

#

before i was like "how can that be slower than 1 when the granade is in mid air?"

#

now i am like "What the fuf"

little eagle
#

So what did it report? The systemChat I mean.

astral tendon
little eagle
#

-49

#

Well, you could try the alternative:

vectorMagnitude velocity _GasShell / 3.6
#

That should never be negative.

astral tendon
#

yup, that is a positive value

little eagle
#

I guess Dedmen is right, and the grenade is flying backwards.

astral tendon
#

lel

little eagle
#
abs speed _GasShell < 1

That'd work too.

astral tendon
#

that code you sended before is in metres per second

little eagle
#

No, I divided by 3.6 to convert to km/h

astral tendon
#

My country did not put a flag in the moon soo, yeah...

little eagle
#

Mine neither, although it built the first space rockets I guess.

astral tendon
#

Germany?

little eagle
#

Yea

astral tendon
#

Cool

#

oh wait

#

7x1 flashbacks

#

๐Ÿ˜ญ

meager heart
#

also you can check when smoke shell is "landed" with velocity _shell select 2

#

if that is the task...

astral tendon
#

Not only that, i also need to check if the shell is not rolling

#

so < 1 is a really slow rolling so the script can fire anyway

little eagle
#

That's annoying to do, as there is no command to read rotating speed.

#

Best one can do is compare last frame with current frame.

meager heart
#

maybe with vectorModelToWorld ๐Ÿค”

little eagle
#

That's maybe rotation, but not rotating speed.

austere hawk
#

if the shell is rolling, it also has velocity... or not?

little eagle
#

It could roll in place, maybe...

meager heart
#

probably not Z

austere hawk
#

but thats silly...

little eagle
#

I'd just put the grenade on a timer and don't care about it moving or not.

austere hawk
#

exactly, the fuse doesnt care if its rolling or not...

astral tendon
#

eh, but my script delets the smoke once it stops and make it own smoke and starts a tear gas effect

austere hawk
#

and what does rolling have to do with this?

little eagle
#

Scripted grenades are fun. ACE has flashbangs, incendiaries, flares...

austere hawk
#

or put more exact - rotational velocity

astral tendon
#

well, there is a situation were the granade would roll slowly on a small ledge and take allot of time to go speed == 0 and fire

#

and others that the scripts fires in mid air

austere hawk
#

what grenade fuse exists that waits until the thing has completely stopped moving? propably none id imagine

#

they get triggered by initial impact and then have a timer (maybe)

astral tendon
#

that has nothing to do with fuse

austere hawk
#

what grenade that rolls slowly are you talking about then?

astral tendon
#

more like to start the Tear gas effect

#

the vanila smoke

austere hawk
#

starting a <effect> -> thats what a realworld fuse does. And realworld fuses either work on a timer, or on impact (the simple ones)

gleaming oyster
#

i find that GL loaded smoke especially has a tendancy to bounce and roll off of objects real easy

austere hawk
#

so why worry about rotation speed when you can (and realistically propably) shoudl just use a time delay for the effect to start (like a fuse does)

little eagle
#

Yeah, gl grenades are pretty much bugged.

#

Some error about bouncing in their simulation.

gleaming oyster
#

Say you aim your fire against a wall it'll ping pong itself against something else, sending it rolling across the ground instead of dropping

astral tendon
#

my problem was that the tear gas effect would start in mid air if the player trows too far

little eagle
#

And?

austere hawk
#

if the grenade rolls, it is not midair ?

#

so if speed < 2m/s you are definitely not midair anymore

astral tendon
#

and no one is hit by the gas effect and is dull

little eagle
#

Well, if you throw it straight up, the grenade will have v=0m/s at the highest point.

meager heart
#
waitUntil {
    sleep 3; 
    (velocity _shell select 2) == 0
};
```3 seconds after its landed ^
#

midair fix*

#

๐Ÿค”

austere hawk
#

<= 1 for rolling fix... propably?

astral tendon
#

also, it does not fire in mid air on its highest point. because of the 3 second dellay (that is also the fuse delay)

austere hawk
#

Increase 3 sek timer to 5sek in config if you have problems with midair stuff

i fail to see the issue eitherway.. if its just smoke greneade with scripted teargas effect why is it one-off effect start and not a continuous check? And if its a continuous check why does it matter if it's in the air or rolls when it starts?

unborn ether
#

Gas shell is a projectile, but still a vehicle, so if it hits 90 degree wall and fall back it might have negative speed.

sick sorrel
unborn ether
#

It inherits the parameters of camera created with camCreate, not the one you might be looking when you operate it.

edgy dune
#

So say I do the following```sqf
myvar=false;
publicVariable "myvar";

 would I have to have `publicVariable` again if I where to update `myvar` somewhere else? like so
```sqf
myvar=true;
publicVariable "myvar";
little eagle
#

Yes.

edgy dune
#

wonderful

meager heart
#

weekly uav camera questions lol

little eagle
#

They should rephrase it to some math problem to get me motivated to look into it.

meager heart
#

there is few

#

camera position and direction

inner swallow
#

2 + UAV = 4 - camera = how

#

#quickmath

meager heart
#

2 + 2 is 4
minus 1 dats free
quick mafs

#

name your RTT differently maybe, SuicideKing ๐Ÿ˜€

#

(if that was real question)

inner swallow
#

SKKKRAA?

#

oh

#

wait

meager heart
#

raw sause

inner swallow
#

RTT?

meager heart
#

yes

inner swallow
#

er..

meager heart
#

render to

#

t...

#

te

#

tex

inner swallow
#

t

#

?

meager heart
#

...cmon

#

almost

#

like really close

inner swallow
#

textile?

#

texture!

#

textual

meager heart
#

success

inner swallow
#

texting

#

which one

#

๐Ÿ˜„

meager heart
#

texture! <

inner swallow
#

also no not a serious question ๐Ÿ˜„

#

ah

little eagle
#

rapelling towards transport

meager heart
#

๐Ÿ˜€

kindred lichen
#


My_FormatTimeFunction = {

_m = floor (_this / 60);
_s = floor ( _this % 60 );
if( _s <10 ) then
{
     _s = format ["0%1",_s];
};
_msg = format ["%1:%2",_m,_s];
};

_time = str (TOTAL_TIME call My_FormatTimeFunction);
TotalTimeMarker setMarkerText (format ["Total Time: %1",_time]);


help me, getting generic expression error on the function call.

little eagle
#

Just use the BIS function for this.

meager heart
#

BIS_fnc_secondsToString ๐Ÿค”

kindred lichen
#

That works! thanks

winter rose
#

Hi, I'm looking for a way to detect that a player is looking at a specific building door, do you know if there is a way?

meager heart
#

yeah to start you can just check it with

#
hint str getCursorObjectParams;
#

@winter rose

winter rose
#

oooooouh yeah, thanks a lot!

meager heart
#

np

wary vine
#

got a wierd issue ```sqf
private _controlGroup = _display displayCtrl 180000;

systemChat str _controlGroup;

private _controlGroupPos = [
    (0.3185 * safezoneW + safezoneX),
    ((0.159 + 0.066) * safezoneH + safezoneY),
    (0.360937 * safezoneW),
    0.638 * safezoneH
];

private _idcStart = 180001;

_controlGroup ctrlSetPosition _controlGroupPos;
_controlGroup ctrlCommit 0;

private _ctrl0 = _display ctrlCreate ["xPhoneSetupPlain", _idcStart, _controlGroup];
systemChat str _ctrl0;
#

systemChat str _controlGroup; is returning control #180000

#

systemChat str _ctrl0; is returning No Control

#

my mistake, I wasn't including the edited controls in the right place xD

meager heart
#

createVehicle will create empty vehicle/object, you need createVehicleCrew or BIS_fnc_spawnCrew to make it work, also there is only one option for that plane crew, that is driver _aircraft... fullCrew maybe too much ๐Ÿ˜€ @exotic tinsel

#

BIS_fnc_spawnVehicle< will spawn vehicle with the crew

#

0.159 + 0.066 = 0,225 ๐Ÿ˜„ @wary vine

exotic tinsel
#

yup, i had syntax error in that my bad.

wary vine
#

@meager heart i know xD but for some reason every ctrl in my group needs + 0.066 so its quicker like this xD

plucky willow
#

I'm trying to spawn some stuff on the ground using GroundWeaponHolder_Scripted to hold the items, but the items are invisible while on the ground. Is there a way to make them visible?

plucky willow
#

Figured it out, wasnt the groundweaponholder but the syntax of createvehicle i was using that was incorrect.

winter rose
#

@meager heart getCursorObjectParams did the trick, thanks ๐Ÿ˜‰

compact maple
#

Hello, is it possible to have an optional parameter in a function ?
i call a func with only 2 params, but the function get 3, with 1 optional

still forum
#

yes. See

compact maple
#

perfect thanks you

unborn ether
#

@wary vine @meager heart

private _hO = 0;
private _wO = 0;
private _ctrlW = 0.361;
private _ctrlH = 0.638;
{
    ...
    _ctrl ctrlSetPosition [
        _wO * safezoneW + safezoneX,
        _hO * safezoneH + safezoneY,
        _ctrlW * safezoneW,
        _ctrlH * safezoneH
    ];
    ...

    _hO = _hO + _ctrlH;
} forEach _imaginaryCtrls;
#

Offsets => plastic GUI

meager heart
#

๐Ÿค”

#

ok thanks i will try that one! ๐Ÿ‘Œ
(wrong tag ๐Ÿค”)

unborn ether
#

๐Ÿ˜„

meager heart
#

๐Ÿ˜€

unborn ether
#

I do that for like everything but main display group, which is still positioned by safezone absolutes

earnest path
#

Hey guys i am trying to create a dynamic billboard that refreshes data. I would like to keep it server side and i have taken the approach to use UserTexture1m_F per character. So i have 11 rows of 41 characters and they render great in the map editor but the moment i put this under Dedicated server setup there is really bad lag that does not go away if you stay next to the billboard or 10km away. Could someone please give me a hint as to how can i utillize that UserTexture1m_F helper object so its attachable to other objects and will render texture in multiplayer but not lag.

unborn ether
#

So basically you can simply just change numbers to re-scale all the GUI

still forum
#

@earnest path #rules 9) Do not cross-post

earnest path
#

I am glad you noticed that as no one else did in the other channel

still forum
#

Maybe the others that read your message didn't know the answer. Just like me.

meager heart
#

same here ^

#

just no clue

unborn ether
#

@earnest path So to my view, you attach 41 helper objects to a billboard and update their textures by something like setObjectTextureGlobal?

earnest path
#

This is correct however my test is static so no updates. Just one load and i get constant lag .

unborn ether
#

Well attachTo is like really intensive on anything in-game

#

If you attach 1 attached object, to an object which was attached to unit, which moves (matryoshka right) - this will just kill your client netcode

#

You do apply that 41 times so I would probably change that approach to something else. For example creating a 41 selections in a billboard model, which is 100% accurate way.

earnest path
#

Oh wow i didn't even think of that.

#

Is it possible to add selections to an existing object trough config ?

#

@unborn ether Thank you for the pointer! Really appreciate it and i will try not to break more rules here.

unborn ether
#

No, selections are created in a model, config just defines their appearance.

still forum
#

You can also use the new setPlateTexture to set user configured text onto a "plate"

#

no need to have textures and stuff for all the characters. The engine generates the texture for the text for you.

#

Problem is you again need your own model with a number plate on it. And the text length is limited.

earnest path
#

Ok so the solution requires a mod which i will have to do i guess. Do you have any pointer as to where should i read about creating plates for objects ?

earnest path
#

I just read that yes so this will only work for small signs ๐Ÿ˜ฆ

still forum
#

yeah. As I said 15 characters. You could just make multiple models. Like if you need 41 characters that would need 3 models standing next to eachother.
and if you need 11 rows that would be 33 models. Which is way better than what you have now which is 451 different models

earnest path
#

I will both approaches. I was hoping i can achieve that without modding

little eagle
#

If you attach 1 attached object, to an object which was attached to unit, which moves (matryoshka right) - this will just kill your client netcode
"netcode"
:thonking:
Just attach local objects if you're worried about traffic.

#

Rollo, just post your scriot you have atm., so people know what it should be in the end.

earnest path
#

I am at work at the moment but i will definitely upload it once at home.

unborn ether
#

@little eagle Well it doesn't seem he wanted that to be local

little eagle
#

Why?

still forum
#

you didn't understand what he meant @unborn ether
local objects. But on every player

#

in the end everyone has the same display. But without any network load

earnest path
#

If local objects work i can always create a mission namespace variable that contains the text and than have the clients create their objects and refresh.

little eagle
#

Every machine (with interface)

unborn ether
#

Like remoteExec to 0 for updates once upon a time?

#

-2 if to be exact

little eagle
#

0

#

There is no reason to use global objects, even if the script is controlled by the server.

#

But I have no idea what the script should do. 41x11 chars sounds like some wheel of fortune board to me.

unborn ether
#

Well, kinda a way to do, but I would rather still create one billboard model with all selections, even if local.

little eagle
#

Rollo probably doesn't have the option to make a mod. Otherwise he wouldn't fuck around with 1x1 textures.

still forum
#

you could even make it like the ingame watch, date display.

#

animations. Only a single texture. But each selection references a different place on the texture based on animation

little eagle
#

Maybe it's one of those billboards you see near the road in the US. "J e s u s i s L o r d" etc.

still forum
#

In the end that would just be a billboard animateSource ["row1_1", 41]; or
billboard animateSource ["row1_1", toArray "A" select 0]; to set the first character on the first row to A

#

That would actually be kinda neat. You could make a real board thingy like on airports with that. These clackery ones

little eagle
#

I honestly don't think it's a problem with the 1x1 model. It's probably some bug in the script.

#

Also not a problem with attachTo.

still forum
#

well 400 objects..

little eagle
#

Yeah, flat ones with no simulation.

still forum
#

But generally with performance problems. Stop speculating and guessing. Measure and check. #perf_prof_branch

little eagle
#

I say it's the script. Probably doing 11x41 times setObjectTextureGlobal or something.

still forum
#

in a PFH ๐Ÿ˜„

earnest path
#

I am exactly after the airport board. i will upload a photo but i dont have one here right now

#

I did use setObjectTextureGlobalbut i assumed it just references the texture from the mission file so each client will just load it localy

still forum
#

yeah that's true

little eagle
#

That's true, but if you use it 451 times at once, that's a lot of text.

earnest path
#

I will be at home in about 2 hours and i will package a mission and share it here so you can see the code and the desired result. I will include the textures that i have prepared as well. Than we can discuss it further if you guys are willing to. Thank you for your time i really appreciate it. I have been looking for a solution to this for since 3 years ago and i never managed to find a good approach. Recently i saw another developer posting a script about a shooting range with live score board and when i saw how he does it i revived that project.

#

The ideal solution will be using vanilla Arma with a server side script but if it is not feasible than i will have to go with a mod. Since my knowledge in making mods and 3D models is very limited i never investigated this option.

spark sun
#

Does #monitor admin command correspond to a BIS function returning the server FPS?

still forum
#

almost yeah

#

it also returns memory info for which there is no function

little eagle
#

No, but you can get the server fps a different way.

spark sun
#

diag_fps ?

#

with a remoteexec of course

still forum
#

rhetorical question? If not then, yes.

little eagle
#

Like this I guess:

{
    floor diag_fps remoteExec ["systemChat", remoteExecutedOwner];
} remoteExec ["call", 2];
spark sun
#

yea thanks. I was asking if BIS have one to avoid write my own function ^^

little eagle
#

If you habe a scheduled script and need it in a variable:

commy_serverFPS = nil;

{
    missionNamespace setVariable ["commy_serverFPS", floor diag_fps, remoteExecutedOwner];
} remoteExec ["call", 2];

waitUntil {!isNil "commy_serverFPS"};
spark sun
#

to get variable from server

#

Does CBA have a better framework for that ?

still forum
#

CBA events

#

send a event away. The receiver processes it. And sends another event with the result back

spark sun
#

I see, I noted for futur work may be ๐Ÿ˜ƒ

#

Does params ["_a"] create a copy of _this select 0 ? Or is it a pointer ?

little eagle
#

Neither.

still forum
#

it's a pointer in the backend. Just like any variable

#

It behaves the same as _this select 0 if that's what you mean

little eagle
#

No.

still forum
#

aka _this = [[]];
params ["_a"] the _a would point to the inner array.

#

and as you can edit arrays by reference.. You can edit it by reference.

spark sun
#

If I pushback an element in _a

#

now _this select 0 has the new element ?

still forum
#

Like I said and as you can edit arrays by reference.. You can edit it by reference.

#

no

#

because you are not modifying _this

#

the array inside _this select 0 would have the new element

#

but _this select 0 won't return something different

little eagle
#
private _a = [];

[_a] call {
    params ["_a"];
    _a pushBack 1;
};

systemChat str _a; // [1]
#

arg...

#

Does this answer it?

spark sun
#

Yep!

#

That what I expected but I wrote a more complex function and it didn't work. I will investigate more then ...

still forum
#

private _a = [];

[_a] call {
_temp = _this select 0:
    params ["_a"];
    _a pushBack 1;
(_this select 0) isEqualTo _temp //true
};

systemChat str _a; // [1]

That's what confused me. _this select 0 doesn't change if you change _a. It'll stay the same value

little eagle
#

Why would it?

still forum
#

if you change _a the change won't propagate to _this. Only if _a is an array and you change the content of that array by using a function that changes it by reference

#

because both _a and _This select 0 are pointers to the same array

little eagle
#

Yeah, why did that confuse you?

spark sun
#

So if you do a CBA_fnc_addPerFrameHandler you can change parameters during the execution of the PFH

#

The next execution, the modified parameters would used, isn't it ?

delicate lotus
#

Is it possible to chain dialogs? Like one is basically the Frame of the other one with all the fancy stuff while the other has all the buttons and functionalities?

#

Or other saying, can I create a parent and a child dialog?

still forum
#

@spark sun as long as you modify a array by reference, yes.

spark sun
#

Sound cool then, thanks!

edgy dune
#

Im having some trouble with publicVariable again, so say I do the following in a file called script1.sqf ```sqf
_myVar="Words";
publicVariable "_myVar";

Now will `_myVar` become public even tho it has the underscore?  and if it does become public would I get `_myVar` by for example hinting in another file called `script2.sqf`
```sqf
hint format["%1",_myVar];
winter rose
#

nope.
do the following:

MyPublicVar = _myVar;
publicVariable "MyPublicVar";
edgy dune
#

oh so the _ prevents it from becoming public then?

winter rose
#

I think so, and even if it does it's bad practice and leads to confusion

edgy dune
#

i see

winter rose
#

๐Ÿ‘

edgy dune
#

thx

still forum
#

I never actually tried.. Theoretically _ variables can be public

#

but you cannot access them by just writing _myVar because that's a local variable

edgy dune
#

Yea it didnt work for me, so maybe thats why, is there a list of all reserved words in arma 3?

still forum
#

there are no "reserved words" concerning variables

#

you can literally use everything from unprintable control characters to emoji

#

but using the = operator to set them you cannot use any variable names that are named like commands

delicate lotus
#

text faces like ( อกยฐ อœส– อกยฐ) too?

still forum
#

yes

#

and about publicVariable as I said I didn't test what it can do. Theoretically it can do everything too.

edgy dune
#

alright lets make a emoji variable now

delicate lotus
#

Just use emojis as your Scripting TAG

#

( อกยฐ อœส– อกยฐ)_fnc_someFunction

still forum
#

that'll be inconvenient though ๐Ÿ˜„

delicate lotus
#

It will make you special

errant jasper
#

Is there something like a killed event handler for projectiles (from a fired event handler) ?

winter rose
#

isNull , it's what is used in BIS_fnc_traceBullets

still forum
#

ACE also checks periodically via isNull.. So I'd guess the answer is no

winter rose
still forum
#

Ohhh.. That could work. That was added after the ACE thing I talked about was done

errant jasper
#

Thanks @winter rose . Saw that after I asked, but it seems not to work.

still forum
#

@winter rose don't post in wrong channels. Deleted messages confuse me

errant jasper
#

I was making a training aid script where I need to get the bullet path and look backwards to get the most correct positions. My workaround at the moment is to look into the future a bit instead - approximately one frame where the bullet is going by extrapolating that position from the bullets current velocity.

winter rose
#

@still forum nope, never did such thing ๐Ÿ‘€

#

totally innocent :D
Eh, even I can be wrong from time to time ^^

little eagle
#

I never actually tried.. Theoretically _ variables can be public
Iis no reason why globals couldn't begin with underscore, because setVariable.

#

Lou, eventhandlers don't work for CfgAmmo period, Not a single one.

polar folio
#

does anyone know how to make sure a stacked "oneachframe" EH or an "eachFrame" mission EH can be successfully added? having some issue with varying initialisation speeds on people's machines. i'm talking as early as inside the main menu of the game

still forum
#

can be successfully added?

#

addMissionEventHandler never fails afaik

polar folio
#

well apparently it does from a function defined in CfgFunctions using postinit. but only on some people's machine. very weird

still forum
#

never heard of that

#

and I logically can't see how that could happen.. knowing the backend of CfgFunctions..

polar folio
#

well. agreed...but ๐Ÿ˜„

still forum
#

addMissionEH should return the index of the added EH

#

if it returns bogus you'll know it didn't work

meager heart
#

also it will return _id when added (second ๐Ÿ˜”)

still forum
#

but I don't know of a way to check. It should always work as long as you are in a mission

polar folio
#

does main menu always qualify as a mission?

still forum
#

no

polar folio
#

only if an intro is playing in the background?

still forum
#

yeah. If not -world=empty

polar folio
#

would that have an effect on BIS_fnc_addstackedEventhandler too?

still forum
#

yeah

#

that uses addMissionEH in the backend

little eagle
#

@tough abyss I suggest you add a script helper control to RscDisplayMain that executes a function via MouseMoving / MouseHolding.

polar folio
#

@still forum oh so it does not use "oneachframe" anymore?

#

@little eagle yea thx. i will need to make a workaround like that now. most likely found the issue now. thx guys

little eagle
#

Wouldn't call it a work around. What exactly is the script supposed to do?

still forum
#

correct. Every shit life/exile crap broke onEachFrame

#

Even BI figured out that it cannot be used anymore

little eagle
#

Even BI figured out that it cannot be used anymore
Huh?

polar folio
#

@still forum i think KK might've changed it. saw him in the header of the fnc

little eagle
#

Changed what?

polar folio
#

@little eagle all it does is add a main per frame handler. it worked fine. i'm jsut moving some stuff to the main UI so i'll need to alter init slightly

still forum
#

bis addStackedEH using addMissionEH instead of onEachFrame singleton (wrong use of singleton. But you get what i mean)

little eagle
#
class Extended_DisplayLoad_EventHandlers {
    class RscDisplayMain {
        commy_mainMenuEachFrame = "\
            params ['_display'];\
            private _fnc_script = {\
                systemChat str 1;\
            };\
            _display displayAddEventHandler ['MouseMoving', _fnc_script];\
            _display displayAddEventHandler ['MouseHolding', _fnc_script];\
        ";
    };
};
still forum
#

that would stop running as soon as you get into a mission right?

#

๐Ÿค” Could probably be useful for Intercept

earnest path
#

@little eagle @still forum I have prepared the mission file for the ticker board it is a 148kb zip how can i share it with you

little eagle
#

You could've just posted the relevant script. I mean, how complicated can it be?

still forum
#

I don't even want that mission file ๐Ÿ˜„

#

Discord PM allows uploads up to 8MB I think

earnest path
#

I dont think i can upload here. How do i paste a script its 77 lines long

#

Do i just escape it with `

little eagle
#

Github gist or pastebin.

#

77 lines is probably too long for discord.

#

Well, not allowed.

earnest path
still forum
#

Uhhh. A use of try/catch :3 Nice.. Though it's completly useless as there is nothing in there that throws anything.

#

how often is that function executed?

#

And I'm assuming you are deleting the UserTextures again when updating the billboard?

earnest path
#

Its work in progress the catch will log errors

still forum
#

will it?

#

Since when does catch do that

little eagle
#

Does this really lag when used on server? How is this executed?

earnest path
#

Well it actually lags now in editor as well so it could be something in this version of the code too

still forum
#

I don't see anything inherently wrong in that code. Except if you periodically refresh for some reason. Which is why I asked how often is that function executed?

#

the useless try/catch and private ARRAY bother me.. But otherwise..

little oxide
#

A new command to see what playaction is played, this can be fucking cool

little eagle
#

Well, Dedmen, it does use two loops inside each other with a global command. Nยฒ

earnest path
still forum
#

Well we already know that spawns 400+ models and setTextureGlobals each of them

#

that will kill your fps for a second

#

but fps should come back up when it's done

little eagle
#

Does it lag once? Or is this executed every X seconds?

still forum
#

And for the third time how often is that function executed?

earnest path
#

So at the moment it lags every second with the current state of the code

still forum
#

once per second?

earnest path
#

The function will be executed every minute once

still forum
#

Are you re-freshing the screen every second?

#

So.. wait.. You execute it once per minute (which is a bad idea. It should only run when really needed) but it lags 60 times per minute?

little eagle
#

It lags with one billboard like in the code snippet? Or all 41 required?

earnest path
#

Yes

#

Like in the code snippet thats why i wanted to give you the mission file so you can check it out.

#

One billboard with all characters initialized and one row of different textures currently

still forum
#

the attachTo shouldn't be needed I think. the object doesn't have gravity it doesn't fall down. So you can just setPos it once to the right position and it should work

little eagle
#

I somehow can't believe that 42 textures would lag the game.

still forum
#

I'd say first try to get rid of the attachTo.
Just setPosWorld the characters to the right place and see what happens

earnest path
#

Its not 42 if you open the screenshot you will see the whole board is initialized so its 17x42 = 714

#

Early on i gave you wrong row count or some reason i had 11 in my head

little eagle
#

I counted Welcome to my ticker board ARMA is awesome
and it's 42.

#

Does it write the same thing 17 times?

still forum
#

17 rows commy

#

it's 42x17 XY

earnest path
#

No so you will see there is an init loop which creates the placeholders with default texture and there is a character population loop which changes the textures for each character

still forum
#

yeah just saw that. L14-L54 is only executed once

earnest path
#

The idea is that once created the placeholders stay there for the mission duration and i just update the relevant placeholders with the desired textures

little eagle
#

What's the resolution on the images?

earnest path
#

1024x1024 34kb paa file

still forum
#

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

earnest path
#

Each one of the characters

still forum
#

256 should be enough for these small things

#

maybe even 128

#

1024 is what i use for a small car, like kart size car

little eagle
#

I think you fried your graphics card with this.

earnest path
#

๐Ÿ˜ƒ

little eagle
#

And that's why it lags.

still forum
#

1024x1024 RGB that is 3MB in raw memory per texture

little eagle
#

I think a billboard like this is possible, but this is not how I would've written it. And you definitely need 128pxยฒ chars max. Better 64px.

still forum
#

but duplicate textures should only be stored once.

little eagle
#

It's not the memory I think, but the rendering in 3d. But no expert on that.

still forum
#

with 128x128 that would be 50KB per texture instead of 3MB.
and 64x64 is only 12KB

#

I think Arma's rendering engine throws each object at the GPU seperately

earnest path
#

Ok i can maybe redo the size and recalculate the offsets and so on and let you know

still forum
#

with 740 objects.. That's like.. Not even the number of houses in kavalla

#

Wait.

#

You have the big size because your image object is 1mx1m right?

little eagle
#

Dedmen, those are nothing objects though. It's all graphics. And well, half the commands in the script aren't needed either.

still forum
#

so you actually have a huge transparent texture with a little character in the middle?

earnest path
#

Yes

still forum
#

Oh man..

#

64x64 won't be enough then

little eagle
#

1x1 m, dedmen

still forum
#

the whole texture is streched over 1mยฒ. Not just the few centimeters of that character

little eagle
#

Yeah, thonking about how to solve that.

still forum
#

The engine has to render each object seperately and take into account the texture transparency and how that influences the objects behind it

#

the 700 objects behind it

meager heart
#

there is also for forspec loop

still forum
#

I really don't think that the script is the problem

austere hawk
#

do fps drop permanently? or just chugging/hitching occasionally?

little eagle
#

^

still forum
#

if it runs once per minute it should lag once. Not constantly

little eagle
#

Permantently, as in it's the graphics.

earnest path
#

So it runs quick than one second lag quick one second lag

still forum
#

But again.. We are speculating what is causing lag

austere hawk
#

arma doesnt like transparency in some cases... just permanently display the muzzleflash of the rifle you are holding and you can see your fps drop by an insane amount

still forum
#

prof build will probably show you how the render function is taking up most of frametime

little eagle
#

Dedmen, do we have another way to render a texture in 3d?

still forum
#

drawIcon

#

That sounds reasonable right? i think that should work

little eagle
#

madman

meager heart
#
for [{_pointer=0}, {_pointer<(_max_columns*_max_rows)}, {_pointer=_pointer+1}] do {}; //--- slow

for "_i" from 1 to (_max_columns * _max_rows) do {}; //--- faster

๐Ÿค”

still forum
#

Yes. Definetly. But the script is not the real problem here. Atleast not yet

#

I think kingsley did tests with DrawIcon3D thousands of items per frame

little eagle
#

sldt1ck wanted to get this out of the system.

earnest path
#

I will adjust the loop but the loop only exec once right now

little eagle
#

Rollo, delete the attachTo lines.

#

Bet that does a lot with little effort.

still forum
#

I also have a Intercept test that draws.. 100 icons per frame. 700 should be doable

meager heart
#

sldt1ck wanted to get this out of the system.
yes! ๐Ÿ˜„

little eagle
#

Does DI3D do obstruction?

still forum
#

occlusion you mean? BI recently added occluders for buildings. So that things behind them that you can't see won't render

#

Considering it's a special thing only for buildings that BI added only recently.. I'd say no

earnest path
#

If i delete the attachTo how do i place the the placeholders correctly or should i just detach once they are placed?

still forum
#

@earnest path you don't need to actually add the "empty" characters to then billboard

little eagle
#

Math, setPosASL

#

That too.

still forum
#

just make a big texture with all the empty character backgrounds. And set that texture onto the billboard.

little eagle
#

Now I want a billboard too. :/

earnest path
#

You have one but its laggy ๐Ÿ˜ƒ

still forum
#

Instead of _billboard_character attachTo [_billboard,[_pointer_x, _pointer_z, _pointer_y]];
do

_pos = _billboard modelToWorldWorld [_pointer_x, _pointer_z, _pointer_y];
_billboard_character setPosWorld _pos;
little eagle
#

WORLDWORLDWORLD

meager heart
#

passes Land_Billboard_F to commy

little eagle
#

No, one where I can set each char. Does this game have a complete set of characters all in one texture each?

still forum
#

I drank to much... I'll bed.
if setPosWorld and using the one big texture and deleting unused empty characters isn't enough.. Have fun trying to drawIcon3D

earnest path
#

Ok no lag after these two lines

still forum
#

I'm still not satisfied

little eagle
#

Get fraps and count before after FPS

still forum
#

fraps really? That's so 2009

little eagle
#

That's so 2009
So am I.

still forum
#

you can see fps in in-game video options

earnest path
#

Well there is but way better than before

meager heart
#

also steam overlay

still forum
#

I think if you use my idea of big background texture and getting rid of empty characters that'll probably good enough for your use case

earnest path
#

So looking at the board shows 50fps lokking at the sky 60 locked so i dont know what is the fps that it goes up to

still forum
#

disable VSYNC in the video options

earnest path
#

74 sky => 55 board

still forum
#

I guess I shall make a proper modded billboard with one model and a single texture with animations to change the characters

earnest path
#

I don't have the knowledge to do that unfortunately

little eagle
#

Do it, dedmen.

still forum
#

I do, or atleast I should. I still have a project to finish but I just need to import the model into arma and that'll be done. I'll add it to my todo

earnest path
#

Do you guys work for BI you have very extensive knowledge of how things tick?

still forum
#

Well...

#

maybi

little eagle
#

Do you guys work for BI
No.

you have very extensive knowledge of how things tick?
T-thanks?

earnest path
#

Either way i am very thankful for your help. I have learned a thing or two

still forum
#

We spent a lot of time with Arma. And I stuck my hands elbow deep into it.

#

commy massaged it till the bones started sticking out. And I pulled the skin off

earnest path
#

I have also spent a long time but i probably know a fraction of what you do ๐Ÿ˜ƒ

little eagle
#

@earnest path
Why not

"#(rgb,2048,1024,1)color(0,0,0,1)"

->

"#(rgb,4,4,1)color(0,0,0,1)"

?

still forum
#

TIL that, that is the resolution of the texture

little eagle
#

lol

still forum
#

last time I used that i was blindly punching in numbers without knowing what they mean. besides the RGBA at the right

little eagle
#

I think this ends up in memory too, no idea if they actually optimize the size in memory.

#

There is some cool stuff you can do with procedural textures dedmen.

#

Sadly you can't use those as noise map for random, otherwise I'd have fun with that.

still forum
#

yeah.. Had lots of fun with r2t and blinkin lights on the VR cubes

#

I still have a disco cube script somewhere

little eagle
#

See? Flummi knows what's up. He uses 8x8pxยฒ

still forum
#

Let's see.. disco particles, animation bongo, watery wetness, VRAM prefiller (that one was nice), ragdoller (ragdolls the player by throwing a mass 1e10 food can at him), explode everything at cursorTarget with 40 huge helicopter explosions... Where are my disco cubes

meager heart
#

disco cube should be disco sphere, aka disco ball... ๐Ÿ˜”

little eagle
#

fix TFAR

still forum
#

dedmenfnc_makeDiscoLight oh.. There it is. .. Nah that's only disco lightpoints..

#

Ah.. there is a dedmenfnc_discoObject. that uses #(rgb,8,8,3)color(%1,%2,%3,1) What does that 3 on the left side even mean?

little eagle
#

idk

#

lol

still forum
#

what

#

Discord you drunk

meager heart
#

rgb,8,8,3 < format

storm crow
#

rip Clyde

still forum
#
    dedmenfnc_spawnDiscoObject = {
        params ["_varname", "_pos", "_doLight"]
        _object = "Land_VR_Block_04_F" createVehicle _pos; 
        _object setObjectMaterialGlobal [0,"a3\data_f\light_flash.rvmat"];
        _light = false;
        if (_doLight) then {
            _light = "#lightpoint" createVehicle _pos;
            _light setLightBrightness 2;
            _light setLightColor  [0,0,0];
            _light setLightAmbient [0,0,0];
        }; 

        if (isNil "dedmenfnc_spawnDiscoObjects") then {dedmenfnc_spawnDiscoObjects=[];};
        dedmenfnc_spawnDiscoObjects pushBack [_object,_light];
        
        if (isNil "dedmenfnc_spawnDiscoObjects_thread") then {
            dedmenfnc_spawnDiscoObjects_thread = true;
            [_varname] spawn {
            while {missionNamespace getVariable (_this select 0)} do {
                {
                    _x params ["_object", "_light"];
                    _randomColor = [random 1,random 1,random 1];
                    _color = format["#(rgb,8,8,3)color(%1,%2,%3,1)",_randomColor select 0,_randomColor select 1,_randomColor select 2];
                    _object setObjectTextureGlobal [0, _color];
                    if !(_light isEqualTo false) then {
                        _light setLightColor  _randomColor;
                        _light setLightAmbient _randomColor;
                    };
            } forEach dedmenfnc_spawnDiscoObjects;
                    
                sleep 0.4;
            };
            
            {
                deleteVehicle (_x select 0);// 
                    if !((_x select 1) isEqualTo false) then {
                        deleteVehicle (_x select 1);
                    };
            } forEach dedmenfnc_spawnDiscoObjects;
            
            dedmenfnc_spawnDiscoObjects = [];
            dedmenfnc_spawnDiscoObjects_thread = nil;
        };            
        }; 
    };

Here. Take it.

#

It even combines blinking cube with blinking light

little eagle
#

Why do you write so fucking ugly code, Dedmen?

#

Masochist in addition to being a furry?

meager heart
#

he was in a rush for a disco party, maybe

austere hawk
#

thats just the free advice version. The Pro version of his scripts comes with extra code-junky formatting

little eagle
#
        };            
        }; 

Dedmen, what's the point of indenting if you write this at the end of the script?

still forum
#

what do I know. Ask my younger self ยฏ_(ใƒ„)_/ยฏ

winter rose
#
dedmenfnc_spawnDiscoObject = {
    params ["_varname", "_pos", "_doLight"];
    _object = "Land_VR_Block_04_F" createVehicle _pos;
    _object setObjectMaterialGlobal [0,"a3\data_f\light_flash.rvmat"];
    _light = false;
    if (_doLight) then {
        _light = "#lightpoint" createVehicle _pos;
        _light setLightBrightness 2;
        _light setLightColor  [0,0,0];
        _light setLightAmbient [0,0,0];
    };

    if (isNil "dedmenfnc_spawnDiscoObjects") then {dedmenfnc_spawnDiscoObjects=[];};
    dedmenfnc_spawnDiscoObjects pushBack [_object,_light];

    if (isNil "dedmenfnc_spawnDiscoObjects_thread") then {
        dedmenfnc_spawnDiscoObjects_thread = true;
        [_varname] spawn {
            while {missionNamespace getVariable (_this select 0)} do {
                {
                    _x params ["_object", "_light"];
                    _randomColor = [random 1,random 1,random 1];
                    _color = format["#(rgb,8,8,3)color(%1,%2,%3,1)",_randomColor select 0,_randomColor select 1,_randomColor select 2];
                    _object setObjectTextureGlobal [0, _color];
                    if !(_light isEqualTo false) then {
                        _light setLightColor  _randomColor;
                        _light setLightAmbient _randomColor;
                    };
                } forEach dedmenfnc_spawnDiscoObjects;

                sleep 0.4;
            };

            {
                deleteVehicle (_x select 0);//
                if !((_x select 1) isEqualTo false) then {
                    deleteVehicle (_x select 1);
                };
            } forEach dedmenfnc_spawnDiscoObjects;

            dedmenfnc_spawnDiscoObjects = [];
            dedmenfnc_spawnDiscoObjects_thread = nil;
        };
    };
};

properly indented, TABbed and ;'ed

still forum
#

cool. Now please fix the bullshit code and clean it up. Though.. I don't actually see thaaat much crap code in there

winter rose
#

a semicolon was missing, that's about it

fossil yew
#

Is saveProfileNamespace mandatory to save profile namespace vars?

#

It seems it sometimes works without

#

Can't tell when

still forum
#

generally not

#

But if for example the server crashes before saving the vars on it's own.. That's like the only usecase of saveProfileNamespace

fossil yew
#

If mission is changed via #missions?

little eagle
#

Properly indented he says, but it uses 6 indents for a ~40 line script, urh

fossil yew
#

Can server profile permissions cause the problem of not saving vars?

still forum
#

missionEnd should save automatically

#

if the server cannot write to the file because it doesn't have permissions to do so.. How would it save the vars then?

fossil yew
#

Trouble is I'm not an administrator on the server, can't check :(

still forum
#

We can't either ^^

fossil yew
#

I just see mission state not loaded haha, yes I know

winter rose
gleaming oyster
#

Does the same apply for servers?

little eagle
#

Some people complained about a dedicated server not storing some profile namespace variables, so we put saveProfileNamespace everywhere -.-

#

Here's a baseless, but educated guess:

winter rose
#

I can confirm, it saves on game exit

little eagle
#

Some script X (ui?) of BI uses saveProfileNamespace, so we never have to, unless on a dedicated server where that script X doesn't run.

gleaming oyster
#

So, you need this on a ded but not a client?

little eagle
#

Maybe, idk

winter rose
#

quite possible
anyway, since you want data to be saved, save it? it doesn't matter if (dedi) server or not

gleaming oyster
#

Does the return from the namespace get updated anyways though? So it wouldn't matter as long as the setter sets the proper data?

#
profileNamespace setVariable["Blah","Blah];
hintSilent format["Blah return: %1,profileNamespace getVariahle "Blah"];
//"Blah return: Blah ?
little eagle
#

Yes.

#

SPN is only for inter sessions.

gleaming oyster
#

I don't understand?

little eagle
#

Does the return from the namespace get updated anyways though?
Yes.

gleaming oyster
#

SPN is only for inter sessions.
What does this mean?

little eagle
#

So it wouldn't matter as long as the setter sets the proper data?
Yes, assuming by improper data you mean script errors.

#

saveProfileNamespace does only do things from one game session to another.

gleaming oyster
#

Right, okay.

little eagle
#

I'd say OBJECT type is improper data for profileNamespace, yet setVar and getVar in one session would work fine.

gleaming oyster
#

you'd never have the same reference to the object in two different sessions so what is the point?

little eagle
#

Exactly.

meager heart
#

afaik a lot of confusion started after people was using saveProfileNamespace on the server side to store mission progress etc... and they had troubles with saved data after server crash...

gleaming oyster
#

Oh, after server crash? Yeah no doubt. File isn't written properly after crash right?

meager heart
#

yeah...

gleaming oyster
#

Nothing you can do about that except use an external DB

gleaming oyster
#

is it possible to ever essentially "redefine" a macro defined with the pre processor?

meager heart
#

with #undef maybe

#

but why

gleaming oyster
#

Possibility sparks curiosity more than not

viral gust
#

Depending on what you were trying to do, you could probably just do new define after using for the first time as needed. Something like this:

#define IM_A_NUMBER 2
hint format["%1 bats. Ah ah ahhhh.", IM_A_NUMBER];
#define IM_A_NUMBER 5
hint format["%1 bats. Ah ah ahhhh.", IM_A_NUMBER];
//2 bats. Ah ah ahhhh.
//5 bats. Ah ah ahhhh.

I'd test it to be sure but I won't be home until way late... I don't think such a thing would cause a compile error in SQF nor other languages that can use preprocessor... ๐Ÿค”

#

I'm sure the community as a whole would beat you to death with a mechanical keyboard if you did that either way though ๐Ÿ˜›

winter rose
#

I am not sure you can override like this without #undef first (also, yes. but I like my keyboard).

viral gust
#

I think C compilers will only throw warnings but not actually error out. That way you can use several different header files that each define the same thing differently

#

Yeah, just tested with a c++14 compiler: warning: "TEST" redefined

#

http://cpp.sh/6rfds << C++ shell in a webpage for testing some basic C++ syntax and such ๐Ÿ˜„

#

Love that website

little eagle
#

redefining macros mid script ๐Ÿ‘๐Ÿผ

viral gust
#

Updated the code to put the defines inside main()

#

It didn't even complain that time

#

Oh wait, yes it did. Compiled and executed as expected though

blissful phoenix
#

A3 will make it work raw, but unless you undefine it first it will fail rapification

astral tendon
#

What the heck, the mussic still plays but this error makes no sense

unborn ether
#

It does

#

Because syntax expects 2 elements if its an array, STRING and BOOL

#

Try putting bool there after

#

ow wait, its STRING and NUMBER ๐Ÿค”

meager heart
#

check it with vanilla music... maybe

#

also you are passing string (music name) as array

#

try this maybe

"MusicRapidDeploy" remoteExec ["playMusic"];
#

@astral tendon

astral tendon
#

nop

#
waitUntil {
if (MissionGO == 1) then {
    if (MissionSelected == Airport) then {[] call MissionAirport};
    if (MissionSelected == Construction) then {[] call MissionConstruction};
    if (MissionSelected == Storage) then {[] call MissionStorage};
    MissionGO = 0;
    publicVariable "MissionGO";
    sleep 20;
    if (LevelDifficulty == 1) then {["MusicBarricatedSuspects"] remoteExec ["playmusic"]};
    if (LevelDifficulty == 2) then {["MusicHostageRescue"] remoteExec ["playmusic"]};
    if (LevelDifficulty == 3) then {"MusicRapidDeploy" remoteExec ["playmusic"]};
    };
};
#

the other musics plays with no problem, only "MusicRapidDeploy" have that

meager heart
#
0 spawn {
    waitUntil {
        sleep 0.5;
        MissionGO == 1
    };

    if (MissionSelected == Airport) then {[] call MissionAirport};
    if (MissionSelected == Construction) then {[] call MissionConstruction};
    if (MissionSelected == Storage) then {[] call MissionStorage};

    MissionGO = 0; publicVariable "MissionGO";

    sleep 20;

    if (LevelDifficulty == 1) then {"MusicBarricatedSuspects" remoteExec ["playmusic"]};
    if (LevelDifficulty == 2) then {"MusicHostageRescue" remoteExec ["playmusic"]};
    if (LevelDifficulty == 3) then {"MusicRapidDeploy" remoteExec ["playmusic"]};
};
#

@astral tendon

#

try it in the console

astral tendon
#

on the debug console works, though i need to make changes on the script file

meager heart
#

gl

astral tendon
#

That was supouse to keep looping but i dont feel like its nesessary, maybe i dont even need that waituntil

meager heart
#

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

meager heart
#

edited above ^

astral tendon
#

with the [] worked as well, strange

#

Maybe is just arma casual fart...

wintry eagle
#

Does anyone know how to script post-process effects for radiation/ nuclear wasteland?
I'm looking to create a Aurora Borealis effect I saw in a single player mission one time, along with wind/ geiger counter effects. I know its possible, and I know certain missions already have them, I just have no idea where to start. I'm building a zeus mission, for reference.

warm bronze
#

Have a look at aliascartoons on YouTube. Not sure he has released Aurora stuff yet, but he has done a lot of stuff towards what you are looking at.

#

Looks like he has published an Aurora one.

wintry eagle
#

Interesting, will do!

willow rover
#

How can you set the variable of a object, vehicle, and player that is your CursorTarget. for some reason the variable always remains the same in MP.

digital jacinth
#
myGlobalVar = cursorObject;
publicVariable "myGlobalVar";
#

not really sure what you mean it stays the same in mp tho

still forum
#

@little eagle Some script X (ui?) of BI uses saveProfileNamespace, so we never have to, unless on a dedicated server where that script X doesn't run. easy to test. Hook saveProfileNamespace with Intercept and log how often it's called.
On server the problem is that the server is not always properly shutdown. On my linux server for example I just kill it. Which doesn't give it the ability to save profileNamespace

@viral gust that cpp.sh page times out for me ๐Ÿ˜„ I prefer godbolt

#

@willow rover explain. You want a variable that does the same as cursorTarget but you don't want to use cursorTarget for some reason?

viral gust
#

I'm not familiar with godbolt, I'll have to check it out! Sucks that the other page times out for you though! It's a pretty sweet resource!

willow rover
#

If a car has a Variable of plate1, how could you get that car using cursorTarget but reference the variable of plate1.

digital jacinth
#

Okay, I am trying to interpret your question, I take it you have a variable set to a car with setVariable here or is the car placed down in the editor and you have given the variable name "plate1" to the car?

willow rover
#

I am trying to change a variable of a vehicle that is defined by a script when the vehicle is spawned.

#

Any sorry for the confusion I am up late trying to fix my cars plates.

digital jacinth
#
// assign car to new global varaible
myNewGlobalVariable = plate1;
// unassign variable
plate1 = nil;
#

This will assign the car that is set to plate1 to a new variable name and empty the variable "plate1"

#

not sure if you want this to happen tho. The car can have multiply variables assigned as well which all reference the car then.

#

and since it is for MP purposes you might want to call

publicVariable "myNewGlobalVariable ";
publicVariable "plate1";

after that, so everyone has the same value/object assigned to the variable

willow rover
#

Okay but wouldnโ€™t that reference the vehicle itself not change the value of a already defined variable of the vehicle.

digital jacinth
#

in this case the vehicle would be referenced by "myNewGlobalVariable" and the reference used with "plate1" will be set to nothing.

still forum
#

you want to change the variable that vehicle is referred to?

willow rover
#

Okay thanks both. Helps in multiple situations I am having.

grave bridge
#

is there a way to display a text for a player locally? something like hint?

digital jacinth
grave bridge
#

no, I want to display an object

#

and sadly hint works only global

#

also the ...Chat commands work only for specific groups of units

still forum
#

So what now? display a object or text?

#

also the ...Chat commands work only for specific groups of units what do you mean by that? Chat commands work on players.

grave bridge
#

I want to display a hint (or something similar) with an object for a specific player.

still forum
#

What does "with an object" mean?

#

You want to display a 3D Model in a hint?

grave bridge
#

no, I want to display a value that an object returned

still forum
#

objects don't return values

#

A car or a house are objects.

#

They don't "return" stuff

winter rose
#

if you want to hint "an object", you can still do

hint str player; // use str to "stringify"

@grave bridge

still forum
#

We are going in a circle.
"I want to display a text"
"no I want to display an object"
"I want to display a hint with an object"
"I want to display a value that an object returns"

Could you maybe just say exactly what you need instead of walking around in a circle?

#

also and sadly hint works only global no it doesn't. hint is local

grave bridge
#

strange, when I was calling it in console, it was displaying for everyone

still forum
#

well if you click "global execute" it will globally execute.

grave bridge
#

wait... global execute?

#

probably faulty translation, becouse I have 3 "execute" buttons in polish version of the game lol

#

just different colors

still forum
#

left one is local, middle one is global, right one I think is server

grave bridge
#

oh shit, that would explain a lot, thanks

warm gorge
#

Any idea why getDirVisual returns innacurate values occasionally for vehicles? Im using it for markers right now in combination with drawIcon, and not sure why its doing this.

still forum
#

what does inaccurate mean? jittering around?

warm gorge
#

By innacurate, it's direction on the marker isn't facing the same way as the actual vehicle. Such as, for example, a van earlier was the complete opposite way it was actually facing. I'm just using the vehicle's icon as the marker[getText (configFile >> "CfgVehicles" >> typeOf _x >> "icon")] call BIS_fnc_textureVehicleIcon;

#
{
    _x params ["_object", "_texture", "_color", "_size", "_text"];

    _map drawIcon [_texture, _color, getPosASLVisual _object, 24, 24, getDirVisual _object, _text, 1, 0.04, "RobotoCondensed"];
} forEach SR_mapMarkers;

This is how I'm drawing the icons.

still forum
#

how far are you away from the van that was the opposite direction?

warm gorge
#

I was inside it

still forum
#

uhhhhhh... Well.. ๐Ÿค” hmm

#

But not like.. The icon is facing the wrong way. But the actual icon is drawn with the wrong rotation? So if you'd use something like a arrow graphic it would still be wrong?

warm gorge
#

Either or I think. It's hard to tell what is going wrong with it exactly, other than just that the icon rotation isn't always correct

#

Sometimes its fine though, which is the weird part.

still forum
#

if it's sometimes fine then it's not the icon being wrong by itself.. I am confusing myself with my wording....
getDir without the visual has the same problem?

warm gorge
#

I will give getDir a try, haven't tried it yet.

steady terrace
#

BIS_fnc_TaskCreate wants a position. so I do getPos "trigger1" whiiich is wrong. what's wrong with my logic?

[zeus,["test"],["Go here!", "testmission", "final"], |#|getPos "final",1,2,true] call BIS_fnc_taskCreate;

winter rose
#

getMarkerPos ๐Ÿ‘€

#

@steady terrace

still forum
#

If "trigger1" is really a trigger then getPos trigger1

winter rose
#

dang, reading too fast and letting peripheral vision do the job :D

yes, if trigger is an object, remove the quotes
if a marker, getMarkerPos

going back to sleepโ€ฆ ๐Ÿ‘€

steady terrace
#

welp stupid me

#

thaaanks

torpid pike
#

Asked in the question channel but figured I'd be better helped directly asking here; I want to get flight gauge data out of ArmA into a table or database, which I can read in an applet on a 2nd screen for my flight sim. Any common/good methods for achieving this? So far I've built one very nifty looking heading gauge in Unity and I'm using a flight sim overlay panel here: https://www.ebay.com/itm/Flight-Simulator-Front-Panel-Mask-for-monitor-22-23-size-/263478413501 on top of my screen. Just need to get it to read some values, somehow My goal is to get the 5 or so instruments commonly used on ArmA 3's flying vehicles to send that data to gauges that update based on their in-game values for immersion. Best methods? Already done?

still forum
#

getting the data from the gauges is kinda complicated.. It's easier to just get the data directly.

#

for example the getDir command returns the heading directly. And getPosASL contains the height above sealevel

torpid pike
#

Ahh, but should that be serialized towards Unity or something secure?

#

thanks btw, does help clarify somewhat

#

Hmm, I'll jump on A3 and take a peak at the types of data my instrument gauges require. Thanks!

gleaming oyster
#

Is there any way to reference the name of the current script?
say i want to reference the name of the sqf and it's path relative to mission

#

i want to be able to move around the function and be able to execute it regardless of it'a location

winter rose
#

_thisScript I believe - look for magic variables on the biki

gleaming oyster
#

trying to exit with condition and execute it back with new params. Isn't _thisScript a spawn magic variable? Everything scheduled? >:(

winter rose
gleaming oyster
#

Hm, alright. This'll work. Thanks

#

Wait a sec the handle is only a reference though? What do you mean not in the script itself?

#
_this call
{
    _thisScript defined?
};
winter rose
gleaming oyster
#
0 spawn
{
    _thisScript defined?
};

Lol, the link you sent has no info?

winter rose
#

plenty of links in it though

gleaming oyster
#

There is currently no text in this page. You canย search for this page titleย in other pages, orย search the related logs, but you do not have permission to create this page.
My browser may be funking out. Either way.

#

Thanks for the help, i'll have to test this out later today

winter rose
#

https://community.bistudio.com/wiki/Script_(Handle)

gleaming oyster
#

Magic Wiki man returns

winter rose
#

\o/

meager heart
#

name of script... maybe scriptName "duhScript.sqf"; ๐Ÿค”

gleaming oyster
#

@meager heart

scriptName "its_v_it_s.sqf"

:)

meager heart
#

bulli

winter rose
#

๐Ÿ˜„ trololo

meager heart
#

oh also

#
_script = [] spawn {};
sleep 2;
terminate _script;
#

or from inside with _thisScript

steady terrace
#

how would I use thisTrigger in an sqf file?

gleaming oyster
#
//onActivation
[thisTrigger] call compile preProcessFile "yourScriptBleh.sqf"
//yourScriptBleh.sqf
params["_trig"];
//_trig is now your trigger reference
meager heart
#

or if you will create your trigger in script, you can use thisList,thisTrigger in setTriggerStatements which will set activation/deactivation for that trigger

gleaming oyster
#

yes, but thisTrigger is an editor reference for placed triggers right? @meager heart

still forum
#

thisTrigger is a local variable

#

so call compile preProcessFile "yourScriptBleh.sqf" should work too (and then just use thisTrigger)

meager heart
#

yes, but setTriggerStatements < that is the same as trigger init fields in the editor

gleaming oyster
#

Oh, well that works

#

I thought it was like this in init boxes

meager heart
#

condition yes ^

#
_trigger setTriggerStatements ["this", "(thisList select 0) call tag_fnc_someFuntion", "deleteVehicle thisTrigger"];
steady terrace
#

@gleaming oyster so I used execVM instead cause my brainfart cleared up.. how is that different from call compile preProcessFile?

still forum
#

execVM is equalTo spawn compile preProcessFileLineNumbers

#

spawn, spawns the script off to run later and continues your script immediately. call waits till the function you called is done before it continues your script

steady terrace
#

ahh alrighty

#

well there's nothing else in the script other than that one function so I won't have to worry about that

#

how do I create a task locally, so that other players don't see the task?

meager heart
#

@steady terrace

still forum
#

I think that is global though

#

Ah. It has a parameter for that

meager heart
#

yeah, there like every possible option for the tasks in one

astral tendon
#

How do i get a Aray of all tasks in one side with out have to put a player name in it?

unborn ether
#

Use simpleTasks forEach of the allPlayers.

meager heart
#
private _allTasksWest = (allUnits + allDeadMen) select {isPlayer _x && side group _x == west} apply {simpletasks _x};
#

maybe

astral tendon
#

returns nothing

meager heart
#

are you testing it for WEST and you have tasks ? ๐Ÿ˜€

astral tendon
#

sure

#
{_x setTaskState "Succeeded"} forEach ({simpleTasks _x} forEach allplayers)

This works but what if there is no players in the server?

meager heart
#

what are you trying to do ?

astral tendon
#

Set all tasks Succeeded

edgy dune
#

so if I use preprocessfilelinenumbers like so ```sqf
call compile preprocessfilelinenumbers "testFile.sqf";

and lets say that `testFile.sqf` has just this inside ```sqf
variable1="hello";

does that make variable1 public but also at the same time a final kind of like java ?

#

and thus not changable?

winter rose
#

nope

#

call compile etc. will just create code from your file

meager heart
#
{
    if (toLower taskstate _x in ["created","assigned"]) then {_x settaskstate "succeeded"};
} foreach simpletasks player;
#

@astral tendon

still forum
#

@edgy dune call compile preprocessfilelinenumbers "testFile.sqf"; if testFile contains variable1="hello";
is exactly the same as just executing

variable1="hello";
edgy dune
still forum
#

"advantage" ?

#

it preprocesses the file.

#

There is no "advantage". It just does what it does.

#

where does it say on that page that it has some advantage?

meager heart
#

i saw it... wait lol

edgy dune
#

it says

meager heart
edgy dune
#

The preprocessFileLineNumbers command remembers what it has done, so loading a file once will load it into memory, therefore if wanted to refrain from using global variables for example, but wanted a function precompiled, but not saved, you could simply use: and then shows an example

still forum
#

That's a lie

edgy dune
#

oh nice

still forum
#

will be removed in the rework of that page

edgy dune
#

oh theres a rework for that page? when?

#

so what does it mean to process then a file, just assume im a dum dum and if you could explain like ima a 2 year old ๐Ÿ˜›

queen cargo
#
Scripts and functions that use long variable names will run more slowly than those with short names. Using cryptically short variable names is not recommended without explanatory comments.
_pN = "John Smith"; //this line executes in half the time of the line below
_playerNameBecauseThePlayerIsImportantAndWeNeedToKnowWhoTheyAreAllTheTimeEspeciallyInsideThisImpressiveFunction = "John Smith";```
i feel more offended by this one
yes, it takes like a fraction more time to process
edgy dune
#

I liked that one XD

queen cargo
#

['true || {false} || {false}'] call BIS_fnc_codePerformance; //fastest
['true || false || false'] call BIS_fnc_codePerformance; //normal
['false || false || false'] call BIS_fnc_codePerformance; //same as above
['false || {false} || {false}'] call BIS_fnc_codePerformance; //slowest``` this also looks like it is a measurement issue and nothing else
errant jasper
#

@edgy dune Preprocessing runs the C/C++ like preprocessor on the file before compiling. Try compile loadFile the following content and you would get an error

#define MY_VAR  "Without preprocessing I will be left in the file at compilation".
// Heck I would too```
edgy dune
#

cause of the comment right?

errant jasper
#

Both.

still forum
#

@queen cargo second one is correct. First one is correct-ish but still dumb AF

errant jasper
#

Both '//' and #define are preprocessor features.

still forum
#

The preprocessor pre-processes the file. Strips comments and handles macros.

edgy dune
#

oh I never used the #define so I should prob look into that ๐Ÿ˜ญ

#

more reading yeaa

queen cargo
#

ohhh .... wait ... yes ... now i see why second one is correct ๐Ÿ™ˆ
guess bed time is soon to come

#

saving a < ms for no reason but to make code less readable

edgy dune
#

speed is everything my guy

#

its nerf or nothing, w8 wat

still forum
#

the shorter variable names info won't be as pronounced on the remake. Lou is currently working on that

errant jasper
#

It matters more when it is publicVariabled right? Doesn't Arma send the variable name when that happens?

queen cargo
#

shorter variable names can be boiled down to this: "do not use variable names that exceed 2000 characters as it starts to have actual performance impact at that point, maybe"

edgy dune
#

Dr.House is making it? k ๐Ÿ˜›

queen cargo
#

things one should not care: networking

#

saving a fraction of some ms is not worth it

#

even in networking terms, not worth it

#

especially because there you use global vars which have higher chances to collide with eg. mission variabels or other crap some scripts might add

waxen tendon
#

dumb question

#

triggerActivation trgMisionComplete;

#

complains because its a variable and not an object

#

but it is an object

queen cargo
waxen tendon
#

i have a trigger named that

queen cargo
#

your error message makes literally no sense ...

#

there is no type "variable"

#

so get the full error msg

waxen tendon
#

"Error unedfined variable in expression: trgmissioncomplete"

queen cargo
#

tells you that your variable is not defined

#

thus go and double check

#

also, is the trigger created via a script?
if yes, are you in a server-client situation?

waxen tendon
#

trigger is placed in eden

#

this is singleplayer

#

so no i guess

queen cargo
#
thus go and double check```
waxen tendon
#

๐Ÿ‘

scenic pollen
#

Code optimisation question - can anyone explain this?

Why is this:

// mrg_fnc_sum
params ["_a", "_b"];

_a + _b
// myLoop.sqf
private _x = 2;
for "_i" from 1 to 100 do {
  _x = [_x, _i] call mrg_fnc_sum;
};

3.9x slower than this:

// myLoop.sqf
private _x = 2;
for "_i" from 1 to 100 do {
  _x = _x + _i;
};

_x

Running 10,000 cycles of each, the first averages 0.2281ms whereas the second averages 0.0591 ms.

Note that in each test the myLoop.sqf file is compiled (compile preprocessFileLineNumbers) and then called from within the debug console via [] call fnc_myLoop;

austere hawk
#

dedmen just today mentioned in wiki topic that calling anything will be slower than directly coding it

scenic pollen
#

But why?

still forum
#

because calling a different function.. Is calling a different function

scenic pollen
#

Appreciate the help, just trying to understand

still forum
#

Single function is like you are walking down the road and walking into a store.
multiple functions is like entering and leaving every store along the road

#

Turning to the right, entering a building, leaving a building.
or in SQF.
executing call, entering a new scope and copying _this, leaving the new scope, copying the return value and deleting the _this again.

scenic pollen
#

Omg I just realised my test is wrong, I've been testing the wrong code ๐Ÿคฆ

austere hawk
#

gg

scenic pollen
#

The 2nd one is supposed to call _sum (not directly sum it). It's been a long day ๐Ÿ˜…

still forum
#

Oh in that case. The second one will still be faster. Because private variables are resolved faster than globals. Because the private namespace is usually smaller

scenic pollen
#

Ah that's good to know

#

Yep, both now take about the same time to run (with the private one being slightly faster, as you mentioned)

#

Still, I'm really quite surprised that calling just a single function is 3.9x slower than directly coding it. I mean, that's a pretty huge difference right (especially if we're running time critical tasks)?

still forum
#

shouldn't be 3.9x

#

and yeah. inlining code is a thing I do in my high performance scripts. Same as putting global variables that I access multiple times into a local variable so it can be accessed faster

scenic pollen
#

Result from debug console:

Result:
0.0245 ms

Cycles:
10000/10000

Code:
[] call mrg_fnc_myLoopV1;
Result:
0.0081 ms

Cycles:
10000/10000

Code:
[] call mrg_fnc_myLoopV2;
#

Btw I reduced the number of iterations (hence faster run times in this test)

still forum
#

Well.. That is alot more than I expected ๐Ÿ˜ฎ

scenic pollen
#

Ikr ๐Ÿ˜…

queen cargo
#

that looks extremly weird

#

though ... kinda expected

#

one could say

scenic pollen
#

I mean if someone else wants to try and replicate this then feel free. It's entirely possible I'm doing something wrong (which is likely, considering I'm almost asleep at my desk)

queen cargo
#

3 commands vs one, single command

#

understandible

#

thus

scenic pollen
#

Yeah

astral tendon
#

One says that select 8 is _alwaysVisible and the other says is shared what is the one correct?

still forum
#

both? I'd say

#

They could refer to the same. Even if the names are different

astral tendon
#

They actually sugest diferent things

meager heart
#

bis_fnc_taskCreate uses > bis_fnc_setTask

winter rose
#

@astral tendon you can open function viewer, check the code or the comments in it

astral tendon
#

though, the task still does not have a icon if i cant see it.

winter rose
#

if a tree falls down in a forest and no one is around, does it make sound? ๐Ÿ‘€

astral tendon
#

it think it does if there is like one wall in bethen the person and the tree.

still forum
#

Does AI see you if you hide behind a fallen tree?

winter rose
#

^ ๐Ÿ˜„

meager heart
#

will _tree setDamage [1, false] disable explosion effect for the trees ?

winter rose
#

trees explode? ๐Ÿ˜ฎ

meager heart
#

๐Ÿ˜„

unborn ether
#

wtf is going here ^?

still forum
#

what tree fiction you mean?

winter rose
#

this is the ent of it ๐Ÿ‘€

gleaming oyster
#

Trees exploding = death to mankind

meager heart
#

what was that command to close If-Then blocks in lolcode ? ๐Ÿ˜€

winter rose
#

KTHXBAI

meager heart
#
O RLY?
  YA RLY
    <code block>
  NO WAI
    <code block>
<here> ???
winter rose
#

โ€ฆmy brain

meager heart
#

ahaha

gleaming oyster
#

๐Ÿ˜ฑ

meager heart
#

OIC ! ๐Ÿ˜„

winter rose
#

KTHXBYE, my bad

#
HAI 1.0
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
   UP VAR!!1
   VISIBLE VAR
   IZ VAR BIGGER THAN 10? KTHX
IM OUTTA YR LOOP
KTHXBYE
gleaming oyster
#

KTHX omfg lol

unborn ether
#
HAI 1.0
CAN HAS ARMA?
CAN HAS STATICTYPES
KTHXBYE
minor lance
#

hello!

winter rose
#

you may be taking from the ground at that time?
maybe (unsure) the invisible container is destroyed as soon as you take the last item

fringe yoke
#

Is there a way to check if an extension is present?

ivory nova
#

Sorry, newbie question, but is it possible to call a function from a define? Something like, #define DEFINITION(A, B, C, Aa, Bb, Cc) [A, B, C, Aa, Bb, Cc] call ARMA_fnc_function;?

#

Or is that bad form/retarded?

fringe yoke
#

That's fine iirc

ivory nova
#

Thank you (: Had some trouble getting that to work but will try again

#

Sorry I was born in Australia these easy things are hard for me

wary vine
gleaming oyster
#

@wary vine This is pretty nice and very neat in a sea of copycats. The transitions and style is very smooth. Oh, and nice branding :p

#

The tooltip doesn't really make much sense though when entering your name

#

There wouldn't be any point in remembering the last input?

#

And choosing your number is kind of neat. How does your communication work? What would be cool if you combined KK's server transfer stuff and you could dial someone from a different server

#

only to return back after the call was made

#

isolate the player's new position to a telephone booth or a bus stop

#

The wallpaper feature I think is pretty cool though, have you gotten apps to install now?

#

And say, you needed a better subscription service to access or install the apps

#

so the phone bill to pay esssentially

#

especially since most life gamemodes give you like 150 bucks every 5 minutes like wtf?

#

Money management in those gamemodes I feel is never of any importance, risk and it's potential reward is never established

wintry eagle
#

@warm bronze I used some of Alias's scripts for my fallout effects; they work okay but not perfectly. I had to use his dust storm + Geiger-counter effects separately, seems like he pulled his wasteland effects script in v1.6 ๐Ÿ˜ฆ

wary vine
#

@gleaming oyster thats a lot of messages xD

#

the tooltip isnt a tooltip

#

its a malfunctioning disabled autocomplete xD

#

and calling isnt going to be in at the start

#

im going to work on it over time

warm bronze
#

I was going to use them this weekend as well @wintry eagle an in house modder made some of his own stuff for it though. Used almost all of his stuff thus far and love it. Especially the snow storm and lightening.

wintry eagle
#

It is definitely good! One of my scripters helped me set it up, I've never touched scripting before, and unfortunately Alias videos were more aimed at people who know what they're doing ๐Ÿ˜‚

#

But once I realized the only real work I had to do was on the init.sqf file, its now quite approachable at a low level.

verbal otter
#

breaking point mod //Hope this fucking works cutRsc ["RscDisplayInfoScreen","PLAIN"]; ๐Ÿ˜‚

unborn ether
#

@still forum Interesting, if there is any chance to have a command named lbSetRowHeight that changes rowHeight of RscListBox?

still forum
#

@fringe yoke Is there a way to check if an extension is present? Yeah. callExtension it and see if it returns anything.

#

@unborn ether not easily I'd say. Unless something like that already exists somewhere

fringe yoke
#

yeah, I was just hoping for a more elegant solution

unborn ether
#

nah, not existant, but just got a multiple reasons to have one.

velvet merlin
#

is it expected behavior that acos below -1 and above 1 returns "-1.#IND" (undefined)?

#

like shouldnt the engine normalize/clamp? the input automatically to sensible values

still forum
#

should get a note on wiki ๐Ÿ˜‰

velvet merlin
#

tx

lavish ocean
velvet merlin
#

also the first has function to set time for a specific sunAngle. on angles close to 90 it seems to fit, yet closer to 0, there is some difference to the angle shown by the functions

#

for the second issue the normalization to do the acos should be (part of?) the problem

    private _temp = ((_desiredSunAngle + (24 * (sin _latitude) * (cos _day)))/((12 * (cos _day) - 78) * (cos _latitude)));
    _temp = ((1 min _temp) max -1);
    _temp = acos _temp;```
molten folio
#

apparently in this script its missing a ) but cant seem to see where its missing sqf { if (ITEM_VALUE ( configName _x) > 0) then { _inv lbAdd format ["%2 [x%1]",ITEM_VALUE(configName _x),localize (getText(_x >> "displayName"))]; _inv lbSetData [(lbSize _inv)-1,configName _x]; _icon = M_CONFIG(getText,"VirtualItems",configName _x,"icon"); if (!(_icon isEqualTo "")) then { _inv lbSetPicture [(lbSize _inv)-1,_icon]; }; }; } forEach ("true" configClasses (missionConfigFile >> "VirtualItems"));

unborn ether
#

ITEM_VALUE and M_CONFIG are macroses you might be missing

still forum
#

the error message should tell you where

molten folio
#
{
if (ITEM_VALUE(configName _x) > 0) then {
_inv lbAdd f>
  Error position: <(configName _x) > 0) then {
_inv lbAdd f>
  Error Missing )```
#

dont see where to add everything is there

thorn saffron
#

Say I want to have an array to I want to edit in multiple functions without the need to pass that array into them as a param. In other worlds I want a public array that functions can read and edit. How do I do that? Define the array in init?

still forum
#

@molten folio ITEM_VALUE macro

#

@thorn saffron Put the array into a global variable and use that

thorn saffron
#

ah so its something , without the leading underscore to create global, like this?

taroSuperDuperGlobalArray = [[[],[]],[[],[]],[[],[]]];```
still forum
#

yes

thorn saffron
#

i define that in init or just in script?

delicate lotus
#

How can I create those highlighted areas on a map where everything else gets like a grey shade above it?

thorn saffron
#

Limit area module or something like that IIRC

still forum
#

init would probably easiest

thorn saffron
#

@delicate lotus not sure if it doesn't kill the player

still forum
#

highlightes areas? Just a big marker?

thorn saffron
#

Either that module, or just placing markers

delicate lotus
#

let me get a screenshot of what I mean (Hoping that what im talking about actually exists...)

gleaming oyster
#

Oh god, please don't talk about the modules

delicate lotus
#

YEP

#

that

thorn saffron
#

its a module

delicate lotus
#

ew

#

Im actually trying to make this mission completly without any modules...

#

is there no way to do it without? XD

thorn saffron
#

area markers

gleaming oyster
#

Taro, each module works with functions that already exist. the modules are just there to streamline input to give the fnc

thorn saffron
#

yeah, I guess you can call the area limit via script

gleaming oyster
#

I am sure you can replicate it in script.

thorn saffron
#

or you know, just call the zone limit function the module uses, just without actually placing the module (Should be possible)

gleaming oyster
#

eeeeehhh. I wouldn't. They're not always the best.

delicate lotus
#

ill just use the module

#

lets hope the game does not explode...

gleaming oyster
#

gives headache

thorn saffron
#

why would it? its already used in official bis missions

delicate lotus
#

Oh you mean like the combined arms showcase mission where the helo tends to lift up before dropping everyone off?

still forum
#

You need to place more IED's. Then the game will for sure explode

gleaming oyster
#

Just because it's used in official bis missions doesn't mean it works well

delicate lotus
#

true XD

thorn saffron
#

If you want to reinvent the wheel, no one is stopping you ๐Ÿ˜„

gleaming oyster
#

The wheel isn't round. It's a block

#

creepy. One minute here, gone the next

thorn saffron
#

@delicate lotus Just in case, its called "Cover Map" module

gleaming oyster
#

Commy has talked about the insane design of the vehicle respawn module already in here