#arma3_scripting
1 messages · Page 278 of 1
thanks tho
Well @earnest coral I can provide help
But I don't formally mod arma 3.
To seperate the server-side comment you normally user a server side init.sqf
inside a custom pbo
that PBO is added the mod loading
Then what happens is the server-dispatches remoteExec code to clients
The clients then process that data, then send it back to the server-side component.
It generates a lot of traffic overhead as arma 3 is not really designed to be a server-side -> client-side
message passing
it costs a lot.
Ye. Less powerful machines feel it a lot more though.
Well that's what one would think. .. but I find server to client traffic has far less effect to most people than it does to me, someone with a horrible pc
@tough abyss The less scripting commands you have, the better
Any way to test things without the need to restart the whole game again and again... and again?
Was about to write that. Set up the dev environment and you just have to restart the mission. Some setups and you can even recompile functions during a mission.
i can change the files when using file patching and the server/client is running?
thanks!
two locations, that shouldn't need anything special
_myLocations = [loc1, loc2];
_locDistances = _myLocations apply {player distance (getPos _x)};
_nearestLocation = _myLocations select (_locDistances find (selectMin _locDistances));
If you want to use selectMin
_myLocations = [loc1, loc2];
_locDistances = _myLocations apply {player distance (getPos _x)};
_nearestLocation = _myLocations select (_locDistances select 0 > _locDistances select 1);
Is neater though
my_fnc_nearerLocation = {
params ["_origin", "_location"];
private _distances = _location apply {_origin distanceSqr position _location};
_location selectMin _distances;
};
Perfect case for distanceSqr for maximum speed
_origin is AGL
I don't think you can use selectMin like this, no?
Why not?
Yeh you need to find it in the distance array then select that element in the location array
But if there is only two elements, seems like a lot of overhead a simple > than could achieve
Not so sure about that. Must test.
There is a massive overhead in SQF for every command used
my_fnc_nearerLocation = {
params ["_origin", "_locations"];
private _distances = _locations apply {_origin distanceSqr position _x};
_locations select (_distances find selectMin _distances);
};
Yeh, the second example I posted should be quicker
Using find with 2 elements seems silly
Sure, but SQF. It's not silly if it's faster
Gimme the results when you have them
If find is quicker I will eat my shorts in horror
And find in two element array isn't actually that slow anyway
It's not slow, but you'd expect a quick* comparison to be quicker
In normal programming world, at least
Need to change what SQF stands for
This is normal programming too. It's just that every command is a function with type checks instead of a low level "greater than"
We need a findMin and findMax
_arr = [127, 255];
_arr select (_arr select 0 > _arr select 1)
vs
_arr = [127, 255];
_arr select (_arr find selectMin _arr)
Is this right?
That's the discrepancy indeed. normal programming & low level
Selecting a minimum from an array, then finding that index in the array will be majorly slower than just a >
yeh that's right*
jesus oh god
I've been up far to long to make that typo
My words are just gone
You don't do just a >
🙃 🔫
you also do two select
you are just comparing
_arr select 0 > _arr select 1 vs _arr find selectMin _arr
As the rest is just duplicate
select is a command too
yeh, but the result of either of those will be the same
So the result of selecting from the original array will be the same
if select has a big overhead, gonna be upset
select has massive overhead, hence why params is so big
0.005 ms
0.0038 ms
yup, mine is faster
Every command has big overhead. select is a particularly shitty one.
_arr = [127, 255];
_arr select (_arr param [0] > _arr param [1])
It's slightly slower
The difference is smaller than between selectMin find and select though
This all just saddens me
The fact they managed to create such a large overhead on one of the fastest operations is just
Check the C++
two thirds are type checks
And select has many alternative syntaxes now
They all have to be checked. Many if's you're doing every time
The vanilla select requires nothing, so it's somewhat sad they couldn't avoid ruining it
"vanilla select" ?
Yes, it does check LHS and RHS types
selectMin for example only checks RHS type
That is 50% of 80% of the processing time gone
*estimate
A type check wouldn't slow it down that much C++ side
If it was left to purely arr select index, you're checking that index is an int
That's it
Which is negligible
Maybe. I'm just trying to explain the observed behaviour. If you have better explanations that match reality, go ahead.
I'll do a select vs find in C#, hold on
Ignoring any type checks
Okay so, an int array of 1, 2 -> arr[0] > arr[1], then converting to int (like select bool would do in ARMA)
Is
80ms over 10m iterations
Same arr, finding the minimum, then finding the index of that element, over 10m iterations
is
403ms
The vanilla select requires nothing, so it's somewhat sad they couldn't avoid ruining it
select wasn't ruined. It was always slow as dirt
binary commands tend to be like that.
Was the plan to use a language for enfusion, or w/e it's called?
Idk, should ask the devs
Even if that engine is the plan
Okay so, an int array of 1, 2 -> arr[0] > arr[1], then converting to int (like select bool would do in ARMA)
Can you even test like this in C#?
Doesn't the compiler optimize everything away?
Sure, it does optimisation at runtime, but there isn't much you could abstract from it
Idk how deep that rabbit hole goes. No programmer
Not a fan of machines thinking for you. But I guess that's better than getting more shitty programs from shitty programmers
Even with any optimisation, it still has to select the array twice, compare, then convert the bool to int
😄 yeh
Oh, yeah. Now I remember why I tried param
_this select 0
is slower than
param [0]
Only works for _this of course
Is there anyway to add all items to Arsenal EXCEPT default Arma 3 weapons? Updating a mission to incorporate VAS, but of course don't want a WW2 Map with the default Arma 3 weapons. Or do I have to do a whitelist :S?
You have to fix the configs of the addon with the item.
oh, you want to remove the vanilla weapons
wait
yes
I only want the WW2 weapons included with the mod, none of the default arma 3 weapons
You cannot remove them, but you can add an Arsenal with only the WW2 weapons.
you have to go through all classes though
yeah thats what I figured
But wanted to see if there was an easy way instead of whitelistinng
No
I mean
You could write a script that reads the configs with and without the mod
and parses a list for you
But if you're not into scripting it's faster to do by hand
I think
ok commy thanks!
Is there a way to hide script errors? I don't want to fix the error as it isn't causing a problem for the scene and I just want to film a quick cinematic shot and its in the way. I already have show script errors dissabled in the launcher and it is still there
are you previewing in 3den? 3den always shows errors.
disable @sthud then
dont launch with the mod, yes
Never mind just realised what you were saying ;D
Fix the error ¯_(ツ)_/¯
Nah, you can just remove -showScriptErrors
They aren't shown by default, you enabled them with this startup parameter
The ones in 3DEN previews are independent from the parameter, they always show (in my experience)
Yea i'm talking about those too. They show when you're previewing a mission in 3DEN even if you dont have the startup parameter enabled
That's silly
commy2 - Today at 4:08 PM
Fix the error ¯_(ツ)_/¯
check #general_chat_arma @little eagle 😄
@indigo snow Since when? Do you know that? iirc i haven't noticed a msg in there oO
since it first came out man
If there is an error, fix it. Everything else is retarded. Sorry.
was a bit suprised too
Errors should always been shown. Imo
but think about the life-Server!
It forces people to fix their shit or drop bugged addons
see msg above.
Sometimes you might open a mission which its functions are serverside (like mine) and theb you cannot avoid errrors
you can run it as hosted mp in eden
is there any Rsc or control that we cna create for a color picker or any thing arma related
if not would it be possible to make one?
also can it return "#(rgb,8,8,3)color(0,0,1,1)"
you'll have to script it yourself, there is no ready color picker control
check how color pickers are implemented (tons of examples online), insert image with range of colors, add click event hander and translate mouse position into position on color picker image
thanks
is there any way to accept any value for the second position in an array? ex: [0,*]
array select 2?
I have a switch condition check. [x,y] ... hoping to have first value dependent and second not.
some need the second value specific. just curious
😮 thanks
Can I simulate a multiplayer game somehow? I want to test my code using isMultiplayer, isServer
run it on a server? 😃
join a server with enabledebug 1 test it with server side exec
ok thanks Ill check it out
@willow pike I cant just join any server cause it doesnt have my mod
Make a local Server
@Foley#1330 When I try the map in MP its the same as hosting a server. therefore I cannot test isServer, as it will always be true
@jade abyss Can I make a local server and join that from the same pc?
What event handler, if any, can I add to an object like a box that is triggered when the box is destroyed?
Would it be the same as for soldiers?
killed
thanks, Dscha.
yepyep
Anyone knows anything about a Anti Nss Script, there will block peoples nss, cours signing files issent working for me
Is there a way to capture an object's vehicelvarname in the Killed event hander? Upon adding the eventhandler, it returns the correct name but when the killed handler is triggered it flips to "any".
basically trying to get the vehiclevarname of a killed unit or object, but it appears its dumped when the vehicle is destroyed?
nevermind I figured it out. Instead of trying to pass a variable set to the object's name on killed, I have to do vehiclevarname (_this select 0) inside the handler.
am I right in reading that there's no server-side event handling for a player death/respawn?
all I can find is a bug report for the mpeventhandler "mprespawn" being client-side only
@ionic orchid idk bout that bug report but if whats on the wiki is valid, MPRespawn is indeed an option you could use: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#addMPEventHandler
you add the eventhandler on the players - on the server - and everytime a player will respawn, it will trigger
bummer :/ I gave that a shot but nothing happens server-side ( https://feedback.bistudio.com/T72876 )
it does read like it should work, but in practice not so much, sadly
Aye. I was also looking at onPlayerRespawn.sqf for you but it seems that is also only locally executed
I think I'll try hooking the client-side call...and passing something back to the server with publicVariableServer
messy, but I'll take it if it works
On a side note while searching I found out https://community.bistudio.com/wiki/Multiplayer_scripting is quite outdated, still using SQS 😮
veh2 = nearestObject [player, "All"]; doesnt seem to work
veh2 returns null i believe
coolio, that worked... used the mission onPlayerRespawn.sqf script to do it
playerHasRespawned = player;
publicVariableServer "playerHasRespawned";
then I catch that on the server and use that to re-init the player addActions that lost when they died
that=they
could anyone help me to test Auto Defense Turrets on my server? https://forums.bistudio.com/topic/193884-brpvp-english-server-and-client-files/?do=findComment&comment=3140614
To see it it catch the correct target when multiple targets.
Hi everyone, I'm new to scripting but want to create a script bound which will report the current in-game time to a hint. Every post I've read either has to do with syncing real-world time or something else unrelated to my needs. Is there a way to retrieve the current in-game time and display it in a hint? Any help would be greatly appreciated!
Thank you for the prompt response Quiksilver and for my purposes I'd rather have the time displayed as a hint than having to check the watch. I haven't seen any command to pull the in-game time (same as what's on the watch) so I can use it as a hint but I probably missed it in all my searching
Thank you!!
Sorry for my impatience but i wanted to ask how i would accomplish
veh2 = nearestObject [player, "All"]; doesnt seem to work
veh2 returns null i believe
Or just capture every vehicle that is Air tank LandVehicle and Ship
accomplish what?
Well to find the nearest object that is type of all
Well, 'ALL' would only work if you have an object which its ID is 'ALL'...
So unless you modded in a thing called "ALL"...
if you are referring to ALL as ALL objects then just do nearestObject player;
Oh, I read the bottom part
put Air, tank, LandVehicle and Ship into an Array and then do someting like nearestObject [player, _array]. You could have to put some operator in (I haven't done anything for a week because I was on vacation and can't remember crap). Otherwise just do a foreach statement with each part of the array.... e.g.
{
_veh = pushBack (nearestObject [player, _x]);
} foreach _array;
that's for finding the closest of all 4 types
then you could do a foreach sttatement for each _veh
and then see which ones distance is the least
@tough abyss
@cerulean whale thanks
Im having a problem getting a blacklist to work via script for the bohemia arsenal, I have figured out how to whitelist, but when i change " BIS_fnc_addVirtualItemCargo; " to " BIS_fnc_removeVirtualItemCargo;" I get no joy
@tough abyss CfgWorlds something-something
@half monolith remove probably removes item that you already added
I think the issue is that nothing is getting added so when i try to remove say a nightstalker in my test script, all i really have is an empty box
[] spawn BIS_fnc_arsenal;
[_this,[
"stuff",
"moreStuff"
],true] call BIS_fnc_removeVirtualBackpackCargo;
[_this,[
"stuff",
"moreStuff"
],true] call BIS_fnc_removeVirtualMagazineCargo;
[_this,[
"stuff",
"moreStuff"
],true] call BIS_fnc_removeVirtualWeaponCargo;
[_this,[
"optic_nightstalker",
"optic_tws"
],true] call BIS_fnc_removeVirtualItemCargo;
this works to whitelist things,
if (count _classes == 0 && _add < 0) then {
_cargoArray = [];
_save = true;
} else {
but i changed the add to remove
looks like removing anything just clears the list
probably not fully implemented
oh wait, classes == 0
no it supposed to remove properly looking at code @half monolith
@tough abyss First airport is defined right in CfgWorlds, others are in secondaryAirports
so how would i initialize it full, so there are items to remove?
I'd write my own script to add only what you need
well i have no issue with a whitelist, as i can make it work. we have a rather large collection of maps id like to implement this on, and the task i was given was blacklist, and not to touch missionfile. it comes from above lol.. the other thing is we dont want to remove much more than thermals and some other stuff.
I don't use Arsenal myself to tell for sure, just looking at scripts and guessing that you can't have "Everything but", only "Everything" or list defined by yourself
Yeah looks like add* and remove* functions only operate whitelist
basically to remove something you have to add it first
thats what i thought i read somewhere
if (_add > 0) then {
if (!(_class in _cargoArray) && (_class != "" || _class == "%ALL")) then {_cargoArray set [count _cargoArray,_class];};
} else {
_cargoArray = _cargoArray - [_class];
};
yeah it operates whitelist only
so to make blacklist, need to white list everything first, is there a way to do this without actually making the list?
Yeah just look how its done in arsenal itself and replicate in your script
ok ill look at that , thanks for the help
Or modify arsenal to make this blacklist instead of whitelist
Depending on your scripting ability
#define CONDITION(LIST) (_fullVersion || {"%ALL" in LIST} || {{_item == _x} count LIST > 0})
this is condition that checks if item should be included in the list
Make a copy of arsenal script, name it something else and have this define changed to exclude items that are in the list
I guess it should work
not that great, learning as i go ported a couple missions so far. is one thing to get help, but to understand it at the same time is another sometimes. im trying to learn more than have handed to me, I wasnt able to get that to work, preprocessor failed missing filename. at least i get to see a diff error
unpack functions_f_bootcamp, copy arsenal script from there to your mission, modify it, compile the script into your own arsenal variable, call it instead of BIS_fnc_arsenal where needed
gotcha
So when i start my server i get this error "no entry 'bin\config.bin/CfgMarkers.ALR_Shop" anyone know how to fix it
You're trying to create a marker that's not present in the game.
Did you edit that missions mission.sqm with 3den or have any mods enabled when editing, potentially unnoticed?
in 3den and i have my modpack active
Put 3den on your server as a test if it starts with no error there is something calling one of its entities, or so it would seem. You need to find the "include addons", I want to say thats in the mission.sqm and find the dependency.
Or merge your edits with an older file
If anyone else can provide a better solution please do, I personally have never encountered this problem.
3den issent that just the normal edditor in arma 3
I'm sorry that is a bit confusing there is an extension for it and I read your error wrong lol, I am totally wrong
What was the last thing editied before you started seeing this error?
i deleted a shop
Is this mission.pbo derived from a mod? If so which one?
i dont know what you mean
You have VOIP:
no
Whats the mission like my dude?
Is it alits life, exile, domination, annex?
And can you paste your servers rpt log
It is Kelleyisland
Nice
Hey guys, what command can I use to set a lb item greyed out?
Its works when i lunch with TDAST but when i lunch with my start.bat it come with the error
Guys, I am looking for a way to set OPFOR units in an outpost to captive until a condition is met
What's the best way for doing this?
Can I somehow get a list of all units (or vehicles in general) inside a trigger area?
do I need to iterate over all OPFOR and check if they are inside the area?
?
I don't get what you mean =/
if ( _inArea ) then { do whatever you want with _x }
{if _x <inside area> then <do stuff with _x>} forEach <opfor units>
something like that?
dammit
I was hoping for something like
{<stuff>} forEach <units inside area>
{
if ( player distance ( getMarkerPos _x ) < 100 ) exitWith { _inArea = true; };
} forEach [ "areas", "areas" ];
{
if ( _inArea ) then { do something with _X };
} forEach _opforUnits;```
That's not at all what I want to do
{<stuff>} forEach <units inside area>
Your code seems to check if the player is inside an area
yes and then do stuff with the people inside that area
and if yes, do something with all OPFOR units
then remoteexec on east when the trigger is made on map
I don't get it; you set _inArea once
and then you check it in each iteration of the loop
why though? It doesn't change
If they're not in the area, then _inArea will be false.
Hahah, yes it will
_inArea is either true or false
Yes
if ( _inArea ) {}
If they're in the area, then the variable will be true
Otherwise it wont
It will check when that script is run
{
if ( _inArea ) then { do something with _X };
} forEach _opforUnits;
is semantically identical to
if (_inArea) then {do something with _x} foreach _opforUnits;
It's just how I write my code
Look mate, it works, I have tried it just right now
the logic of that script is If the player is in one of the following areas, then do something with ALL opfor units
What are you saying is wrong with it?
I want do something with those opfor units that are in the area of trigger X
Ok look, then that script may not be for you, but it works. You asked for a script to execute something on opfor units in an area. You may just go with a trigger and when a opfor unit enters, RE on all opfor units.
look, I was not saying that your script would cause arma to explode
I was saying that it doesn't do what I want (not even close)
and it doesn't
I could post some code to respawn a vehicle right now
and it wouldn't be wrong code
but it would still have nothing to do with what I was saying
and either way, what you said is wrong
Then I understood wrong what you needed
that code does NOT operate on opfor units in a certain area
it operates on ALL opfor units if the PLAYER is in a certain area
Yes, but You may just go with a trigger and when a opfor unit enters, RE on all opfor units.
Ah ok
only those that are in the area
Jeez
What Opfor units do you need?
FFS what a misunderstanding xD
look, I don't care to get them filtered by faction, what I care about is getting a list of units that are inside the trigger area
calm down boys lol
Why not use a trigger
@thin pine I AM USING A TRIGGER
Calm those titties
Use thisList
It's an array containing all units that match trigger condition
ok im going to write you something reall quick
{_x setCaptive true;} forEach thisList; should this work?
(condition set to simply true)
then I am screwed
it doesn't work
in this case I can set the condition to this
but then I need another trigger to activate when a flag is set
never mind, in that case I can just use this and <flag>
Or use the inArea code if you want total control and oversight
then I need to iterate over all opfor units though
private _areas = [ "area1marker", "area2marker" ];
private "_inArea";
_inArea = false;
{
if ( player distance ( getMarkerPos _x ) < 100 ) exitWith { _inArea = true; };
} forEach _areas;
_conditionsMet = false;
if ( _inArea && { side _x isEqualTo east } ) then {
_conditionsMet = true;
};
} forEach playableUnits;```
I would like to avoid that
Could use nearEntities to only get the close ones hehe
@rotund cypress player? shouldn't that be a _x?
yeah sorry
Tbh tho what kind of environment is this in? Big MP gamemode?
@thin pine nearEntities THANKS! That's exactly what I wanted 😃
Or coop mission?
It's a coop mission
I want players to drive by an OPFOR checkpoint and not be shot
after a while I want OPFOR to turn hostile though
Ah
all other OPFOR units are hidden far away from the AO
so unless players go exploring and find out that santaclaus is actually their parents, I don't need to set all OPFOR units to captive, only that one outpost
the worst case alternative would be that: setting ALL opfor to captive until they are supposed to attack
Btw you could have a trigger set to this, activation opfor, set trigger variable name and then retrieve a list of all opfor units in that area using the list command
List trigger1 for example
Idk if it has to be set to repeatable. Maybe.
But jusr useful hint
{_x setCaptive true;} forEach thisList; doesn't seem to work =/
neither does {_x setCaptive true;} forEach (list thisTrigger);
{_x setCaptive true;} forEach (thisTrigger nearEntities 50); DOES work, but it doesn't work with the triggers actual area
too bad we're not supposed to use setFriend after the mission has started
that would really help with this kind of mission
if list thisTrigger doesn't have needed units then you misconfigured trigger
Anyone knows how to fix this http://imgur.com/a/Ryz2Y
Use the correct password.
Fixet it
Anyone know how to fix where the database wont write or read to the database
commy2 - Today at 8:39 PM
I'm laughing, Dscha. Just so you know.
What would they all do without you?```
Good question.
I'm trying to dump a connecting player straight into the running mission, but can't seem to stop the map screen from showing?
I've tried:
skipLobby = 1;
showMap = 0;
skipLobby works fine, showMap not so much :\
ah, nevermind - in-editor tooltip says it only hides the map and that screen isn't skipped
@ionic orchid Do you want to skip the briefing phase (map screen)? There is a launch parameter you can do when you launch your server to bypass it
I'll see if I can find it
that would be awesome if you could
I used it on my server before I went away on vacation. Let me just msg one of the guys to see if they remember it
I see there's one for SP missions, but that's probably not the one you mean
Try that. I've found the one for skipLobby and autoAssign but can't find the briefing one
Maybe I did it somehow different. 😛 I'll keep looking for you though
looks like it might be just the thing
a filthy hack but I'm starting to find that filthy hacks are kinda common :/
Doesn't look so bad, except that KK apparently doesn't understand how escaping the waitUntil code block works.
@little eagle it's late....and i know I shouldn't..but ima do it anyway. Please elaborate.
my 2am brain dun see nuffin wron with dat code
Yeah, nvm.
0 spawn {
waitUntil {
if (true) exitWith {false};
false
};
systemChat "exited scope despite using false";
};
Thought you can exit the scope anyway, but apparently you have to exit with true.
It's different from the while block apparently
0 spawn {
while {
if (true) exitWith {true};
true
} do {};
systemChat "exited scope despite using true";
};
The waitUntil version does not exit, but the while version does.
Seems like they go out of their way to call the waitUntil code block inside a second scope.
Which they never do anywhere else.
So KK's code is still right, but since it works with no other command, I'd still avoid it.
I'll ask dedmen, the C++ guy with the source tomorrow if he can figure out why waitUntil is special
I'd imagine you can't exit it due to the way it executes engine side
With the rate at which it executes, etc
How is arma's code actually parsed @dusk sage ?
is it just strings with regEx?
that are performining instructions internal to C++ ?
Why doesn't BI make this native to arma 3?
And make a C++ system thats sandboxed to the game?
Also Dscha gets asked too many dumb questions.
q: The side specific zeus missions has the other sides removed from the zeus interface so they can't be spawned. How do I replicate that effect in other missions?
well @tough abyss as you can see the intercept sort of got went into stall (no progress(not enough contributors))
Next q: Going from a class string to that class's faction, what is the easiest way to do this?
{ if ( faction _x == "BLUE_F" ) then [[true]] else [[false]; } forEach _classes; // does NOT work, _x is a string, not object.
help?
Commy always askin me stuff.. ugh...
Intercept is not Dead. It's stalled because Nou now has a new Job.. I am currently the only Dev semi-working on it that is really able to do Engine level stuff. But i got over a dozen other Projects that are higher on my Todo list.
@still forum ye i know he is busy ... but what i mean is that it's surprising not more people joined it
I don't know enough sufficient to code in C++ to even consider contributing
Well the Range of people being able to do such level of stuff is kinda not big
@woeful void
{ if ( (getText (configFile >> "cfgVehicles" >> _x >> "faction")) == "BLU_F" ) then [[true]] else [[false]; } forEach _classes;
Not only that people who know how to do C++ are actually in jobs doing it.
@still forum
@still forum Looks hacky as heck but.. if it works, I'm not going to argue. I'll try it now.
Theoretically.. There are a ton of Arma hackers.. All of the real hackers could actually do it.. Ask them why they don't. Even I learned all that stuff I am using on Intercept through Hacking
I also need this to apply to Men and wepaons too. Will that cfgVehicles be a problem?
Do you know any details on how the ArmA 3's engines commands are actually parsed @still forum
weappons, no.. but I got men, drones, choppers, hemmtt's... it looks like it works for all the faction specific stuff. Thanks.
For the sake of intellectual curiosity ?
@woeful void should work for everything inside CfgVehicles.. "should"
Yeah i do why?
Are the scripting commands interpreted internally as function calls?
@little eagle exitWith is causing a "break" in script. The while loop has a special handler for break events which cause the while loop to go into the Done state -> Stops looping
Uhm.. yeah.. you could say that
Don't know what else they would be ^^
So what controls the pausing in the scheduler?
then [[true]] else [[false]; D:
How is arma's code actually parsed @BoGuu ?
Idk, try asking Dedmen while he is here 😉
I only did that because the bits inside the [[]]'s wern't relevant to the question.
those are actually a bit longer then a simple bool each. 😃
Why doesn't BI make this native to arma 3?
That's like saying why don't they make their own game, native to their game, no 😉 ?
After every few instructions the game checks how long it has been executing scripts.. and if it's too long then it pauses execution till next frame... (from memory.. not quite right but close enough)
Because offering full C++ coding ability would open the door for a ton of possibly malicious mods.
With the extensions It's still kinda controlled... People can decide themselves if they wanna take the risk. If all scripts were fully capable C++ everyone would be forced to take the risk.. and BI can't do that.. Thats was also the argument with the Java thingy
It's singlethreaded
Thats what they did in C# with SE it doesn't allow access to certain aspects of the entire .dll library
purely because of that reason, they did however have to introduce an instruction counter
Arma is an old Engine.. It's not always easy to just "do stuff"
To prevent scripts locking up
You're talking about what I would imagine to be, total rewrite
Hmm, yeah not time feasible etc. I wonder if this increase in ram usage
will cause more performance issues?
Purely because of being 64bit ?
What? No.
Wouldn't make the singlethreaded aspect more pronounced?
o.O
Read something a while back about how RAM is allocated per core. And each core manages that RAM, in conjunction with the OS. Don't remember where it was.
Having more Ram the Engine can store more stuff in memory.. so instead of calculating stuff everytime do it once and store it.. For example Arma's String class doesn't have the length stored... They iterate the string to see where it ends. This was probably to save memory back then.. With 64Bit having more available could change that...
Ah so, the memory improvements will probably pave the way to more optimisation?
Ram is not allocated per core.... You're probably talking about cache... In short.. No 64Bit will not cause performance degredation
exactly
There might be minimalist uh.. "worsenings" (my english gud!) to performance... But only at a nanosecond scale... Nothing to care about
Interesting, on the note of dwarden pointing out that memory leak in badly written scripts. How does a person write "good scripts"?
If you don't mind me asking?
How would you know they don't leak ?
It'll be quite obvious when you're causing a memory leak, unless it is a problem BI side of things
In most cases you'd have to be quite explicit on writing bad code
Memory shouldn't be able to leak through scripts... Thats the a reason of implementing a engine controlled scripting system instead of allowing for example external c++ like we talked earlier. Everything is controlled Engine side.. They user shouldn't be able to do anything bad.. like leak memory or crash the game or anything
Well.
I did discover a bug.
Where I invoked one of the UI elements in game.
And actually crashed the game.
Which probably? Shouldn't have happened?
The term 'memory leak' in SQF is quite ambiguous
People often associate running out of memory -> leak
The scripting system is very nice.. (except performance wise) It doesn't let the user do reaaaal bad stuff.
Yeah.. I also have a report on the Feedback tracker about a sqf bug that can reproducibly crash the game. Bugs happen
@dusk sage It complained about the array being too big and exceeded the limit and kept spamming virtual memory page errors
Well.. It's your fault if you make an array so big that you run out of memory....
It was my fault I understood that.
But it was so easy to do thats the problem
Putting append in place of pushBack.
Like I said a perfect scripting engine shouldn't allow users scripts to influence the engine so far that it would crash... But nothing is perfect. SQF is close... But still far off (yes! that makes sense!)
Should this bug I discovered be reported?
Well... Filling an array till you run out of memory... Uhm... no.. not really... Report to yourself for not having enough memory
Not that one
This one.
/*
Author: Karel Moricky
Description:
Shut downs the game.
Parameter(s):
NOTHING
Returns:
NOTHING
*/
//--- Open options menu (forces to return to main menu)
ctrlactivate ((finddisplay 0) displayctrl 102);
//--- Close options menu
(finddisplay 3) closedisplay 2;
//--- Activate exit button
ctrlactivate ((finddisplay 0) displayctrl 106);
My crashing script report got ignored so far... And i understand it not being high priority... Your code crashes the game.. so what? Either don't use it.. Or you want to crash on purpose. But BIS should have it on their Feedback Tracker for the day they decide to fix all that stuff
But this is a Bi internal thing
Related to directly invoking the UI elements
something the engine does on it's own
If I can crash it?
Can the engine not do the same?
The amount of ways you can crash a server with SQF is amazing
Does the engine crash itself? No it doesn't. That issue only happens if you semi-consiously cause it so... Not important
@woeful void btw please don't ask the same questions in multiple rooms if you don't get an answer after a few minutes... Some people only check discord every half hour or so
That's a bit general, it would depend what I'm doing
I use diag_log a lot though, yes
😛
I saw one the other day, openDLCPage on the server
🤦
yeh
Easiest way to crash a server
is to flood the scheduler
With non-sense threads that do nothing.
WOOT, got exatly what I wanted, where a faction (not sided) zeus only has access to his own faction stuff (and no story or VR units): ```
z_west_nato addEventHandler [
"CuratorObjectRegistered",
{
_classes = _this select 1;
_costs = [];
{
_cost = if (
((getText (configFile >> "cfgVehicles" >> _x >> "faction")) == "BLU_F")
and ((getText (configFile >> "cfgVehicles" >> _x >> "vehicleClass")) != "MenVR")
and ((getText (configFile >> "cfgVehicles" >> _x >> "editorSubCategory")) != "EdSubcat_Personnel_Story")
) then {[true,0.1]} else {[false,0]};
_costs = _costs + [_cost];
} forEach _classes; // Go through all classes and assign cost for each of them
_costs
}
];
Thank you for the help
Now all I need to do is preserve the original costs now....
Still quite annoying all we have for debugging is diag_log
Easiest way to crash a server is to flood the scheduler
Or just use one command 😛
'intercept'?
To debugging... diag_log, systemChat, diag_captureFrame Is all I need.
Hey @dusk sage Do you use this ever?
?
Wait.
I wonder if thats better than exitWith O_o
Ohhh it got a syntax update a while ago.
So it's not obsolete.
You could use a try catch throw in place of an exitWith?
yes?
Instead of exiting with simple try { condition then put the catch at the bottom bypassing all the returns etc } ?
Yep.
It appears to work.
@dusk sage Have you ever used try catch and throw?
It seems like you can bypass completely evaluating an entire block of code using it.
I have a couple of times
It's just syntax sugar though
And does not represent a 'normal' try catch
Well, sort of, but won't help with anything internally
Would it work in place of exitWith ?
"BIS_fnc_exportCuratorCostTable" is supposed to paste the text into the clipboard, but I am not seeing it when I ctrl-v into excel. Is there a step I am missing here? [_classes, "xls"] spawn bis_fnc_exportCuratorCostTable; Re: https://community.bistudio.com/wiki/BIS_fnc_exportCuratorCostTable
Are you in MP while executing that?
SIngle player, but I'll try it in MP now.
no.. copyToClipboard doesn't work in MP
ok, so I was in the right mode then.
Just to make sure I understand the event model correctly... when someone does a radio message that a trigger is wired to (Radio Alpha), every client connected to the game is notified of that radio event so they'll run the trigger's On Activation event locally? or is it only executed on the server?
Triggers are evaluated globally by default
so all clients and server as well then?
Only if you "tick the Server" box will it be evaluated server-side only
ok. That makes sense, thank you.
If you are dynamically creating them
you just set the global false in the createTrigger
ok, so createTrigger handles it's own client notification then... alright.
Far nicer than other languages I've had to work with.
Depends
What commands are you using?
Each command often has it's own locality restrictions.,
Just for testing: {(leader _x) sideChat "GO!"} forEach allGroups;
something stupid simple just to get a message as feedback.
and a little earthquake rumbling.
Slowly progressing on my little script to get other AIs assist with a AI if he's engaged. Like Upsmon basically.. But more tailored for what I really need.
http://pastebin.com/zxzLLRLB
http://i.imgur.com/L0IrIN9.png
findNearby isn't done, as I am aware if group nearby was tasked in a area to patrol they will not return. For now I rather optimize what I have and improve important parts before working further with other functions i.e firednearby etc.
My question is:
Is there a better way finding nearby friendlies? If so how? Or how would you do it in a way to be much optimized and good code?
One approach is allUnits select {_x distance yourAIGuy < 1000}
Ofc another conditions like side also go into {}
Try the diag tool in console to see what works best in your case
I dont say its better
Okay, I will do that. Reason why I ask is that is because we are a quite large community
40 players on each mission and I want to have the code so clean and optimized as possible..
For example this is how I do it:
_nearestunits = nearestObjects [getpos _unit ,["Man"], 1000];
_nearestfriendlies = [];
if(_side countSide _nearestunits > 0) then{
{
_a = _x;
if((side _a == _side) && (group _a != group _unit) && !(behaviour leader (group _a) isEqualTo "COMBAT")) then{
_nearestfriendlies = _nearestfriendlies + [_a];
[group _a, getpos _shooter, 100] call CBA_fnc_taskAttack;
};
} foreach _nearestunits;
};
Loads more objects than 40 on the map
Haha well I want to avoid zeusing missions constantly cause I want to play.. And before UPSMON was perfect when we were 15 guys
Now bigger we are, more performance hit we get with UPSMON
So we decided to write our own.
Utilizing FSM also
Yeah thinking about doing this way -> I do findNearby - I store all nearunits in a array.
Then I call the function to task attack
And select few members out of that array
And task them cba_fnc
Just want to write it clean as possible to avoid performance hit
No need to count before foreach
Oh don't worry the count is just for debugging
If empty it will get skipped
Well quiksilver problem is we are already experiencing people getting kicked out cause of steam ticket null (memory leak) every 10 minutes..
We do have a heavily modified modpack we do ourselves but also using ACRE and ACE
Me and the other developer are programmers IRL and computer scientist guys
Yeah, i7
SSD
FIBER 100MB up and down, datacenter switches
Speedtest gives us approx upload to.. 50MB
Let me re test two secs
We got 3HC
headless clients running
Shit tons of ram but that doesn't matter since arma doesn't use half of it.
Agreed.
23:35:07 > Player Pte.Chase.J kicked off, Steam ticket check failed: Steam authentication failed.
battleeye disabled
RPT and client files shows nothing more than some usual errors that's arma related
Yeah our speed as been increased.
I don't think your issue is hardware related.
verifySignatures = 2;
Nothing to do with my basic.cfg - ran with both modified and unmodified
Same affect.
People just simply CTD every 10-15 min (Not everyone just one or two person at time)
Not everyone, just 1 or 2.
So lets say you crash quik. You rejoin then 20min later someone else crash
etc
Different
Try a simple mission. See if it persists.
Then you know it is /isn't mission related
We are debugging ACRE as they run a masteridcheck and noticed few people crash at the same time.
Mods are fun to work with too lol. Have fun
Yeah? Where do you recommend start adding them, just in our mods?
Well that is because they CTD
So that shows up when they CTD
Yeah that is what we think it is.
We got nooo freaking clue where
Our HC have never actually crashed
funny thing
HCs **
Haha yeah problem is.. SideOps we have only like 25 people and it barely happen.
And if it happened it would take hour(s)
While in a main op, we have 40 people
It goes mad.
What I probably will do is debug the main op on my end only.
And host.
See what happens and see what I can do.
Its something Idk.. My other partner tells me its ArmA
And maybe some old mods.
So we are going to CUP to see if that will help it and remove older mods.
Yeah well we noticed one thing
If shit isn't optimized
This shit keeps happening
Hence removal of upsmon
Well I'm frustrated..
I can't make a active mission for 40 people cause anything above 60 ai
people drop like flies
U use mods?
Yeah, ACE ACRE Maps (CUP) 3CB and our modified version(s)
Myeah u can always blame those
We also have our custom scripts as addon(s)
My hardware health is green, its from my own company lol (HPE)
See if the problem persists in vanilla
You ever try headless client my dude?
Again, I can't really run vanilla here guys for 40 people.
For 10 people sure but then issue will not happen
even with mods.
Is headless really that unstable? My network performance should handle it.
So should my threading
Dont use HT on dedicated servers on x32 it will just re-thread the main thread more of a client improvment and should be implmented client side, anyone else do that testng yet?
I'm on 64 bits
Oh sweet sauce nevermind
Alrighty, plan set .. still finish my tasking system for AI being engaged etc
Use perf branch for dedi server
Make a separate addon for me and my friend for debugging purpose and for the server.
Re do basic.cfg
And pray..
What's with AI behaviour lately? I'm constantly having my patrolling AI go into random directions.
I thought they were fleeing somehow but I had allowFleeing off.
I never really worked with AI, Wasteland just has group that moves around objective through 4 move waypoints and that's it
Which didn't change since like 2012 when I started making Wasteland but now they suddenly wander off under unknown reason
Hm, yeah AI following target sounds like explanation
All my attempts to repro it in closed environment failed though, only seem to happen on populated server with lots of players everywhere around AI group
ok, here is script-code what caused known memory leak / overloaded netlayer and lead to server freeze / stall later
[] spawn {
while {true} do {
if (!isNull objectParent player) then {
detach player;
}; }; };
and this was workaround script-code attempt to address it (no more leak/perf issues nor crash)
[] spawn {
while {true} do {
if (!isNull objectParent player) then {
if (!isNull attachedTo player) then {detach player};
}; }; };
since new Profiling branch 1.66.139995 (and it's performance binaries) in #perf_prof_branch
this is covered and FIXED at low-level within engine itself, to prevent leak, stop performance/netcode issues etc.
yet,
please take look into your script code for similar cases of 'weird' script-code related to different commands as issues may still exist
Oh , sweet. Thanks.
similar bug may exist for different command, hence i share it so creative community can take look and help narrow it down ...
Why would someone detach player if it has no parent object? 🤔
objectParent doesn't even return object you're attached to
by the way arma 3 tools, only through steam? I want to start on FSM
No wonder it is causing issues
They execute detach tens of times per frame
Its script fault, not command fault
I wish detach would get logged just like attachTo by BE
No, I mean if it was they would instantly understand what's going on
with all this pointless detach spam their script is causing
Well if you RE'd into server you could do much worse stuff anyway
Actually would BE should really log is moveOut messages
You could crash server with single command just recently
"access" createVehicleLocal [0,0,0]
try from another position?
did you make civilians your enemy by any chance?
if you make civilians enemy you can't enter or loot any empty vehicles
as they belong to civilian side
be sure to check out ArmA's new handShit command https://i.gyazo.com/e61a24b69c83904f2a826985fd328d8a.png
😄
Allows you to set the amount of shit on an unit's hands, for decreased accuracy actually
😄
Can't you just crash a server with this anyway?
isNil {_a = {call _a}; call _a};
No need to get fancy
it will freeze the server, not crash 🤔
I'll sure add that to my script collection... combined with my execOnSteamID script that will sure be useful :3
I thought this already was a staple.
lol can it cause CTD?
No, freeze.
There are tons of ways to crash the game. I won't tell you though, because you sound shady!
Dedmen, since when are you unbanned here?
fair enough, im trying to find solution(s) for my CTDs lol
Still selling TS exploits? ;^)
Probably out of memory, Alwandy. Known problem. I think lowering texture size helps.
Well it is out of memory but trying to prevent this happening in possible ways from a mission making perspective.. Until we get rid of our mods that we believe causes some of this texturing thing.
Dwarden provided a nice perf branch so lets see
if it works
Tiny bit atleast 😄
@little eagle well @still forum is on probation, i gave him 2nd chance 😉
Unbanned since yesterday. And i never sold Teamspeak exploits... I make some of them... that may be true.. but i don't get any money for it
is now sure @still forum now feels all the invisible eyes watching him hidden in the internet jungle around
So... commy.. you just now noticing I'm back tells me you didn't read my stuff about why while gets killed with exitWith {true}
Didn't notice
My question was though, why it does not kill waitUntil
As every other loop is exited by exitWith too
apply
count
select
for
ouh... uhm.... yes... it.. eh.... Because
It also doesn't support return values of event handlers, so more evidence that it doesn't end the scope with it's return value, but exits it.
You're turning into @queen cargo with all these ellipses.
someone summoned me?
Not really, you can go now.
😄
Seems to me like waitUntil and exitWith have a special interaction which is not present for other loops.
but to answer your question: waitUntil is a special case and it has nothing to do with exitWith
same should happen with breakOut and scopeName in waitUntil
That is a good test case.
waitUntil simply will wait until you either leave that scope explicitly or the condition is reached (including the 10k limit)
exitWith will just instantly leave the current scope at given spot
--> it is like you just ended there
I don't think waitUntil has a 10k limit. That only applies to while in unscheduled environment
waitUntil should also have some limit if i remember correctly
but does not really matters 😛 reasoning will stay the same
waitUntil is not really interesting to me anyway since I won't be able to use it ever anyway. But it would be nice to have a one code block loop in unscheduled that is not a ugly for-step-0-do.
in general though ... should be a bug even if it was implemented like that intentionally most likely
It violates the behavior of all other loops and is not documented, so feature-bug
waitUntil is essentially not a loop
using it as such is not how that command was intended
I think it should be avoided as it can lead to problems when you substitute the loop with another command.
since I won't be able to use it ever anyway <-?
waitUntil{sleep 1; False}; <- why not? Came in pretty handy
Nice way to lock up a scheduled script I guess?
Put it in postInit. Will break every other mod or mission that comes after your function in CfgFunctions.
...
who the f would use it there? You always pick the worst possible scenarios oO
What's the deal with waitUntil and exitWith again? I am very curious.
Oh my
exitWith does not quit the waitUntil code block, but actually substitutes it's return value with the one that ends or continues the waitUntil block
exitWith does quit every other loop regardless of the expected return value, like the condition block in while-do
Apparently the same is true for breakOut, so it's not really a special property of exitWith, but waitUntil
It is though
Interesting
it is just the function that is called frequent
it is not an actual loop in its "design" but you somehow have to recheck the condition
I had some code examples illustrating the difference
I think I heard about it before but I barely use scheduled threads anymore to really encounter it in real scenario
though ... you should avoid exitWith in most cases anyway
0 spawn {
waitUntil {
if (true) exitWith {false};
false
};
systemChat "exited scope despite using false";
};
0 spawn {
while {
if (true) exitWith {true};
true
} do {};
systemChat "exited scope despite using true";
};
Both scheduled
First one does not print, but loops forever
second is a bug
the second one does print
Wait, the first doesnt exit?
it is for BI to decide
The first one doesn't
Okay, thats strange.
no thats obvious
well it would if you report true instead of false
exactly
and that is what the second should do too
2nd : Of course, While()true + exitWith worked since.. idk. forever like that.
while & waitUntil are no loops
Spinlocks are also no loops
they just loop your condition over and over again
until they return true
it is how they work
they just loop your condition over and over again
/shrug so they're loops
waitUntil is essentially:
while {true} do {if (call _condition) exitWith {};};
there is an "over" missing
No it's not. The gimmick of waitUntil is to only loop once every frame
... waitUntil is a spinlock ...
Semantics
yawn
spin locks should not exit until their condition is met
thus that while {exitwith} is exiting the loop
is a bug
not that waitUntil is
frameLoop is not existing
the spinLock waitUntil is
but as you wont believe me anyway as always ... https://en.wikipedia.org/wiki/Spinlock
In software engineering, a spinlock is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available.
to simply wait in a loop
and i already told you how the actual SQF code would look like ...
do you even read what i fucking write?!
I don't think spinlock is applicable term here
loop != inside loop
it is the closest that you can get for it as far as i know
it is simply looping over the condition
and that is where the essential difference is
If you're really worried about this
And you need to compile that string badly
Why not do this:
"if (true) exitWith {};" + _string
And then:
_string = _string select [20];
Idk if that works in your context
20 is how long that exitWith string is
didn't count, you have to insert the correct number
22
How would that even work
hmm
I don't think it's possible to tell if a marker is SQF without running it. And then it's too late
You can write code without semi colons
just use commas
try it
you will be surprised...
But yeah. Good idea. Ban all markers with semi-colons
No one uses these in sentences anyway, besides me and I don't play whatever you're working for
/ban
how do they even execute stuff on the server?
on the server???
onLoad never fires on the server
there are no displays on a dedi
remoteExec ?
true, but the best way would be to prevent them from executing stuff on the server in the first place
Can you getText the onLoad of the rscdisplaychat thing?
kick em if it's edited
check it twice a second
Do you even need markers for you missions?
Just disable them if they cause problems
No, scrape them entirely
right, by command
I think you should figure out how they execute anything on the server in the first place.
That seems like a more worthwhile endeavor as that could stop other exploits
Isn't this what BE is for though?
New SQF command proposal. localUnits. Same as allUnits but only returns local ones. I know that waiting for that to be implemented would get me a nice beard.
binary createUnit and addMPEventHandler should be nuked though.
Just use select, dedmen : P
AllUnits select {local _x}
every few frames in MP with hundreds of AI's running around.. uh.. no
They didn't care for that when they changed all weapon sound configs
dedmen, just use it on the groups then
for AI
they're all local to the group leaders machine
unless they are players
AI PFH script. ACE.
I mean
You could just add local event handlers to the units and keep your own list updated
If it's only for soldiers, it should be fine
ace medical_ai ... Tells AI to heal themselves and heal nearbly hurt players. should only run on local AI's for sure.. thats why it's currently using allUnits select {local _x}
// preInit
CBA_localUnits = [];
["CAManBase", "init", {
params ["_unit"];
if (local _unit) then {
CBA_localUnits pushBack _unit;
};
}] call CBA_fnc_addClassEventHandler;
["CAManBase", "local", {
params ["_unit", "_local"];
if (_local) then {
CBA_localUnits pushBack _unit;
} else {
CBA_localUnits deleteAt (CBA_localUnits find _unit);
};
}] call CBA_fnc_addClassEventHandler;
This is the solution, now use it.
It's ACE code not mine ^^
@little eagle I want BI to remove select
and replace it with a less verbose version
replace _array select _something
with _array[0]
slice syntax would be nice.
and easier on the eyes.'
We talked about that the other day
OK, but you don't have to ping me for that. Nothing I can do about that.
Just want your opinion on that.
I don't think anyone would be upset with a faster select
I like dirty, but too much talking does take away from the experience.
SQF is not close to C
It uses the same preprocessor directives as C @dusk sage
Similar yes, close? No
#include
#ifdef
#define
Just beacuse it uses similar style, doesn't make it at all like C
etc
It's more like javascript than C, and that's saying something
Everything that is not assembly is C++ like. We went over this already.
Everything that is not assembly is C++ like
Does it matter?
💤
Hahaha.
Nah SQF is closer to C than it is C++ only in syntax, but SQF is really a bastardisation between PHP (forEach), C, and JavaScript
"Does it matter?"
Depends.