#arma3_scripting
1 messages ยท Page 455 of 1
Why do people never use tag entry in CfgFunctions, like every paste i've seen is missing that one.
It serves no purpose.
Tag already is the classname of the superclass. So why overdefine your stuff?
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
then it's more than a tag!
Bad idea, The classname has no tag.
Backend could conflict with other mods.
Or mission.
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);```
Isn't (_taroShopInventoryWeapons select 0) select _forEachIndex just _x?
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
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.
Is there a way to change or remove smoke granades effect?
@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
Yeah, but still. Why not write:
_weaponClass = _x;
No way to change by script?
nope
Rip
@little eagle cause I dumb at scripting. Still it works, I just want to run my prices function and pass the parameter to that.
Can you copy paste the error message from RPT?
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```
your function probably returns an assignment
can you show the taro_fnc_weaponPrices function?
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);
};```
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
Just like that?
_price;```
ye
I always thought you could always do:
_coolNumber = 10 + 2;
//returm should be 12 without _coolNumber at end of file?
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
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
๐ค
@meager heart Thanks, that did the tick
nice
@plucky willow I know it has been a week, but here is the perfected willCollide function. It's way easier than I first thought. It just needed a good thonking.
https://gist.github.com/commy2/5a6276c1ab1502af113500aa31c22829
@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"?
no
you can add a "true" at the end to do that
which would be same as using publicVariable
oh so if I do this, missionNamespace setVariable ["someVariable","some String",true]; client side,then it updates for everyone on the serve?
Yes, it's called "setVariable public".
The true/third argument is the public flag and by default set to false = local only.
cool thx bby
Do you like randomness? Here! Read this beautiful (content wise.. Yeah the design is crap. People are working on that) blog post by commy about fun with randomness
http://sqf.ovh/sqf math/2018/05/05/generate-a-random-position.html
Examples of getPos and random usage.
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
Yes, it is.
but do i put the script in the button function or the one at the top
nice examples with randomness ๐ keep that blog going guys
How would i start with the script?
profilenamespace in dedicated server returns the server profile?
it needs filepatching?
Yes. No.
@little eagle could u help?
Sure.
i got told that its impossible to do it on the player it has to be on the flooor
By whom?
ud9d
What a noob.
lol
haha
so how is this made
("true" configClasses (configFile >> "CfgMagazines"));
will that be used?
That reports all magazine classes, including stuff like mines and handgrenades.
Rogue space. That won't work.
ty for helping
I am getting negative values with smoke grandes speed, wth
That seems impossible. How to repro?
let time run backwards
But even negative numbers are positive when squared.
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;
};
};
}];
where is the "speed" in there?
my goal before was to debug the smoke granda speed
systemChat str (speed _GasShell);
i want the script to start when the smoke shell have stoped or it would fire in mid air
Does that report a negative number? That's hilarious.
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"
So what did it report? The systemChat I mean.
-49
Well, you could try the alternative:
vectorMagnitude velocity _GasShell / 3.6
That should never be negative.
yup, that is a positive value
I guess Dedmen is right, and the grenade is flying backwards.
lel
abs speed _GasShell < 1
That'd work too.
that code you sended before is in metres per second
No, I divided by 3.6 to convert to km/h
My country did not put a flag in the moon soo, yeah...
Mine neither, although it built the first space rockets I guess.
Germany?
Yea
also you can check when smoke shell is "landed" with velocity _shell select 2
if that is the task...
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
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.
maybe with vectorModelToWorld ๐ค
That's maybe rotation, but not rotating speed.
if the shell is rolling, it also has velocity... or not?
It could roll in place, maybe...
probably not Z
but thats silly...
I'd just put the grenade on a timer and don't care about it moving or not.
exactly, the fuse doesnt care if its rolling or not...
eh, but my script delets the smoke once it stops and make it own smoke and starts a tear gas effect
and what does rolling have to do with this?
Scripted grenades are fun. ACE has flashbangs, incendiaries, flares...
or put more exact - rotational velocity
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
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)
that has nothing to do with fuse
what grenade that rolls slowly are you talking about then?
starting a <effect> -> thats what a realworld fuse does. And realworld fuses either work on a timer, or on impact (the simple ones)
i find that GL loaded smoke especially has a tendancy to bounce and roll off of objects real easy
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)
Yeah, gl grenades are pretty much bugged.
Some error about bouncing in their simulation.
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
my problem was that the tear gas effect would start in mid air if the player trows too far
And?
if the grenade rolls, it is not midair ?
so if speed < 2m/s you are definitely not midair anymore
and no one is hit by the gas effect and is dull
Well, if you throw it straight up, the grenade will have v=0m/s at the highest point.
waitUntil {
sleep 3;
(velocity _shell select 2) == 0
};
```3 seconds after its landed ^
midair fix*
๐ค
<= 1 for rolling fix... propably?
also, it does not fire in mid air on its highest point. because of the 3 second dellay (that is also the fuse delay)
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?
Gas shell is a projectile, but still a vehicle, so if it hits 90 degree wall and fall back it might have negative speed.
http://killzonekid.com/arma-scripting-tutorials-uav-r2t-and-pip/
probably because it's 4 years old, but I can't seem to get this script working? the UAV camera locks on target perfectly, but the billboard only shows a very wide-FOV stabilized forward view. Anyone here able to locate / fix the issue? ๐
It inherits the parameters of camera created with camCreate, not the one you might be looking when you operate it.
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";
Yes.
wonderful
weekly uav camera questions lol
They should rephrase it to some math problem to get me motivated to look into it.
2 + 2 is 4
minus 1 dats free
quick mafs
name your RTT differently maybe, SuicideKing ๐
(if that was real question)
raw sause
RTT?
yes
er..
success
texture! <
rapelling towards transport
๐
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.
Just use the BIS function for this.
BIS_fnc_secondsToString ๐ค
That works! thanks
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?
yeah to start you can just check it with
hint str getCursorObjectParams;
@winter rose
oooooouh yeah, thanks a lot!
np
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
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
yup, i had syntax error in that my bad.
@meager heart i know xD but for some reason every ctrl in my group needs + 0.066 so its quicker like this xD
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?
Figured it out, wasnt the groundweaponholder but the syntax of createvehicle i was using that was incorrect.
@meager heart getCursorObjectParams did the trick, thanks ๐
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
perfect thanks you
@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
๐
๐
I do that for like everything but main display group, which is still positioned by safezone absolutes
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.
So basically you can simply just change numbers to re-scale all the GUI
I am glad you noticed that as no one else did in the other channel
Maybe the others that read your message didn't know the answer. Just like me.
@earnest path So to my view, you attach 41 helper objects to a billboard and update their textures by something like setObjectTextureGlobal?
This is correct however my test is static so no updates. Just one load and i get constant lag .
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.
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.
No, selections are created in a model, config just defines their appearance.
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.
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 ?
https://forums.bohemia.net/forums/topic/212199-implementing-setplatenumber-in-addon/?tab=comments#comment-3254023
Apparently only 15 characters per plate. And I think you can only have one plate per model
https://community.bistudio.com/wiki/Arma_3_Cars_Config_Guidelines#Plate_Numbers
I just read that yes so this will only work for small signs ๐ฆ
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
I will both approaches. I was hoping i can achieve that without modding
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.
I am at work at the moment but i will definitely upload it once at home.
@little eagle Well it doesn't seem he wanted that to be local
Why?
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
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.
Every machine (with interface)
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.
Well, kinda a way to do, but I would rather still create one billboard model with all selections, even if local.
Rollo probably doesn't have the option to make a mod. Otherwise he wouldn't fuck around with 1x1 textures.
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
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.
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
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.
well 400 objects..
Yeah, flat ones with no simulation.
But generally with performance problems. Stop speculating and guessing. Measure and check. #perf_prof_branch
I say it's the script. Probably doing 11x41 times setObjectTextureGlobal or something.
in a PFH ๐
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
yeah that's true
That's true, but if you use it 451 times at once, that's a lot of text.
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.
Does #monitor admin command correspond to a BIS function returning the server FPS?
No, but you can get the server fps a different way.
rhetorical question? If not then, yes.
Like this I guess:
{
floor diag_fps remoteExec ["systemChat", remoteExecutedOwner];
} remoteExec ["call", 2];
yea thanks. I was asking if BIS have one to avoid write my own function ^^
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"};
CBA events
send a event away. The receiver processes it. And sends another event with the result back
I see, I noted for futur work may be ๐
Does params ["_a"] create a copy of _this select 0 ? Or is it a pointer ?
Neither.
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
No.
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.
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
private _a = [];
[_a] call {
params ["_a"];
_a pushBack 1;
};
systemChat str _a; // [1]
arg...
Does this answer it?
Yep!
That what I expected but I wrote a more complex function and it didn't work. I will investigate more then ...
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
Why would it?
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
Yeah, why did that confuse you?
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 ?
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?
@spark sun as long as you modify a array by reference, yes.
Sound cool then, thanks!
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];
nope.
do the following:
MyPublicVar = _myVar;
publicVariable "MyPublicVar";
oh so the _ prevents it from becoming public then?
I think so, and even if it does it's bad practice and leads to confusion
i see
๐
thx
I never actually tried.. Theoretically _ variables can be public
but you cannot access them by just writing _myVar because that's a local variable
Yea it didnt work for me, so maybe thats why, is there a list of all reserved words in arma 3?
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
text faces like ( อกยฐ อส อกยฐ) too?
yes
and about publicVariable as I said I didn't test what it can do. Theoretically it can do everything too.
alright lets make a emoji variable now
that'll be inconvenient though ๐
It will make you special
Is there something like a killed event handler for projectiles (from a fired event handler) ?
isNull , it's what is used in BIS_fnc_traceBullets
ACE also checks periodically via isNull.. So I'd guess the answer is no
@errant jasper maybe, just maaaaaaybe https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Deleted
Ohhh.. That could work. That was added after the ACE thing I talked about was done
Thanks @winter rose . Saw that after I asked, but it seems not to work.
@winter rose don't post in wrong channels. Deleted messages confuse me
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.
@still forum nope, never did such thing ๐
totally innocent :D
Eh, even I can be wrong from time to time ^^
I never actually tried.. Theoretically _ variables can be public
Iis no reason why globals couldn't begin with underscore, becausesetVariable.
Lou, eventhandlers don't work for CfgAmmo period, Not a single one.
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
well apparently it does from a function defined in CfgFunctions using postinit. but only on some people's machine. very weird
never heard of that
and I logically can't see how that could happen.. knowing the backend of CfgFunctions..
well. agreed...but ๐
addMissionEH should return the index of the added EH
if it returns bogus you'll know it didn't work
also it will return _id when added (second ๐)
but I don't know of a way to check. It should always work as long as you are in a mission
does main menu always qualify as a mission?
no
only if an intro is playing in the background?
yeah. If not -world=empty
would that have an effect on BIS_fnc_addstackedEventhandler too?
@tough abyss I suggest you add a script helper control to RscDisplayMain that executes a function via MouseMoving / MouseHolding.
@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
Wouldn't call it a work around. What exactly is the script supposed to do?
correct. Every shit life/exile crap broke onEachFrame
Even BI figured out that it cannot be used anymore
Even BI figured out that it cannot be used anymore
Huh?
@still forum i think KK might've changed it. saw him in the header of the fnc
Changed what?
@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
bis addStackedEH using addMissionEH instead of onEachFrame singleton (wrong use of singleton. But you get what i mean)
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];\
";
};
};
that would stop running as soon as you get into a mission right?
๐ค Could probably be useful for Intercept
@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
You could've just posted the relevant script. I mean, how complicated can it be?
I don't even want that mission file ๐
Discord PM allows uploads up to 8MB I think
I dont think i can upload here. How do i paste a script its 77 lines long
Do i just escape it with `
Github gist or pastebin.
77 lines is probably too long for discord.
Well, not allowed.
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?
Its work in progress the catch will log errors
Does this really lag when used on server? How is this executed?
Well it actually lags now in editor as well so it could be something in this version of the code too
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..
A new command to see what playaction is played, this can be fucking cool
Well, Dedmen, it does use two loops inside each other with a global command. Nยฒ
You can see the result here : https://steamcommunity.com/sharedfiles/filedetails/?id=1381267672
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
Does it lag once? Or is this executed every X seconds?
And for the third time how often is that function executed?
So at the moment it lags every second with the current state of the code
once per second?
The function will be executed every minute once
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?
It lags with one billboard like in the code snippet? Or all 41 required?
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
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
I somehow can't believe that 42 textures would lag the game.
I'd say first try to get rid of the attachTo.
Just setPosWorld the characters to the right place and see what happens
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
I counted Welcome to my ticker board ARMA is awesome
and it's 42.
Does it write the same thing 17 times?
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
yeah just saw that. L14-L54 is only executed once
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
What's the resolution on the images?
1024x1024 34kb paa file
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
Each one of the characters
256 should be enough for these small things
maybe even 128
1024 is what i use for a small car, like kart size car
I think you fried your graphics card with this.
๐
And that's why it lags.
1024x1024 RGB that is 3MB in raw memory per texture
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.
but duplicate textures should only be stored once.
It's not the memory I think, but the rendering in 3d. But no expert on that.
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
Ok i can maybe redo the size and recalculate the offsets and so on and let you know
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?
Dedmen, those are nothing objects though. It's all graphics. And well, half the commands in the script aren't needed either.
so you actually have a huge transparent texture with a little character in the middle?
Yes
1x1 m, dedmen
the whole texture is streched over 1mยฒ. Not just the few centimeters of that character
Yeah, thonking about how to solve that.
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
there is also for forspec loop
I really don't think that the script is the problem
do fps drop permanently? or just chugging/hitching occasionally?
^
if it runs once per minute it should lag once. Not constantly
Permantently, as in it's the graphics.
So it runs quick than one second lag quick one second lag
But again.. We are speculating what is causing lag
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
#perf_prof_branch is there just for that
prof build will probably show you how the render function is taking up most of frametime
Dedmen, do we have another way to render a texture in 3d?
madman
for [{_pointer=0}, {_pointer<(_max_columns*_max_rows)}, {_pointer=_pointer+1}] do {}; //--- slow
for "_i" from 1 to (_max_columns * _max_rows) do {}; //--- faster
๐ค
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
sldt1ck wanted to get this out of the system.
I will adjust the loop but the loop only exec once right now
I also have a Intercept test that draws.. 100 icons per frame. 700 should be doable
sldt1ck wanted to get this out of the system.
yes! ๐
Does DI3D do obstruction?
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
If i delete the attachTo how do i place the the placeholders correctly or should i just detach once they are placed?
@earnest path you don't need to actually add the "empty" characters to then billboard
just make a big texture with all the empty character backgrounds. And set that texture onto the billboard.
Now I want a billboard too. :/
You have one but its laggy ๐
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;
WORLDWORLDWORLD
passes Land_Billboard_F to commy
No, one where I can set each char. Does this game have a complete set of characters all in one texture each?
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
Ok no lag after these two lines
I'm still not satisfied
Get fraps and count before after FPS
fraps really? That's so 2009
That's so 2009
So am I.
you can see fps in in-game video options
Well there is but way better than before
also steam overlay
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
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
disable VSYNC in the video options
74 sky => 55 board
I guess I shall make a proper modded billboard with one model and a single texture with animations to change the characters
I don't have the knowledge to do that unfortunately
Do it, dedmen.
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
Do you guys work for BI you have very extensive knowledge of how things tick?
Do you guys work for BI
No.
you have very extensive knowledge of how things tick?
T-thanks?
Either way i am very thankful for your help. I have learned a thing or two
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
I have also spent a long time but i probably know a fraction of what you do ๐
@earnest path
Why not
"#(rgb,2048,1024,1)color(0,0,0,1)"
->
"#(rgb,4,4,1)color(0,0,0,1)"
?
TIL that, that is the resolution of the texture
lol
last time I used that i was blindly punching in numbers without knowing what they mean. besides the RGBA at the right
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.
yeah.. Had lots of fun with r2t and blinkin lights on the VR cubes
I still have a disco cube script somewhere
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
disco cube should be disco sphere, aka disco ball... ๐
fix TFAR
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?
rgb,8,8,3 < format
Clyde
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
Why do you write so fucking ugly code, Dedmen?
Masochist in addition to being a furry?
he was in a rush for a disco party, maybe
thats just the free advice version. The Pro version of his scripts comes with extra code-junky formatting
};
};
Dedmen, what's the point of indenting if you write this at the end of the script?
what do I know. Ask my younger self ยฏ_(ใ)_/ยฏ
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
cool. Now please fix the bullshit code and clean it up. Though.. I don't actually see thaaat much crap code in there
a semicolon was missing, that's about it
Is saveProfileNamespace mandatory to save profile namespace vars?
It seems it sometimes works without
Can't tell when
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
If mission is changed via #missions?
Properly indented he says, but it uses 6 indents for a ~40 line script, urh
Can server profile permissions cause the problem of not saving vars?
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?
Trouble is I'm not an administrator on the server, can't check :(
We can't either ^^
I just see mission state not loaded haha, yes I know
about profileNamespace I would say that not saving will clear the info on game closing ๐
UPDATE: note on https://community.bistudio.com/wiki/saveProfileNamespace says otherwise. oh.
Variables are also saved when the game is quit.
Does the same apply for servers?
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:
I can confirm, it saves on game exit
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.
So, you need this on a ded but not a client?
Maybe, idk
quite possible
anyway, since you want data to be saved, save it? it doesn't matter if (dedi) server or not
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 ?
I don't understand?
Does the return from the namespace get updated anyways though?
Yes.
SPN is only for inter sessions.
What does this mean?
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.
Right, okay.
I'd say OBJECT type is improper data for profileNamespace, yet setVar and getVar in one session would work fine.
you'd never have the same reference to the object in two different sessions so what is the point?
Exactly.
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...
Oh, after server crash? Yeah no doubt. File isn't written properly after crash right?
yeah...
Nothing you can do about that except use an external DB
is it possible to ever essentially "redefine" a macro defined with the pre processor?
Possibility sparks curiosity more than not
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 ๐
I am not sure you can override like this without #undef first (also, yes. but I like my keyboard).
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
redefining macros mid script ๐๐ผ
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
A3 will make it work raw, but unless you undefine it first it will fail rapification
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 ๐ค
check it with vanilla music... maybe
also you are passing string (music name) as array
try this maybe
"MusicRapidDeploy" remoteExec ["playMusic"];
@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
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
on the debug console works, though i need to make changes on the script file
gl
That was supouse to keep looping but i dont feel like its nesessary, maybe i dont even need that waituntil
ยฏ_(ใ)_/ยฏ
edited above ^
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.
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.
Interesting, will do!
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.
myGlobalVar = cursorObject;
publicVariable "myGlobalVar";
not really sure what you mean it stays the same in mp tho
@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?
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!
If a car has a Variable of plate1, how could you get that car using cursorTarget but reference the variable of plate1.
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?
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.
// 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
Okay but wouldnโt that reference the vehicle itself not change the value of a already defined variable of the vehicle.
in this case the vehicle would be referenced by "myNewGlobalVariable" and the reference used with "plate1" will be set to nothing.
Okay thanks both. Helps in multiple situations I am having.
is there a way to display a text for a player locally? something like hint?
Just a text? Would this be enough?
https://community.bistudio.com/wiki/titleText
no, I want to display an object
and sadly hint works only global
also the ...Chat commands work only for specific groups of units
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.
I want to display a hint (or something similar) with an object for a specific player.
no, I want to display a value that an object returned
objects don't return values
A car or a house are objects.
They don't "return" stuff
if you want to hint "an object", you can still do
hint str player; // use str to "stringify"
@grave bridge
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
strange, when I was calling it in console, it was displaying for everyone
well if you click "global execute" it will globally execute.
wait... global execute?
probably faulty translation, becouse I have 3 "execute" buttons in polish version of the game lol
just different colors
oh shit, that would explain a lot, thanks
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.
what does inaccurate mean? jittering around?
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.
how far are you away from the van that was the opposite direction?
I was inside it
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?
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.
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?
I will give getDir a try, haven't tried it yet.
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;
If "trigger1" is really a trigger then getPos trigger1
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โฆ ๐
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?
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
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!
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
trying to exit with condition and execute it back with new params. Isn't _thisScript a spawn magic variable? Everything scheduled? >:(
https://community.bistudio.com/wiki/Magic_Variables
it's the handle, not the script itself
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?
};
0 spawn
{
_thisScript defined?
};
Lol, the link you sent has no info?
plenty of links in it though
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
https://community.bistudio.com/wiki/Script_(Handle)
Magic Wiki man returns
\o/
name of script... maybe scriptName "duhScript.sqf"; ๐ค
@meager heart
scriptName "its_v_it_s.sqf"
:)
bulli
๐ trololo
oh also
_script = [] spawn {};
sleep 2;
terminate _script;
or from inside with _thisScript
how would I use thisTrigger in an sqf file?
//onActivation
[thisTrigger] call compile preProcessFile "yourScriptBleh.sqf"
//yourScriptBleh.sqf
params["_trig"];
//_trig is now your trigger reference
or if you will create your trigger in script, you can use thisList,thisTrigger in setTriggerStatements which will set activation/deactivation for that trigger
yes, but thisTrigger is an editor reference for placed triggers right? @meager heart
thisTrigger is a local variable
so call compile preProcessFile "yourScriptBleh.sqf" should work too (and then just use thisTrigger)
yes, but setTriggerStatements < that is the same as trigger init fields in the editor
condition yes ^
_trigger setTriggerStatements ["this", "(thisList select 0) call tag_fnc_someFuntion", "deleteVehicle thisTrigger"];
@gleaming oyster so I used execVM instead cause my brainfart cleared up.. how is that different from call compile preProcessFile?
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
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?
the most reliable and all in one function for that > https://community.bistudio.com/wiki/BIS_fnc_setTask
@steady terrace
yeah, there like every possible option for the tasks in one
How do i get a Aray of all tasks in one side with out have to put a player name in it?
Use simpleTasks forEach of the allPlayers.
private _allTasksWest = (allUnits + allDeadMen) select {isPlayer _x && side group _x == west} apply {simpletasks _x};
maybe
returns nothing
are you testing it for WEST and you have tasks ? ๐
sure
{_x setTaskState "Succeeded"} forEach ({simpleTasks _x} forEach allplayers)
This works but what if there is no players in the server?
what are you trying to do ?
Set all tasks Succeeded
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?
{
if (toLower taskstate _x in ["created","assigned"]) then {_x settaskstate "succeeded"};
} foreach simpletasks player;
@astral tendon
@edgy dune call compile preprocessfilelinenumbers "testFile.sqf"; if testFile contains variable1="hello";
is exactly the same as just executing
variable1="hello";
so wats the advantage of preprocessfilelinenumbers then? like im just reading the code optimizaiton page from
https://community.bistudio.com/wiki/Code_Optimisation
and so I really dont get whats good about it
"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?
i saw it... wait lol
it says
https://community.bistudio.com/wiki/preprocessFile < KK comment
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
That's a lie
oh nice
will be removed in the rework of that page
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 ๐
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
I liked that one XD
['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
@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```
cause of the comment right?
Both.
@queen cargo second one is correct. First one is correct-ish but still dumb AF
Both '//' and #define are preprocessor features.
The preprocessor pre-processes the file. Strips comments and handles macros.
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
the shorter variable names info won't be as pronounced on the remake. Lou is currently working on that
It matters more when it is publicVariabled right? Doesn't Arma send the variable name when that happens?
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"
Dr.House is making it? k ๐
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
dumb question
triggerActivation trgMisionComplete;
complains because its a variable and not an object
but it is an object
i have a trigger named that
your error message makes literally no sense ...
there is no type "variable"
so get the full error msg
"Error unedfined variable in expression: trgmissioncomplete"
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?
thus go and double check```
๐
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;
dedmen just today mentioned in wiki topic that calling anything will be slower than directly coding it
But why?
because calling a different function.. Is calling a different function
Appreciate the help, just trying to understand
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.
Omg I just realised my test is wrong, I've been testing the wrong code ๐คฆ
gg
The 2nd one is supposed to call _sum (not directly sum it). It's been a long day ๐
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
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)?
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
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)
Well.. That is alot more than I expected ๐ฎ
Ikr ๐
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)
Yeah
One says that select 8 is _alwaysVisible and the other says is shared what is the one correct?
They actually sugest diferent things
bis_fnc_taskCreate uses > bis_fnc_setTask
@astral tendon you can open function viewer, check the code or the comments in it
though, the task still does not have a icon if i cant see it.
if a tree falls down in a forest and no one is around, does it make sound? ๐
it think it does if there is like one wall in bethen the person and the tree.
Does AI see you if you hide behind a fallen tree?
^ ๐
will _tree setDamage [1, false] disable explosion effect for the trees ?
trees explode? ๐ฎ
๐
wtf is going here ^?
what tree fiction you mean?
this is the ent of it ๐
Trees exploding = death to mankind
what was that command to close If-Then blocks in lolcode ? ๐
KTHXBAI
O RLY?
YA RLY
<code block>
NO WAI
<code block>
<here> ???
โฆmy brain
ahaha
๐ฑ
OIC ! ๐
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
KTHX omfg lol
HAI 1.0
CAN HAS ARMA?
CAN HAS STATICTYPES
KTHXBYE
hello!
Anyone knows why the https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take Eventhandler does fire sometimes with _containes = objnull?
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
Is there a way to check if an extension is present?
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?
That's fine iirc
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
https://www.youtube.com/watch?v=dVkGzmm1iWM&feature=youtu.be whats the thoughts ?
@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
@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 ๐ฆ
@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
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.
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.
breaking point mod //Hope this fucking works cutRsc ["RscDisplayInfoScreen","PLAIN"]; ๐
@still forum Interesting, if there is any chance to have a command named lbSetRowHeight that changes rowHeight of RscListBox?
@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
yeah, I was just hoping for a more elegant solution
nah, not existant, but just got a multiple reasons to have one.
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
http://en.cppreference.com/w/cpp/numeric/math/acos
If a domain error occurs, an implementation-defined value is returned (NaN where supported)
Domain error occurs if arg is outside the range [-1.0, 1.0]
nope. It's standard to return NaN
should get a note on wiki ๐
tx
noticed KK posted this http://killzonekid.com/arma-3-extension-tester-callextension-exe-callextension_x64-exe/
trying to get the sunAngle - these two functions return somewhat different results
https://forums.bohemia.net/forums/topic/174982-brighter-nights-via-scripting/
https://forums.bohemia.net/forums/topic/188051-solar-and-climatological-functions/
anyone into this to give a judgement?
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
overview of the results: https://pastebin.ubuntu.com/p/6JVGYP4r8M/
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;```
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"));
ITEM_VALUE and M_CONFIG are macroses you might be missing
the error message should tell you where
{
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
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?
@molten folio ITEM_VALUE macro
@thorn saffron Put the array into a global variable and use that
ah so its something , without the leading underscore to create global, like this?
taroSuperDuperGlobalArray = [[[],[]],[[],[]],[[],[]]];```
yes
i define that in init or just in script?
How can I create those highlighted areas on a map where everything else gets like a grey shade above it?
Limit area module or something like that IIRC
init would probably easiest
@delicate lotus not sure if it doesn't kill the player
highlightes areas? Just a big marker?
Either that module, or just placing markers
let me get a screenshot of what I mean (Hoping that what im talking about actually exists...)
Oh god, please don't talk about the modules
its a module
ew
Im actually trying to make this mission completly without any modules...
is there no way to do it without? XD
area markers
Taro, each module works with functions that already exist. the modules are just there to streamline input to give the fnc
yeah, I guess you can call the area limit via script
I am sure you can replicate it in script.
or you know, just call the zone limit function the module uses, just without actually placing the module (Should be possible)
eeeeehhh. I wouldn't. They're not always the best.
gives headache
why would it? its already used in official bis missions
Oh you mean like the combined arms showcase mission where the helo tends to lift up before dropping everyone off?
You need to place more IED's. Then the game will for sure explode
Just because it's used in official bis missions doesn't mean it works well
true XD
If you want to reinvent the wheel, no one is stopping you ๐
@delicate lotus Just in case, its called "Cover Map" module
Commy has talked about the insane design of the vehicle respawn module already in here