#arma3_scripting
1 messages · Page 332 of 1
@tough abyss I meant function library is the better way. but thats not the point. Question is why should a function compiled with function library and called from init.sqf run in unscheduled environment? that is how I understood ur answer. Is that the case?
preinit has the preinit = 1; tag or whatever, it means this will automatically be ran in the preinit
The function is not called from init.sqf or anywhere else
It's called from the library
By the library
okay. understood.
It's necessary to run it with preinit tag. hmm. I think I' ve to reconsider my whole scripting habits
thank u for clarification.
No problem, glad to be of help
@peak plover
another but related thing...
if I like to have unscheduled code at a later time during mission then I cant use preinit because suspension is forbidden. Could I workaround with executing an .sqs script and call a function from it? thats what the wiki implies:
unscheduled: sqf code which is called from sqs-code
Yes
Another question is why do you need unscheduled code?
In some cases you can work around using it completly instead
its just for clarification, no actual use case. sometimes u need it if u want to have fast and reliable results .
thx again 😃
No biggy 😃
hello, i want to pass some variables to my dialog when i create the dialog. Should i first declare global variables and then open the dialog or is there a way that i can pass the variables when i create the dialog?
i made a module that can be opened in zeus but i need to pass through the module tot the dialog so that when the user presses ok in the GUI it will send the module to the function and starts working.
@tough abyss to start script unscheduled isNil {your script here; nil} Also all code from Eventhandlers runs unscheduled. Don't use SQS.
@tardy wagon too bad that encryption will come down to a single point where the key is loaded into memory and used Not talking about encryption though. It's just obfuscation what nigel called Encryption. Can quite easilly be unpacked but then you just have a garbled mess of files. But again very easy to find the config.bin and debinarize it and done. Scripts are harder to get to.
@sleek nova you can dialog setVariable ["myVariable",value]
and then inside the dialog get it back via getVariable again
shouldn't be much of a problem
@still forum this is very useful info. thx a lot.
Added that to https://community.bistudio.com/wiki/Scheduler#Where_code_starts_unscheduled for you
yeah cool.! should be added in isNil entry as well.
And I added a link for functions with pre-init attribute. So everyone knows what's meant.
Afaik it is already in isNil I think.
I searched the page for "sched" and had 0 hits ...
True. I'll add it to the notes
thx
@mortal halo Which script command page is missing? Please write in #community_wiki or mention me when you answer so I don't overlook it. I can also make you a biki account btw. But as you already asked Dwarden better not doubleduty that.
So they are confirmed working?
I haven't tried it myself, but I guess?
lbSetText has 2 variants. Control lbSetText Array and lbSetText Array.
I guess these behave the same as over lbSet commands?
K. I'll add them in a couple hours
Intercept has a huge list of undocumented functions. But I didn't add these to Biki because I don't know if they even work.
stuff like lnbsetpicturecolorright
or lnbsetpicturecolorselectedright
Someone who has time to waste should check.
Basically all the red stuff on this page https://community.bistudio.com/wiki/All_Arma_Commands_Pages
@tough abyss No. over 80% of that doesn't exist
Yeah, param1 and param2 for example are not commands.
Atleast not available in release build. They probably existed at some point in time. And probably still do in the source. They are just disabled
Or they're internal and are only used by the devs.
Which is what I just said. somewhat. Or atleast tried to say
I've no clue what this is but it looks cool https://community.bistudio.com/wiki/diag_captureSlowFrame
Gibberish to 99% of players.
Should be more used than it is IMO. People constantly complaining about bad performance. But too lazy to check why their performance is actually bad.
I always run profiling build so I can quickly check why FPS are getting low in a Mission
@still forum he said he'll only create my acc towards the end of the week. take a look at "All Arma Command Pages" page. There are alot of undocumented important functions
Gibberish to 99% of players.
I think you mean content creators, but that is more their own problem then.
https://github.com/intercept/intercept/blob/develop/src/client/intercept/client/sqf/uncategorized.cpp#L161 This file lists all undocumented functions that are actually in the game
ctrlSetTextRIght is not in there. It doesn't exist in the game
It's lbSetTextRight
lbSetTextRight
its simple
i knew it existed
just didnt know the name
so i sat down for hours
hehe
until i decided to use supportinfo
But most stuff on that all commands page doesn't actually exist. But I have the Intercept list so I actually have a list of commands that exist and need docs
Just need time to add that stuff
yeah
in a couple hours I'll have time to atleast add the lbSetText commands
How did you lads from Intercept find out about those commands?
^^
you can check commands with supportInfo
but it only gives you the operands type
not actual usage or meaning
supportInfo. Basically
We also get description and examples for the commands that have that.
The info that is shown when you type the command in DebugConsole and press F1
I've some weird AI behaviour in my mission.
Prerequisitues:
I'm running an edited domination 3.74 mission. Enemy AI is spawned by HC_1.
Now I ve a script (executed by action menu) which let u spawn friendly AI (on another HC) in all positions where can be fired from of the vehicle u r currntly driving.
Those AI is NOT joined in players group, it has its own group. This is needed to hold the locality of that AI to HC and NOT get it to players client.
This is essential because those AI should use the ASR AI Mod which is enabled on HC (on server as well).
The script is a variant of this one:
https://forums.bistudio.com/forums/topic/205284-solved-get-servers-ai-instantly-in-player-driven-vehicle-in-mp/?do=findComment&comment=3196078
Behaviour:
The AI is just not firing on enemies... its sometimes aiming but not firing.
What I tried:
I tried to reveal all by any player known enemy AI to that AI gunners to ensure that these AI gunners know about enemies. But this helped just not.
What I need:
A suggestion a hint or anything that leads me a new way because I ve no clue why that AI isn't just firing on enemies.
Do they fire if player leaves the vehicle?
can't say for sure but I think they don't. what r ur thoughts behind that question?
Well I've experienced similar things since arma 1, that ai in vehicles won't shoot at targets if you don't command them to do it. and as soon as you dismount they fire
Could be unrelated
sounds very related and an BI issue.
but what Im actually thinking bout is if it has todo with turrets locality. Maybe turrets locality is not changing from player (who has vecs locality) to HC. I think this could cause such thing.
I assume you lack the information to wether this odd behaviour takes place in singleplayer/editor environment
I ll test that later ( but Im at work now).
Alright, sure let's just get some ideas out there 😄
thats why I posted here, to get ideas 😃
Also
In your script, when you evaluate the seats for vehicle
There is a lot of else
I had that as well before but now I use ```sqf
call {
if (isNull (assignedDriver _vehicle)) exitWith {
_unit moveInDriver _vehicle;
_unit setskill ["aimingAccuracy",0.1];
};
if ((_vehicle emptyPositions "Gunner") > 0) exitWith {
_unit moveInGunner _vehicle;
_unit setskill ["aimingAccuracy",0.1];
};
if ((_vehicle emptyPositions "Commander") > 0) exitWith {
_unit moveInCommander _vehicle;
_unit setskill ["aimingAccuracy",0.1];
};
if (count _turrets > 0) exitWith {
_unit moveInTurret [_vehicle,(_turrets select 0)];
_turrets = _turrets - [ (_turrets select 0)];
_unit setskill ["aimingAccuracy",0.1];
};
if ((_vehicle emptyPositions "cargo") > 0) exitWith {
_unit moveInCargo _vehicle;
_unit setskill ["aimingAccuracy",0.1];
};
};
because it looks a bit cleaner
thats not the script im currently using
Using call and if exitwith looks a bit cleaner then 100x else
I know and I think Ive improved it meanwhile
if not... I ll do ;-D
Also I love your name, it was my favourite thing in math for a while
I ve that pseudonym sins 20 years in www and its really good because that name is unused on every webservice where I like to create an account 😃
Hmm, can a function be turned into a string?
Ex.
_func = bis_fnc_endMission;
_mystring = format ["%1",_func];
and later use ```sqf
call call compile _mystring;
why not _str_func = str(bis_fnc_endMission);
I'll try that, got a update can't launch ;'(
probably, but i guess you might run into rare issues
Yeah, it just puts the whole function into the string
But is there a way to only put (bis_fnc_endMission) in there
I want the variable not the value of the variable
There must be a way
Well where are you getting the variable to contains the function code from?
I mean functions are just a code type variable
Yeah, but I want to be able to send the function over internet
If I try to send a string that's the whole function, it will cause network lag
I guess my only alternative is to just string the function in the beginning
RemoteExec?
_myfunc = "bis_fnc_endMission";
call call compile _myfunc;
Yes but where is it coming from. Are you just getting the CODE type variable into your function or what?
[_unit,spec_fnc_exit] call respawn_fnc_addRespawnUnitScripts;
Also call missionNamespaceGV ["fnc",{}]
is there an easy smart way to truncate what "player" returns? i just want the name of the player not "1-1 alpha remote playername"
Anyway
I guess I'll just have ot use [_unit,"spec_fnc_exit"] call respawn_fnc_addRespawnUnitScripts;
Well yea
If you only have a value, there is no direct link to a function variable necessarily
Unless you parse allVariables and hope it a variable in a namespace you check
I just want to be able to add a script to my stupid event handeler, I guess this'll do
Yea since you already know the name
Just figured I might try to give the possiblity to use a function instead of a string and stuff...
If you just had a value of 1, good luck finding the variable that was the original source of it, if it exists
So you already have the name of function since you wanted to str it
Why add more commands instead of just adding some quotes :P
nvm on my question i just found profileName
Yeah, I wish there was a command like varName so I could _varN = varName myvariable_1; //"myvariable_1"
Yeah I know, I'm just overthinking and making things overcomplicated again
Stupid brain...
Well the issue is where you have myVariable_1 on the right side of the = operator
Its simply a value, there are no references to any variable that might also contain that value
The sort of exception is the preprocessor commands but they of course get resolved before the script ever runs
Yes, getvariable/setvariable can be used instead for cases where I get variable names which are generated inscripts
Im not directly following
I meant the fact that when you start interpreting the script, everything to the right is just values
Right of the = sign that is
Yes, but I require the value of a variable that I do not know the name of
So now where getting back to where do you get the code type variable from?
Eg the value youd feed into a varName command
Its there where you need to solve it
Because now youre basically asking which variable contains 1
Theres a sneak tho, i think the cfgFunctions framework inserts some shit
__functionName or whatever
Yeah, so I can relay the variable that currently contains 1, which might change and I might want to use the same variable later
Does that even make sense?
ohh shit, I've lost it... nvm... nvm
okay
i need help
whats the action for dropping an item (specifically, a vest or uniforms) into a container
there's DropWeapon
there's DropMagazine
there's DropBag
but no item 😱
Uniforms and vests did not exist before arma 3, That's probably why you can't find the action
is it all engine hardcoded in the vanilla inventory?
You can try creating your own functions for that https://forums.bistudio.com/forums/topic/168642-drop-uniformvest/?do=findComment&comment=2652183
This'll get you started
yeah i went to do this with the dummy unit workaround
not possible because there is no action
You just make your own action that grabs the uniform data, deletes it and recreats it in the container/on the ground
but how would you execute a function that you only have the name as string?
call call compile "bis_fnc_endmission"
wuups scrolled up 😄
well the thing is
hmm ok
wait hold on
why are you not customizing the vanilla inventory and keep this functionallity in from it?
because vanilla inventory sucks in every possible manner
i am making a complete redesign of how it works
Didn't ace2 have custom inventory?
Yeah, inventory can be pain.
lemme explain the basic functionality here..
my inventory system is complex. basically except for the assigned items - i grab each and every possible container and make a "window" of it
so a container could be the players uniform, player's vest, player's backpack
but also
ground holders,
dead bodies' uniforms
etc. etc.
there's no actual menu but rather a 3d camera rotating around the player and the nearest supply containers are floating 3d button
clicking on a button opens the container window
you can open as many containers and move items between them
see
that's like
totally redesigned
i have the whole UI set up
the only thing left is to implement populating windows with items
Whoa, that sounds really cool
yeah
Got me all excited
it is
obviously currently i only have the ui part going and only the player containers are hardcoded to display
but yeah
old max payne style esc menu cheating 😛
rotating camera will be abused for sure
but still a cool idea
@peak plover CODE is basically just a String.
use _string = bis_fnc_endMission though
this is going to be part of a survivalish kind of mod anyway
you can't go survival without abusing 3d here
especially in arma
1p is always better
yeah i know but im not hardcore enough
@still forum _string will be too big for networking, if I intend on having more than one big functions
Why do you need strings for networking?
if you publicVariable a script it sends the string AND the compiled instructions. So if you send code it's actually bigger than the string
I'm currently only sending the fallowing > "bis_fnc_endMission"
Instead of the whole function only the function name
Some examples ```sqf
// TO UNIT:
// [_unit,"spec_fnc_exit"] call respawn_fnc_addRespawnUnitScripts;
// TO SIDE:
// [side,"_unit setVariable ['reSpawned',true]"] call respawn_fnc_addRespawnUnitScripts;
anyway about my problem. the workaround you suggested @peak plover is probably the only way to go here. the only problem is... I am dealing with not a single container but an array of containers. there can be multiple vests of the same type with different items in them. this can be easily solved using a hashmap.. but this is not an object oriented environment here so im gonna have to make 2 arrays - one for the types and one for the items and manually link each type to its items
this is getting really out of hand 😦
but i'll do it.
Why don't you just send Code instead of string @peak plover ?
@peak plover isn't remoteExec already only sending the function name to the target?
no
[] remoteExec ["someScriptCommand", targets, JIP];
But if you remoteExec {call bis_fnc_dummy;} that's way less networking load than sending the whole thingy
yeah
that only sends the name.
Didn't think of that variant
These commands are not to be executed instantly
I add this to the array of scripts/code which are all strings which will be executed at one point
This way I get the least amount of traffic at once. If I want to add some stuff for player to run when it respawns I can do that. But if I used the server to manage all the players and remoteExec for all the scripts/functions. when a ton of players respawn the traffic would be insane
is there a function i might be missing
to get item cargo
without vests / uniforms (items with containers)
i need this badly if it does
like now
or else im gonna have to do soooooooo many array substractions 😦
You need to get a list of items inside container?
no no no
nevermind actually
it is so god damn stupid to categorize an ACO scope with a god damn heavy plate carrier
where's the logic
backpacks have their own category because arma 2
cant you add a new one for vests and uniforms? 😦
Maybe there is one but it's not implimented in sqf or not documented
Jeezz 😄 don't lose your mind
Again nigel. Just use code instead of messing around with strings and compiling stuff
I don't understand the benefits
compile is slow
If you store the code instead of the string you need a little more memory. But don't need to compile anything
also you don't need to mess around with quotes in your string
So ```sqf
_nul = {
_code = call compile _x;
_nul = _unit call _code;
true
} count _respawn_scripts;
where ``_respawn_scripts = ["bis_fnc_endMission","_this setVariable ['dude_dead',true,true];``
should be instead ``_respawn_scripts = [{---code frmo endMission---}, {_this setVariable ['dude_dead',true,true];}];``
And I remove compile
The issue I'm getting is that what if I have 5 functions and I add them from a remote client or I want to remove some of the functions
Also publicVariable might not work if there are qoutes in the function?
no
_respawn_scripts = [{call bis_fnc_endMission}, {_this setVariable ['dude_dead',true,true];}];
otherwise yes
Hmmmm
I'll try to send bigger variables and see what happens
How slow is compile is also a good question
Ohh wait
ohhhhhh
_script = {bis_fnc_endmission};
{{Contentsofscript}}
holy shit
after much debug
the function works
I took a vest, put 4 first aid kits in it.
put it inside a box.
then I made a complex algorithm and i replicated the container into another box
and
there you go! 2 boxes, with a vest and inside the vest 4 first aid packs - each
that single function spanned across over 5 hours and two scripting sessions. one sitting for researching how this works and the other implementing
gonna do a test soon on a box << backpack << weapon << aco sight
see if i can replicate that
nice
holy shit, yeah that's deep
consider magazines and their ammo count aswell
format ["%1",{(bis_fnc_endMission)}];
//{bis_fnc_endMission}
This is actually what I wanted to do, thanks dedman
The curly brackets can be though of as quote marks and CODE as strings.
That's brilliant
What?
the use of curly brackets
Usually it's done like this:
{call My_fnc_aFunction}
So it's still executable, but saves memory and is faster to recompile as eventhandler.
_nul={call call _x;false}count [{myFNC},{yourFNC}];
While it does look weird, I guess it works.
What's the _nul for? It seems to me that it always results to 0.
count results to whatever number but I don't want a random number going around my scope
Sometimes causes issues
It doesn't unless you're working with those ingame init boxes in the editor
I could swear it happened to me more than once and now I do it out of habbit and fear
Okay, but that seems to be very superstitious.
You could say that the "return value" of the assignment "operator" is more prone to cause problems, especially when it's the last operation in your function.
The quote marks are there to please Dedmen.
The script could be broken.
but it works with all other items
Have you tried it with the mine detector?
if he counts it correct?
No, but if it doesn't, then we know that the script is broken.
well the microdagr is fine too only bandages and earplugs and stuff like that
Try the vanilla mine detector.
why is arma scripting such a pain?
I guess that means that your script does not work with the vanilla mine detector?
Hmm, then I don't know why that would be.
even other mod items work...
wish there would be something like UE4 script visualisation for arma where u see in a visual why where there problem sits while play testing would make stuff way more easy
What does counting items mean here anyway?
Well. You could just use a Debugger. That is essentially UE4 script visualization
saw a release of arma ied but still
diag_log after every line, then you know exactly when the error occurs
IED? RUN!
is there a reason on my other project i placed a 20-30 weapon crates and it totaly wrecked the performance ?
Maybe too many operations.
visual programming would fully be possible using SQF
however ... i do not know of such a framework for wpf so ... wont create a tool for it
(just like you can do all languages with visual programming as it essentially just is a visualization of an AST)
What's the best way to remove an array element?
Thanks, well, it will proboly not work in a loop, because it might shift the array when deleting
I'll make a new array and use pushback
or you use select to filter the old array and move the result into a new one
{
if (whatever) then {
_arr set [_forEachIndex, objNull];
};
} forEach _arr;
_arr = _arr - [objNull];
I've never used the select filter, but I've seen it used many times
It really depends on what you're trying to do exactly.
_respawnUnitscripts = [[{myfnc},false],[{yourfnc},true]];
_respawnUnitscripts select {!(_x select 1)}
Does this make sense?
But it says !, so it should select myfnc
yeah
_respawnUnitscripts = _respawnUnitscripts select {!(_x select 1)};
Whoa, yeah select looks pretty awesome
i love it
It is.
Sometimes I wish it had _forEachIndex, but I guess that would be weird as the array size changes.
Well, the name is weird, but it would work.
or u just count while exexuting select ... would be easier.
like _n = _n + 1 ?
yes
Yeah, that always works ofc, but it's not very convenient.
_respawnUnitscripts = _respawnUnitscripts select {
if ((typeName _x) isEqualTo "ARRAY") then {!(_x select 1)} else {true}
};
Correct use of select?
if (_x isEqualType []) then {
Think it'd be hard to take a script from escape Malden and put it into Escape Tanoa?
Thanks commy2
_respawnUnitscripts = _respawnUnitscripts select {_x param [1, true]};
It would currently involve making a BLUFOR helicopter into an OPFOR one and then spawning it via the special events scripts
This is what I'd use instead of what you proposed.
Warrants a comment though, since it's probably not obvious to the not SQF veterans.
wait, does 1 param [10,false]; work?
Yes, it would report "false".
Whoa, mind blown
Because 1 would be treated as [1] and that array has no tenth element, so it uses the default value
param is THE command when dealing with arrays. The only reason to ever use select is because it's faster in simple scenarios when you already know lots of things about your array.
Does params have the same features? as in 3 params ["_a",["_b",3]];
But it still works if I feed it a intriger instead of an array?
a intriger?
oh integer
uh, think so?
test it in debug console 😛
should be fine
_a would be 3 and _b 3(default)
works, whoa
nigel is easily impressed.
Or... maybe, these things are just extremely impressive
I was impressed when they added them like 2 years ago.
They changed a lot about how SQF looks.
they did?
Arma 3 didn't have these commands at launch, so yes, they were added in a patch.
Release date: July 16, 2015
wow, 2 years and 2 days
yeah well params doesn't really change how SQF looks imo, it's just another command
Except that you now have one line handling all passed arguments instead of one line for every one plus one if for all the default values.
how does x39 feel about params?
it didn't change the looks. Except almost every script function that has parameters starts with a call to params now.
So it didn't change how SQF looks but how every SQF script file looks
so it kinda did change how SQF looks didn't it?
So you're saying it didn't change how SQF looks, just how the beginning of almost every SQF function looks.
Yeah.
just saying oneoh is wrong in a very weird way
params is a game changer and so is param, even though it's still underutilized imo.
In different ways.
a lot of new stuff is underused
Goes to show how much copy pasting is going on.
Most people apparently learn from old Mission scripts
That's the nice way of saying the same thing.
It's true. You saw that learn mission post on armaworld
and even the guy building a Mission so that everyone can learn from it doesn't know about params
The real question is which is faster, select or count, for executing a function for a large array
For every element for a large arra
count
because select well... if you always return false..
if you always return false then select is theoretically as fast as count
select and apply create new arrays, so...
Hmm
yeah. But if you always return false it's an empty array
and that's not much different from a number
processing time wise
me wrong? that doesn't sound likely
There is probably a bit more going on in C++ land for select though compared to count
count = 0.0442 ms
vs
select = 0.0444 ms
code inside brackets sqf {_x distance player > 1000;false}
execute that about 10 times
One thing I prefer about selectvs. count is, that the select version has the array first and then the code. It seems to me that that is easier to write down for whatever reason.
Yeah it does, they both have their uses
you use macros everywhere though so you have strange tastes commy
I need to get in on that macros, I want to see if it influences performance
They don't influence performance at all. And if they do, then probably negatively.
they don't.
why would macros change performance?
they might increase preprocess time by a few microseconds
considering that's only done once per script.
hmm, I want macros for easily readable scripts 'tho
Well you could use a macro for it's readability even though it's not the most performance effective solution. That is what I mean.
if you execute all your scripts via execVM then it's probably worth it not to use macros
but macros have 0 effect at runtime. And that's what you have to care about.
That's always in consideration, always
if you execute all your scripts via execVM <-- Why would you do that oO
I'm also considering going from conventional function names to fnc_01, fnc_02. This will save on characters
you must be trolling now
It's shorter than writing spawn compile preprocessFileLineNumbers @jade abyss
less bytes per script and less time to process shorter variables
I actually was considering it
@jade abyss Some Mission scripters do that. And most People copy from these idiots
Oh my...
yes i'm going to learn korean so i can say more in fewer characters
@peak plover Don't.
korean characters proboly take more bytes than normal/numbers
I was already writing kind of a dictionary for the functions
what kind of life do you lead nigel?
lol
if you go from myasdasdasd_fnc_asdwekjfetgehjgiesjfoskfoiesfihjesfhesfjesiofesifesfesiojf to my_fnc then it is actually worth it. But don't.
If you want to get max performance... Never call functions
inline everything
Well, if this script runs 1000 times in less than a second then, yes I belive it might make a difference
Having a program that converts regular script into a oneliner might be cool as well
But wait, doesn't the engine do that?
replace \n with nothing
notepad++
done
the engine compiles the code into binary internally
at runtime there are no spaces or newlines
or semicolons
or comments
it removes bugs too
and fixes missing ;'s
except if you use comment "My comment" That will still be there and eat performance at runtime
🌴 😵
comment "My comment"
ahhh the function nobody uses
I think either CBA or ACE uses comment atleast once. Atleast it used to
yeah but they use macros too because they're satanic
@little eagle bad commy! Bad commy! Shame! SHAME! SHAME!
Doesn't matter, found a reason to blame Commy. Leave me alone.
and ensure a clean codestyle. Getting rid of over 50% of typos
No, Dedmen, comment is never used, because it's like the one command that does have absolutely no use.
And fkn up readability =]
if you typo a macro you get a compile error. If you typo a variable name you get weird unexpected behaviour and bugs
I thought comment was used in some string script because // wouldn't work in there.. don't remember
No, even then you could just put the comment as string into the code and don't use the command.
The command literally just eats execution time for nothing.
does Arsenal loadout export use that? maybe?
ye
Then that's probably where I saw it used
Yes, but you could just remove the comment command and nothing would change.
Wasn't it just copyToClipboard and diag_log?
true
I guess it could be faster for an empty function that only contains a comment.
{
"does nothing";
nil
};
vs.
{
comment "does nothing";
};
would putting a load of comment "blah" in an each frame EH do anything? or would it just be ignored?
0.0002 ms
0.0002 ms
Nigel, exec at least 10 times.
@jade abyss probably not. That's searching if a variable exists. seeing it doesn't then allocating a new variable and moving the string in there
òneoh, comment is a command that reports nil and expects a string.
It does take execution time
the comment command takes a reference to the string from the stack. and does nothing and returns nil
0.0069 ms
0.007 ms
so it's not even stripped out like a //?
Tl;DR;
useless command.
Nope, oneoh
No. That's exactly the point
which cunt thought we needed this command
¯_(ツ)_/¯
0.0001 ms faster when run 10 times
i thought it was new?
I argue that this is a true useless command, yet types like X39 will defend it and actually use it.
rly Nigel? massive 0.0001ms faster!
nooooo
(relatively)
lol Commy
OFP old that command is
Well comment is 0.0001 slower, the other one is faster
you are literaly a reatarded @rancid ruin
you spelled retarded wrong
ah! trigger activation field! // doesn't work there that's why comment is used there.
you are literaly a reatarded
and literally
as you're able to introduce comment lines with semicolons in a SQS script.
pressed accidently three times the l ... corrected by pressing one time too much the backspace
Don't ask
comment can become useful in cases where you need to be able to find the start of something
only ever used it in ArmA-UI-Editor for custom events when the editor used some partion of eg. the init event
Revo
comment can also be used to create comments inside trigger activation fields where // or */...*/ does not work.```
@still forum
if you need to mark the start of something just use //start
So Trigger again (damn you trigger)
yeah. I already wrote that above ah! trigger activation field! // doesn't work there that's why comment is used there.
Ah, haven't seen it
What's so bad with triggers?
in config strings not possible @still forum
init = "sometoolcode; comment ""userspace""; someusercode;"; was the way to go
And if you write your code inside a string (cuz you're dumb) then you also have to use comment. Because you can't preprocess from string. You can only preprocess from file
why am i a retarded 😦
Reasons, oneoh
because you try to get drama out of nothing
like... erm...
init = "sometoolcode; ""userspace""; someusercode;";
again you can just use the plain string without comment in there
how is this different?
that doesn't sound right
I think Dedmen wrote the one use one could consider.
init = "sometoolcode; /*userspace*/; someusercode;";```
no Dscha
I think that errors, Dscha
i think someone needs to add a new channel called "Scripting - showdown"
i am not sure, i think i used that before
won't work if not preprocessed. And I think that won't be preproced
or scripting discussion
because we ALWAYS go offtopic in here
yep
^ smart man
How so? This is very much on topic.
When your brain boils it's good to have a few arguments about the tiny things
you just need to advertise it
i am a very smart man when i'm not trolling or being a retarded
yeah. we're not offtopic right now
yep
but often
How often is that? @rancid ruin 😄
99% of the time imo tbh
oneoh is literaly reatarded.
🍪
very literaly.
quiet literally.
-l
-2
whenever i see commy's name i think of that "macho macho man" song except it's macro macro man
anyone else?
Better a macho than a wimp I guess.
🤦
tbh it's only because i want to be a macro macro man
end-user might delete such strings ... which is dangerous as that would "harm" the tools experience
thats why the comment
with the comment command they at least barely know "ahhh ... maybe i should not touch this" ... and there are plenty of dumpasses out there who still would remove it as they want a "CLEN CUNFIG"
"start also pls no delet"
What kind of code would that even be that has to separate the config entry string like that?
cannot remember anymore
nee dto check
Seems weird to me.
https://github.com/X39/ArmA-UI-Editor/search?l=C%23&q=comment&type=&utf8=✓
SQF Properties
where a special kind of properties that can be added via AddIn that perform a set line of events
eg. storyboards are not possible using good old configs as far as i know
Do i need to grab my popcorn again?
🍿 lets share
the fuck is wrong with you guys
they are all a retardeded
literaly.
i know
it is the default mindset you need to even start playing arma
Totally literally.
-l -l
apology accepted.
looks pretty much like this:
//in config
onLoad = "comment ""<{0} ctrlShow {1};>"";(_this select 0) ctrlShow false;comment ""</{0} ctrlShow {1};>"";comment ""<{0} ctrlEnable {1};>"";(_this select 0) ctrlEnable true;comment ""</{0} ctrlEnable {1};>"";";
//extracted
comment "<{0} ctrlShow {1};>";
(_this select 0) ctrlShow false;
comment "</{0} ctrlShow {1};>";
comment "<{0} ctrlEnable {1};>";
(_this select 0) ctrlEnable true;
comment "</{0} ctrlEnable {1};>";
That looks horrible though.
it is an editor
there is no need to manually edit theese fields
I don't believe that this had to use comment though.
how you would want to make user space stuff and multi-sqf properties possible in a generic interface then?
<group name="SQF">
<sqf infinite="false">
<name>Enabled</name>
<format>{0} ctrlEnable {1};</format>
<arg index="0"/>
<arg index="1">
<boolean/>
</arg>
</sqf>
<sqf infinite="false">
<name>Displayed</name>
<format>{0} ctrlShow {1};</format>
<arg index="0"/>
<arg index="1">
<boolean/>
</arg>
</sqf>
</group>```
make a seperate config entry that stores your information
onLoad_UIEditorInfo
that wouldn't need to be scripting conformant and executable
onLoad is the config based event
since when you can have more then one of those?
see the point then?
no
#rekt
You have two entries onLoad with your script and onLoad_UIEditorInfo with all the other info you need to store alongside with that script
you can even store the XML you posted above
UIEditorInfo stuff still would need to be executed
onLoad thus would require a hook for that
UIEditorInfo stuff still would need to be executed
Why?
because those are things that are setable in the editor?
So?
The comment's aren't executed either.
So having them in a string or in a separate config entry makes no difference.
As I said. Put the stuff that needs to be executed into onLoad
the stuff in the Info variable doesn't get executed and doesn't need to
because everything that needs executing is inside onLoad
you mean carry another field for the offsets or what?
requires updating the offsets with each update for onLoad which can get bloated too and can cause easy trouble when user edits the field by hand
true
you need to update both fields
Your one field solution doesn't create any problems if the user edits it by hand?
only if he puts code inbetween the comment sections
as his custom code would vanish
with every edit
or if he deletes the comment
which would break any other solution too 🙈
so not much different
What if the user edits your comments away?
back when i coded that i put quite a lot of thought into it
and that was the best solution in my opinion
user still could edit the field if he wanted manually, i could get the required info without any problems
as said @little eagle any other solution would break at that point too
I question that the solution you came up with is the best.
feel free to find a better solution
Well dedmen convinced me of one.
next week the implementation of the ui editor in arma.studio will start
so ...
i am open for ideas
It's better because it doesn't use comment.
how many people use this program anyway?
in your info struct you can store how long your part of the script is. So then any user could add onto the End without problems
quite a lot actually @rancid ruin
cannot say how many exactly as i only see the requests to the version
but still everyday at least one is on board
at least one person per day uses it?
would not solve that every property might or might be not set
it all is pretty dangerous to use when user manually edits
eg. he could place stuff in front of the field as he just thinks "that should work or shoulndt it?"
and all that stuff could break
as said: best solution was imo to create a start and end tag and put stuff inbetween
everything else is userspace
and does not requires a hacky way that could be broken easily by a Luser
you can do
""<UIEditor Code starts>""; code; ""<UIEdtor Code ends>""
no comment. And the user clearly knows he shouldn't edit inside there.
And as you need to use the seperate info field you can now store as much info as you want without bloating and wrecking the readability of onLoad
"pls no edit"
if there's only one user i'd just email him and let him know of the best commenting policy
today only i got ~10 accesses to ArmA-UI-Editor update api page
how many were from your IP?
only one
not one user. One per day atleast. Online. Using it.
one access from my ip
that was what i was talking about
SELECT * FROM `analytics` WHERE path LIKE "ArmA-UI-Editor" GROUP BY timestamp, source```
if one can improve that little SQL query, you can get better info
need to learn for exam
Now we're off topic.
oneoh wanted to know
cool
ArmA-UI-Editor is a tool (not that wide appliance) without any advertising of mine going on
wanna now compare it to a framework that ppl have to use to get access to mods they like?
great idea
But how many of thiose 1 mil subscribers are from <insert undesirable group here>
/jk
@rancid ruin https://docs.google.com/spreadsheets/d/19-M_2KxvmY14KYBRoGwOYSgZjkVCgKW4gbxGNcl2oyc/edit?usp=sharing refined data
private _player = objNull;
{ if ((name _x) == "h0nkX") exitWith { _player = _x; }; } forEach allPlayers;
private _adminPos = getPosATL _player; _adminPos params ["_posX","_posY",""];
private _adminUID = getPlayerUID _player; private _marker = createMarker ["veh", [_posX, _posY]];
_overxiled setMarkerShape "ELLIPSE";
_overxiled setMarkerBrush "SOLIDBORDER";
_overxiled setMarkersize [1, 1];
_overxiled setMarkerColor "ColorYellow";
_overxiled setMarkerAlpha 0;
_bomb = "B_Truck_01_transport_F" createVehicle getmarkerPos "veh";``` always spawns me 5-8 vehicles at the same position, why is this?
@waxen jacinth surely thats not all of the code if that is the case
@subtle ore updated
where is that script callen
debug
if you call that script 5-8 times then indeed it spawns 5-8 vehicles
Global or local execution?
global, so it prolly spawns for each all player?
Yep
ha
for every instance on the server
^
if you got 8 clients, (server counts as client in net architecture) it will spawn 8 times
but if executed local, vehicles still visible to everybody - right
wasn't sure about that
since it's local, how would i circumvent that to spawn it not for all instances
there is createVehicleLocal if you want a local vehicle. Thus through logic thinking you can deduce that createVehicle is global
@still forum Explain this https://community.bistudio.com/wiki/addWeaponGlobal then.
would mean that addWeapon is local
Though this add's weapon to a unit
and unit inventories are always global I think
Lul
the addWeaponGlobal command will replace the weapon currently in a slot with the added weapon if it shares the same slot
KK comment: If you do not remove weapon first, using this command from dedicated server will duplicate weapon.
My fav:
In Arma 3, the alternative variant of this command (addMagazine ARRAY) accepts global arguments Arguments of this scripting command don't have to be local to the client the command is executed on, i.e. you can use it on the server to give remote unit a magazine with limited ammo.
// Remove the script to the list
_unit_scripts = _unit_scripts select {!(_x param [0,nil] isEqualTo _script)};
very select
exciting
Might as well write param [0] if the default value is nil. I'm also not sure what select does if the code reports nil.
Removing to a list doesn't make much sense
you mean from?
and... use deleteAt and find
_unit_scripts deleteAt (_unit_scripts find _script)
I too suggested deleteAt, but I guess this handles multiple?
Dunno. Also worth thinking about good old - [_script] then instead of this.
true. That might be even faster
I seldom handle arrays full of code (script ?)
It handles multiple, yes
_unit_scripts = _unit_scripts - [_script] then
0.0514 ms
vs
0.0524 ms
Check mate
- [] is 0.001 ms slower for x100
Im actually more suprised to the select thing
It actually works, and it's nice
how big is your _unit_scripts array?
Currently it's empty, but it might be 1000s of elements
One day
I am prepared for that day
You are perf testing something on an empty array?
There is no point in testing it if the array is empty.
test again with a few dozen
am im the only one who does not understands what point the whole code has? did i missed something?
you are the only one
The point is to remove some elements from an array.
Seems like something common and straight forward.
_script makes no sense for me
0.0541 ms // select
0.0536 ms // -[]
It's a variable, X39
no shit
// Removes respawnUnit scripts to the unit specificied
// [_unit,{spec_fnc_exit},"onRespawn"] call respawn_fnc_remScriptUnit;
"respawn_fnc_remScriptUnit" spawn debug_fnc_log;
// Code begins
params ["_unit","_script","_scriptType"];
/*
unit_onKilled_scripts
unit_onRespawn_scripts
unit_respawn_scripts
*/
// Get the scriptType
_scriptTypeName = format ["unit_%1_scripts",_scriptType];
// Grab old scripts
private _unit_scripts = (_unit getVariable [_scriptTypeName,[]]);
// Remove the script from the list
_unit_scripts = _unit_scripts select {!(_x param [0,nil] isEqualTo _script)};
// Update the script array on the unit
_unit setVariable [_scriptTypeName,_unit_scripts,true];
why are you using // not comment command?
if _user_scripts is a collection of scripts
what point does removing one has?
multiple instances of the same are also kinda stupid
seems like a concept issue for me
I'm new to this, leaf alone @rancid ruin
so @peak plover considering it might have thousands of entries. Do you choose the remove method that's slower if you have more than about half a dozen elements? Or do you use the one that's fastest for 2 elements?
yeah. Multiple times the same script actually makes not much sense
you should use pushBackUnique and then stop having to care about multiple instances in the array
<array> select <code> to remove those could also be replaced by a simple <array> - [ <code> ] which should be faster for non-empty
Which we are talking about right now inbetween your messages @queen cargo
Is it CODE or SCRIPT we're talking about?
@queen cargo There can be cases where I want some thing to happen more than once, like stack it
is there a difference?
{CODE}
SCRIPT = execVM "blah"
SCRIPT = [] spawn CODE
code
the purpose still is not clear to me ... why you remove all isntances of a particuilar code?
why not execute all and then clear the array?
I guess naming it wrong is the mistake here
There might be cases, when a punishment code is applied to player and then I want to remove it
Or a reward is given to the unit for respawn, but then I want to remove it because something else
What if
It's a very abstract task to handle arrays full of CODE. The whole thing could probably be made obsolete. It's like a bureaucracy working on itself.
@queen cargo Think of it like removeEventHandler
He removes a element because he doesn't want it to execute anymore
Exactly
but he still wants the others to execute
so why not execute all and then clear the array Because that doesn't make any sense
That made a lot of sense actually.
I have a variable _keep, which I use which determines if the code is removed when used
I mean, what you said before. Not X39.
the whole concept seems weird to me ...
if it is seen as event handler, the stackable thing makes no sense
as it is for executing after death the remove all thing would make sense
if it was just for a set of actions after death and additional actions based on events (eg. killed by idk ... a grenade adds a grenade on respawn to player inv) then two arrays would be the most simple way to archive
It's not to be executed after death. It's to be executed all the time I guess.
// Removes respawnUnit scripts to the unit specificied
haha, specificied
It can be used to remove scripts which may run onRespawn, onKilled and respawn. I guess yeah it's like a custom event handelere
Stackable eventhandlers make no sense?
why add multiple instances of the same EH?
But those don't allow this kind of customization
because you want the script to fire multiple times
I can have mission_onRespawn_scripts and unit getVariable ["unit_onRespawn_scripts"];
It's not like he copies the whole function. He uses stuff like [{My_fnc_blah}, {My_fnc_blah}]
Also there is no event for custom respawn. Essentially onRespawn is when unit goes into spectator, then respawn is when he comes out
But I can't use events from a single spectator script, because I might want to switch them out
This is a base so I can have 3 spectator scripts and switch inbetween using paramaters.
Basically where you see solutions I see issues
What if scenarious
Makes sense
More than using comment.
Damn it, Commy you're buying my popcorn this time. Not enough in the budget
most of this channel is people arguing for 2 hours over 0.0001ms
Like that's a bad thing?
"ooh, there's people with immense passion about what they do, all they do is try to figure out the best ways to do the smallest things"
you tested on an empty array right?
with a filled one it should be slower due to code execution vs engine
Tried with a filled one
He retested it after I told him. At 9:25 PM
@rancid ruin that's the point of #arma3_scripting.
why do people write stuff like 0.0001ms. Just write 10e-7s instead.
Wouldn't that be 10e-4s?
No.
fewer keys need pressing, saving me 0.0001ms
It's 1e-7 or 10^-7, but maybe I was too obvious with the trolling.
Ahhhhh fuck typing on mobile.
soo... 1e-4 is 0.0001?
1e-8 @little eagle
milli is 1e-3
Oh ffs.
:joy:
Thank god.
oooh, you said s. so it's ms with the combination of 1e-4
seeing duplicates already 🙈 thought it was 4x0
Classic X.
yup, nigel
missread 🙈 thought 0.00004ms was written
Damn, this is pretty sick.
lmao, learning lots of new things today.
And yeah stacked EHs really don't make sense when you think about it.
Nothing makes sense if you think about it long enough.
that's deep
It's also false.
Write it in EEE standard for float please
So how do I go about displaying text on the screen with display?
ctrlSetText
Fixed.
Assuming rscCut
Or cutRsc.
Basically I need an example of a RscTitles config.
Make a CT_STRUCTURED_TEXT and use ctrlSetText
private _control = findDisplay 46 ctrlCreate ["RscText", -1];
_control ctrlSetPosition [0,0,safezoneH / 5, safezoneH / 10];
_control ctrlCommit 1;
_control ctrlSetText "COMMY WAS HERE";
Thanks
Hello, I can't understand a part of a wiki page ( https://community.bistudio.com/wiki/addMPEventHandler )
Specifically where it is stated that :
"MP event handlers are added globally to every client on network in multiplayer and will fire on every client too upon event."
I wanted only to add a killed event handler which fires on the server , is this the command i'm looking for?
You can add a isServer check
I actually didn't know it did that. Commy probably knows best but he's gone to bed already
There is always EntityKilled (missionEVH)
KK's comment confirms what the wiki says
@dusk sage and where will this event handler fire?
@still forum I'll just add a check then
addMissionEventhandler is local
^, if you add it on the server, just there
Cool,but I can't attach it to a specific object unfortunately
So will just have to use mpkilled,right?
if you check isServer and exit directly the perf impact on clients will be negligible
""Killed" and "Hit" eventhandlers are executed where given unit is local." D:
Yeah sorry didn't specify that
Seems odd
Actually I want vehicles local to players to be tracked
From the server?
how does one determine if a vehicle is a jet/plane?
i assume theres a config about somewhere
Yeah exactly
@tough abyss isKindOf 'Plane'
Will the EH throw an exception if the function does not exist on the client machine?
what function
nothing throws an exception
@tough abyss Ayy, don't worry about it
I don't even know how to give EH a function that may not exist 😮
Well the function I want to execute from the EH code
Well actually,let's suppose i'm doing something like this
_vehicle addMPEventHandler ["mpkilled",{_this call Server_fnc_myEventHandlerScript}];
The Server_fnc_myEventHandlerScript function is defined only on server
unscheduled
just put the isServer check before your call
@novel path #looking_for_game #looking_for_unit
thank you @subtle ore
@novel path this is #arma3_scripting. You couldn't be any more wrong in your channel choice
my ENG is bad sorry
Why don't you post in the channel you started in when you joined the Discord? The first channel in the list that you can write in?
becuse i saw you talking here so i say it here
Hey guys I'd like to show my own HUD on screen with a bullet and mag count. I was thinking of updating it every frame but is there any other way of doing it? Would updating it only on firing/reloading/switching weapons/doing other stuff that needs an update ... do the trick?
Don't see why not @tardy yacht
How Can I get a list of editor enabled/attibutes of a Jet's sensors preInit when ForceRespawn is enabled in Vehicle Respawn Module? I'm using forcedRespawn because I apply custom modifed loadouts with Vehicle Respawn Module at mission start.
expression field of module: if (isServer) then {params [["_newVeh",objNull],["_oldVeh",objNull]]; private _sensors = listVehicleSensors _oldVeh; diag_log text format ["PreInit Detected Sensors: %1", _sensors];}; returns empty array. Only After postInit/ second instance of vehicle is the array not empty, but then these are not editor enabled sensors only default.
if (isServer) then {
params [["_newVeh", objNull], ["_oldVeh", objNull]];
private _sensors = listVehicleSensors _oldVeh;
diag_log text format ["PreInit Detected Sensors: %1", _sensors];
};
```sqf
code
```
@cloud thunder The Vehicle Respawn Module does not pass any arguments, so params will make _newVeh and _oldVeh report objNull. I checked the module and it seems to me that the module isn't supposed to. No idea where you got that from.
Of course
listVehicleSensors objNull
is
[]
Your saying the Vehicle Resawn Module does not pass the entities of new vehicle and old vehicle when new vehicle is created?
It doesn't. Why would it?
I surely wouldn't want it to
maybe once you get a vehicle destroyed you no longer have a certain type of asset
Not true. It does. I already have 1 function wich applies loadout to new vehicle and another function wich applies sensors that where on old vehicle to new vehicle It just doesn't apply sensors on second instance preInit when ForceRespawn is enabled..
Thre after all params are fine
I just tried it and the Vehicle Respawn Module doesn't pass any arguments in _this in it's init field.
True it doesn't in init. Try expression field as I mentioned before
Are you using a mod for this? I don't have an expression field in that module.
no mods
I found it. It's a single line and not a field.
9:52:42 ["a",[bis_o1,<NULL-object>]]
9:53:16 ["a",[bis_o1,<NULL-object>]]
But it doesn't work as described for me. The new object is reported as null
It is also not executed for that initial forced respawn.
Eh, Editor and Modules being broken. Nothing new.
I guess it's a race condition between Eden setting these sensors and the respawn module killing the vehicle.
Ok anybody with experience with Vehicle Respawn Module expression "line" in here?
PreInit the new vehicle is isEqualType "" so it this case (first instance) function is spawned with same parameters passed then new loadout is applied. There after new vehicle is never "" or null in my custom loadout function..
It's broken. Find another way to do this.
Why not use the alternate syntax of enableVehicleSensor instead?
https://community.bistudio.com/wiki/enableVehicleSensor
Also btw. preInit refers to the phase before any objects exists. So there are no vehicles at preInit.
I already use that command to apply the sensors in my function
But did you use the alternative syntax with the object classname instead of the object?
No i am using the object
"B_Plane_Fighter_01_F" enableVehicleSensor [componentClassName, state]
This should enable it for every vehicle with that classname in the mission if I understand it correctly.
The objective is to apply desired sensors in vehicle obect editor then respawn the vehicle with the sensors set in the editor.
how do you make a box for code in discord?
```sqf
```
I just tested the alternative syntax of enableVehicleSensor and it doesn't work.
Here is what I'd do:
["Plane", "init", {
params ["_plane"];
// do magic
}] call CBA_fnc_addClassEventHandler;
But you said no mods.
"B_Plane_Fighter_01_F" enableVehicleSensor ["IRSensorComponent", true];
^ this gives me a generic error. So the wiki also lies to us.
it expects object tho description isnt right
vehicleClass is a string / classname usually though.
Well, it's obvious that the expression line doesn't work and reports null as "old vehicle".
[missionnamespace,"respawn",[_newVeh,_veh]] spawn bis_fnc_callscriptedeventhandler;
//--- Delete the old vehicle
if (_wreck > 0) then
{
if (simulationenabled _veh) then
{
//--- Delete after init code is finished (in separate thread, so this one can continue)
_veh setVariable ["BIS_fnc_moduleRespawnVehicle_destructionScript", [_newVeh,_veh,_wreck,_initScript] spawn
{
_newVeh = _this select 0;
_veh = _this select 1;
_wreck = _this select 2;
_initScript = _this select 3;
waituntil {scriptdone _initScript};
if (_wreck == 2) then
{
private ["_boom"];
_newVeh allowdamage false;
_boom = createvehicle ["M_AT",position _veh,[],0,"none"];
_boom setvelocity [0,0,-1];
sleep 0.5;
_newVeh allowdamage true;
};
deletevehicle _veh;
}];
}
else
{
//--- Delete without any effects
deletevehicle _veh;
};
};
}
The first line here does the execution of the expression line and is spawn'ed. So executed at least one frame after the module function has deleted the wreck.
Have I mentioned how scheduled environment scripting sucks and leads to all kinds of race conditions today?
There.
Don't use the expression "field" line.
It's broken.
That ticket is not accurate it will never be null object after the first time.
It reported null for me multiple times.
And it's a race condition, so it might report null some times and other times will appear to work correctly.
then your doing something wrong. Its working for my reinstae sensors function exept first run