#arma3_scripting
1 messages Β· Page 636 of 1
Yes. and I'm using set.. what's the problem here?
you use get to get, and set to set.
or now... getOrDefault if you want a fallback
mind I didn't know that at the time π
Yeah but i never talked about set so why do you assume that i cannot use it :U
I just asked a simple question, and get answers about like 3 different topics that I didn't even ask about β¬ββ¬ γ( γ-γγ)
I don't answer to false dichotomy :p
Lets ask him about arma 4 to completely push him into a ragefit
What do fish have to do with this?
either that or getOr
getDefault is confusing
Also misleading
yeah getDefault sounds like you only want the default value or smth
ACE people also brought up tryGet but to me that entails that it will just tell you that it failed when it failed
not bad
do, or do not π©
getIfYouCan π
how to really get Dedmen out of himself: getKeyValue_OR_Getdefaultvalue
getValueIfDoesntExistGetDefault
*naming conventions left the chat
Still missing the variant with two "t"
gettOr
Would fit with some naming conventions π
Youβ¦!!
get _key and gett [_key, def]
but sometimes there is not a get*, e.g setBehaviour/behaviour
so the proper naming would be π
makes sense
private _value = _hashmap "key";
private _value = _hashmap orDefault ["key", "default"];
_hashMap get _key orDefault _def 
_hashmap select "key"? arf, not going to happen.
private _value = hashmap getOrDefault ["key", "default"];
This is definitely the way to go. It almost reads like plain English which is good
get1 _key and get2 [_key, _def]...it says it all
A bit more and dedmen will be like "Hashmap is not gonna happen, bye"
he's gonna keep it aaall to himself π
_hashMap = createHashMap;
_hashMap get "test"; // bench only this line
0.00113ms
_array = [];
_array find "test"; // bench only this line
0.00110ms 
_array = ["abc", "def", "lol", "test"];
_array find "test"; // bench only this line
0.00144ms
_array = ["test"];
_array find "test"; // bench only this line
0.00124ms
_hashMap = createHashMap;
_hashMap set ["abc", 0];
_hashMap set ["def", 0];
_hashMap set ["lol", 0];
_hashMap set ["test", 0];
_hashMap get "test"; // bench only this line
0.00143ms
_hashMap = createHashMap;
_hashMap set ["test", 0];
_hashMap get "test"; // bench only this line
0.00144ms
your test seemed wrong
_array = [];
diag_codePerformance [{_array}];
_array doesn't exist in { }
now it reminds me of some JS I did 2 years ago π performance-based for millions of data objects
it does
doesn't it run in a separate thread?
I thought it was supposed to be a "clean" test
it shouldn't π€
Huh
I thought it doesn't, well retest then :U
(definitely not seperate thread at all though) but maybe it doesn't link the parent scope afterall, I thought it does
I just tested. It won't work (_array not defined in { })
use _this instead
didn't you suspect that the numbers were too close?!
numbers adjusted
I expected them to be very close for small array vs small hashmap yes
what?
yeah
I mean I used to do "hashmaps" before like that! I created a two dimensional array:
[_keys, _values]
then I used find to find the index and get the value
I know, other people did too.
True Hashnaps dont search entries like arrays tho afaik
_hashMap = createHashMap;
_hashMap set ["abc", 0];
_hashMap set ["def", 0];
_hashMap set ["lol", 0];
_hashMap set ["test", 0];
can we get a more convenient syntax too?
_hashMap = createHashMap [
["abc", 0],
["def", 0],
["lol", 0],
["test", 0]
];
that is not possible because nular commands can't be unary too
createHashMapFromArray maybe. But i don't think so as iterating array and inserting is a really easy thing to do
I don't mind a createHashMap [] though
btw, which one is faster?
_unit getVariable ["var1", 0];
...
_unit getVariable ["var100", 0];
or
_hashMap = _unit getVariable "hashmap";
_hashMap getOrDefault ["var1", 0];
...
_hashMap getOrDefault ["var100", 0];
?
also is there a "hashNull"?!
first is faster. As second need to hash the whole script value including its type while first one only pulls out the string and only hashes that
also is there a "hashNull"?!
yes, its called "createHashMap"
_array = [];
_hashMap = createHashMap;
for "_i" from 1 to 6 do {
_array pushBack _i;
_hashMap set [_i, _i];
};
6 values:
Find last value
Array: 0.00149
Hash: 0.00132
Find first value
Array: 0.00127
Hash: 0.00137
Find non-existent value
Array: 0.00137
Hash: 0.00120
50 values:
Find last value
Array: 0.00307
Hash: 0.00212
Find first value
Array: 0.00123
Hash: 0.00141
Find non-existent value
Array: 0.00299
Hash: 0.00134
100 values:
Find last value
Array: 0.00443
Hash: 0.00128
100 values as strings:
Find last value
Array: 0.00436
Hash: 0.00219
with small arrays like 10 elements all values are basically within margin of error
Sorry to interject, I'm trying to use an SQF file to addAction to an object in an mp mission.
The object's init:
this execVM "file.sqf";```
file.sqf:
```sqf
params ["_myUnit"];
_myUnit addAction ["action", {}];
This code doesn't work. any idea why?
is it fast enough to be used like that?
I guess I theoretically don't need to hash the type of the variable.
instead of a null
fast enough? if I make a hashNull it would be exactly the same
because nulls usually have ~ 0.0005 ms delay
Result:
0.0013 ms
Cycles:
10000/10000
Code:
createHashMap;
Result:
0.0014 ms
Cycles:
10000/10000
Code:
objNull
it should. any more details maybe, any mods, what is the object, is it a simple object, ?
so it's two times slower. although not that important
the object is a soldier
@opal mulch what's the error?
huh? I just showed it being equal or faster than objNull? how is that two times slower?
Result:
0.0006 ms
Cycles:
10000/10000
Code:
objNull
We are on different computers, did you think of that?
there's no way my computer is faster than yours! cuz it's the very definition of potato
its equal to objNull
You havent seen dedmens computer :D
if you put this addAction.. directly in init, it works?
Yeah I didn't see the second part at first
I thought it was just one test
Result: 0.0011 ms
Code: []Result: 0.0013 ms
Code: createHashMap;Result: 0.0014 ms
Code: objNull
its even comparable to array :u
oki doki
I've found my problem. the file.sqf was in a folder and I used a forward slash instead of a backslash. thanks to your feedback i was able to deduce the problem. thanks!
but your code didn't show any folder or slashes :u Always show the code you're having problems with π
Will do
looks promising
hehe
_array = [];
_hashMap = createHashMap;
{
_array pushBack _x;
_hashMap set [_x, configName _x];
} forEach ("true" configClasses (configFile >> "CfgVehicles"));
LastClass = _array select (count _array -1);
[
diag_codePerformance [{
_this find LastClass;
}, _array, 10000],
diag_codePerformance [{
_this get LastClass;
}, _hashMap, 10000]
]
[[0.194024,5154],[0.0039,10000]]
πΏ 8049 entries
forEach (("true" configClasses (configFile >> "CfgVehicles")) select [0, 50]);
50 entries: [[0.0038,10000],[0.0024,10000]]
20 entries: [[0.0025,10000],[0.0025,10000]]
10 entries: [[0.0021,10000],[0.0024,10000]]
diag_codePerformance [{
_hashMap get LastClass;
}, _hashMap, 10000]
]
?!
the values too?
ye
are hashmaps "sorted" by insertion then?
unsorted
_array = [];
_hashMap = createHashMap;
for "_i" from 1 to 6 do {
_array pushBack _i;
_hashMap set [_i, _i];
};
_array
[1,2,3,4,5,6]
keys _hashMap
[<null>,<null>,<null>,<null>,<null>,<null>,1,2,4,5,3,6]
ehh... oops
[[0.194024,5154],[0.0039,10000]]
πΏ 8049 entries
this doesn't seem right! that's way too fast (in comparison)!
_cbaHash = [] call CBA_fnc_hashCreate;
_hashMap = createHashMap;
{
[_cbaHash, _x, configName _x] call CBA_fnc_hashSet;
_hashMap set [_x, configName _x];
LastClass = _x;
} forEach ("true" configClasses (configFile >> "CfgVehicles"));
[
diag_codePerformance [{
[_this, LastClass] call CBA_fnc_hashGet;
}, _cbaHash, 10000],
diag_codePerformance [{
_this get LastClass;
}, _hashMap, 10000]
]
[[0.212089,4715],[0.0077,10000]]

