#arma3_scripting
1 messages ยท Page 308 of 1
{ _x setDammage 1 } foreach _allowedObjects;
can u paste what blacklist and whitelist are?
nvm i see it
they shouldn't have quotes i think
if they're variable names
_blacklist = [mapobj1, mapobj2, mapobj3];
Whitelist is classnames and blackist is variable names.
I tried whitelist as classnames rather than strings and it doesn't work.
oh ok.. i thought both were variables
_allowedObjects = (nearestObjects [player, ["All"], 200]) select { (typeof _x) in _whitelist && !(_x in _blacklist)};
or since they're class names, you can pass thems traight into nearestobjects
_allowedObjects = (nearestObjects [player, _whitelist, 200]) select { !(_x in _blacklist)};
yeh idk, would need to see what you have for blacklist and whitelist
whitelist is random buildings around the map
i thought it was class names?
Was strings as I was using str _x find "name" > -1
|| str _x find "name2" > -1
Which was gross looking lol
Trying to clean this up into an array
instead of having a ton of || blah || blah || blah
etc
how are you getting the references to the objects?
getting the names via nearestObjects
(what do you have for _whitelist = )
_whitelist = ["chairplastic_f"]; for instance
i guess first thing is to try this (ignoring blacklist):
_allowedObjects = (nearestObjects [player, _whitelist, 200])
Type Array expected String
It works when I used find etc and the blacklist
Which this is annoying lol
Yes
Along with a ton more
(str _x) find "chairplastic_f" > -1
If I use that and change it to other names it works
No idea why I can't cycle through an array
you could?
this isn't an error > (nearestObjects [player, ["chairplastic_f"], 200])
so your _whitelist must not be ["chairplastic_f"]
must have a different format/layout
I already said that before. You need to assign variables to your black/whitelisted objects and use these in the array
because nearestObjects returns the objects. Not their classname
it takes class names though
Couldn't I use find to search the whitelist?
You could also filter by classname but then you have to convert the array of objets to classnames first
I don't see why. find just makes it more complicated
need to see your whole code to help i think.. http://pastebin.com
Remember to not set it to never expire :x Please ^^
let it expire after a month or something
Does anyone know the fastest way to sort an array by distance?
An array of objects that is
took the quotes off the blacklist (so it's objects, not strings)
Nope
If I remove the quotes from the whitelist it doesn't work.
Same with blacklist
yes
so _blacklist needs no quotes
_whitelist is a list of class names (which are "strings" though), so it needs quotes
@blazing zodiac https://community.bistudio.com/wiki/BIS_fnc_sortBy
Yea that's quite slow however @distant egret
I found a much quicker way to be _coverObjs = _coverObjs apply { [_x distance _unit, _x] }; _coverObjs sort true;
Depends how many objects you got
it's about half the time in my case
There's quite a few objects in the array most times
Ah k, I use it with like 3 objects so doesn't matter for me.
@glass temple those aren't full class names though are they?
Full would be something like Land_cages_f
So best way to do this without adding full classname?
Rather is it possible to get rid of the (str _x) find "name" > -1 bs?
the 'find' is the only way to search for a partial string afaik
well easiest/fastest way
what is test1? a object variable?
It's the name of an object I placed in eden
{
_x setDamage 1;
} forEach (nearestObjects[player, _whitelist , 100] select {!(_x in _blacklist)});
and blacklist is without quotes
Uhm
then.. Make it full classnames and add the missing ones into there
If you really wanna kill performance.. But as I said doesn't matter anyway
It only runs on server init so...
Unless this runs everytime a player joins then...
you could but its a lot harder
something like
also a lot slower as dedmen said
{
_x setDamage 1;
} forEach (nearestObjects[player, [], 100] select { !(_x in _blacklist) && {_dedmenYeah = _x; count (_whitelist select {(typeof _dedmenYeah ) find _x > -1}) > 0 } });
just use full class names.. much easier
Well thanks for spoon feeding me guys. I appreciate it.
My method works fine. Performance crappy but.. works. Except if I have some typo in there
I'm just reverting to my default version.
This one https://pastebin.com/HjdkdmNA
It works fine, just ugly lol.
Why not mine ^^
Didn't work
aww ._.
Does anyone know what ADDON = false and ADDON = true mean in CBA's XEH_preInit?
#include "script_component.hpp" // Macros and what not
ADDON = false; // ?
#include "XEH_PREP.hpp" // Function preps
ADDON = true; // ?
And CBA_common is?
Also, does ADDON affect scripts in any way? Should stuff like keybinds be put after or before them?
what is VarName = true ? ๐ I think you can answer that yourself
You cannot realisticly execute code while ADDON == false.
it's just so you can easilly check if the Mod is loaded. Instead of looking in cfgPatches you can just check that variable
So keybinds, etc. should be placed after ADDON = true.
No. Doesn't matter in any way
It's just setting a variable.
It doesn't matter if you don't know you that you need it
Weird. I placed mine between #include "XEH_PREP.hpp" and ADDON = true, though no keybind is added.
Are you sure keybinds should be set at preInit?
Oh yeah.. That's also what I'm doing ^^
diag_log to check if your code is being executed?
diag_log "my keybind is running" kind of thing?
yeah...
Ok. I'll report back.
Yep, it's running: ```
15:52:04 [735,66.294,0,"XEH: PreInit started. v3.2.1.170227"]
15:52:04 "my keybind is running"
15:52:04 [735,66.843,0,"XEH: PreInit finished."]
Perhaps it will work with XEH_preStart or XEH_preInitClient like it does in CBA's accessory module? https://github.com/CBATeam/CBA_A3/blob/0d4f10d730c71a8d2b6fa8220ceca8fb28b2cd28/addons/accessory/XEH_preInitClient.sqf
Just to be on the safe side - if will work within the keybind function, currect?
[
"Debug Menu",
"debug_menu_key",
"Open debug menu",
{if (serverCommandAvailable "#logout" || !(isMultiplayer)) then {call FUNC(openDebugMenu)};},
""
] call CBA_fnc_addKeybind;
XEH_preStart doesn't add a keybind as well.
And I guess the differance between XEH_preInit and XEH_preInitClient is global vs. local? Idk.
Does _modName need to be the same on as in CfgPatches?
Do this in your init.sqf or XEH client-only event handler to ensure that it is registered when your mission/mod is initialized. Hm, ok.
is there an easy way to access eden editor layers through scripting, or is that just an editor thing?
Using XEH_preInitClient worked ๐
how do i run getunitloadout and get the output in my clipboard
copyToClipboard getUnitLoadout player
thanks
np, bookmark this shit here bro https://community.bistudio.com/wiki/Category:Scripting_Commands
already did
just dint understand the copytoclipbgoard str part
i dont script a lot anymore
i didnt understand why i couldnt just copToClipboard getUnitLoadout player
getUnitLoadout returns an array, and copyToClipboard expects a string
in a sensible world copyToClipboard would work with arrays, but this is arma
anyone know what in the fuck this magical line of code does?
teamMember _agent deleteResources ["Legs"];
probably not used
it's just...so weird...and so SQF
It's obvious that XEH_preStart doesn't add the keybind. Keys are stored in missionNamespace. Which doesn't exist at preStart.
Why wouldn't you be able to use if inside a SQF code statement? There is literally no reason it would not work.
preInit and preInitClient are both executed locally. There is no Global. Just preInitClient is not executed on Servers probably.
Thanks @still forum.
Does anyone have experience with (hundreds of) thousands of markers in arma?
I decided to do some plotting in arma and noticed that the performance gets worse and worse the more markers there are.
e.g. this picture has 160000 markers: https://i.imgur.com/2BgXkWn.jpg
the first 1/4 took 80 secs, the next 1/4 was 300 sec, then 500 sec, then 800 sec (around 8 sec per quarter was for calculation of colors)
Is there any way to improve performance when using this many markers?
I mean, what do you expect ๐ They are all objects ๐
I am impressed it handled that much without crashing
The thing is: Once they're created performance is great. but createMarker seems to get slower and slower depending on the number of markers.
Should I open an issue on the feedback tracker for it? (But I guess I'm the only one who does crazy stuff like that :/ )
How "great" is performance? I'd expect a fps drop to <10fps
Yeah.. It's kinda correct that createMarker shouldn't get that much slower but... No one creates so many markers
aha, i create so many markers
it does indeed get quite slow
it's about 20x faster if you don't have the map open while the markers are being created @drowsy hollow
what's that plotting, anyway? slope?
iirc i had 40fps fully zoomed out looking at a map with 32,000 markers @still forum
for comparison, i can't maintain 60fps on tanoa in jungles
@rancid ruin thanks for the tip. i always had the map open when creating them.
Yes, the plot is slope.
looks good
basically, higher fps = markers get created faster
you might get highest FPS looking up in to the sky, or zooming in to the max with the map open, test them out
Funny that I was just going to ask about roughly the same thing as Shado, So let me just hijack your question (a little bit) and ask:
Is there a way (using extensions or not) to create a dynamic overlay on the map screen? Something like that could take a texture either dynamically created by an extension or fetched through http, for example (also served by an extension). Right now, the only function that I see that could display an image is drawicon but that doesn't seem to take arbitrary images...
@still forum I'm not at 240.000 markers and have 15fps in map
...and I'm not planning on patching the texture in the exe memory @still forum so don't suggest that ๐
you can do quite a lot of stuff with this @final vessel https://community.bistudio.com/wiki/drawIcon
I know but... c'mon! There has to be another way of doing that. Legally.
oh you already know about that command, never mind
@rancid ruin Sure, but there is still the most important part that is missing: how to get the custom texture/image
you'd need to have it in an addon, or the mission file
to create a dynamic overlay <- unfortunately, I'm aiming for something more ambitious ๐ฆ
"dynamic overlay" isn't very descriptive
you can do quite a lot using custom fonts and stuff
design wise
No, no, no. I mean: I would like to put dynamic custom images on the map. Those images will change often (a dozen of times in a minute)
Because even doing something as simple as a filled polygon on the map doesn't work ( https://feedback.bistudio.com/T124244 )
yeah, filled polygons would be cool one day. i use polygons for a few things, would be nice to have them fleshed out. wrote a script which distributes small markers inside polys, makes them kinda filled.
So, to recapitulate: you can't use polygons on the map, putting thousands of square markers is also pointless. Also, trying to draw using simple lines is slow and ugly.
If there was a way to have an extension create a texture and then show that texture on the map it would be great.
You could do stuff like anti-aliasing, gradients, smooth bezier curves, etc...
i've found creating markers isn't actually that slow if you have them all defined first
i could get through 32k in like 1 min i think
although i guess that is kinda slow in the grand scheme of computing
That's kinda slow if you're limited to 0.003s (afaik) every frame for scripting
people have made mods which load youtube videos and display them on billboards, so i'm sure what you're asking for is at least technically possible
Besides, I'm saying I want to change that overlay, so those markers are going to need to change color anyway
That youtube video thingy is with filePatching. Which I already recommended before
ah, download video, convert to ogg, play in normal fashion?
that's not very exciting
yes
Thank you but I really can't use filePatching for public servers and mods (and that's what I'm working on :D)
I know. But most People don't know that and think it's a huge new thing. Already had that in Arma 2 and no one cared back then. The guy that lately got a bunch of YT clicks with that was just some Life guy that copied an old script from someone else...
arma's UI system is totally fkn archaic and old school anyway
probably hasn't been changed since ofp days
That might very well be true
Yes, but a custom texture (on the map!)isn't that much to ask, isn't it? ๐
the map display technically does quite a lot of stuff fairly well if you compare it to GIS software. it just does it...slowly
arma must be the only game where your FPS can go DOWN when you open the map
i'd consider yourself lucky that you can draw lines and polygon outlines to be quite honest @final vessel
nvm. Yeah, you're right.
I remember the Arma 2 times, where the pilot was forbidden to open the map, since the loadingtime to be back ingame was sometime > 30s ๐
i installed arma 2 again a few weeks ago
instantly uninstalled when i remembered it had separate sliders for mouse x and y sensitivity
so fucking clunky and strange. dunno how i spent thousands of hours in that game now
even getting your mouse sensitivity right is a fucking mission
There was nothing better +I don't mind the Slider oO
just, who thought anyone needed that?
why not?
who's ever been like "i love this game but i wish i could reduce my vertical mouse sensitivity" lol
How often did you aimed up and instantly downwards? ๐
You didn't need to uberVertSpeed.
And when you are a movementlegasthenic -> Helps alot =}
Can't find that word in google ๐
crazy BI doing BI things
Anyway, so I take it there is no way to generate custom textures on the fly for Arma? Is that true?
you can use procedural textures
You can generate custom... yeah that
but you've not really explained what your "dynamic overlay" would look like so who knows if it'd suit your needs
On the fly? You can create them, but won't be able to load them oO
You could do stuff like anti-aliasing, gradients, smooth bezier curves, etc... @rancid ruin
loading textures via HTTP or other means and displaying them on the map. I think :u
And I want those things to move so I can't just generate them and embed them in a PBO
Is that http command even enabled for MP?
there's a thread on BI forums where some mad cunt made a load of functions to draw bezier curves
using map markers lol
And we go back to the "performance" part of the discussion ๐
Okay, let's try again:
I want to have a filled polygon, with hundreds of vertices, spawning a few kilometers and that will be changing shapes each ~5 seconds
draw the image using a proper programming language, then read it pixel by pixel and recreate it using 1 marker per pixel in arma ๐ค
You could... Just draw an overlay over the game from your extension. Like the Steam overlay or Fraps
That could actually be a good solution
What are you trying to achieve in the end?
a headache
Point is I don't want to tell everything because someone else will beat me to it then ๐
But now we're all really interested and want to see what you're up to
can you pm me something if i promise not to steal your idea? :D
i demand full transparency
Let me find a screenshot
A short description is enough^^
no, we want pictures!
shush Whitey
I'm already eagerly await... freezes because he used await in main thread
If a marker is an object, can you turn it into a simple object? ๐ค
๐คฆ
http://imgur.com/a/sEC0B (please don't steal the idea :P)
[5:02 PM] Dscha: I mean, what do you expect :joy: They are all objects :smile:
No. Dude... The Facepalm is atomic Another Synchronization joke
So a Weathermap
bagsee weathermap
Yes, a weathermap. And the presence of soldiers creates rain
guys check out my WIP weather map: http://i.imgur.com/zKtcGSC.jpg
What do you think ๐ ?
All of this marker art is really neat.
you can do that fine with markers, just not at high resolution
So now, there are 1300 squares and that alone takes 1-2 seconds to draw or update ๐
@tough abyss And? Aren't they Marker-objects? Or how would you call them?
The wheathermap is not markers. It's polygons and rectangles
Kudos for @austere granite for the SQF part of the job
you can make rectangular, elliptical and hexagonal markers dedmen
Yes. Just saying the weathermap is not made with a ton of markers
@final vessel Are you drawing those rectangles based on the black line? Can you explain how you did that? Maybe I just don't get what's going on in this picture
Anyway, it's slow. Using one big polygon could do the trick if only... it worked. I would lose the gradients inside but could gain performance
here's some of my marker art
@jade abyss [yourMarker] call BIS_fnc_replaceWithSimpleObject ๐ฏ
๐คฆ
๐คฆ
@tough abyss Please stop. Facepalms kill braincells
Ok ok.
๐คฆ
how do you upload images to discord?
You don't, you dirty Whiteypeasant
drag and drop them into chat. But it's disabled here
(btw. i think we BlueManGroupGuys also can't)
๐ฎ C&C Generals <- first thought :x
Stack what's that?
Tanoa through the Predator's eyes.
Oh, we can.
*deleted
can i rip your thing
@drowsy hollow everything is in python, in memory. Both square values and the line are calculated in python and then given to Arma where a script updates the squares and draws the line
@rancid ruin we can have hexagonal markers?
^
yeah, negative elliptical shado
I never figured out how to draw lines using a script. Is there a documentation for this?
drawLine
Use drawline for sweet 1px width lines
or you can make a function
There is documentation for everything in Arma script... Except how to write them correctly ๐
i was thinking ... setMarkerShape "POLYLINE"
assert (true == true);
๐
So, now that I've got your attention... how the eff' can I do that more efficiently? As I said before, using a custom dynamic texture overlaid on the map would allow me to have smoother lines and a more detailed map
You don't, give up.
Problem solved, next one.
Thanks! ๐
Make it happen Dscha
that... was unexpected
I do some magic here and some wizardry there
do it with normal map markers at a low resolution and rate, keep upping resolution and rate until it kills FPS, report back here with your findings @final vessel
in the end i call @little eagle to do some macromagic, done -> We got a Coffeemachine.
Just like the Linux Kernel.
2000 lines of defines and includes
and at the end one single function call
great.
anyway @final vessel No clue, tbh. First of all, i wouldn't create all Marker at once. Just the area wich is beeing seen + Next thing is -> Is THAT much detail rly needed? What if you double the size of the marker (you can count for yourself, how many would be removed, when doing that ๐ Hint: 4 != 1)
lol just noticed the Emoticon to the right of the chat box changes everytime you hover over it ๐
๐
i've not tested it but i'd presume that the expensive part is creating the markers. changing their colour would be faster.
@jade abyss thanks for the answer. Hmm... pfff... Is that much detail really needed? I'd say yes. If it weren't for arma's engine, I would have put even more detail in there. Python handles that map in microseconds
however there's also the line in the middle and it's 2017 and we want it to look fancy : ')
Python != Arma
Python = Only handles that part
Arma = Also AI, Physic, 1000000000 other scripts/commands/nudepics/whateveryourgotrunninginthebackground
in one thread. So comparing them is like...
comparing a 50t-Truck vs. Ferrari. Makes no sense.
you just just fuckoff the whole dynamic idea, and instead pre-generate a shit load of these images, then pack them in to an addon along with some meta data?
Chickenfeed and Drums!
yea no
http://www.ppe.pl/upload/editor/images/ruskie jajka.png <- fucked off the whole dynamic idea here
anyway its not possible obviously, but it's a shame that there's no way in arma to draw in image on map like that
i loved that shit
Yeah, but as you said, it's not 1990 anymore
Ni pagody! Elektronika!
Nu Pagadi
Wolfenstein 3D is out already ๐
@jade abyss Also, I refuse to believe that updating 1300 markers has to take 2 seconds
early 90s arcade Handheld Oneoh
With ONE soldier on the map
Refuse to believe what you want ๐
how many seconds does it take if you're not looking at the map?
Anyway, that was exactly the reason we started doing that in python instead of SQF. We want the computations to be done this century
around 0.2 i reckon
@final vessel why did you remove the album?
@dusk sage instantly pirated his idea here http://i.imgur.com/zKtcGSC.jpg
Because everyone knows what a weather map is, huh? ;P
that's a 404 as well
w/e ^^
maybe it's faster to modify other UI elements instead of map markers, have you tested that @final vessel ?
cos you can position ctrls over the map
The problem is loading the image, not anything else
That's not really the way I want to take TBH. I can see getting a 2x speedup tops, with changing markers.
I'm looking for something that could work 100x faster
Which is impossible without filepatching, so that's about it
update the map in unscheduled if you aren't already and possibly distribute the work over multiple frames
I'm looking for something that could work 100x faster
Oh boy ๐
People, please read the thread before answering.
Sorry.
Can anyone tell what the intended boundaries for random [min, mid, max] is ? Because the midpoint can move the result ouf of the array (random [0, -1, 10] produces negativ numbers) and more critical, random [0, 10, 10] can produce 10, even though random used to not include the upper boundary
I really appreciate the answers of people trying to help me, but I can't help but feel that:
- I'm coming here with the problem: I want to dig a hole. A big hole. Arma gives me a shovel.
- I want to find a way to bring an excavator, hence my question here.
- Most of the answers here I get are along the lines of: "why would you even want a hole? it won't be flat!" or "you can't dig that big of a hole with a shovel" (thank you!) or "you could bring 100 people with shovels"
- No one seems to think that expecting an excavator to do the digging is a sane idea... instead I'm looked at as some weirdo ๐
this excavator doesn't exist though
we're just trying to figure out what is possible
I feel you @final vessel.
this is SQF, if you wanna dig a big hole, the best tool available will be some kind of wrench
Answer: There are limitations to the engine, that you have to life with :/
@outer plover I think if you attempt to move the midpoint outside of your distribution, then you should expect what appears to be anonamlous behaviour (just dont! ๐ ) As for the bounds, are you positive it is actually 10? If you try floor the results, do you still get 10?
What do you want to hear @final vessel ? Us blaming SQF and Arma for not supporting what you're doing?
random [0, 10, 10] results in 10 most of the time, literally 10, not 9.9999 or anything
So flooring produces still 10
What answer can a chat room even give.
The real question is why would you need such a hole. You can burn the bodies instead of burying them ๐
@outer plover https://community.bistudio.com/wiki/File:bellcurve.jpg
There is no surprise it produces 10 most of the time, that's the nature of the distribution, but I was not aware it was upper inclusive. Is this causing issues? You can always lower it
Pretty goods ones in most cases @little eagle.
I know what a gaussian distribution is, but the question is, random x used to return an open (well, right open) interval. random [] doesn't specify
Hence the question, what IS the intended behavior
]min,max[ I guess
No, it is definitely inclusive
The wiki doesn't state whether it is inclusive is not, so just go with whatever you're given ๐
No, I asked for the intended behavior, not the observed one
...
You'd have to ask one of the big guys that question
Should ask the one who implemented it, not us
Or somebody with a lot of time and IDA ๐
oh shit, alternative syntax 3 is great
@lavish ocean to the rescue ?
From the examples posted on the wiki page, the usage for the alt syntax looks somewhat borked
Mh what did someone say IDA?
nono, all fine here
@still forum Is the gaussian random inclusive ?
back to the coffing dedmen. sleep well. Shush shush
You probably know that
Nobody is going to know that without looking for it
random [min, mid, max] right?
yep
I googled it and the first result is that shitty book.
He knows
wtf
He's not a wizard
stupid Americanski
Harry ?
is max optional?
No
No, that wouldn't work
There's a two-value version that computes a random between x and y but you have to give it a seed
Which makes it a little less random ๐
That is the point of the seed. You get the same result in MP on different machines.
Well, if you give the seed for a random generator, you restart the sequence, so, let's say 123 random [0, 10] always returns the same result
@outer plover So what you are looking for is a random number between x and y ?
Ouh god. I'm in the Middle of a PRNG. How did I get here ahhh
Well, yeah, selecting an array element based on a random number and a given midpoint that I can bias according to user wishes...
Just turn your function into a big array and use selectRandom
Dedmen rethinking all the poor life choices he made at this poitn
There
So what's the issue with using random [0,5,10] etc ?
More than enough...
That's a bit of a brute force method
No, it's not
@dusk sage Its the floor i think
It's not a brute force method
@BoGuru with this method, can 10 actually occur or not ?
You said it did, so without further information I'll assume it can
As I said, I just want to know whether the end points are inclusive or exclusive
you could always test it
But you are welcome to lower max by one of course
You only have to generate the array once and can even put a pre generated one directly into your mod or mission.
Varanon, no one knows what the intended behavior was regarding min and max being inclusive or not.
Maybe not even the author of the SQF command
commy is right. If you have such array [1,2,3] and your midpoint is 2 just add 2 [1,2,2,2,3] ?
[] spawn {
while {true} do {
if (random [0,5,10] isEqualTo 10) exitWith {hint "yep."};
};
};
There you go ๐
Thats not a PRNG ^^ It's a LCG :x Even worse
Geez, guys, are you patronizing on purpose or do you practice ?
Forget that I asked
You keep asking a question we told you cannot be answered.
yes we practice
@outer plover Anyway even if it is inclusive it's higly unlikely you get a 10
It won't take long with a while true
If I get a 10, I will select outside an array bound, though
๐
Here, this is what ACE2 used for random distributions:
https://github.com/CBATeam/CBA_A3/blob/master/addons/common/init_gauss.sqf
Just select a random element
Then just check if it's 10 and random again ?
Ah, that's what you mean, commy2
Like what ?
Make your own gauss curve and you can choose it to be intended to be inclusive or not.
Or run that code above and give us the answer ๐
It's not at all slower and just as random
@dusk sage 2000 years later
๐ต
x = 4 random numbers added together * 0.25
if x < 0.5
return min + (mid-min) * (x * 2)
else
return mid + (max - mid) * (x*2-1)
Does that help?
No, it still doesn't say what was intended :S
What an earth is that
But you can see that it's ignoring the max if 4 random numbers between 0 and 1 being added and multiplied by 0.25 are less than 0.5
The random thing with seed is not as useful as our scripted solution in ACE, because of JIP.
It would have to automatically discard X rolls the server made on the JIP clients or something
To answer the question: random [0, 9.999, 10] can result in 10 as well, so I guess the intended behavior is to return a number from min to max including the boundaries
With a center midpoint, neither boundaries are likely to come up
Well. I wrote the algorithm the engine uses up there :x
So the answer is, if x can be 0 or 1, you'd have min & max inclusive
random [0, 10, 10]
would be
x = random 1
if x < 0.5
return (10) * (x * 2)
else
return mid
so 50% chance to return mid. Question Answered. Didn't take that long tho ๐
That wasn't the question
No, the question is what was intended.
The question was whether it was inclusive on max
So the answer is, if x can be 0 or 1, you'd have min & max inclusive
Well that is what is intended.. I think. Eats a leaf
x is the returned value from random 1 So.. If that can be 0 or 1 then.. yeah :U
And this is their gaussian distribution ๐ ?
Arma is using LCG https://en.wikipedia.org/wiki/Linear_congruential_generator with glibc parameters
Are you sure this is for the alt syntax (gaussian)?
What I posted above yes. Thats the gauss function with min,mid,max arguments
oh lord
Anyway to track down the mouse ui number code?. Fx the keybord ui number code for B = 48
nope
damm :3
if you mean "Keyhandler for mouse"
yup that is what I meant
nope :/ Its missed pretty hardly.
dam :3 Anyway to track down if you fire a gun? Fx I got a pickaxe and if that getting fired it need to call the function pickup meth. Instead of scroll and click pick up ๐
yep
btw Dscha, I figured sending the variable now
๐
really dirty but well..
forget you!
Thanks
"forget you" ?
inb4 compile format remoteExec call
nahh
nah, setVariable via remoteExec - Commy
not really either
I'm sitting. ๐ฟ
๐
Now i got Bronystuff in my History...
There always is.
aww yis
ok going back to remote exec setVariable
the other way wouldnt keep them final
Ok I deleted the link ^^
so in short its now: remoteExec setVariable and then remoteExec one of the functions
really just more comfortable to have it that way for developing
tbh. For alot of Vars i send them in one bundle to the Client (especialy when its just for Init).
^^
I have this little setup going on, whenever the server restarts it just pulls for a git update, rebuilds the serverfiles only
In short: Iam too lazy to rebuild the clientfiles
Same here.
So why are you using RE w/ setVar?
this way: bug/new idea -> logout -> work -> update git -> restart server via command -> login -> test -> repeat
I click one .bat file -> Packing ServerData + MissionFile -> Uploading to Server -> Via RDP another .bat to Server to start A3 Server -> When A3 Server starts -> Copying all Data to the correct folder -> waiting to be loaded ๐
I just never make mistakes.
Why not @dusk sage ?
Mountain out of a mole hill
And pvar is ruled out because..?
๐ค
simple reason BoGuu, RE is at a certain point in time you can define and only to a single (or multiple) targets
Single Target -> Also possible with PVC
i mainly removed pvclient in favor of the networkmanaging profits of remoteExec
Which are ๐ค ?
see documentation
If there was no reason, remoteExec would have probably never been introduced
expect of the security filters n stuff
That was my mainconcern, regarding PVC/PVS. You can't rly filter whats beeing send to that var.
Given it's dynamic, it'd be hard to filter anyway
Yep
With RE(C) you have at least some kind of restriction given. Wich lets me sleep way better ๐
And so does the pvar ๐ ?
There is no point debating using PV versus RemoteExec for sending clients compileFinal functions from server.
Unless you going to bother to work out the overhead / network usage for both.
They both accomplish the same thing with same amount of security
^
if the data sent to the client was manipulated, there would have been another security flaw in the first place
Neither of them send encrypted messages if that is what you mean.
More like -> Sending over a function to a var, instead of a idk.. a number or a string.
which means there was a way around compileFinal
Are functions still compileFinal'd if they are send via publicVariable?
Personnally i prefer remoteexec, because i know the order the functions are send to a client.
With PV i am depending on order the variables are sent by the engine
But PV is alot easier to implement for an addon maker.
Debating security is pointless, a server can send any remoteexec / pv cfunction it wants.
If someone has managed to run custom code on your server, you have already lost.
@little eagle yeah they are
yes
Sounds to me like that would be the easier thing to write then.
because i know the order the functions are send to a client.
That is guaranteed?
@little eagle same also if you send via remoteexec & use mission namepsace set variable
@tough abyss I agree with PV easier for AddonMakers
Downside of the RE-Filterlist just beeing loaded by Mission or Addon (depending on where Arma finds it first)
@jade abyss remotexec you need to tell mission people to edit a pbo ๐
Besides talking about sending functions from server -> client == no be filters
from client to server?
@dusk sage if you send the functions in an array with RE.Tthen have the client go through the array, setting the functions. You are guaranteed the order
How is that different from sending the array via pubVar?
hmm actually i am wrong about editing the mission for RE whitelisting. Ignore that ๐
@little eagle Most people just PV a compileFinal function. no client function required. With RemoteExec version, you need a client function
So editing the mission whiteliste -> works
not true tho
Not rly, you can send the whole Code over Deco
[_Veh,{player moveInDriver _this}] remoteExecCall ["call",_Player];```
for example ๐
"anymore"
True, but i hate the idea of re call
(before someone asks: That was from a test ๐ )
it never was, yet its not less secure than a function shared or local
Of course, "call" with RE is crap. But sometimes... :/
Well re'ing setVariable is much more 'elegant' than re'ing call
The problem with that is, that you're sending the "{player moveInDriver _this}" string every time over the network.
Yep Boguu
true that commy
The question is, are you compileFinal'ing @vague hull ?
I know Commy, that was an example that it IS possible NOT that you HAVE to do it
yes I am
Its a example how to do it NOT
So if you were to PVAR a compileFinal'd function, your argument against that is?
PVC,PVS or PV?
Server to client I assume he is doing
Well.. I have read that (in theory) remoteExec, reduces Networkspikes
would have been PVC in that case
btw why not:
missionNameSpace setVariable ["MyTag_fnc_MyFunction",{hint "I am awesome!"},true];```:D
thats pv again
Well.. I have read that (in theory) remoteExec, reduces Networkspikes
Link?
I've always thought RE was worse for the network (and asked for a quantative answer the other day - seemed to agree). Whitelisting with RE has a negative effect though
as far as I know
Heard something similar also @little eagle
I've seen servers drop to their knees with RE calls firing about
With the Whiteliste, prolly
Yep
"Heard it" doesn't mean it's real tho.
Someone mentioned that its got their Probs with it. No clue why
Never said it is true.
Worth noting that the tests were done when the whitelisting was new.
But that Argument came up in the early beginning of RE
And when do things get fixed? @little eagle ๐
Maybe some time for new Tests.
I know, yet its kinda like: "its new, its its better"
๐
I saw this in a setPos be log the other day
#1 2:1723 HeadlessClient_F [-2147483648,-2147483648,-2147483648]
๐
oO
That's outside the box
THAT is outside the box:
http://i.imgur.com/AdIPNF0.jpg
isnt -2147483648 the minimum int limit?
it's 1 past it, yep
looks like someone caused and overflow o.O
at least that worked ๐
Why is your server fps at 5 @jade abyss
must be using the scheduler
It was during a test. Spamming while(true) stuff, wich spawns a the same Function, that creates the while(true) before
๐บ
nice.
was something like that.
MyTest =
{
while{true}do
{
[]spawn{call MyTest; diag_log diag_activeScripts;};
};
};
call MyTest;```
Soo, what's the conclusion ? Client FPS tied to server FPS ?
Also ๐
Mostly because of: How long does it take, to takeout a Server by spamming its threads
Was for 2017mod, i planed to add a hidden function to Bamburgh, that executes when the Servername consists "life" or something similar
it takes a long time ๐
No clue, too long ago (>9Month)
hahaha ๐
That was pre-MemoryBug
brilliant
and they would have never known ๐
Since 64bit, stuff like that is horrible. Before, if you created something recursive, which ate memory, you'd crash out at 4GB~, now your whole PC crashes at 100% ๐
nope, memory usage was low as usual ๐
just the script handle thingy stuff was filled.
Gonna make testrun
You should put some actually heavy code after the spawn
so it spawns a new instance and then does very heavy calculations
Wasn't my intention
and also set scriptName to something with Life. So if anyone with a profiling build comes around he'll think it's some life script
Intention was: Slow death
I think diag_activeSQFScripts or whatever it's called outputs the path to your sqf file right?
again: That was >6-9 Months ago, the example above was just for illustration, writen in 30s...
You could use the bug where an eventhandler is saved as a string. When the eventhandler has the script it doesn't have any filename
continues suggesting stuff
I think only if execVM'd or fileNumbers'd
Right now, i only spam with countless spawns. Nothing else. Why? Because i just don't want to and do other stuff^^
But they can detect who is causing that. And modify your Mod and then republish the modified version ๐ฎ
Thats why -> Slow death. Occuring only after... idk... 10-30min
Until they find that out -> evil laughing.
[base_speaker, "base_alarm "] remoteExecCall ["say3D"];``` returns a unkown sound, but its there and defined: ```cpp
class CfgSounds
{
sounds[] = {};
class emp
{
name = "";
sound[] = {"destroyer\emp.ogg", 1, 1};
titles[] = {};
};
class ru_incoming
{
name = "ru_incoming";
sound[] = {"media\ru_incoming.ogg", 1.2, 1};
titles[] = {};
};
class base_alarm
{
name = "base_alarm";
sound[] = {"media\base_alarm.ogg", 1.2, 1};
titles[] = {};
};
};``` any idea?
ah damnit
there is a whitespace grr
Few days ago I saw a Script Optimization guide from a guy that told everyone that stripping every possible whitespace from your script improves Performance by a lot. That would have helped you there ^^
facepalm
lol
Same guy that told everyone to use very short unreadable Variable names. Because they execute a lot faster than >100 char long variable names.
I'm sure it helps when all your code is constantly execVM'd mid mission.
Same guy that made that addon free arma radio thingy. Dedmen leaves now ###
@still forum Erm, regarding the long Var names = That would make sense, tbh.
๐
This also looks like Network Error
No CPU-load change, steady RAM usage ๐
btw. it doesn't write anything to the logfiles
Can be send from Client
MyTest =
{
while{true}do
{
[]spawn
{
uisleep 0.5;
call MyTest;
};
};
};
publicVariable "MyTest";
MyTest2 =
{
while{true}do
{
uisleep 0.5;
diag_log diag_activeScripts;
};
};
publicVariable "MyTest2";
Executed on server
[] spawn MyTest;
[] spawn MyTest2;```
21:09:13 "[2901,0,0,0]"
21:10:37 "[345589,0,0,0]"
18 FPS atm
is it still about how to crash the server the fastest?
nono, not fast
Wasn't my intention ๐
Just.. erm.. nothing gets executed on the Server anymore
Almost
For example: Check MyTest2
It should spam every 0.5s the Log
Thats my log since i started:
21:09:13 "[2901,0,0,0]"
21:10:37 "[345589,0,0,0]"
21:11:09 "::: DIAG ActiveScripts: Spawn-ed: 349390 | execVM-ed: 0 | exec-ed: 0 | execFSM-ed: 0"
Thats it ๐
FPS is still at 20, but... yeah ^^
Nothing else is working. I like that
[] spawn { TEST_A = []; while {true} do { TEST_A pushBack []; }; };```
this is a nice game killer
Instantly 9999 when pasted to console ๐
and what memory bug where you refering to earlier?
My bad, Iam sorry
can I force an AI to turnOut all the time and deny a turnIn ?
I think "careless" was the setting
I don't want a wp or behavior change
I just want a specific unit to be turnedOut the whole time
if(!isTurnedOut)then{ai action["StuffForYouToFindOut",vehicle AI]};
Would look ugly, but can't think of another solution atm. Maybe ask tomorrow again, when more peeps are online, who played with AI more around
Hey, quick question here. Is there a way to check if the server has gone into debriefing or not?
what for?
Saving the position of objects at the end of a mission.
Is the ending of a mission scripted or defined within the mission.sqm?
In other words, what triggers the end of a mission.
Okay, I'm thinking even before the breifing. But a way to gauge a time reight before it. I dont know...
the end of the mission is scripted
Then put what you need before the end is executed in the script
Hmmm..well. Wait a sec, now that I think about it. It doesn't really "end". It just restarts the server. So it's continious. That is why I wanted to save the objects
"restarts" means?
Well is it restarted via script?
yes
Full restart of SERVER or just Mission or inside mission?
@jade abyss serverCommand
Same method applies
You can save it in a database or if you want to, the server's profile.
IMO database would be easier
@tough abyss I have a feeling you have this slight bias towards databses. But yeah I understand the two different methods. Like I said, I got the saving part done with the minimalist amount of performance impact
21:54:03 [1.01718e+006,0,0,0] \o/ there we are \o/
I dont follow?
Different topic
Yup. I am spamming my Server wth [] spawn {while{true}do stuff ๐
0__0
1.000.000 active atm
dumdidum
21:55:11 [1.06827e+006,0,0,0]
*i am waiting for the Server to crash.
But I am bias I suppose. Never worked with saving stuff in the profile.
๐คท
Profile? oO urgs
At least a large amount of stuff for that matter.
why save in Profile? no, thats... no
My thoughts ^^
facepalm No of course not
DB!
Question. Why did you think I am bias to db's?
btw. extDB is working with x64 Version of Arma? (haven't tested yet)
@tough abyss "ArmaHosts" Host provider? Likely working with db's more than anything else? Yes?
I host Arma servers. Databases are the best way to store data
So much can go wrong with saving data in a profile.
Well yes of course. I was sort of joking tehehe.
๐
You can never be sure D:
๐
dumdidum... still waiting
22:00:21 [1.27274e+006,0,0,0]
Are you waiting for it to burn, is that it?
Want to make arma crash. Run a Life server...
Thats nutting new
Not nearly as fun too I guess
I don't have to deal with them, soo... sucks to be you ๐
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
hehe
22:05:07 [1.42596e+006,0,0,0]
Constantly 14% CPU load, Ram barely noticable, but almost any []spawn stuff is blocked since the first 2-3s
๐ค
Oh, now its dead
~2.000.000 x Spawn-ed
MyTest =
{
while{true}do
{
TEST_A pushBack [];
[] spawn MyTest;
};
};
Took me about 25min to kill him. Acceptable slow death.
Wow.
Server ~15-20FPS (i7-6700K)
Client - no change
_loc = getPos _pos;
_refy = createVehicle ["Fridge_01_closed_F", _loc, [], 0, "FLY"]; ``` _pos is a object obviously but Mr. createVehicle wants 5 arguments, how come?
createVehicle [type, position, markers, placement, special]
something else must be broken before
params ["_pos"];
_loc = getPos _pos;
_unitG = createGroup resistance;
_unit = _unitG createUnit ["I_Soldier_F", _loc , [], 0, "NONE"];
_refy = createVehicle ["Fridge_01_closed_F", _loc, [], 0, "FLY"];```
from:
https://community.bistudio.com/wiki/createVehicle
_veh = createVehicle ["ah1w", position player, [], 0, "FLY"];```
Does the fridge fly?
^^
Maybe it does LOL
well the commands before are working and the unit will be spawn
no clue, too late for me
Just do this:
_refy = "Fridge_01_closed_F" createVehicle _loc;
way faster:
_refy = "Fridge_01_closed_F" createVehicle [0,0,0];
_refy setPos _loc;```
KISS
Erm... ... thank you? oO
'way'
Keep It Simple Stupid, Dscha
But that saying is dumb anyway. Sometimes you don't want stuff to be simple...
the capitalization in this
German, I was explaining what "KISS" means.
I'd prefer if you would call me by my actual name, "Mason" and not my nationality that is in my nick too ๐
Okay, Mason.
๐
The whole name was too long to type.
Mason has one less letter than German
Therefore, it is faster to type Mason instead of German = time saved
Gotta keep up the efficiency ๐
Okay, The.
So I had edit my fn_onfired.sqf on my server so when I have MeleeHatchet in my hand and fire it, it should call fn_pickaxeuse.sqf. But that do not work. What am I doing wrong?
params ["_unit","_ammo","_projectile"];
if(_ammo isEqualTo "GrenadeHand_stone") exitwith {
_projectile spawn {
private["_position"];
while {!isNull _this} do {
_position = getPosATL _this;
uiSleep 0.1;
};
[_position] remoteExec ["life_fnc_flashbang"];
};
};
if(_ammo isEqualTo "SmokeShellYellow") exitwith {
[_projectile] spawn {
params ["_projectile"];
waitUntil{uiSleep 1; speed _projectile < 0.2};
_enemies = _projectile nearEntities ["Man", 50];
_nonUnits = [];
{if(!isPlayer _x) then {_nonUnits pushBack _x}} forEach _enemies;
_enemies = _enemies - _nonUnits;
_projectile remoteExec ["life_fnc_teargas",_enemies];
};
};
if(currentWeapon _unit == "MeleeHatchet") exitwith {
[] call life_fnc_pickAxeUse;
};```
Reminds me of MTG.
What am I doing wrong?
```sqf
<replace with code>
```
Now add "sqf" after the first three ` to enable syntax highlighting.
Yea saw that ๐
I'd add for debugging:
diag_log [_unit, currentWeapon _unit];
And check the RPT file what that reports.
German, I was explaining what "KISS" means.
Ah, kk
Does anyone have a faster way to sort an array by distance to a unit than _objs = _objs apply { [_x distance _unit, _x] }; _objs sort true;
No, looks fine.
You'll have to loop over every element regardless, better to let the engine handle that for you
Alright, thanks guys.
That is actually probably the best solution one can come up with.
If performance is the problem, then you might just be using TOO many objects you want to have the distance sorted
It's not causing an issue yet but the runtime is a bit longer than I'd like depending on the location.
This is the entire function
The nearObjects is only there to allow editor placed objects to be used as cover still
Any tips on speeding this up from anyone would be greatly appreciated
};
};
};
}];
};
};
}
Oh joy
I know lol
Thats even worse! ๐ฑ
if()then{
if()then{
if()then{
if()then{
if()then{
if()then{
if()then{```
if !(_modelInfo in _blackList) then {
if (_modelInfo in _whitelist) then [{
A white list and a black list?
ยฏ_(ใ)_/ยฏ
Some objects won't pass the size check
I thought both concepts exclude each other.
but are still viable cover
Are you german, The Hound? Would explain alot ๐
A, so the white list is just to skip another check.
Basically yes
the blacklist was there because it trimmed quite a bit of time off the execution
You should cache if a classname is viable or not instead of computing it for every object again.
unfortunately the objects in the blacklist array don't have classnames
well most of them
actually that's not true.
pretty much just new_wiredfence_10m_f
doesn't have a class
well you could also cache them by model path instead of the classname
Same thing, no?
I guess so, how would I go about that?
The distance checks have to remain, but all the classname and isKindOf checks would fall away.
CBA available?
yes
wait, I'll give you the concept
Why always CBA when you can just https://community.bistudio.com/wiki/getModelInfo
It needs to stop really
// init
Hound_viableCover = [] call CBA_fnc_createNamespace;
// the function
...
private _isViable = Hound_viableCover getVariable (getModelInfo _x select 0);
if (isNil "_isViable") then {
_isViable = <do all the classname / isKindOf / model checks>
Hound_viableCover setVariable [getModelInfo _x select 0, _isViable];
};
_isViable = _isViable && <proceed with distance checks>
You missed the point, Harm
Like completely
lol
CBA dependency can still be avoided
Sure, but that made it easier for me. And getModelInfo alone doesn't help here at all. He's already using it.
Wtf are you on about. He said it's available.
So might as well use it. If he said no all that would change is what I would've wrote.
Jesus.
+1
Is there a way to make a specific 'room / area' darker so its like night time? https://img.knight-industries.org/2017-04-08_19-25-04.png Thats the current situation but its well day time. I don't want my complete mission time to be night time tough
At least try to comprehend what I'm doing here.
Ok cool, thanks for this commy. I'll try it out as soon as I get home.
You understand what this does right?
You only have to do all the model / classname checks once for every model.
So some more checks initially, but every other copy of the object type is done way faster.
No shit sherlock
But using CBA to create a namespace
Isn't it overkill
Like you can already use an already defined namespace
I don't get it that's why
And what namespace should be used instead?
missionNamespace ? uiNamespace ? Even profileNamespace if you don't wnat to run the checks between restarts
But then you can only have one cache. Maybe he wants to use the model paths for something else later too.