#arma3_scripting
1 messages · Page 325 of 1
It's about that what I always hoped the UGV would do if I tell it to follow
unfortunately follow does not work with UGV
I think you need to create the control from a class where the shadow is predefined
Does anyone know if it's possible to slow down the condition check in addAction to not be onEachFrame
I need to check if a door is open or closed to have this action show and the fnc to check it is somewhat slow, I would've liked to have slowed the check down to maybe 4 times a second instead of on each frame
Yea that's how I had it setup before
Will have to go back to that I suppose
NOTE: condition is evaluated on each frame in |non-scheduled environment. If action is added to some object and not to player, condition will only get evaluated IF player is closer than 15m to the object AND is looking at the object. If action is added to player, the condition is evaluated all the time.
Unfortunately it seems not
it could still be better than having a script spawned manually doing it though
depending on how heavy the check is i guess
the check is returning the nearestDoor to you to check for the proper animation to use with animationPhase to see if the door is open
you could use a public bool variable for the condition too
is the action on the door?
or the player?
you don't really need to find the nearest door then?
just the animationphase of _target
Oh shit, I forgot entirely about _target
although I think _target will return the object
so the building the door is attached to
true
might be worth checking out the default open/close door actions
see what they do
do you know where I would find those?
in the building config I would assume somewhere?
or can we even see them?
yeh cfgviewer, on phone
depending on how you're adding the actions, you could also include the selection name in the condition
like have the condition as { _target animationPhase "door_1" > 0 } or whatever
animationSources entry is what you need, some of them are just animated hitpoints afaik
the game does it (at least with cup running) like i said above
this is the CloseDoor_01 from a Land_House_C_1_EP1 >> UserActions:
condition = "((this animationPhase 'Door_1') >= 0.5)";
position = "Door_1";
statement = "([this, 'Door_1','Door_1_Handle','Door_1_Handle_2'] spawn CUP_fnc_Door_close)";
(excluding some obvious ones)
{
_doors = getNumber(configFile >> "CfgVehicles" >> (typeOf _x) >> "numberOfDoors");
for "_i" from 1 to _doors do
{
_x addAction
[
"Breach", //Name
{
[_this] call Hound_fnc_attachCharge;
}, //Code
nil, //args
1.5, //priority
true, //showWindow
true, //hideOnUse
"", //shortcut key
"('BreachCharge_Remote_Mag' in Magazines Player) && {(_target animationPhase (format['door_%1_rot', ([_target] call Hound_fnc_nearestDoor)])) isEqualTo 0}", //condition
1.75, //radius
false, //unconscious
format["door_%1", _i] //selection
];
};
} forEach _buildings;
Does the animation phase ever go between 1 and 0 without a scripted method? Never seen like a door go halfway open or such.
This is what I'm doing right now to add them to all buildings with doors on the map
_buildings being that array
condition = "((this animationPhase 'Door_1') >= 0.5)"; 🤔
would depend on how the building is set up
that one i mentioned doesn't have a door_1_rot that i can see
you can see all the options in AnimationSources
is this for strictly a mission script?
because seems like it might be better to add it to the config for buildings? but then i guess you'd have to put it in every building type
No this is meant to be usable at any door on any map
It does work this way but the function that returns the nearestDoor takes longer to run then I'd like to have it running on every frame when near a door
i don't think i'd work on all third party buildings though
you're sort of assuming there's a door_X and door_X_rot
I know that I'll ahve to change the format for some of th ethird party buildings
but that can be done with checks and generally just changing those parts of the strings to match whatever the authors used
format["('BreachCharge_Remote_Mag' in Magazines Player) && {(_target animationPhase 'door_%1_rot') isEqualTo 0}", _i], //condition```
i think that would work without that check
(but still makes the same assumption about door_X_rot)
That was the first thing I had tried but _i doesn't hold it's value in the condition check
it doesn't need to
that is passing the formatted string in as the condition
rather than passing 'format' as part of the condition
OH I see
I misred that
perfect this is exactly what I was looking for
thanks for working through that with me man
np.. the door_X_rot is the harder part to solve i think
I'm just hoping that they follow the same naming convention map wide in some of the third party maps
like "door_x_whatever"
i wouldn't count on it.. some will use third party + vanilla buildings
and not different for every building
the one i'm looking at seems to have just Door_1 for both the selection and animation
where can I view the anim names by the way?
animationSources in the building config?
yeah
so you could read it from there
finding any that contain door would probably be pretty safe
but then you need to match that with the selection name
Does anyone happen to know the name of the sound when an explosive is placed off the top of their head?
The little beeping sound that is
@blazing zodiac the config viewer is your best friend in this case. Likely you'll have to go digging. Not many times people are able to remember a classname off the top of their head.
Yea I've been looking through for a bit
Some of the sounds may not be acessible via the config viewer iirc, data lock probably.
Are there any concerns around using remoteExec to execute scripting commands, rather than functions? I remember reading it somewhere but cant find it anymore
does getOut EH also when an unit respawns/dies when inside a vehicle?
its not listed here: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetOut
is it possible to detect a player using modded armour and decrease its ballistic protection to zero through a script?
@velvet merlin afaik not.
Does the profiling branch of an arma 3 server provide much information that might help in determining what could be causing script lag on a server?
Because im having quite some issues on my server. Done my best to optimize both the server and client mission file. Ive got the server FPS higher than it used to be, but still experience severe server script lag at times
@warm gorge Yes.
Ive never used it before, so hopfully not too complex
Well.... It's a profiler. Soo.. It's not gonna tell you "That script there is the problem!"
Yeah I know I know, im sure ill figure it out
in debug.log it logs scripts and functions with unusual long runtime
but its very bare overall and you have to do most of the work yourself
Since when? And where is that debug.log? I've never read/heard about that
debug.log is only with diag.exe and located in the profile folder
diag exe is not profiling branch though
I was bored (again)
Hovercrate \o/
https://youtu.be/rvs8QV59r9s
It's like auto fußball
Hi. I attached an object to the turret of a tank, but the direction it faces are always forward (it folows the barrels movements, but nose always pointing the same direction as the body)
anybody know what I need to do?
@tough abyss going to check one moment
@nocturne basalt setDir
@tough abyss no server crash 🤷
Yep, peer to peer and ded.
You're executing this via a event script yes?
Letme try this one more time
@subtle ore So I guess, the dir value I need to get from the turret itself and not the vehicle?
and set it on my object
@tough abyss client crash, not server crash however.
@nocturne basalt use getDir on the player setDir on the object.
_myPeaShooter setDir (getdir player);
will that work when Its supposed to follow a turret on my tank?
@subtle ore If client crash make sure to upload the crashdump to the feedback tracker report
Yep I know.
Can't see anything in the Biki, does anyone know if there's a way to change the wholeHeight of a combobox control ingame? Populating them with an unknown number of items, and want to resize to fit the number of items up to a limit.
@jade abyss this OBE is this with just draw3D and lineIntersects etc or do you have to mod?
Looks pretty cool
is there a possibility of doing something like a manual transmission for vehicles in script? Or is that something more along the lines of a config?
Is publicVariables considered performnace heavy? Considering JIP and stuff like that. I have maybe 10 PVAR's with scripts in them, broadcasted from server to all clients joining. Is this generally a bad idea or is it fine?
@rotund cypress I would assume bad, as the more variables you pack on the more that are stored in memory. I would only use variables and set variable on a need to know basis. Also, if the variables aren't reset or set to nil after end usage it affects performance acoording to the biki
Thing is this, you would still have so many variables stored in memory, public variable or not, doesn't matter. It's more the broadcasting I am worried about.
If I have 100 functions with mns variables, it would be the same, still in memory.
size matters. a few dozen publicVar's that each contain a single number are not as heavy as a single variable containing a 20kb script
These variables are because I want to get certain scripts off of client side, antihack etc
Most of them are < 20 lines
And of course @still forum. I wonder if if the performance impact is negligible or if I should stop doing it.
However I really don't want some of these scripts on client side
If you don't want the scripts to be on the clientside. Then there is not really a way around it
You shouldn't do it if you can prevent it ofcause
Would you be able to say if it's negligible performance impact or no?
Not sure how easy that is to say
Am I correct in saying that resetting a variable to nil after use will save performance regardless right?
Instead of storing scripts/code in public variables, how about you simply have the server run this:
addMissionEventHandler ["PlayerConnected", { _this call myFunFunction; }];
myFunFunction:
// Stop server from running this
if (time == 0) exitWith {};
params ["_dpID", "_uid", "_name", "_jip", "_owner"];
diag_log format ["Player Connected: %1", _uid];
private _initFunction = "
if (isServer) exitWith {};
// The code you want your client to run
";
// Have the client initialize
[[], compile _initFunction] remoteExec ["spawn", _owner];
@rotund cypress
You rly have spawn whitelisted? @tough abyss
I don't see how that would solve my problem anyways, I have server side code, multiple functions, that is accessed by both server side and client side.
Thanks anyways though!
The server runs that code and is only present on the server. It is never seen by the client.
Doesnt matter
Am I correct in saying that resetting a variable to nil after use will save performance regardless right? No @subtle ore
I just skimmed your whole publicvariable discussion and thought you wanted to pass code to the clients instead of having it located in the mission.
Yep exactly
a remoteExec with code has more overhead than a publicVariable with same code
^^
Just how I do it personally, if you're worried about a couple 0.001 ms then whatever.
Am I mis interpreting this? @still forum Once created, variables will take up space in your computer memory. This is not drastic for small variables, but if you use a big number of very large variables, you should undefine any variables that are not needed anymore. This can be done with the command nil.
Yes. They take up space and don't do anything. Which also doesn't do anything performance wise
Well, ye, but it shouldn't do anything with performance
assigning the variable to nil however needs some processing to be done. Which "hurts" performance
Just thought I would share that if it was at all helpful. But I only use that one time upon a client connecting.
Anyway. Have a good evening. I'm off for the night.
And if I would use your method, I would have to use PVAR regardless
Since the server also uses the code
Every situation for use is different. I didn't know your application.
You should also look into dewhitelisting spawn for security
I would use public variables in that situation too.
In case you use this on a production server
I would never whitelist call / spawn since that would mean free for all for hackers
True. I haven't used in production environment yet.
You could just make a function to pass code to, then make sure its the server that is remoteExecuting it with remoteExecutedOwner and then exit if its not
Thats how I have made my debug console for one
Gotcha. Thanks. Anyway. Gotta run.
So it can securely be used in a production environment
Cya
Thanks for the tip anyways 😉
anyone know what the CBA command is that you want to use over the default sleep command?
CBA_fnc_waitAndExecute?
But that's not really a "sleep alternative" It does a completly different concept
Is fleximenu in CBA A3?
is there a way to stop a particular playAction animation? e.g. die, spasm etc? playActionNow description suggests that it cancels previous playActions but this doesn't happen with for me.
Is there a way to get dikCode of escape key when its rebound to another key than default?
Maybe inputAction is what I'm looking for
Ye
Found it, thanks
It's just returning 0 with inputAction which is weird
I guess actionKeys worked however
Id like to polish an arsenal script by automatically adding grenades to grenade launchers and rockets as well, automatically without having to load them manually. is there anyone that can give me some direction on this?
@little eagle / anyone from ACE team / anyone else:
why are you caching the RemoteControl unit in a GV - ref: https://github.com/KoffeinFlummi/AGM/issues/327#issuecomment-57999966
whats the benefits (and downsides) of this approach
it seems like bis_fnc_moduleRemoteControl_unit is actually set by BI
yes its from ZEUS
what GV @velvet merlin ?
AGM_player (probably now ACE_player)
it's pretty simple, sometimes you want to refer to the current unit, and sometimes the actual player
ace_player is player when not remote controlling
take for example gforces module, you want the effects based on unit flying the plane, not "player" since that could be the guy connected to zeus
can I attach an object to a weapon?
the script dont see the weapon as an object but as a string when fetching it with _this select 1
no you cant. weapons are not entities in A3
@velvet merlin ok thanks... that sucks :\
there is the attachment system though; i guess its about your mech - not sure if one can make them work for vehicles
nah I actually tried to make something work on a handheld weapon this time
by a man
@cedar kindle do you know where ACE_player gets cached. from what i read its done in perFrame EH
ok thanks. how often are they checked - perFrame?
@velvet merlin I just added a test attachment like this:
class test_bipod_01_F: ItemCore
{
scope = 2; /// available in Arsenal
displayName = "My Little Bipod"; /// name of item in Inventory (and Arsenal)
picture = "\A3\Weapons_F_Mark\Data\UI\gear_accu_bipod_01_snd_CA.paa"; /// icon in Inventory
model = "\Test_weapon_01\test_bipod_01_F.p3d"; /// path to model
class ItemInfo: InventoryUnderItem_Base_F
{
deployedPivot = "bipod"; /// what point should be used to be on surface while unfolded
hasBipod = true; /// bipod obviously has a bipod
mass = 10; /// what is the mass of the object
soundBipodDown[] = {"A3\Sounds_F_Mark\arsenal\sfx\bipods\Bipod_BLU_down",db-3, 1, 20}; /// what sound should be played during unfolding
soundBipodUp[] = {"A3\Sounds_F_Mark\arsenal\sfx\bipods\Bipod_BLU_up",db-3, 1, 20}; /// what sound should be played during folding
};
inertia = 0.2; /// how much does the bipod add to inertia of the weapon
};
is it any way of fetching that object in an EH?
is it any function like "attachedweaponitems" or something?
Any idea why BIS_fnc_switchLamp isn't working for me when run on the server? Works fine when run locally/globally th o
thanks alot
@winged sphinxRanger#8911 you need to remoteExec it as I think the comand is local to the machin e
I need some guidence... If i am correct then this: if(typeOf vehicle player == "O_Heli_Attack_02_black_F") then { vehicle player removeMagazinesTurret ["8Rnd_LG_scalpel",[0]]; vehicle player removeMagazinesTurret ["38Rnd_80mm_rockets",[0]]; }; will search for that type of vehicle and remove that type of ammo, right?
@velvet merlin yeah it's a cba perframehandler
And this: if(typeOf vehicle player == "O_Heli_Light_02_F" || typeOf vehicle player == "O_Heli_Light_02_v2_F") then { vehicle player removeMagazinesTurret ["12Rnd_PG_missiles",[-1]]; }; will do the same for both types of orca?
yep
@chrome mason As i told you the last time, do it this way:
if(typeOf vehicle player in ["O_Heli_Light_02_F","O_Heli_Light_02_v2_F"])then{...```
Makes it easier fo you.
Also:
```sqf
Code
```
= Correct Code Highlighting.
Ah
I didnt realise you could highlight
Anyhow, will this execute on a player everytime they enter that vehicle or will i have to include some sort of loop to constatly search to see if that vehicle is being used or not
I need to basically have it so that when a player enters the vehicle it executes that code
So there is an event handler for "Getin"
I'm still an sqf noob so a way from a vet to include this event in a script will further help me understand how to include this
Would you be able to help me out @jade abyss
no
It just won't help it. You will run in more complex stuff later, so taking you by the hand wouldn't help you in the end. ¯_(ツ)_/¯
See i'm a visual learner, i read and understand syntax etc but fair point
Just play around in the Editor (e.g. use "systemchat str _this/_VariableName") -> Thats how you learn the quickest.
why are you caching the RemoteControl unit in a GV
So all scripts work with remote controlled units. Basically every time you would useplayer, you use a local variable instead that is the unit the camera is currently attached to. And in the places you can't use a local variable, you useACE_playerinstead.
whats the benefits (and downsides) of this approach
Pro: everything works with zeus
Con: you poll every frame for the "current unit". But there are other reasons to do so, so meh.
commented on Oct 6, 2014
T_T time flies
hey
how i can declare multiple object for addeventhandler ?
like this
player addeventhandler ["HandleDamage", { player playAction "gestureFollow" }];
working only for player, i want to make it working also for AI / Zeus controled unit
by caching the RemoteControl unit in a GV?
actually in that case you could do
_unit addEventHandler ["HandleDamage", { params ["_unit"]; _unit playAction "gestureFollow"; }];
(the first param passed in to the script is the unit)
Dialogs/GUI question:
Does anyone know why RscStructuredText or other dialog elements disappear behind IGUIBack regardless of which order I place them in the GUI Editor?
don't know why, but a solution is to put the background in controlsBackground instead of controls
then it can never be on top of controls
@subtle ore Thats what I thought. But BIS_fnc_switchLamp's effect is meant to be global, so im not sure why it wouldnt work when run on the server.
@nocturne iron Is fleximenu in CBA A3? yes
https://community.bistudio.com/wiki/breakOut Why do I never see anyone using that return syntax to for example exit a foreach loop early?
@still forum I've always exited loops early through a variable, guess I just havent gotten into a habbit of using breakOut
Besides that example on the Wiki page I haven't ever seen code that uses breakOut with return value. Just wondering if there is some problem with it that makes it unusable or something
i guess because it's ugly/confusing and resembles GOTO, which everyone hates
@still forum https://github.com/CBATeam/CBA_A3/blob/ffd5fa78b0c51427e186909682fe7ea1815c6906/addons/arrays/fnc_findNil.sqf#L25-L31
All I see is the same A2 code from jaynus over and over again.
X39s was on the initial link.. like https://github.com/X39/XInsurgency/blob/f010e1c4e449652ad7e1bc18650e85334e5840b8/codeBase/X39/Insurgency/Square/getUnitCount.sqf
i'm guessing that's generated code or something
That's from OOS
ah ok
Yeah. I tried to find a better search filtering out all the breakTo's without return. Found out that didn't work and reverted my message again. You happend to click my link in the 20 seconds it was wrong ^^
@little eagle
thanks. why cache it and not check the variable from BI when needed? aka is the perFrame check more optimized in general vs just do the query when needed
There is an eventhandler associated with it.
check our variable against the BI one
if still the same -> ignore
if different -> update our variable and do event
It's a bit more complicated since it was moved from ACE to CBA. ACE_player now is essentially for bwc and set by the event.
yes thats done by CBA perFrame
While CBA has an internal variable
technically it's not done by a perFrameHandler, but by a EachFrame mission eventhandler.
yeah ok. my point was the frequency
like this should not be an expensive operation, is it?
missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player]
perFrameHandler doesn't necessarily run each frame though.
so again my question is why you use the current design with caching and updating it every frame, vs just put that into a function and call that when needed
like this should not be an expensive operation, is it?
It's not, but it sure is ugly compared to ACE_player. But the real reason is, that you need a global variable anyway for the eventhandler.
missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player] This is cheap. But still more expensive than just using the variable. And also a lot more verbose
@still forum oooooh! breakOut looks neat
a function and call is even moore expensive. And also verbose
so again my question is why you use the current design with caching and updating it every frame, vs just put that into a function and call that when needed
And the answer is to have the playerChanged eventhandler
TFAR does the same with TFAR_currentUnit
readability is a good argument, so is the playerChanged eventhandler
readability is a side benefit, because you could just use a macro
right
BI added that PlayerViewChanged EH that could replace the EachFrame check. CBA tried that. It broke a lot of stuff because it didn't work as expected. And CBA reverted to the EachFrame check again
True, technically ACE_player is no longer the variable the EachFrame handler for the eventhandler checks against, but the variable itself is updated by the eventhandler.
People liked ACE_player
And it's easier to remember to just use ACE_payer everywhere where you would use player.
I also think using a variable is cheaper than the nullary player command.
But that also depends on how many globals you have.
I have no idea what's going on with PlayerViewChanged. It's totally broken.
A variable and a nullary command are the same compilation wise. Sadly. It could get faster if BI would stop ignoring my scripting bug reports
ACE_player is always the Unit that your Camera is in
So.. when Remote Controlling via Zeus for example
You are not IN the UAV. So no.
ACE_player will be objNull at preInit or maybe even nil when your preInit script runs before ACE (only possible with addons)
Quick check, anyone know if it's possible to create a simpleObject from p3d only and texture it in-game with setObjectTexture(Global)?
@zenith totem I'm pretty sure createsimpleObject only takes p3d paths anyways
Oh cool
You need HiddenSelection defines. Which you only have in config. That's why you need to create from config
hey i have a possibly quite easy question, i just haven't been able to answer it myself just yet. How could i use triggers to activate a function on a each player's computer as they themselves enter the trigger area?
Just put the function into onActivation.
So i want a function to be called as soon as a player walks into trigger area, but i don't want that function to be called on all player's computers and i don't want it to be called only once when activated, but as each player enters,
nah sorry demen, didn't explain it correctly
the trigger onActivation script is executed on each player already
making it retrigger for each player that enters is your question then
You can set triggers to repeatable
hence a bad explanation XDE
yes but they don't retriger if repeatable
they only are able to be re activated
so essentially i want the trigger to activate a funtion every time a player enters the area, no matter if the trigger already has other players on it
does that make sense?
Yeah. I don't know about Triggers. That's more #arma3_scenario than #arma3_scripting. But I think that's not possible using triggers then.
yeah thats what i thought -_-. I am currently using a loop to check the players distance from a point as a makeshift trigger and that is working when, but i don't want to have to use that for all 7 triggers i need it for : (
thanks anyway
That's how I would do it.
To safe a little performance I'd check all triggers in one loop
yeah ok that would make sense
just while you're there, i want to ask a similar question. with these triggers i am making various capture points and currently i am using triggers. They work perfectly atm, but do you think (from your experience) that i should stay with the triggers or would makeshift trigger loops be better?
Hi there, can someone help me to run this acex module from github plz, i'm lost and very bad at scripting and modding https://github.com/acemod/ACEX_artillery thonk u
@limpid pewter Stay with triggers. That's exactly what they were intended for
k thamks
@tough abyss Would creating from model at least use the default textures? I'm guessing it does otherwise what use is it
@still forum was able to use triggers for that need after all, just needed to start a loop (active when trigger active and not when trigger isn't) that would run my script for each player remotely from server. using thisList. Thanks for your help
@zenith totem It will use the default textures for that Model.
If you got the Model path of the config of a retexture it will not use the texture of that retextured object
@still forum I'm planning to use a custom model in an unmodded mission so I can't use class/cfgs, default textures is at least workable for my purposes though
another possibly stuid question: Which is the correct way for spawning a function using remoteExec? this sqf _myParams remoteExec ["myFunction", somePlayer]; or is this the correct way ```sqf
[_myParams, myFuction] remoteExec ["spawn",somePlayer];
Does anyone know of a way to change the moving bool of a control via sqf?
There seems to be a ctrlXXXX command for just about everything defined in a control except that
remoteExec should according to BIKI spawn the script. Not sure though
no, but why not use some kind of EH to set the ctrls pos everytime the ctrl is moved?
its clunky but idk
@still forum thanks
Well the idea is to create basically a lock and unlock button that will allow the controls to be moved around but the user so they can set it up however they like
Similar to some MMOs UIs for addons and what not
All that's needed is to be able to toggle the moving property via sqf
the only way i can think of doing it, is if you were to create your own little GUI editor infrastructure that would save to a profileNameSpace and then could be used latter. But again, no idea how it would work and if at all XD sorry
Actually I think I just thought of a workaround
duplicate each ctrl, one that's got moving enable and one that doesn't
Then toggle them with ctrlShow
yeah ok thats sounds like a good idea 😃
And eventHandlers of course
remoteExec should according to BIKI spawn the script. Not sure though
No. For commands, the command does the same thing as remoteExecCall. The difference is with functions.
Which is the correct way for spawning a function using remoteExec?
The first one-
Although the second one has the same effect, it's unnecessarily complicated. like
_arg spawn
_this spawn {
...
};
};
instead of
_arg spawn
...
};
ok thanks @little eagle
@limpid pewter Basically this:
remoteExec = remote spawn
remoteExecCall = remote call
Standard rules about spawn vs call applies, if it's just quick do this, use call
If you need suspension etc, use just remoteExec
Just to be sure, must "enableEnvironment" be run client sided or server sided?
Ahh, thanks thats great then.
If it would override it as if you were executing the code in a sp environment, it will remove it
just change the layer
So I've been playing around with DrawLine3D
Managed to render cylinders, 'teardrops' and a couple other shapes
Is there a CBA XEH that runs on game load?
When addons are being loaded and such.
Pondering whether this hacky ass thing would work -
XEH_preStart (or whatever the on game load XEH is called, if there is one): ```SQF
if (isClass (configFile >> "CfgPatches" >> someMod)) then {
#define STUFF
};
config.cpp: ```CPP
#ifdef STUFF
#include "someStuff.hpp"
#endif
It wouldn't, because preprocessor commands don't work like that.
The preprocessor runs before scripts are processed. PRE-PROCESS.
When your script executes it's too late
@little eagle @still forum why do you update/check for RC EachFrame and not uiSleep 0.1/0.01 loop frequency?
to not miss out any script check for RC, yet ensure ACE/TFAR_player is updated as soon as the switch happens?
PS: did anyone ever ask KK for a playerEntityChange EH? (or was their failed attempt to it/sth similar sign enough they cant/wont)
Because a scheduled script with a uiSleep 0.1 might only trigger 10 or 20 seconds or several minutes after the player changed.
And yes. They are updated on a eventhandler which get's triggered inside that check
Because a scheduled script with a uiSleep 0.1 might only trigger 10 or 20 seconds or several minutes after the player changed.
Uhm, what?
What I said
Thats nonsense
Why?
LET THE FIGHT BEGIN 👺
🤦
It's true though.
In wich situation?
🍿
And it's a thing ACE has to think about.
Scheduler overloaded.
too much sqf done in ui namespace?
🤦
Spawn 5000 scripts that do some heavy script in a while true loop
Can happen, when Sheduler is full/overload, but even then -> More than 10s? Thats nonsense with uisleep
those nametags onEachFrame already lag a bit by themselves, or is there more efficient solutions these days?
The scheduler will be dead
Why?
uiSleep does exactly the same as Sleep does (in that regard)
@velvet merlin I think it works better with Draw3D than EachFrame
(well i meant that 😊 )
I don't see why that would be choppy then. Maybe use the "visual" getPos whatever commands instead of the simulation ones.
10s is rare, but the old warfare coding added such delay at times (especially with some other bad coded systems)
I've seen missions where the ESC pause menu took 30 seconds to open. It's also scheduled.
Makes the game unplayable.
Sounds like pretty bad coding or a 486er as PC
Yes. Exactly. @jade abyss
yeah clicking the options button in the pause menu is a good sign when the scheduler is overloaded (and most likely a while true somewhere) as unfolding the menu will be slow as hell
If you have sooo much stuff running, that your sheduler is fkd up, you should reconsider your code.
@jade abyss This is CBA though. CBA has to work even if it's running on a Life server or worse.
And that's exactly the reason why they can't have that potential problem that might in rare cases occur. Because even these rare-cases are too much
But putting everything inside an eachFrame (wich costs way more than a simple sleep 0.1; loop), i dont know if thats a better solution :/
scheduler overload is like the fear that you get stuck with your car on a highway ...
it is nonsense, can indeed happen but only if too many dump idiots drive on the road
chances that you get extended sleep rates for scheduled scripts are very low and you have to intend to get there ...
TIL traffic jams don't actually exist
for nearly all scripts, spawn is way more then enough
Yeah. I know the overhead. And I hate it too. But.. there is no better way. Engine Eventhandlers could solve all that. But these mostly don't ever appear. And if they do they are in some way broken.
Especially if you control the Mission you are running spawn is completly fine. Because the Mission is the place that could mostly mess up. Mods tend to get it right or atleast not too wrong
only actual things that require faster response times are thigns like TFAR
where kind of real time is required for the immersion
ohh yeah ... right @little eagle ... forgot that positions update by reading the brainwaves of the user
True. Sad, but true @still forum
TFAR would be fine if position updates are lagging a bit. Not that nice. But doesn't kill the game as much as when you press the Interaction key and nothing happens for a couple seconds. when trying to drag some downed mate out of enemy fire
imho, Multiple Threads for SQF (like declaring "This runs in Sheduler/Scope 1 of 10") could help. but... i doubt that will be doable.
that is engines fault though @still forum
as it is a ui event handler
@jade abyss nope, actual real multi-threadding is pretty nasty in most used script languages
@jade abyss Do you mean it would just execute 3ms of each "Thread" one after the other? So that atleast 10 scripts will run if the scheduler is completly overfilled?
Would reduce the impact of the problem. But not by much
Even bohemia's own functions are trash for overloading the scheduler
Try and use their ambientAnim on a few units and you're asking for trouble where you can't revive people properly
More like:
Thread 1 = Run Scripts 1-10
Thread 2 = Runs script 11 (HeavyLoadStuff)
Thread 3 = Runs 10-100
etc. that kind of stuff
that is not how it will ever work 🙈
I ended up overhauling the ambientAnim for my milsim group lol
Or "Thread"'s sorted by priority? So that priority scripts execute first?
Or do you actually mean Parallel scripts? @jade abyss
Not about priority, more like a: If > 3ms -> Put in the next Thread and handle it there, so it doesn't affect the other ones
Parrallel, more or less.
Imagine it more like a LoadBalancer
Too much load on ScriptingThread 1? -> Put it in the next one!
i personally think they should just make arma CLR compatible and thread safe
afterwards we got our new "script language"
That doesn't work. You can't run some parts of the script engine in Parallel. And you can't control that only threadsafe commands are used in a script
Who is talking about some parts?
me.
Script -> whole *.sqf file
Either way, In bohemia's next game, for bohemia's sake it better not be SQF , SQF is aids
Yeah. As of right now only some SQF commands can be executed in Parallel safely. That's why you can't do such a thing for every script without overhauling the complete script engine
Most of Scripts can be ran in parallel. But as soon as you have a createUnit or setVariable in it you are not threadsafe and as such can't run in parallel.
Intercept is already doing some experiments on parallel scripts.
Thats why i said: i doubt that will be doable.
It would be just nice to have ¯_(ツ)_/¯
OOP would also be nice to have, but that is never going to happen in A3
Most of TFAR's onEachFrame can probably be parallelized. Didn't have time to look into that yet.
@zenith totem We already have that. Kinda. Intercept can do all that.
You're welcome to look at those BI functions.... 😄
To "fix" scheduled environment, they would also have to get rid of the disableSerialization and "undefined variable in expression" nonsense. And fix that bug with with.
Yes
whats the bug?
get rid of the disableSerialization They can just choose to not throw an error
"undefined variable in expression" nonsense They just need to pass a false instead of a true
And fix that bug with with. They just need to store in in the ScriptVM instead of a global Variable
[] spawn
{
with uiNamespace do
{
for "_i" from 1 to 1 do
{
systemChat str [
currentNamespace isEqualTo uiNamespace,
currentNamespace isEqualTo missionNamespace
];
// result [true, false]
sleep 0.05; //<-- small suspension
systemChat str [
currentNamespace isEqualTo uiNamespace,
currentNamespace isEqualTo missionNamespace
];
// result [false, true] <-- switching
};
};
};
They just need to pass a false instead of a true
Wich could end up in more confusing ppls ^^
wait, what? Commy?
Rly?
try it out
for, if, try, call
the problem is that the Namespace doesn't switch back when the Scheduler enters the function next frame.
The current Namespace is a global variable. with namespace switches that. Scheduler leaves the script it get's switched back. Scheduler enters the script on next frame. The Global variable doesn't get set again.
Make me a BI dev and I'll fix it in a few hours.
you probably would not
you would have to ask your management to be allowed to put it in high priority so you can fix it
^^
would require a new variable for the scructs where they store those scripts in
telling what that fancy namespace was
but one probably does not wants to hunt down bug in ancient code bases like the one in RV
@still forum If it switches when moving scripts, why is that same logic not applied in reverse?
Experience with game development
*Senior Engine Programmer*
Don't have that
Math and linear algebra skills Not the best in the world.
nobody has
that is why such things are bollocks
also, that job is mainly for the actual engine
not for the scripting part
whoever works at that position is too expensive for the script engine
I have a lot of experience with the Arma Codebase though.
Also it doesn't say that that job applies to Arma 3. Might also Apply to Argo/DayZ/Arma 4 or whatever
shit will never get done anyway ... the way i would do it would be the same what Keen Software House did with Space Engineers
https://github.com/KeenSoftwareHouse/SpaceEngineers/tree/master/Sources
making the whole game open source but leave the content out
takes organisation
but allows for the community to contribute
or different speaking: fire all your programmers, you got passionated modders now doing the job for free
((though ... it was a wish that KSH followed))
I must agree, tbh. (except for the "fire your programmers"-part)
afterwards your engine goes down in performance a lot
so you hire those old engineers again to now only do performance patching
new features come mostly from community anyway, but community does not cares for overall performance
community does not care for overall performance Sooo wrong
Yeah, it's the most important thing oO
Well, the people talking here currently do
ye ... totally ...
just that the scope is different
you implement a new feature in a gigantic source base
it is not like you know anywhere close to enough or spend enough time to fix all those holes
Yes.
FSM's are just SQF with a bit of statemachine control flow mixed in
Don't they run in their own scope/Thread?
I've never touched any FSMs in a major manner, only altering some SQF on steps
yes @jade abyss
FSMs are like SQF
just different
Way to say absolutely nothing.
^^
If you want the best available performance. Ditch Battleye and use Intercept
But iirc, spamming too many FSM's -> Performance was also going downwards. (wasn't there a max of 20 or so?)
Got a link?
Thanks
Doesn't matter for what the purpose was, tbh. Of they got a better Performance -> HeavyLoadScripts in FSM might help ¯_(ツ)_/¯
it would
execution time is ~1/3
of the whole script engine
just forgot where i read that in the wiki ...
Still: Wasn't there a max Number of FSMs?
I'll check.
I can't remember where it get that from, but i am pretty sure there was.
while you are on that @zenith totem https://github.com/ArmA-Studio/ArmA.Studio
Something deep deep down in the back of my brain
y ... same with that 1/3rd
@queen cargo I've seen it but it was early stages when I last used it
read it on some wiki page i now attempt to find for ages
Something deep deep down in the back of my brain
Your imagination?
https://ci.appveyor.com/project/X39/arma-studio/build/18 give it another try mb @zenith totem
depending on when, many things have changed and got more solid
If you create more than INT_MAX FSM's you produce a integer overflow
Nah, in my imagination there is something else.
integer overflow?!
you mean like ... crashing the game ... 🤦
So how does intercept work? Is it basically just a client&server dll that fires code directly at the game rather than going through the script engine
or just some script error crap
@zenith totem Basically yes
I don't see anything limit the count of FSM's you can spawn with execFSM. And my Visual Studio crashed
I can only make use of it serverside then since I'm running an unmodded mission
Yeah that would be true then
hmmm
But still worth looking into purely for simplying SQL stuff
And hiding that away a little bit from the exploitful SQF
if intercept is too complicated you might also want to look into alternative SQF script languages
Which have no advantage over plain SQF other than being OOP. Because in the end they convert to plain SQF
I have a game dev on my team who hates SQF and was looking for some "normal programming language" interface anyway
So he should like intercept
i highly doubt that
"anything but SQF" in his own words
Everytime i read something like that: I have a game dev on my team i must giggle 😂
Hey, I didn't say professional game dev 😉
We have 3ms per frame of scheduled script.
These can be
SQS
SQF
FSM
They are sorted by age (longest time since last execute)
and then for 3ms the oldest of them get executed.
If the first one takes 3ms then only that will be executed and no other scripts will run after it in that frame
So FSM's being 1/3rd is not that right
but?
Besides Java based FSMs. These run outside of the 3ms scheduler
I'll look at what's been said later, leaving the building I'm in before I get locked in lol
If the first one takes 3ms then only that will be executed and no other scripts will run after it in that frame
wait wait wait, wasn't it -> When 3ms reach -> Script gets suspended and the next one will be executed?
No.
3ms per frame max.
Otherwise we wouldn't have that "script might not execute for several mintues" problem. The game would just freeze if you launched thousands of scheduled scripts
The 3ms run time
A scheduled script runs for exactly 3ms before it is put in suspension to be resumed on the next frame, again for another 3ms and so on until the script is finished. The amount of suspension depends on FPS. At 20 FPS the duration of suspension for example is 50ms.
This means that if scheduled script cannot be completed under 3ms, the execution can stretch for undefined amount of time, subject to engine load, FPS and other non scheduled scripts running at the same time. A while true loop with sleep started in scheduled environment therefore has little chance to follow with exact interval.```
Yes. again for another 3ms in the next frame/scheduler cycle.
But and no other scripts will run after it in that frame wouldn't be true
I read it like 3ms reach -> store somewhere, use/execute the next script.
That wiki text is incomplete then.
the whole wiki is partially outdated
partially false and nowhere is actual number evidence
Btw Arma 1.72 is still executing the Java FSM's even though the Java scripting engine should be disabled. I should someday try to reenable the Java engine and hook into it ^^
Why?
Fun
But Java
lord GabeN himself
or worse: commy
anybody here willed to do my job for me today? still got 4 hours to work but i do not want to ... would rather get shit done on ArmA Studio
Hmm. I only need to re-enable the ExecJFSM script command.. That should be easy
Java is evil
do not do it 😨
It's not hard to make a case for any language other than SQF lol
you now got 3 other ones
2 form to SQF
one uses DLL magic
2 form their one subset of lang
somewhat resembling a different one
one is c++
pick one and stick with it
You also have partly implemented LUA and Python is getting the basics up currently.
c# is also on the list using arma2net
even a solution to debug your SQF code if that was all that ever bothered you is available by today
fuck this crap ... need to redownload arma because steam "forgot" my arma on my HDD being there -.-
and not enough room to just "install" it ontop
but arma2net still needs SQF on one side.
Still using a HDD and not an SSD? 😮
Don't need a HDD for Arma ^^
Intercept seems like the cleanest solution from a glance at the repo
I can live with having to wait half a minute for all models to load ^^
got 2 SSDs in my system
need actually a new HDD with actual storage in place as one of my HDDs is dying where most of my crap is on (5TB)
but they currently are priced at incredible ranges
RPTs have probably trashed my main SSD anyway
cleanest solution is SQF
all other things require some sort of hack to get to their goal
being the hack that you use external tool to compile to your target language
or hook the engine
SQF works in every arma
at any time
tell your dev he should man up
and use the appropriated tools
Intercept also works in.... Arma 3.. at any time.. If Intercept is installed and up-to-date... :u
Not an issue to maintain for a server only deployment
Not to start back on what was previously somewhat argued about above, but in regards to scheduler overload and its effect on uiSleep/sleep, from my experience uiSleep has proven a lot better than sleep in terms of being affected by scheduler lag, but when the scheduler becomes overloaded, it definitely still makes a noticeable difference
Both commands do exactly the same in MP (after the briefing).
There can be no difference.
Really? When I switched from sleep to uiSleep on my server mission, I noticed that scripts which used it as a timer were a lot more accurate compared to sleep
uisleep is not affected by fps
Thats what I was under the impression of. Which in my case where I was suffering low server FPS at one stage, uiSleep seemed to help over sleep.
I always hear mixed opinions on sleep and uiSleep, in terms of some saying uiSleep isnt really that different to sleep other than the fact that it can be used where simulation is paused, others saying that it is. Very confusing
From my experience, uisleep works as described in MP
@little eagle & @still forum, ok thank you. I assumed it was pretty retarded to begin with 😂
placebo @warm gorge
In arma there are too many variables to take into account
In my cases either it's the script being too complicated or broken, other than that the difference is so marginal that it makes no difference in real gameplay. As long as you don't leave your script running and use event driven intead of waituntil etc. It will be fine
if _array is usually empty the second one would be better.
But if it has more than a couple elements then the first one will be better.
Just add a isEmpty check. Like if (_array isEqualTo [])
I have a permanent mention counter displayed in here 😑
Hey guys, does anyone of you know a good command or a good way of setting a object relative to another objects position?
Found a command that should work, modelToWorldWorld 😃
Question is, why not modelToWorldASL lol
Am I retarded or is there no moveInDriver equivilant that plays the animation still
Other than action that needs the vehicle to be unlocked
@queen cargo right click #arma3_scripting and then mark as read
does not works on mobile phone @tough abyss :/
@tough abyss now we can create Altis Life Casinos for gambling Dialog slot machines
selectRandomWeighted [..., "7", 0.0000001, ...]
Exactly.
How would I go about getting the floor position of a building. So from there I can build up the floors into a array.
don't think there is really a concept of 'floors' in the game
you might be able to use 'buildingPos' to get the various heights
or lots of samples with lineIntersects
"memoryPoints"
@jovial ivy the best (although non-dynamic way) would to get the heights of floors for each building class relative to the origin of the model
thats how ALiVE etc do it
"Dialog slot machines" great term for that
Also, how do you guys do your UIs
I currently do mine manually in the config and hate it with a passion
@nocturne iron Hmm gotcha, i'll take a further look into it later.
What idd is 46? (from findDisplay 46)
I mean since its the main screen, is it always present even when you are in say, ACE spectator mode?
I cant seem to get it to work. Im calling ACE spectator mode manually from an addaction (as sort of like a satellite view object)
this addAction ["Spectate", {[true] call ace_spectator_fnc_setSpectator}];
And i put this in my init.sqf:
_keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 33) then {[false] call ace_spectator_fnc_setSpectator}"];```
33 = F (according to resources.bisimulations.com/wiki/DIK_KeyCodes)
but im pressing F and it wont work
needs to be \prefix_of_pbo\folder_in_pbo\file.sqf
the prefix is generally determined by the folder of your stuff on P:
so if your stuff is in P:\conway\modfolder\init\init.sqf, you should use \conway\modfolder\init\init.sqf
that's the case whether your config.cpp is in conway or modfolder
or init even
best to use cfgfunctions for running scripts though btw
because they compile while the game is loading where execvm recompiles it every time you run it
hey gents me again on the cfgfunctions :D
CPgen = call JSFAR_CP_fnc_gen;
CPinit = call JSFAR_CP>
16:38:54 Error position: <JSFAR_CP_fnc_gen;
CPinit = call JSFAR_CP>
16:38:54 Error Undefined variable in expression: jsfar_cp_fnc_gen
16:38:54 File mpmissions\__cur_mp.Malden\initServer.sqf, line 2``` Error from a mission with the initserver located in a server side mod as @mod/addons/mod_cp.pbo/cp/fn_gen.sqf
in mod_cp.pbo are ```Markdown
- config.cpp
- folder called cp
- inside folder cp the script fn_gen.sqf```
Need to see your config.cpp
jsfar_cp_fnc_gen is not defined
{
class JSFAR_CP
{
class CombatPatrol
{
file = "addons\mod\cp";
class fn_init {};
class fn_gen {};
};
};
};```
isn't that JSFAR_CP?
{
class myTag
{
class myCategory
{
file = "myPath";
class myFunction {};
};
};
};``` From the BI
Full RPT? Because functions end up being undefined if they have a syntax error.
Tag is not needed.
Your path isn't right
class CfgFunctions
{
class JSFAR_CP
{
class CombatPatrol
{
file = "addons\JSFAR_CP\CombatPatrol";
class fn_init {};
class fn_gen {};
};
};
};```
Get rid of addons\
Either
\JSFAR_CP\CombatPatrol
or
JSFAR_CP\CombatPatrol
I can't remember which it is atm
16:45:56 C:\InstallationCharlie@JSFAR_CP\addons\jsfar_cp.pbo - unknown
This PBO IS being loaded. Is that the right one?
yea
What's the full config.cpp?
that is the full thing
You could try to load the mod locally and check via ingame config viewer if the class is right and check if the function is defined via debug console
why does it need a patch
Oh yes. You need CfgPatches too.
Because every config patch needs a CfgPatches class.
should I change the name to CfgFunctions.sqf instead than config.cpp?
no
You put them both in config.cpp
class CfgPatches {
...
};
class CfgFunctions {
...
};
okay lemme try that one
16:57:18 c:\w\stable\futura\lib\network\networkserver.cpp NetworkServer::OnClientStateChanged:NOT IMPLEMENTED - briefing!
16:57:18 Attempt to override final function - bis_fnc_storeparamsvalues_data
16:57:18 Error in expression <f !(isServer) exitWith {};
CPgen = call JSFAR_CP_fnc_gen;
CPinit = call JSFAR_CP>
16:57:18 Error position: <JSFAR_CP_fnc_gen;
CPinit = call JSFAR_CP>
16:57:18 Error Undefined variable in expression: jsfar_cp_fnc_gen
16:57:18 File mpmissions\__cur_mp.Malden\initServer.sqf, line 2
``` nope
didn't work
Did you name the class in CfgPatches JSFAR_CP
class CfgFunctions
{
class JSFAR_CP
{
class CombatPatrol
{
file = "\JSFAR_CP\CombatPatrol";
class fn_init {};
class fn_gen {};
};
};
};
class CfgPatches
{
class MyAddon
{
// Meta information for editor
name = "[JSFAR] Mission Library";
author = "TheNightstalk3r";
url = "";
// Minimum compatible version. When the game's version is lower, pop-up warning will appear when launching the game.
requiredVersion = 1.72;
// Required addons, used for setting load order.
// When any of the addons is missing, pop-up warning will appear when launching the game.
requiredAddons[] = {"A3_Functions_F"};
// List of objects (CfgVehicles classes) contained in the addon. Important also for Zeus content unlocking.
units[] = {};
// List of weapons (CfgWeapons classes) contained in the addon.
weapons[] = {};
};
};```
change MyAddon to JSFAR_CP
rgr
17:00:10 Error in expression <f !(isServer) exitWith {};
CPgen = call JSFAR_CP_fnc_gen;
CPinit = call JSFAR_CP>
17:00:10 Error position: <JSFAR_CP_fnc_gen;
CPinit = call JSFAR_CP>
17:00:10 Error Undefined variable in expression: jsfar_cp_fnc_gen
17:00:10 File mpmissions\__cur_mp.Malden\initServer.sqf, line 2``` not there yet
RPT
https://pastebin.com/r86Dj1hi
Oh
Remove fn_ in CfgFunctions
16:59:40 Warning Message: Script \JSFAR_CP\CombatPatrol\fn_fn_init.sqf not found
16:59:40 Warning Message: Script \JSFAR_CP\CombatPatrol\fn_fn_gen.sqf not found
You have:
class CombatPatrol
{
file = "\JSFAR_CP\CombatPatrol";
class fn_init {};
class fn_gen {};
};
Change to:
class CombatPatrol
{
file = "\JSFAR_CP\CombatPatrol";
class init {};
class gen {};
};
if !(isServer) exitWith {};
CPgen = call JSFAR_CP_fnc_gen;
CPinit = call J>
17:05:34 Error position: <= call JSFAR_CP_fnc_gen;
CPinit = call J>
17:05:34 Error Generic error in expression
17:05:34 File mpmissions\__cur_mp.Malden\initServer.sqf, line 2```
yea done that
is it because of the underscore betweeen JSFAR and CP?
https://pastebin.com/wipjpP42
https://pastebin.com/fu3kaQYY
Yep.
You are ending the function with an assignment operator.
CCP_Init_Done = true;
And then you are calling this function and you store the return value in another variable.
CPgen = call JSFAR_CP_fnc_gen;
ah how should that be addressed?
So basically:
CPgen = (CCP_Init_Done = true)
aaaah
You have to rewrite your function so it has a return value that is not from an assignment operator
so it should be return true?
E.g. simply:
nil
and CCP_Init_Done = call JSFAR_CP_fnc_gen;?
I didn't even realise SQF was that retarded
It's a feature!
can I simply use return true?
As I said, you can return anything you want.
Just not an assignment operator.
Ideally every function should have a return value. Even if it's just true or nil.
so I can put at the end return true;
No
awh
You can just return true but you cannot return true as SQF doesn't have a return command
the last value in your script will be returned so if your script ends with true it will return true. or isPlayer player it will also return true
call {
true // <- return value
};
you just can't end with x = y because the = operator returns Nothing. And you can't have a function return Nothing
isPlayer player it will also return true
Well,false, because this is on a server
No diff
If it's on a Server and you want to use return just use Intercept 😄 If your C++ is better than your SQF.
Doesn't matter.
I leave the ; away to indicate a return value though. Just for readability
I hate this particular error so much.
SQF
Readability
CHECK MY SCRIPTS. THEY ARE READABLE ALRIGHT
hmm
still spawns me in water as if it didn't read it
anything that used to be in initserver.sqf, should it be called or used with execVM?
Used to be?
Btw I lied. Operator = doesn't return nothing. I think a =operator doesn't even exist.
It's the variable assignment Instruction that doesn't return anything.
@tough abyss Just check RPT for script errors.
nothing there
You are calling or spawning your function somewhere right?
call yes
in initserver.sqf
hmm still no luck
as if it never ran
@little eagle another feature I'm not aware of? https://pastebin.com/CM8kKebU
calling that code does nothing
Why do you put the link inside `` ? It would be far easier if I could just click it
fair enough
No, but who knows whats wrong with this script. It's 1200 lines +
just preventing the window to pop up when posting
it works fine when used with execVM
You don't have the rights to have a window pop up here.
I think it's because of the waitUntil {!isNil "CCP_Init_Done"};
really?
didn't know that
I don't see what could be wrong with that script. It's a little too big for my screen
the script itself works flawless, but for some reason when using it as a function it gets either stuck or won't run at all
What part of that script is the important one?
it's the init of combat patrol
Have you considered just putting some diag_log's in there to check if it is executing as it should
prob found it
it should run before mission start
or it'll wait forever for the CCP_Init_Done
Does someone know how to create a lightsource with the "beam" effect that the lighthouse does?
Have a look at the lighthouse Cfg, it'll be under reflectors or something like that
Probably not possible via script https://ss.jaffa.cat/2017-06/4n2pA8cH.png
What setting in that config do you think causes the beam? @zenith totem
innerAngle outerAngle
FindDisplay 46 doesnt seem to work while im in spectator mode. Is there a way to see the current IDD's that are onscreen?
It may be possible to get something similiar using setLightAttenuation though
"linear (SCALAR) – Support signed number, effective range is from 0 ~ 100 (passed minus value will be treated as 0), this parameter determines the concentration of the light source, higher the number is, more will the light concentrate, vice versa. In other words, this parameter will turn the source into spotlight and sharpens its light circle border."
https://community.bistudio.com/wiki/setLightAttenuation
I'd guess the Attenuation setting controls the Attenuation setting. And not the Flare cone size.
hi, with regards to GUIs, what is the best way to only allow numbers be entered into a RscEdit control? Is the some way that XML coding could do this? or would i just have to do it in within another functions?
XML coding?
like the html coding, thats what it says on the wiki, well at least how i understood
GUI's are configs. No XML and no HTML.
And thus #arma3_config may know more about that.
#arma3_scripting wise you might be able to add a eventhandler that fires on every character entered and makes sure only numbers are allowed
Nah i meant like structured text. The wiki said something about XML being like HTML or soemthing (need to read more about it before i start refering to it often XD).
I don't really want an EH to fire on every character, trying to save performance. But maybe i could check every character returned in the string, to see if it is a number or not. If not, bring up an error message
Could i do something like this? ```sqf
_myString = "dk25mdl";
{
errorCheck = isNumber _x;
} forEach _myString;
or isn't a string directly seen as an array? im not sure
awesome, yeah just the command i couldn't find 😃
but would i be able to use the forEach command on the string, like the string was an array or not?
yeah that's what i thought
so how would i go about checking each character in the string?
{
if (_x in ["0", "1", ... , "9"]) then {...};
} forEach (_string splitString "");
Or something like that
typo in "splitString"
Structered Text is HTML yeah. But that's not GUI.
I think there is not much point in TEXT outside of UI.
Maybe for diag_log text if that counts.
nearestObjects doesnt seem to return simpleObjects, is this intended?
simple object created with config or model path?
nearestObjects with type filter or []?
nearestObjects filters by classnames. simpleObjects don't necessarly have classnames.
You can use allSimpleObjects
Hmm, but it should work with empty filter.
doing typeOf returns a class
@little eagle my bad i read what you said wrong. I meant i do use types
SimpleObjects are basically terrain objects like houses. Does nearestObjects also return these?
No.
Well
When loading a savegame certain lamp posts are returned until the mission finished resuming...
Can I use something similar to onEachFram where I can use private variables?
Anyone know the locality of setLightnings?
Server only propgoating to clients?
I could try to use a while loop that sleeps every 0.01 seconds though.. But that is more demanding right?
@tough abyss _buttonBox ctrlSetEventHandler ["ButtonClick", "_this call fnc_SpawnIt"]; do ctrlParent (this select 0) to get display
Excuse me guys, may i ask if the forEach loop gets stopped on the 10.000th iteration?
rofl, that must be a big array
Yeah :L
What data are you storing in it, and how can you possibly need an array that big? If I may ask 😃
@nocturne basalt Why don't you just use global variables?
No. the loop is far less demanding
@jovial nebula In unscheduled yes. afaik.
Understood,thanks.
@rotund cypress I'm using forEach for formatting vehicle data (Inventory,mostly)
So i was trying to find an universal method (That could work even with "full-inventory" vehicles)
Ah okey, sound strange it would be that big still though considering a full inventory
if u don't need the _forEachIndex value in ur forEach loop then I would say u should use a count loop because its faster.
^^, requires a boolean to be returned though
No it doesn't.
since?
Ever.
It doesn't run faster or it doesn't require a bool?
You just need to return anything. Nil, Number,String doesn't matter
Oh ok
require bool
ye right
It might just error when you return Nothing. But I'm not sure about that
It errors when nothing is returned
But ye, nil, number or whatever does indeed work
But if you have a forEach loop with 10k elements in unscheduled environment you are doing something wrong.
Just make it run in scheduled
@still forum if I use global variables, wont that effect other vehicles of same type? I want to limit these animations to this vehicle only
but if while is less demanding I'll stick to that
I'm actually running it in an FSM
👋
Really can't think about other ways to achieve an accurate vehicle saving
count does not need a return value. Its just if you return something then it should be a true boolean if u want to count all elements. this is because of Alternative Syntax (1)
FSM's are scheduled anyway
Yeah it was just for pointing it out
@tough abyss is right
When using alternative syntax 1, if you do not return a value you will receive an error in RPT.
alternative syntax 1
Is that the first syntax or the "first alternative" (the second one)?
thats not true
Well it's the alternative syntax, not the default syntax.
@tough abyss Can you post a example where you return nothing?
And at least afaik, or can remember, last time i forgot to put a return value I got an error in RPT
{
systemChat str _x;
} count [1,2,3];
if u are not returning anything than all elements are counted
there is an other reason for those error...
{
0 = 0;
} count [1,2,3];
^ idk about this one tbqh
As I said you have to return anything. Every script command you can call returns something.
if u have nested counts and forget that the inner count returns a number then u get an error
but if u have no return value then all is counted.
just test it urself
Yeah. That returns Nothing. And that's what I mean
example:
There we go ^^
this is nonesense because _x; does nothing
_x returns current index in array
No..
or not curretn index
It returns current element
but the value of current index
_x returns the current value
I'm with dedmen 😛
ye what i mean
Everything returns something
which returns a number which.. for some reason is an error.. mh..
Everything besides one thing.
{ _x disableAI "ALL";} count AllUnits;
test this ... no error
Yeah. @tough abyss Because it returns Nil.
Holy shit. Just start the game and try it out you fucks.
rofl
The return value in the count loop can be number or nil. Other types error
bool or nil*
ye ^
Thanks
So I was right from the beginning then 😃
Agreed.
I give it up... but I know that if u use only commands inside a count which have no return value then u ll get no error
And the current element iterated over is _x inside the CODE block of the alternative syntax of count
@tough abyss The point is that every command returns something (except assignment)
gotta go sadly ...
It's just that the return of many is nil
@tough abyss What I'm trying to tell you is every command returns something.
At some point in time once you've written enough code datatypes appear everywhere
The whole damn language is just datatypes 😛
It get's even weirder when you start adding your own Datatypes.
team addTeamMember member
https://community.bistudio.com/wiki/addTeamMember
Someone defend this
hmpf yeah.. Some coder messed up a bit though. count really errors if the value is not a bool But other values like Number and some more are convertible to bool. So count could really work with more.
Yeah.. I know. Wiki is crap ^^
It's a colloqiualism
And the assignment "operator" reports void in C++, no? Nullbyte
To a beginner Nil is just like Nothing. Because essentially that's what it is. A value that contains Nothing.
But that's the essence here. "A value that CONTAINS Nothing"
When I talk about Nothing I mean Nothing. No value at all
assignment is not a operator. It's a instruction that just doesn't push a return value onto the stack
Hence the quote marks
@still forum okay I agree that.
Every command returns something.
But I m with the wiki:
Nil is nothing
what have I just read
That can btw be fixed by just adding 3 lines of code to the Assignment Instruction. That just returns the assigned value.
So you theoretically could just do a = b = c = d Like you can in C++
But I don't work at BI soo.. That's never gonna get fixed
Sorry for interrupting your old fart discussions..
But does this mean that I finished the available cycles in my script?
http://imgur.com/a/rYZbo
what is this ?
Lol can't send pictures
It means it ran 10k times
diag_codePerformance by default always runs 10k times.
That means it was fast
Has nothing to do with your code itself
Slow code would run less cycles to not make the test take forever
You don't need to assign tmp and you don't need to pass cursorTarget in an array btw
I just saw that alot of people have that habbit to assign needless return values and think they need to pass everything in an array
Lol
Think the assignment thing stems from init fields, which is where a lot of people first do any scripting
Thank you everyone btw
Didn't CBA fix that you need to store assigned values bullcrap?
Yeah one of the more recent versions did
Also, I think the weirdness was that the init field needed to return "nothing"
So you could also just stick nil on the end
Nah. Every single statement had to return nil. Not just the last one.
UI magic. Wrapping it all in a call{%1}
Aha ofc, similar to the UI group name magic
It's even more fucked up tbqh.
Hey Guys, i'm lookin for a way in the debug to find object_x and have placed at all found object_x, an object_y - i remember once i found a little debug script to display all all atms on the map for example, guess this would be kinda the way
but actually i have no clue where to start
if someone could point me into the right direction, would be great
{_x addaction ["<t color='#FF0000'>Save</t>", {[player] remoteExecCall ["ser_fn_updateplayernato"];},[],0];} foreach allplayers;
Okay i have a question why does this work like intended. You have to see i want to add for every player one Save option in the scrollbar. The problem ATM is if i use
{_x addeventhandler ["Respawn",{
params ["_unit","_corpse"];
removeallactions _corpse;
player addaction ["<t color='#FF0000'>Save</t>", {[player] remoteExecCall ["ser_fn_updateplayernato"];},[],0,[],[],[],[],-1];};
]} foreach allplayers;
there is the action added again even if i did not respawn, next thing is it is visible only for another player but not for me if i delete the last part there is only one save on each client and won't be shown to other player. But then after respawn it is not stored because it is on that unit. if i just use player addaction it is visible once again to another player which should not.
Does anyone have ideas or can give me information about that
It looks completely wrong.
Like you add N amounts of actions to the player with N being the number of connected players.
this will not work as intended:
[player] remoteExecCall ["ser_fn_updateplayernato"]
player will be caught from the machine which sends the remote execution and therefore on all receiving machines it will be the same value/object
I know now... i just talked back to Adanteh but still there is more to solve but i think i should rework that entire bottom part with information i just got
just read revos note about remote execution of reveal here:
https://community.bistudio.com/wiki/remoteExec
oh this is an important note. because my development is atm just hosted. i mostly work with remoteexeccall
but i think this could also aply to that
Hi guys. I know that this gives me the ammocount for mainTurret of a tank like this:
_v = _this select 0;
_w = _this select 1;
_ammoPos = _v ammo _w;