does that mean that the key can be anything?!
not necessarily string right?
working now: Number, bool, string, array(containing supported types), code, side, config
#TODO Nil, Any, Namespace, NaN
One question I haven't decided on yet.
{} forEach _hashMap
inside the loop there are _x and _y variables available? or better _key and _value? or have _x be an array?
that's tough π
I'd say use the old convention and use the magic variable _x so we could use _x params ["_key", "_value"]
but again having the _key and _value predefined by the engine could be faster (or is it?). and also _forEachIndex doesn't seem to be relevant anymore...
it will be faster yeah
_forEachIndex can just give iteration count, I intended to implement a iteration count command that works in any loop anyway
apply and select included?
"any loop"
β¬ββ¬ γ( γ-γγ)
_x and _y if you ask me
_his and _hers
shorter variables will be faster.
pulling stuff out of _x would be slower even than _key and _value variables.
_k _v?
Ah, that reminds me, I wanted to speed up the _x and _forEachIndex assignment in forEach loop
I think the ppl who use hashmaps can remember that _x == key and _y == value π
and others hopefully
if there were no standards, I would love
_k for key, _v for value and _i for iteration ofc
I already see ppl complaining why they need to write _key instead of _x π
and to those people I say they should get themselves an IDE!
I just noticed that SQFLint doesn't have magic variables...I'll go back to NPP
π
Dedmen going far east of the chart π
waitUntil too?! I mean it's not much of an "iterative" loop so I had to ask this one!
Ours. πͺ π¨

wait hashmap is an object?!
Your mom is an object
Objectifying foxes is not cool!
that's inside an array...π€ wat?!
oh so the array should be constant? (or made up of constants)
People modifying HashMap while iterating over it will be fun
can you modify the key?!
no
then what's fun?!
I mean is it more fun than iterating over an array and modifying it in the loop?!
hows MP stuffs for them?
I think they're like arrays in that regard
im just asking because of common usage of setVariable currently, and i believe different things also giving the global option for createNamespace with that.
but if I use an array, I can still add elements to it right?
I think so yeah. because it can mix stuff up even more
Yeah they are like arrays in MP
can you also delete elements from the hashMap to make it smaller for looping?
like:
_map set [_key, nil];
How will you get a specific key in the end?
what do you mean?
e.g. _value = dictdata["key"] in other languages *
with the "get" command?
did you skip the whole conversation and benchmark results above?
Yeps
does it have both:
_uwot get ["key", "default"]; // default
_uwot get "key" // nil
then scroll up
i am lazy
No. Yes. Read above
Can you send me a voice msg?
use text to speech
(joke aside: π sounds lovely)
_hashMap = createHashMap;
_hashMap set [["test", 1], "test"];
_hashMap set [1, "test"];
_hashMap set [2, "test"];
_hashMap set [3, "test"];
_stuff = [];
{
_stuff pushBack [_x, _y];
} forEach _hashMap;
_stuff
[[2,"test"],[1,"test"],[3,"test"],[["test",1],"test"]]

what kind of sorting is that?!
arent they unsorted in a lot of languages
shouldn't it be like [["test",1],"test"], [1,"test"], ....
The thing that will enable sqc to have a nice object syntax π€«π€«
Something like that won't be possible, right?
_a = [["things",1],["thongs",2]];
_val = _a get "thongs"; // 2 ?
β
that's an array
but I think he said no
createHashMap [["things",1],["thongs",2]]
that is an array Dscha
obj = {
Foo: "Bar"
};
Diag_log(obj.foo); // bar
Fun with SQC π€π€ really need to get the Documentation done for my lil transpiled lang :D
Yeah how did you imagine that to work..
you can use find and findIf if you want to find stuff in arrays
dunno how that's related to the HashMaps were talking about..
That wasn't the question.
You could Auto convert with Arrays π€·ββοΈπ€·ββοΈ
Okey the answer to your question is No. That's an array, not a hashmap
his question is more like: #arma3_scripting message
Your result was [[2,"test"],[1,"test"],[3,"test"],[["test",1],"test"]], i was asking to confirm, that the array stuff wouldn't work.
to avoid set
His question doesn't really say what the question is.
More or less, Leo
Yes I have a script that spits out an array. I don't see why a hashMap access command would work on an array
If you are asking if you can create a hashmap by yourself, insert values from an array and then call get on the hashmap, yes you can
Yes I have a script that spits out an array.
Something you know, and i don't.
Now i do.
its a forEach loop that does a pushBack into an array
How should i know how it looks "before", when the forEach normaly uses arrays?
it now supports hashmaps too
Yeps.
But we also discussed above that forEach will support HashMap and how, I thought you read the conversation above now?
Nope, doing other things here atm.
Please no ask confusing not clear enough questions that were already answered above
the problem with that is that sqf loops are slower than native engine loops:
{
_a pushBack _x
} forEach _b
vs
_a append _b
reading pages of text vs talking with another person here
erm.... prios are set for me.
Yes, but you probably only convert an array to a hashmap once
new insert command could get alt syntax, that it inserts from key,value array into hashmap
maybe string too?!
that way you can also insert from array mid-lifetime without having to create new hashmap
yeah that too
does anyone have an 8k or 4k monitor?
I wanted to ask for a favor
4K here
can you take a screenshot of windows color picker and send it to me?!
Windows?
like, in MS paint? or Windows main colour, or something else? ok
here it is, not resized
thanks!
may I know why? π
much better than my 1080p!
I wanted to take that rgb color "range" on the right and put it in my mod!
for a color picker obviously
I just realized that it is pixelated anyway.
So it probably would've looked the same on my monitor if I resized it! π
I wanted to create it using controls, but I think 32*32 controls was a little too many! π
nothing some macros can't solve π
I can stretch the pic to 8K if you want π
you could blur it a bit?
Make it with a script yourself?
Create image, for i fron 0 to 16000 do
(Setpixelcolor 0,x to x.x.x)
That gives you 16 bit colors i believe on the same Resolution
it doesn't look THAT bad!
#screenshots_arma message
I mean even Microsoft didn't care that much! π
Is that script produced?
The thing is that the resolution is equal to the amount of colors you have. So if its 8bit color, it ll always look 255 px Resolution :D no matter if 4k or not
no! I wasn't in the mood to right a script for that.
I just used the picture Lou sent me 
Ah alright
Hi im trying to make a script using Trigger ammo so it always delpoys the submunition the approprieate distance from the ground but i cant thing of a way to get the distance from the rocket to the ground and i cant use alt as a trigger because the rocket might be comign in from diffent ellivation meaning different Angles of attack
https://community.bistudio.com/wiki/Arma_3_Weapon_Config_Guidelines#Ammo_changes_on_fly_and_on_hit
If you made your munition a mod you could use this.
If that's not an option I can imagine that one could get something to work using a vector as the projected flight path and checking when that intersects with terrain, but I have no idea how well that works or performs.
But you know there is a very good colour picker out there already?
For some reason, in the object init the systemchat does not work, it does not display with the mission start
Is that a intend behavior?
It's most likely being called before you can even join the mission.
Try to also use diag_log and see if that is called.
at the same place as where you use systemchat
ok
btw... if you see https://community.bistudio.com/wiki/Initialization_Order you will notice that object init is called way before anything else, so it's possible it does show, just before you can see it
Anybody know if itβs possible to make the drone jamming mechanic from contact DLC work in the main branch of the game?
https://community.bistudio.com/wiki/Arma_3_Spectrum_Device
Some features are available without the DLC, but not all (and it's barely documented)
Create an RscPicture with the color-image from above, when the user clicks on it -> _pos = ctrlMousePosition _ctrlRscPic -> calculate from there on further
https://community.bistudio.com/wiki/ctrlMousePosition
@opal zephyr stop posting your questions in multiple Channels!
Sorry, I saw #arma3_config after I posted it here and thought it would be more appropriate there
is there a way to find out which "states" devices have for example the campfire: What is on or off?
Hi guys!
I have a question about the CreateDialog command.
If I enter this command while sitting in an airplane with the engine on, the throttle starts to increase. So the plane started to move.
Any ideas?
How did you even do?
What exactly?
I called createDialog inside the plane
createDialog "RscDisplayGame" in the Debug console
i tried to handle it with setAirplaneThrottle 0 but failed
Ah, yeah I can confirm it starts to increase its thrust weirdly. Maybe because of the autopilot when you can't control the plane because a dialog is open, but 100% sure it's not an supposed behavior
Its propably the same as with the plane automatically changing your throttle when you open the chat/the ESC menu
I suppose it's a Dialog too
Suppose both are the same
So how can i report the bug?
thank you!
Make sure you don't duplicate a ticket, search before post
didn't find any dialog before
Really?! Where?!
Exactly what I do
It's a controlsGroup with this picture in it
And the whole thing in a another controlsGroup
And it's exists on the feedback.bistudio.com
If you've made a ticket add the link to it in your message in #arma3_feedback_tracker please 
Ah, CtrlGroupCeption. Always fun.
@oblique arrow i didn't, because the same tickets already exists.)
Ah, then add a link to the relevant ticket @peak thunder
That way its easier for someone to find the ticket rather than needing to search for it for themselves

Yep, createDisplay works fine!
Good to know! π
But how can i check it opened in code? With createDialog i can use the Dialog command. Any ideas?
β_this lazzyMod onβ
displays have IDDs
!isNull findDisplay IDD
another way is the onLoad event handler
Exactly! Good point! Thank you kindly!
np. also this is more accurate (dialog returns true for any dialog, but this way you can find the exact display/dialog)
that looks very nice! I'll see how mine turns out (because I'm already half way done). Then I'll decide which one I like better!
@robust hollow if I decide to use yours, do I have your permission to rip it from the source? (I use a different style for borders). of course, I'll give you proper credits! π
sure π
O
I'm confused as to how you access the parameter values in a event script
I've created a onPlayerKilled.sqf and want to use the value of the _oldUnit parameter to evaluate a conditional
https://community.bistudio.com/wiki/Event_Scripts#onPlayerKilled.sqf
params ["_oldUnit", "_killer", "_respawn", "_respawnDelay"];
so it is provided to the script in _this
what would be the syntax for access that value though?
I kind of get thrown off by _this in sqf too, it makes it look like you should be able to use dot notation to access the value of that instance
Huh, params just does assign values into the variables. In this case, Just _oldUnit returns the old unit
_this#0```is the old unit
params isn't a data type, but a command
Is there a better write up for the syntax of sqf for somebody who knows how to program anywhere?
The wiki is kind of a mess

the pages say basically everything worth knowing
I'm a poor guy so didn't even experienced other languages than SQF, but I'd say I agree π I feel SQF is a really strange language, especially when I look up into a βproperβ language's code
The write up on the wiki is just written in kind of poor English
what would be the syntax for access that value though?
I'm assuming you're the best English speaker around then
setDammage Buldozer π
is the ```sqf
_var
just a style convention?
@hybrid dragon but yeah, if you have any ideas to improve the wiki, please send your input in the #community_wiki channel π
I might do a little write up when I understand SQF better
I really wasn't trying to be rude
np then π
the underscore means something; see the Identifier page
yep
local vars are auto killed at the end of their scope
(btw the Variable(s?) page has a nice illustration for that)
"A global variable is visible from all scripts on the computer on which it was defined. Names given to units in the Mission Editor are also global variables pointing to those units, which may not be redefined or modified.
So can you not have the names of a unit be repeated across missions?
Surely that's not the case
not in the same mission
so is a global variable in scope for the mission then?
as in that's the highest level scope that a user-defined variable can exist?
depends how you look at it. local variables exist within the script scope. global variables exist inside the missionNamespace (usually, wiped on mission exit), uiNamespace exists until the game exit, profileNamespace exists even after game restart (saved to file)
The local variable definition is very clear, I found the page on namespaces too
Sorry for asking so many dumb questions
nope, beginners questions and we are glad to help
"there are no stupid questions, only stupid people" I don't know if it is also an English saying π
question about __EVAL and __EXEC:
I'm assuming I can't have , in the expression. What if I did this?
__EVAL(call compile "'9999' getTextWidth ['EtelkaMonospacePro', 0.75 * ((safezoneW / safezoneH) min 1.2) / 30]");
is it valid?
pretty sure you can use ,
I think Dedmen said you can't
you cant use () inside __EXEC though i think
actually that might be eval, i used to toArray my code to get around the () issue in eval
are there not escape characters?
what for?
Say you wanted to print a hint that had a quote
Well we have \n, but it doesn't work everywhere I believe
is that not the newline character?
double quote, or use single quote to define the string
hint 'hello "friend"';
// or
hint "hello ""friend""";
__EXEC doesn't like round brackets () inside expressions. If you need to have grouping, perhaps you could calculate values inside the brackets separately and assign to local variables
https://community.bistudio.com/wiki/PreProcessor_Commands#EXEC
__EVAL doesn't like curly brackets {}, if you need to have code in your expression use compile String instead
https://community.bistudio.com/wiki/PreProcessor_Commands#EVAL
doesnt say anything about ,
endl?
anyway,
is this valid?
__EXEC(_editWidth = call compile "'9999' getTextWidth ['EtelkaMonospacePro', 0.75 * ((safezoneW / safezoneH) min 1.2) / 30]")
actually no it was string! my bad
https://community.bistudio.com/wiki/endl
I confused it with: https://community.bistudio.com/wiki/lineBreak
yes both these two ^^ I so much don't use them, soooβ¦
the scripting language is a lot more powerful than I would have assumed though
πͺ
Having a lot of fun
another question guys:
is this valid?
w = ... + __EVAL(_var);
I'm assuming it is right?
Bad codes from Pico:
My_fnc = {call My_fnc;};
call My_fnc;```
I did something like that acidentally 
doesnt look like it
w = "3 + __EVAL(_editWidth)";
and your earlier __EXEC errors
because of ,?
19:29:18 Error in expression <_editWidth = call compile "'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error position: <"'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error Missing ""
19:29:18 Error in expression <_editWidth = call compile "'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error position: <"'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error Missing ""
19:29:18 Error context .2) / 30]")
19:29:18 Warning Message: File d:\users\connor\documents\arma 3\missions\_debug.vr\description.ext, line 0: '.min': '1' encountered instead of '='
19:29:18 Warning Message: Config : some input after EndOfFile.
19:29:18 Error in expression <_editWidth = call compile "'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error position: <"'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error Missing ""
19:29:18 Error in expression <_editWidth = call compile "'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error position: <"'9999' getTextWidth ['EtelkaMonospacePr>
19:29:18 Error Missing ""
19:29:18 Error context .2) / 30]")
19:29:18 Warning Message: File d:\users\connor\documents\arma 3\missions\_debug.vr\description.ext, line 0: '.min': '1' encountered instead of '='
19:29:18 Warning Message: Config : some input after EndOfFile.
oh!
__EXEC doesnt like ()
it should work if you take it out of the string and use the macro for ((safezoneW / safezoneH) min 1.2)
nope
That's weird.
Anyway, I think it'd be better if I just did this (in debug console)
('9999' getTextWidth ['EtelkaMonospacePro', 0.75 * ((safezoneW / safezoneH) min 1.2) / 30])/(((safezoneW / safezoneH) min 1.2) / 40)
and put the result as:
res * ((safezoneW / safezoneH) min 1.2) / 40
in my config
the width might change on different ui scales/sizes no?
you can put gettextwidth directly in the config calculation
mmm, well, the ugly toArray option is always available π
so you mean:
call compile toString array
?
yea, to use code with () in __EXEC. though i wouldnt recommend it as it is inconvenient to edit
I always assumed that's why the game does this:
((safezoneW / safezoneH) min 1.2) / 40
so I'm using this expression in my GUI a lot!
it scales somewhat properly according to my tests
but I only tested the interface sizes.
not sure about aspect ratios (I only have a 16:9 monitor)
yea, my point was if you do it once in debug and put the result directly in the calculation it wouldnt be correct for people using a different ui size/aspect/resolution
yeah but I also scale the font too (using that expression)
sizeEx = 0.75 * ((safezoneW / safezoneH) min 1.2) / 30;
It would indeed not be accurate
but works as an approximation doesn't it?
depending on the aspect ratio i suspect it could be considerably off. only for what you were suggesting here though
#arma3_scripting message
Why use GUI grid and not UI_GRID (pixelGrid)?
I've never used it so I'm not familiar with it
you're missing out. i find pixelGrid much nicer to work with.
oh no! 
that is definitely much more convenient!
I wish I'd used that sooner!
where should I put this? It says that is have a local effect. So init.sqf or initPlayerLocal.sqf or initServer.sqf or some combination? (using it on dedicated server)
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
];
hacky.. yeah should work, it shouldn't look inside strings, but maybe it does, it was never built for such shenanigans. You can also call script functions from there if they were compiled before the config entry is parsed.
like calling mod function from uiNamespace in description.ext
Btw if you have a number entry, you don't need/want __EVAL.
if you do it in a config that will be binarized, you get the wrong numbers out of the getTextWidth.
If its unbinarized, you can just use a string.
depends on where you need it to execute
want to remove some gear after death of AI and Players, so I guess initServer AND initPlayerLocal ?
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (faction _unit in ["OPF_F", "IND_F", "BLU_F"]) then
{
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
clearMagazineCargo _unit;
deleteVehicle (nearestObject [_unit, "WeaponHolderSimulated"]);
};
}
];
missing a semicolon on the clearMagazineCargo line
because some of those commands require a local argument and others have a local effect, I'd say you'd be right to add it to players and the server, and do a
if local _unit then {
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
clearMagazineCargo _unit;
deleteVehicle (nearestObject [_unit, "WeaponHolderSimulated"]);
} else {
clearMagazineCargo _unit;
};```
or something like that.
it threw lots of errors: because of (
#arma3_scripting message
if you do it in a config that will be binarized, you get the wrong numbers out of the getTextWidth.
If its unbinarized, you can just use a string.
Wait really? Why? Doesn't it run after game initialization?
number values get evaluated when they are read
scope = "if (isClass configFile 'cba_main') then {2} else {0}"
stuff like that
so I should make them strings?
if they are numbers, you could yeah
they should only be evaluated once when the UI opens, if you're doing UI stuff there
if you're doing UI stuff there
yeah. what about something like this?
w = ((safezoneW / safezoneH) min 1.2) / 40;
it does have some other stuff too
besides numbers
It works just like that
in description.ext
not need to make it a script (string)
you mean it doesn't work in config.cpp?
it works in both
I think it should, if you don't use absolute values for x, y, w, h they are represented like that (safeZone * 42) without "" too.
the quotes around it are added automatically if you don't put them there
but I prefer not to rely on it doing that properly
so the expression will be evaluated every time? that's actually a good thing (because of ui changes)
Yeps
@tough abyss
https://stackoverflow.com/a/3235902
Check if line interesects with each plane of the bounding box
Thats highschool math
HashMap = createHashMap;
HashMap set ["test", "testval"];
HashMap set ["ref", HashMap];
You want to do bad, you get bad π
[["ref",!!HashMap circular reference!!],["test","testval"]]
!!HashMap circular reference!!
what's that? is that an error?
because I think it shouldn't work like that
It handles circular reference and prints you an error.
Instead of the way Arrays work by doing expensive checks on every insert and crashing if it detects a circular reference.
You'll probably still get crashing or atleast offensive warning messages in your face, but no performance impact on insert
Out of interest: What hash function are you using?
FNV-1A 64bit

i like dat
yes nice π
Is the hashmap a pure for-fun thing for sqf or will it go into the arma engine -> potentially speeding up things in there?
Why would I work on a pure for-fun thing all day while I'm at work, and while I already built the exact same thing for fun over a year ago π€
cause you funny
because actual "features" don't need work, only new "bugs" need to be implemented π€£
Yeah well idk. Maybe bohemia has a policy that 25% of worktime employees should do what they want to encourage creativuty
Like google
Idk
Maybe bohemia has a policy that 25% of worktime employees should do what they want to encourage creativuty
Then Dedmen would props just switch from one arma project to another
You mean arma 4? π
<Insert going back and forth 10 more times with this cool kitty, but ill not to do that to not annoy everyone>
warning Dedmen, posting images in wrong channel
warning Dedmen, posting off-topic content
π
"posting images in wrong channel" thats not a thing
"posting off-topic content" you started reee
Circular reference found in HashMap, this will cause a memory leak!
β₯ Context: Hash Key: "ref" <- Serialize Game Variable: hashmap
I hope getting this as a popup in your face, even telling you the path to get to the circular reference, will deter people from doing that wrong :u
question, why would it be a bad thing? an array cannot reference itself?
or only on print (which would then be understandable)
memory leak, it cannot delete itself because there is always a reference to it (being itself)
It even says that in the message 
not the delete paaaart :U
well, fix the memory allocator for cleaning self-references before deletion then!
memory allocators don't clean stuff

the whatever magic stuff duuu eeet

NAO
Only need to add support for some more key types and then it should be done :3
zo, which items? π @bold mica
I don't know "UAS"?
oh, ok
well you can filter arsenal items per-mission in description.ext iirc (or whitelist, I don't remember)
in the mission's description.ext file
just make a new line and add that in?
add the class of the item you want to blacklist
okie
Arma just needs proper gc instead of refcounting π€ͺπ€ͺπ€ͺ
And SQC instead of sqf
Tho.. Binarizing scripts would be enough to get sqc working too π€«π€«
Okay very quick question
player addScore
Working for server host, not working for server client, what do?
https://community.bistudio.com/wiki/addScore
Server only.
Fair enough
Solution remains the same, use remoteExec to run it from a client machine if you need to.
I believe I am struggling to write a proper return statement in my function. I am currently utilizing a test function to check whether or not I am doing things correctly
My current bit is:
private _pos1 = call llama_fnc_testReturn;
The function it calls is:
private _pos1 = position Patrol_1A;
exitWith{_pos1;};
What am I doing wrong here?
There is only one way to use exitWith:
if (...) exitWith {...};
```What you need in `llama_fnc_testReturn` is simply:
```sqf
position Patrol_1A
```Or alternatively:
```sqf
private _pos = position Patrol_1A;
_pos
```The value of the last executed line is the return value in SQF; usually written without `;` at the end.
So if I do a:
if(_letter isEqualTo "A") exitWith{position Patrol_1A};
would that happen to work?
Yup
thank you
what exactly am I doing wrong here? This is onPlayerKilled.sqf
if (_this#0 == playerC) then {
[]spawn BIS_fnc_fadeEffect;
[1] spawn BIS_fnc_fadeEffect;
selectPlayer silentSniper;
10 fadeMusic 0;
playMusic "";
call populate_tasks
} else {
"end1" call BIS_fnc_endMission;
};
calling the function with an empty array as the parameter so that it populates with the default fields also does not end the mission if you're playing as the "silent sniper" character
oh actually I see lmao
Nope, I thought maybe it was just that I forgot to terminate a statement properly
unless you define default values, calling it with an empty array will mean it has no values... so _this#0 doesnt exist
Is it possible to left justify hints?
as in the text or the control on the screen?
hint text
hint "<t align='left'>your hint</t>" should do the job
maybe parsetext first
hint parsetext "<t align='left'>your hint</t>"
yea, parsetext first π
by the way i'm talking arm2oa in game hints
give it a test, im pretty sure ive seen stylised hints in a2 before.
do you need a special command to display parsed text?
Up to which point does this work exactly? Or: What exactly doesn't work?
shouldnt do. hint and parseText have both existed since OA, and the align structured text isnt a3 exclusive according to the wiki
sort of. it all comes out parsed in the end but you can use composeText with setAttributes on specific text elements inside the compseText array to have some stylised text and other "plain" text.
ill get an example
composeText [
text "first text" setAttributes ["color","#FF0000"],lineBreak,
"second text which allows 'bad' characters such as & (would usually break structured text)",lineBreak,
text "third text" setAttributes ["size","1.5","color","#00FF00"]
] setAttributes ["align","left"];```
so you can apply styling to individual segments and to the parsed text as a whole
parsetext is removing \n line breaks
change them to <br/>
Yes, that seems to work. Thank you.
I use something like this:
_result = 123;
hint parseText format ["<t color='#ff0000'>some text</t><br/>some other text & even more<br/><br/>result: %1", _result];
and there are no "bad" characters if you use proper encoding π
ive had issues with characters from other languages (russian, chinese) so it is easier to use the raw text in composeText rather than replacing substrings. especially for the frequency in which one of my mods would be doing it. and because the text it displays is player input it isnt easy to have a replacement for every possible bad char.
also avoids needing to filter out player inputted style tags
forceUnicode soon\β’
that wouldnt have an effect on structured text though would it?
dont think so no
maybe we can add unicode support for structured text tho, dunno. But don't think we did
i wouldnt expect it to, seeing as it is for strings and the bad char issue is specifically to do with the structured text side of parseText.
I'm having an error thrown saying that _posReturn is undefined, what am I doing wrong?
private _posReturn = [_ID,_Letter] call llama_fnc_returnObjectPos;
_posArray pushBack _posReturn;
seems that the function returns nil?
I ran with a testing function that doesn't return nil and I have the exact same issue
is that snippet the exact code you're using?
yes
is _ID, _Letter and _posArray defined? also are there any other errors? if it were done right that snippet would work.
_ID and _letter work
and I defined
_posArray = [];
``` earlier
sorry, ```sqf
private _posArray = [];
and are there any other errors or is _posReturn is undefined the only one?
is the function defined? and in the same namespace the code is executing? also how are you executing the code (eg init files, evh, etc)
it itself is a function
ok, that doesnt answer where and how it is executing though
my logic being if the function isnt defined, it will error but the _posReturn error would override it ingame so you only see that. if the function is defined, you may be executing in a different namespace (unlikely).
Hello guys, I have this old script (not mine)
https://sqfbin.com/enumahikacehonadofuk
is part of a dialog that allows to place a tablet near a door and use it as a keypad. It throws this error:
`1:30:27 Error in expression <_doorList;
_tempSel = _doorList select _index;
_closestDoor = _tempSel select 0>
1:30:27 Error position: <_index;
_closestDoor = _tempSel select 0>
1:30:27 Error Undefined variable in expression: _index`
How to fix?Thank you
exit if index is nil after the foreach (L28). or set a default value but i imagine that wouldnt be ideal for what that script is doing.
also _keypad isnt defined on line 1, so it doesnt know what building to use
looks like the closest building doesn't have a door, so it will not be able to return a valid index π€·ββοΈ
@robust hollow it's defined in another script..
tablet = "Land_Tablet_01_F";
_objects = allMissionObjects _tablet;
{
null = [_x] execVM "kitty_lockFolder\setupKeypads\setup.sqf";
} forEach _objects;```
in a parent scope?
I placed down a vanilla industrial building..and it has numbered doors....
you should really provide _keypad as an argument, just for the sake of using best practice.
function is defined properly, as hints built into it for debugging are going off exactly as they should
sorry..while copy/paste I left this out in the SQFbin link
_keyPad = (_this select 0);
can you share the function?
wonders how many different L*fe Frameworks we already build in this channel
is at the top of the script
I dont mind if the people are trying to figure it out themselves :)
ok, so i'd add a
if isNil "_index" exitWith {};
after the foreach on line 28
Script-spoonfeeding-parasites never stay long
@robust hollow
my testing one which executes in the same way as the full function is:
private _pos1 = position Patrol_1A;
if(true) exitWith{_pos1};
is Patrol_1A defined?
except the full one has a longer list of if statements
No need for exitwith
yes
Last value will be returned anyways
its a helipad on the map
well one of these might be causing the issue...
This piece of script is already broken... tablet vs _tablet
_x is being send to another script (I assume the one in the pastebin), but not defined there (either _keyPad = _this select 0 or params ["_keyPad"])
the problem is that the issue persists in both the tester and the full up function
how do I find people to play arma?
but doesnt if I were to hardcode within the main function
@balmy reef not here... try #looking_for_game
In looking for community channel
kk
hard to help without seeing exactly what you're working with. these testing examples you're sharing have nothing wrong with them.
Sqf bin ;)
This is the full script i'm currently running for testing purposes
private _posStation = position Station_1;
private _stationID = 1;
private _size = 1;
private _group = createGroup west;
"B_GEN_Soldier_F" createUnit [_posStation, _group, "SERGEANT"];
"B_GEN_Soldier_F" createUnit [_posStation, _group];
"B_GEN_Soldier_F" createUnit [_posStation, _group];
"B_GEN_Soldier_F" createUnit [_posStation, _group];
_group setBehaviour "SAFE";
_group setSpeedMode "LIMITED";
_group setFormation "File";
private _stationLetterArray = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X"];
private _posArray = [];
for[{private _count = 0}, {_count < _size*6}, {_count = _count + 1}] do
{
private _stationLetter = _stationLetterArray select _count;
private _posReturn;
_posReturn = call llama_fnc_testReturn;
_posArray pushBack _posReturn;
};
_posArray = _posArray call BIS_fnc_arrayShuffle;
//this is what will actually be used once the looping part is fixed
//private _pos1 = _posArray deleteAt 0;
//private _pos2 = _posArray deleteAt 0;
//private _pos3 = _posArray deleteAt 0;
//private _pos4 = _posArray deleteAt 0;
//private _pos5 = _posArray deleteAt 0;
//this is for testing purposes
private _pos1 = call llama_fnc_testReturn;
private _pos2 = call llama_fnc_testReturn;
private _pos3 = call llama_fnc_testReturn;
private _pos4 = call llama_fnc_testReturn;
private _pos5 = call llama_fnc_testReturn;
private _wp1 = _group addWaypoint [_pos1, 0.1];
private _wp2 = _group addWaypoint [_pos2, 0.1];
private _wp3 = _group addWaypoint [_pos3, 0.1];
private _wp4 = _group addWaypoint [_pos4, 0.1];
private _wp5 = _group addWaypoint [_pos5, 0.1];
_wp5 setWaypointStatements ["true", "{deleteVehicle _x} forEach thisList"];
Sqf bin π’
it doesnt return an array
this is the llama_fnc_testReturn;
private _pos1 = position Patrol_1A;
if(true) exitWith{_pos1};
Call the function from debugconsole and print return to systemchat.
should shrink it to ```
private _posReturn = call llama_fnc_testReturn;
mmhm, well the way you have it is not a valid way to use private so thats one issue out of the way.
okay
you should test after fixing it to see if anything new happens
Can functions be called without input parameter?
yes
Llama where exactly does your code break
_posArray pushBack _posReturn;
I fixed it and the test function succeeded
which means that the error is now in the exitWith of my actual function
private ["_stationID", "_stationLetter"];
private _stationID = _this select 0;;
private _stationLetter = _this select 1;
if(_stationID isEqualTo 1) then
{
if(_stationLetter isEqualTo "A") exitWith {position Patrol_1A;};
I've already run checks to confirm it gets to an runs the exitWith
now I need to rewrite it so that it doesn't throw and error
but I know from previous tests that stationID is 1
Alright
I have replaced the exitWith statement with a hint of "in the exit with for 1A" and gotten it consistently
Call the function fron the debug console and print its result
Arma2OA can you do forEach for each instance of a class of object?
how do I print the result?
just call it in debug and see what it says in the return box
If you have an array of objects than yes
eg. ```sqf
{
// do something with house object
// _x = actual object
// _forEachIndex = current index
} forEach ([0,0,0] nearObjects ["House", 40000]);
just slap this into the editor and hit local exec?
[1,"A"] call llama_fnc_returnObjectPos;
yea
because if so, Im not getting anything
yes
ok, so the issue is 100% in that function. was this exactly what the function is, or is there more?
#arma3_scripting message
actually, also local exec Patrol_1A to see if it returns whatever it is supposed to be
private _stationID = _this select 0;; notice the double semicolon...
shouldnt be the cause any issues though
when i slap a hint into the exit with for 1A, it pops out just fine after executing
hint "test complete";
local exec Patrol_1A to see if it returns whatever it is supposed to be
just gives me Patrol_1A back
using my tester I have found that:
private _pos1 = position Patrol_1A;
if(true) exitWith{_pos1};
```works but:
```sqf
if(true) exitWith{position Patrol_1A;};
```does not
how would I maintain the integrity of my if statements whilst also getting a successful return?
well that makes no sense at all π€
@robust hollow Thanks..that stopped the error...but the script also stop right there. It tells me that is not reconnning the doors...but the funny thing is that in the demo mission it works.Import in my mission,same house, same everything..and it thrown doors errors..it may be conflicting with some other thing..
2:31:22 Error in expression <kDoor = format ["bis_disabled_Door_%1", _doorNumber]; _closeDoor = format ["Door> 2:31:22 Error position: <_doorNumber]; _closeDoor = format ["Door> 2:31:22 Error Undefined variable in expression: _doornumber
this works though:```sqf
if(true) exitWith{Patrol_1A};
diag_log the other variables before the loop to see what they are, maybe also log stuff in the loop. you'll find some value isnt what it should be.
what is Patrol_1A
Patrol_1A is a helipad I have placed on the map
everything checks out when I utilize my test function to return Patrol_1A but as soon as I move over to my full function whose if statements I have confirmed work I all of a sudden cannot get a return whilst still using the exact same syntax
Arma2OA is there a way to temporarily disable a trigger?
yea idk. sqf isnt this unreliable so whatever is causing the issue likely hasnt been mentioned/shown in this chat π€·
Arma2OA is it possible to set the pitch at which an AI unit will watch... i.e. elevation above or below the horizon.
Based off testing, i have found that this:
//works
if(true) exitWith{Patrol_1A};
//works
if(true) then
{
if(true) exitWith {Patrol_1A};
};
//doesn't work
if(true) then
{
if(true) exitWith {Patrol_1A};
if(_stationLetter isEqualTo "B") exitWith {Patrol_1B};
if(_stationLetter isEqualTo "C") exitWith {Patrol_1C};
if(_stationLetter isEqualTo "D") exitWith {Patrol_1D};
if(_stationLetter isEqualTo "E") exitWith {Patrol_1E};
if(_stationLetter isEqualTo "F") exitWith {Patrol_1F};
if(_stationLetter isEqualTo "G") exitWith {Patrol_1G};
if(_stationLetter isEqualTo "H") exitWith {Patrol_1H};
if(_stationLetter isEqualTo "I") exitWith {Patrol_1I};
if(_stationLetter isEqualTo "J") exitWith {Patrol_1J};
if(_stationLetter isEqualTo "K") exitWith {Patrol_1K};
if(_stationLetter isEqualTo "L") exitWith {Patrol_1L};
if(_stationLetter isEqualTo "M") exitWith {Patrol_1M};
if(_stationLetter isEqualTo "N") exitWith {Patrol_1N};
if(_stationLetter isEqualTo "O") exitWith {Patrol_1O};
if(_stationLetter isEqualTo "P") exitWith {Patrol_1P};
if(_stationLetter isEqualTo "Q") exitWith {Patrol_1Q};
if(_stationLetter isEqualTo "R") exitWith {Patrol_1R};
if(_stationLetter isEqualTo "S") exitWith {Patrol_1S};
if(_stationLetter isEqualTo "T") exitWith {Patrol_1T};
if(_stationLetter isEqualTo "U") exitWith {Patrol_1U};
if(_stationLetter isEqualTo "V") exitWith {Patrol_1V};
if(_stationLetter isEqualTo "W") exitWith {Patrol_1W};
if(_stationLetter isEqualTo "X") exitWith {Patrol_1X};
}
shrink that down to missionNamespace getVariable ["Patrol_1" + _stationLetter,objNull] get rid of each individual exit with
okay
So Iβm trying to create a briefing on the map screen using createDiaryRecord and was watching a video on how to add images (https://youtu.be/XJlCAEYs2uo?t=380) the video says it should be about 350px wide to fit in the briefing tab on the map. However, despite my image only being 240px wide it still extends out of the tab (https://imgur.com/gallery/cwvaxnU) can anyone please tell me what on Earth Iβve done wrong?
player createDiaryRecord ["Diary", ["Intel", "
<br /><img image='images\Int_1.jpg'/>
Fig. 1. Image released by the Russians showing the target, Igor Velinov, in their prison.
<br />
<br /><img image='images\Int_2.jpg'/>
Fig. 2. Satellite image taken earlier today showing the prison complex itself.
"]]; ``` There's the code I'm using also
if you edited the image after loading it ingame, you will need to restart before you can see the changes
otherwise, you might be able to use the size attribute to shrink the image
Ah, thanks. If I change the image name to something else would that work too?
yes
@robust hollow thanks for the help, that fixed the issues
https://imgur.com/a/L3qHlDq Thanks, the text's a bit off but I can fix that. Thanks @robust hollow
Arma2OA are there file read / write functions?
When you're playing as the "silentSniper" character
The mission will not end
The first part worlds as intended
Just putting together a intro script and part of it is driving me nuts. I have SQF 2 cutText [format ["<t color='#ffffff' size='4' face='LCD14' align='center' shadow='0'>%1</t>", _missionName ],"PLAIN",-1,true,true]; sleep 6; 3 cutText [format ["<t color='#ffffff' size='.8' face='LCD14' align='center' valign='bottom' shadow='0'>%1</t>", _quote ],"PLAIN",-1,true,true];
Now the mission name comes up nicely in the centre of the screen, but the quote (despite valign='bottom') actually appears slightly above the mission name. I want it along the bottom of the screen.
Any ideas?
remove valign and try "PLAIN DOWN"
Oh of course... the easy solution π shows I've been staring at things for far to long.
Thanks for that
No Arma game supports that. You need extensions
Reading the files in the mission folder or mods is possible with loadFile
disable simulation
doWatch/lookAt at positive AGL is the only option
trying to filter out all Arma 3 classes, so only mods will return. Any idea how to improve it ?
private _list = "true" configClasses (configFile >> "CfgPatches") apply { configName _x };
private _list = _list select { !(["A3", _x] call BIS_fnc_inString) && { !(["CuratorOnly", _x] call BIS_fnc_inString) } };
copyToClipboard str _list;
filter by author maybe?
also you can make that faster:
_list = [];
"_name = configName _x; !('a3' in toLowerANSI _name) && {-1 == _list pushBack _name}" configClasses (configFile >> "CfgPatches")
that is a bit over complicated
Result:
10.6809 ms
Cycles:
94/10000
Code:
_list = [];
"_name = configName _x; !('a3' in toLowerANSI _name) && {-1 == _list pushBack _name}" configClasses (configFile >> "CfgPatches")
Result:
9.83333 ms
Cycles:
102/10000
Code:
"!('a3' in toLowerANSI configName _x)" configClasses (configFile >> "CfgPatches") apply {configname _x};```
another thing you can add is:
configSourceAddonList _x findIf {"a3" in toLowerANSI _x} == -1
he's doing another loop over it
select
it joins both loops into one. so possibly 2 times faster
i'm only referring to your snippet
yes:
his:
private _list = "true" configClasses (configFile >> "CfgPatches") apply { configName _x };
private _list = _list select { !(["A3", _x] call BIS_fnc_inString) && { !(["CuratorOnly", _x] call BIS_fnc_inString) } };
mine:
_list = [];
"_name = configName _x; !('a3' in toLowerANSI _name) && {-1 == _list pushBack _name}" configClasses (configFile >> "CfgPatches")
both do the same thing (I left out the "bad" parts)
and im saying your snippet is over complicated (pushback). the faster of the two results here does the same thing
#arma3_scripting message
oh, ok
I thought it was the same old one!
I can't read without syntax highlighting! π
Also check if condition && {} is slower than condition && condition. In many cases the first method is slower
well, I got multiple conditions
private _all = "true" configClasses (configFile >> "CfgPatches") apply { configName _x };
private _list = _all select { !(["A3", _x] call BIS_fnc_inString) && { !(["A3", _x] call BIS_fnc_inString) } && { !(["cba_", _x] call BIS_fnc_inString) } && { !(["ace_", _x] call BIS_fnc_inString) } };
copyToClipboard str _list;
you might consider this as it is faster
private _all = "true" configClasses (configFile >> "CfgPatches") apply { configName _x };
private _list = _all select {
private _config = toLower _x;
["a3","curator","3den","cba_","ace_"] findIf {_config find _x == 0} == -1
};
in my example it is not a condition
it's an if
yours:
Result:
22.1522 ms
Cycles:
46/10000
Code:
private _all = "true" configClasses (configFile >> "CfgPatches") apply { configName _x };
private _list = _all select { !(["A3", _x] call BIS_fnc_inString) && { !(["A3", _x] call BIS_fnc_inString) } && { !(["cba_", _x] call BIS_fnc_inString) } && { !(["ace_", _x] call BIS_fnc_inString) } };
mine:
Result:
13.48 ms
Cycles:
75/10000
Code:
private _all = "true" configClasses (configFile >> "CfgPatches") apply { configName _x };
private _list = _all select {
private _config = toLower _x;
["a3","curator","3den","cba_","ace_"] findIf {_config find _x == 0} == -1
};
this will give you the best results:
"!('a3' in toLowerANSI configName _x) && {configSourceAddonList _x findIf {'a3' in toLowerANSI _x} == -1}" configClasses (configFile >> "CfgPatches") apply {configname _x};
unless the pbo is encrypted
"a3","curator","3den"
because I'm not sure if all A3 addons necessarily start with/contain these (there could be more)
also, since other people might name their mods in a way that it contains these words, it could filter out non-vanilla mods too
toLower
no need. usetoLowerANSI(2x faster)
why isnt this..working
if ("t1" call BIS_fnc_taskCompleted) then {radioJammer = [[jammer1], 1000, 50, TRUE] execVM "TFARjamRadios.sqf"};
previously this was just the radioJammer= part in initplayerlocal
its for a radio jamming script, but i want it to activate once a certain task is completed
because it only runs on player init
and I'm not sure about locality of tasks, so you might wanna check that too
cuz this script comes like this, idk if i can put it into other things.....ig i can try xd
if you want to jam the radios when a task is complete, add the code to the task's completion code
and leave this in the player init too (for new players I guess)
I'm not sure how this script works. I'm assuming it has local effect because you had it in initplayerlocal
i..dont ask me xd, i just took it from the interwebs
k that works
just adding it below the code that completes the task
Alright, since I have no experience with onPlayerKilled.sqf we should do some debugging to see what's going on.
systemChat (str _this);
if (_this # 0 == playerC) then {
systemChat "Entered if-block";
[] spawn BIS_fnc_fadeEffect;
selectPlayer silentSniper;
10 fadeMusic 0;
playMusic "";
call populate_tasks;
systemChat "Finished if-block";
} else {
systemChat "Entered else-block";
["end1"] call BIS_fnc_endMission; //Not sure if String argument works
};
systemChat "Finished onPlayerKilled.sqf";
```Test it like this to see how it behaves, what `_this # 0` is and so on.
https://community.bistudio.com/wiki/Arma_3_Debriefing#Configuration
Have you defined a custom "end1" in your `description.ext`? I've never used the default ones, don't know if they work.
Test it like that anyways, for instance, I don't know if onPlayerKilled.sqf runs when silentSniper dies.
I'll probably do that tomorrow, just spent like 5 hours working on my car
pretty pooped
Alright. Mention me when you have a result, otherwise I might not see the message.
@cosmic lichen @willow hound as a kinda two hour late followup for the question, what to do with hashmaps:
// SQC custom syntax
obj = { Foo: "Bar" };
``````sqf
// SQF
obj = createhashmapfromarray [["Foo", "Bar"]]```
In my alt syntax, I use it for Javascript like objects and in normal sqf, that could technically work to
o7
is any way how can I use setVariable command with a projectile?
Protectile is an object so yes
_myProjectile setVariable ["yeet","yoink",true];
You can get the bullet object with a fired eventhandler iirc
@little raptor What's the "make code safe for scheduled environment"-thing about? What's "unsafe" about the code in question?
they may not run at the same time
So race conditions?
yes
Which code were you talkong about?
for example:
_id = count _ids + 1; //what you expected the ID to be
//lets say scheduler queue ends here
_ids append ["", _this];
but if another code did this before that:
_ids append ["", _this];
then _id would actually be _id+2 (because another code added two other elements)
Ah, I see.
So it's only in case the function containing the code is spawned?
yes
not necessarily the function itself
even if it's called from a scheduled environment, it'll still be scheduled
Bit weird (to me) that it is being used in the case of BIS_fnc_netId because that function needs to be called anyways to get the return value.
even if it's called from a scheduled environment, it'll still be scheduled
Where code starts scheduled
init.sqf initServer.sqf initPlayerLocal.sqf initPlayerServer.sqf functions with postInit attribute (although suspension is allowed, any long term suspension will halt the mission loading until suspension has finished) code executed with spawn code executed with execVM code executed with exec **code executed with call from a scheduled environment**
Disgusting
yeah. if you want certain events to take place at the same time, you have to switch the environment to unscheduled
with isNil
the only difference between call and spawn is that call doesn't create a new thread.
call code simply means "execute that code here"
Syntax:
isNil code
Parameters:
code: Code - code to evaluate:
**the code will not be allowed to suspend while expression is evaluated, even if the parent scope allows it (see Example 4). **Return Value:
Boolean - true if code returns something other than Nothing
In what scenario is that useful? Cant you just use call?
Ah okay
when you want things to happen in exactly one frame
for example, if you create a vehicle in an unsafe position, but don't move it in the same frame, it'll explode
Oh you gotta send that to the alive guys
Their cars keep spawning offroad and explode before teleporting
So its essentially trading execution control for performance. I assume the game slows down if you force to mucj into one frame
probably still more perfomrant than a burning tank ik collision :)
If they have a discord, you can send the link of this conversation to one of their devs
They do, ill do it later if i remeber it
Hi everyone, is there any way detect when a player take off his uniform. Preferably with handler "Put"
check the eventhandlers page
And?
@viral tangle I'm not sure when that EH triggers. I can give you two ideas:
- if it triggers after the unit takes off the uniform:
uniform _unit == ""
- If it triggers before:
getNumber (configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "type") == 801
both of those variables come from the parameters in :
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Put
either way, the second method is probably safer
is there a way to play a custom sound/music piece locally (on a radio etc.) without using an extra addon or CfgVehicles ? (a method like adding picture to billbords would be nice!)?
and you can add sounds/music in a mission (so no mods needed)
but only with createSoundSource ?
playMusic
the idea is to have a radio play radio message i prerecorded
so not global but on a set position/item
createSoundSource (for SFX), playSound (for CfgSounds) or playMusic (for CfgMusic)
check the wiki for the differences, because it's all possible
playMusic and playSound are local
ah ok thx
Music and sound also suggest diffrent channels right?
so if music vol is 0 u cant hear that (player pc) but sound is like gunfire etc?
probably
is there any limite to the file size/length for that? i used playSound3D [getMissionPath "mySound.ogg", player]; which didnt work
should
it still wont, work no errors , nothing. debug console exec also didnt work
.ogg ,Vorbis Audio,stereo,44100 Hz ,Bits per sample 32 ,bitrate 160 kb/s
sounds right
im trying wav next was mentioned somewere too
path to the file is : mpmissions\AC-130.Altis\shotdark.ogg but i dont have a cfg-sound/music file nor the idea how to make them so that the use the .ogg in the mission folder not as an addon!
you mean the mpmissions folder in Documents, right?
yep
that will get exported to the workshop later
well its basicly the scenario folder if i tell the eden editor to go there! @little raptor
Audio
ID : 12733 (0x31BD)
Format : Vorbis
Format settings, Floor : 1
Duration : 2 min 44 s
Bit rate mode : Variable
Bit rate : 192 kb/s
Channel(s) : 2 channels
Sampling rate : 44.1 kHz
Compression mode : Lossy
Stream size : 3.77 MiB (99%)
Writing library : libVorbis 1.0 (UTC 2002-07-17)Audio
ID : 12733 (0x31BD)
Format : Vorbis
Format settings, Floor : 1
Duration : 2 min 44 s
Bit rate mode : Variable
Bit rate : 192 kb/s
Channel(s) : 2 channels
Sampling rate : 44.1 kHz
Compression mode : Lossy
Stream size : 3.77 MiB (99%)
Writing library : libVorbis 1.0 (UTC 2002-07-17)
sample working .ogg format
weres that sample?
game files
arma 3 root folder i guess?
no, unPBOed one of music addons
ah ok
i try it with the malden one if that works its the format or the mission cfg music thingi
playSound3D doesn't need any "mission cfg music thingy"
also, did you restart the mission?
no but should it be needed when i go back to the editor?
no, either end or restart.
and did you try it in the debug console?
yep did didnt work
while the mission was running?
yes and in person on the map not briefing
let me check it with a vanila arma 3 song
maybe its some script error
i try with LeadTrack01_F_Malden.ogg
hm that uhm odd
after a editor restart both work at least in local exec in debug console
Arma2OA.... I'm trying to copy a very long array to clipboard. I'm using format and then copytoclipboard. Does anybody know why it's getting cut off mid way? Or if there is another way to do it correctly?
format has a size limit
I think 8 kb?
it's on the wiki
in arma2 does string concatenate with the + operator have a size limit?
I don't think so
if all you're trying to do is copy the array, why not copyToClipboard str array?
prefixes are added. but I'm going to try copytoclipboard (prefix + (str array))
Sure wish I could just save the array directly to a file in the mission folder, that could then be read back in as an array.
you might be able to do that using extensions
I wasn't clear on a response to a question I had earlier. With doWatch, is it actually possible to get ai units to look up or down?
I think so. Give them a position to lookAt whose AGL height is higher than their current height
is it possible to get the player's current pitch?
pitch of their what?
aiming direction
weaponDirection
is that a 3d vector?
yes
or pitch,yaw
3D vec, you should convert it
"format Vector3D"
3d vec actually is better. Thanks
this addAction ["AC/DC", {playSound3D [ getMissionPath "shotdark.ogg",laptop,false,laptop,4]}]; well works as intended ,sort of now i just need to know ho to stop it otherwise u can loop it to death if u reuse it XD
delete the source
thats a static laptop and needs to stay there or respawn so how to delete the undeletable
the source, not the object
which is the laptop too or do u mean the ogg?
nvm it was say3D
or create a fake source
otherwise i would think deleteaction ,pause x, addaction again?
then delete that
but how can i create it in the first place and to that every time the song runs
sry for asking that many maybe dumb questions its my first time ever doing something in the editor
see example 2:
https://community.bistudio.com/wiki/say3D
ok
use the dummy with playSound3d
thx
When doing dowatch does the distant of the position that they're watching have any effect on their ability to detect enemies. For example, if they are watching a position very close to them, does it interfere with their ability to detect enemies farther away?
no (unless it affects their LOS on farther objects)
Correct me if I'm wrong, but there is no function to return whether an ai unit is aiming or shooting at an enemy.
no
you could probably write an approximate one
but it'll be slow
you'd have to loop over all enemy units
also, that's only for the aiming part
shooting can be detected with an event handler
I thought maybe their animation state could give it away
not necessarily
I don't recall how the animations were in A2, but in A3 that's not a good method
@little raptor i cant get it to work no mather what , either missing ] or something else were and how do i need to put the example in to fit (and delete the source on a rerun?: this addAction ["AC/DC",{playSound3D [ getMissionPath "shotdark.ogg",dummy,false,dummy,4]}];
do i need to do it with another { }?
what's dummy?
as far as i know i need to tell the playsound3 were to play the sound in this case the "dummy" i create with the example script from say3d and on a rerun delete the dummy so that the sound stops
and dosnt loop
okay from 0:
i placed a laptop model named "Laptop" with the init :
this addAction ["AC/DC",{playSound3D [ getMissionPath "shotdark.ogg",laptop,false,laptop,4]}];
BUT the sound loops and needs to be stoped
syntax highlighting plz (see pinned messages)
oh god
uhm that could take a min
this addAction ["AC/DC",{playSound3D [ getMissionPath "shotdark.ogg",laptop,false,laptop,4]}];
thats right?
yes
the issue is u can use the action directly after it and therefore loop it and i cant figure out how to do that with
/* your code */
private _dummy = "#particlesource" createVehicleLocal ASLToAGL getPosWorld _corpse;
_dummy say3D "whatever";
_dummy spawn {
sleep 5; // at least the length of your sound
deleteVehicle _this;
};;
should i put that in a seperate .sqf and run it before the playSound3D or what is the best solution?
u can use the action directly after it and therefore loop it
so you want to remove the action after the first use?
yes and no i want that the song stops if u press the action again so that is doesnΒ΄t loop when u use the ac/dc action again!
by loop you mean "echo"?
yeah
u can start it again and again and again so u have the same song running 3 times behind
create a .sqf script with this in it (in the mission folder):
params ["_target", "", "_actionId"];
_dummy = "#particlesource" createVehicleLocal ASLToAGL getPosASL _target;
playSound3D [getMissionPath "shotdark.ogg", _target, false, _target, 4];
_target removeAction _actionID;
_target addAction ["AC/DC", {
params ["_target", "", "_actionId", "_dummy"];
deleteVehicle _dummy;
_target removeAction _actionID;
_target addAction ["AC/DC", "scriptName.sqf"];
}, _dummy];
use this in the init:
this addAction ["AC/DC", "scriptName.sqf"];
change the "scriptName" to your actual script name
this will create a "toggle" like button
you can turn it on and off
Thank you very much
np
uhm
it still echos and creates more actions
i dont know but is _actionID not defined?
does the laptop need to be set to a specific name?
it doesnt remove the action
right, missing a line in the second add action
fixed.
let me guess removeaction...?
but if it doesn't stop playing, then you should use say3D
yes
simply _target removeAction _actionID again?
yes
anyway, use:
https://community.bistudio.com/wiki/say3D
and create the sound in description.ext:
https://community.bistudio.com/wiki/Description.ext#CfgSounds
needs to be included with [] or {] right=
what?
it is correct as it is
yes,
create description.ext in your mission folder
follow that guide to create a sound class
use say3D instead of playSound3D
got it thx
@little raptor error missing ; wtf does it want there is a fucking ; behind it
And also at the correct positions?
Can't tell if it's correct or not without seeing the code
_dummy say3d [acdc,100,1,false,0];
3 line
params ["_target", "_caller", "_actionId", "_arguments"];
_dummy = "#particlesource" createVehicleLocal ASLToAGL getPosASL _target;
_dummy say3d [acdc,100,1,false,0];
_target removeAction _actionID;
_target addAction ["AC/DC", {
params ["_target", "_caller", "_actionId", "_dummy"];
deleteVehicle _dummy;
_target addAction ["AC/DC", "acdc.sqf"];
}, _dummy];
acdc is the name of the song defined via description.ext
class CfgSounds
{
sounds[] = {};
class acdc
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "acdc";
// filename, volume, pitch, distance (optional)
sound[] = { "shotdark.ogg", 1, 1, 100 };
// subtitle delay in seconds, subtitle text
titles[] = { 0, "" };
};
};;
and it doesnt work of course
But it must be a STRING
as in
- not
acdc - but
"acdc"
ah ok
AH god damit 3 time the same shit each time the shit echos again
and crates more addaction till it floods the menu
(coooool down on the language)
sry im sitting on hour 3 now on that Piece of ********
i just want it to start one time and if u press it again stop or restart without echoing
You can stopΒ say3DΒ sound currently playing in 2 ways:
- delete the source of the sound (from) withΒ deleteVehicle, or
- kill the source with e.gΒ setDamage.
im doing it with deletevehicle but it still wont work
I feel like I'm going absolutely insane.
A while back I got GM searchlights to track a certain position, using essentially the same code I'm using now. Only now...they're not doing it. Refusing to look at what I want.
params ["_light"];
// probably works, it's hard to tell
[_light,(nearestObject [_light,"land_gm_tower_bt_11_60"])] call BIS_fnc_attachToRelative;
// this works, the light turns on
[(gunner _light),["SearchlightOn",_light]] remoteExec ["action",(gunner _light)];
while {true} do {
// All this is executed but the light doesn't move
_lightTarget = o_cube;
diag_log "TARGET SET";
// _lightTarget = [allPlayers,_light] call BIS_fnc_nearestPosition;
[(gunner _light),_lightTarget] remoteExec ["doWatch",(gunner _light)];
diag_log "DOWATCH";
[(gunner _light),_lightTarget] remoteExec ["lookAt",(gunner _light)];
diag_log "LOOKAT";
sleep 4
};```
(server executed)
uhm no scripting experience but delete // from _lighttarget?
That's just an alternate (more complicated) target system that I commented out to narrow down the issue. You'll notice a dummy target is defined two lines above.
Yes, and doWatch and lookAt both accept objects.
hmm
What's up with the remoteExec?


