#arma3_scripting
1 messages ยท Page 242 of 1
i'm now going to try on dedicated on regular
hum
Here they have true and false for values, but then in a3\data_f\config.cpp they use 0 and 1
So perhaps they have a macro for true and false internally
hmm... what does TASKS count as? Waypoints?
markers
Sure? ๐
I saw a BI marker in allMapMarkers ๐
had only one task active, so I suppose they're markers
tbh they could be their own data type and have a marker too
aaand the markers appear
What did you changed?
absolutely nothing
oh wait, I did restart my game
let's see if restarting it again will break it ๐
yep restarting the game broke em'
hmm
(and before anyone mentions it, no it's not JIP related)
Could it be JIP related?
๐
yes
On Dedi also?
yep
I have a small desk stop complaining ๐
nope, i will continue ๐
(removed it, doesn't belong in scripting, just wanted to randomly complain about stuff ๐ )
If you want to send me things relevant to it @lone glade I'd like to mess around with it
gimme a minute, i'll pack errythin'
Cool, thanks
https://www.dropbox.com/s/hl8uxbm2y05bwvi/markers testing.zip?dl=0
my difficulty setting was also on regular
vanilla mission, no mods required.
Did you run it both on dedicated server and local hosted with regular difficulty?
yep
gnahhhhhh..... -.-
forgot 1st rule for scripting, when it doesn't work -> Check .rpt...
testing for ~45min... wondering why it doesn't work...
var dump
log everything!
So after a bit of research we found that Arma doesn't tell the scripting engine if the player is zoomed out. So, to the game, the camera was at the same Height for both these pictures: http://i.imgur.com/Xf3AcL0.jpg http://i.imgur.com/g7376oz.jpg
Yay!
That would catch everyone that just zooms out tho
Wouldn't tell us who has the high FOV
hmm
I think getting a maxFOV in server.cfg would be best
hello
"I need help" - "No"
is they are anyone can help me
BECAUSE YOU DON'T EVEN SAY YOUR PROBLEM
aoedgnfsbgdfpgindfaspgdfsgndfsgn
Standardreply from my side ๐
i'm creating new unit addon and i got this error Undefined base class
Ah, that error. Waiiitttt a moment. I am gonna take a look at my magicglassbowl to get your config
Mootaz, pls. If you need somebody to help, give him some infos.
+when its config related -> #arma3_config
+if its config related -> #arma3_config
+for configs -> You better use pastebin.com or something similar
๐
Because: I will NOT Download anything from anyone i don't rly know, in a Chatroom ๐
^^ 202% agreed.
is they are someone here that would help
Upload to pastebin or similar @fading dust
Currently searching for my old script... i did that crap before, but can't remember how -.-
what is pastebin
http://pastebin.com/ not even going to say what i was going to say.
ok thx
i never used it and i'm creating my 1st addon
done
i upload it to postebin
link?..
What is the error you are getting?
when i launch arma it crash and say class Tunisian_Rifleman: B_Soldier_F .... Undefined base class line 131 c
so
add "class B_Soldier_F;"
@tough abyss maybe you can loadFile the arma.3cfg - problem is ppl can have a custom name and location; you could read that from the rpt file, but same applies for that ๐
Anyone have experince with RscTitles? As far as pushing variables to the screen?
Yeah they work pretty much like dialogs
Except you do not get the mouse cursor and you can define the fade in, fade out and duration time
I usually create them with cutRsc
I just wrote a little script to allow closing the gear menu when you press the gear button. it works but I'm not used to using eventhandlers - is this a good script?
_xxx = [] spawn {
disableSerialization;
waitUntil {!(isNull (findDisplay 602))};
oneoh_eh_close_gear = (findDisplay 602) displayAddEventHandler ["KeyDown", {
if ((_this select 1) in (actionKeys "Gear")) then
{
(findDisplay 602) closeDisplay 1;
};
}];
};
}]; ```
not very used to dialogs and such but why not just:
player addEventHandler ["InventoryOpened", { (findDisplay 602) closeDisplay 1; }];
Because that would just close the inventory
The point of his script is to enable the gear key which you use to open it to also close it
ah ok, sry missread that then ^^
hahahahahahaha the facewear randomization on the CSAT (pacific) is fucked http://puu.sh/pzqgE/1d2e54a121.jpg
that or they decided to adopt tanoa fashion
Any way to get an editor-placed object's (in this case playable slot) name?
which name do you want? the object reference or what you see when slotting?
the object reference name
I realize that that's just a variable, but I can't help but think player slots have something unique to them I could call
Hey all,
Getting a type error for line 14 of my script
/*
Hit.sqf
This function provides effects when a unit is hit either by enemy / friendly shots
*/
private _unitHit = _this select 0;
private _unitResponsible = _this select 1;
private _sound = "";
//check if unit damaged itself, if so then exit
if (_unitHit isEqualTo _unitResponsible ) exitWith {};
//check if unit hit is vehicle, if so then exit
if (!_unitHit isEqualTo vehicle _unitHit) exitWith {};
//TODO figure out a way to variate sounds between different male sound classes e.g. tm1, tm2, tm3
//assign hit sound from random selection of available sounds
_sound = selectRandom ["tm1_wounded_self1","tm1_wounded_self2","tm1_wounded_self3", "tm1_wounded_self4", "tm1_wounded_self5","tm1_wounded_self6","tm1_wounded_self7","tm1_wounded_self8", "tm1_wounded_self9", "tm1_wounded_self10", "tm1_wounded_self11","tm1_wounded_self12","tm1_wounded_self13","tm1_wounded_self14","tm1_wounded_self15", "tm1_wounded_self16", "tm1_wounded_self17", "tm1_wounded_self18"];
_unitHit say _sound;
sleep 0.5;
//check if it was friendly fire else play radio chatter
if (side _unitHit == side _unitResponsible && side _unitResponsible == WEST) then
{
_sound = selectRandom ["tm1_ff_generic1","tm1_ff_generic2","tm1_ff_generic3"];
playSound _sound;
}
else
{
_sound = selectRandom ["tm1_wounded_team1","tm1_wounded_team2", "tm1_wounded_team3"];
playSound _sound;
}
Error Type Object, expected Bool for if (!_unitHit isEqualTo vehicle _unitHit) exitWith {};
This was working fine in a previous mission I made in ArmA 3 Alpha but now it doesn't work anymore :S
do
(isNull objectparent _unitHit)
Ok I will try that, what is the difference in evaluation?
isNull objectparent is a bit faster
Any ideas why it was working before and not now?
simply because it is not centered @dull parrot
I got her fixed thanks X39
@tough abyss there shouldn't really be a reason it would have worked before, as the issue is caused by !_unitHit
that
You are trying to flip the boolean value of an object
I was under the impress using RscText would create a box, and using center stylings would have done the trick
thx to you btw. @dull parrot i noted that my UI editor acttually works with normal arma screen width etc. shit โค
That editor is handy btw
it will btw.
just that you have to size it correctly
@lean tiger if its inside eden, get3DENSelected should be what you need
Placed down in the editor you mean?
One last question, is there a way I can test these functions in the debugger, can I compile them and then call them in game. At the moment I am checking syntax with debugger and recompiling any time I get a logic error
Debug console won't work for scripts with comments, but if you remove those there isn't really a reason you can't do
_testFunc = {
your code here...
};
[parameters] call _testFunc;
Got it, thanks
One small thing that you might find a convenient is utilizing the params command (added in 1.48) https://community.bistudio.com/wiki/params
So this
private _unitHit = _this select 0;
private _unitResponsible = _this select 1;
is equivalent to this
params ["_unitHit", "_unitResponsible"];
params will both privatize and set the values for passed arguments. As well as being slightly faster
You are correct, I need to refactor this like with the script you helped me with last night.
@lone glade I made the change on that line, however now it is exiting when a friendly unit fires at them. I don't want the script to exit in that case.
Maybe (isNull objectparent _unitHit equalTo _unitResponsible)?
So instead of
if (!_unitHit isEqualTo vehicle _unitHit) exitWith {};
you now have
if (isNull objectparent _unitHit) exitWith {};
is that what you have?
Yea, I wonder why it is causing it to exit.
Well you need to put the exclamation point back in
_unitHit isEqualTo vehicle _unitHit is equivalent to isNull objectParent _unitHit
That works now
Is there an easier way to simplify checking the _unitHit side is the same as _unitResponsible side and that they are both WEST.
Getting a generic error reported from that line.
Yea my expression is bad because after I kill a few friendlies I become hostile and my else case seems to work fine.
Aha I just changed the == operator to equalTo
Oh well that's confusing
(side player isEqualTo WEST) //true
(side player isEqualTo "WEST") //false
(side player == WEST) //true
(side player == "WEST") //error
It's like java and string equality haha
_alphaOld = POINT_CONTROL_STATUS select 0;
systemChat format ["BLUE STATUS WAS = %1", _alphaOld];
POINT_CONTROL_STATUS set [0, (_alpha+1)];
_alphaNew = POINT_CONTROL_STATUS select 0;
systemChat format ["BLUE STATUS IS NOW = %1", _alphaNew];
why is _alphaOld inside my system chat output giving me an undefined error.
Because it is undefined?
We don't know what the content of POINT_CONTROL_STATUS is
It's a global array
Sorry
And it's init to [0,0,0] before it ever hitss this function as well.
I have tested it and if I output jusst the array, it gives me the three 0s so I know it's there.
Is this a scope thing?
code blocks please ```
'''
systemChat format ["BLUE STATUS WAS = %1", _alphaOld];
POINT_CONTROL_STATUS set [0, (_alpha+1)];
_alphaNew = POINT_CONTROL_STATUS select 0;
systemChat format ["BLUE STATUS IS NOW = %1", _alphaNew]; ```
So you are saying
systemChat format ["%1", POINT_CONTROL_STATUS];
prints "[0, 0, 0]", and then
_alphaOld = POINT_CONTROL_STATUS select 0;
systemChat format [%1", _alphaOld];
prints "any"
Correct?
@indigo snow -- thanks for the tip, but it's even more basic than that -- you can just cast "player" within their locality to a string
stumbled on it on accident ๐
๐
who is that jonpas guy and why is he stealing my name
๐
@native hemlock Yes it does.
it's easy, it's marked in giant letters on your blog ๐
What does it mean?
How exactly did X39 got into the muted trolls group?
had some argument on #general_chat_arma with somebody
I guess you can count that as an achievement
He does ๐
so I'm having an issue with groups. In the editor the group shows fine, but on the dedicated server the group shows as null group
We probably could use more information. The group might exist in the editor because it is occupied by AI that are listed as playable, but then not on a dedicated server because those units making up that gorup aren't being played
I have 4 groups that only contain non-playable AI
I renamed each of the groups
the AI are not playable
I dont know what else I can say that would be useful
What is the result of getting the AIs group once it's on a dedicated server?
I have a (server side) firednear eventhandler on the ai in the group and have a switch block for what group they're in
would also note that I can't return the ai with cursortarget
wait a sec
shit
the ai I was testing with had simulation disabled, testing now
"but on the dedicated server the group shows as null group" < how are you checking this?
group cursortarget
then i tried cursorobject
but it was still saying null, so I thought it was an issue with the group
let me test again
would I be correct in stating that ai with simulaiton disabled won't return their group?
no idea.. i thought every unit had to have a group
u checked that cursortarget is the unit?
yep, its fixed now
lthough the group names weren't what I set them to in the editor, oh well
is there anyway to hide the ammo count and fire mode top right corner of screen?
weaponInfo = 0 in difficulty?
Alternatively you can use the showHud (https://community.bistudio.com/wiki/showHUD) script command or showHud entry in your description.ext (https://community.bistudio.com/wiki/Description.ext#showHUD)
awesome, works great. thanks a bunch
hello script that opens boom fot nato help plz
Anyone able to shed some light on this? https://forums.bistudio.com/topic/191876-map-control-not-positioned-correctly-using-ctrlcreate/
for me just by looking at the images it looks like you use wrong XY values
tested using some other control?
((as i am at work i cannot currently go through your code files))
the position is definitely correct, and yes I ctrlCommit'd
I'll post code here 1 sec
/*
* Author: Kingsley
* Creates a map control
*
* Arguments:
* 0: Control config <STRING>
* 1: IDC <NUMBER>
* 2: Group IDC <NUMBER>
* 3: Position <ARRAY>
*
* Return Value:
* Created control <CONTROL>
*
* Example:
* ["configFile >> 'SomeConfig'", 100, 90, [0,0,0,0]] call mars_attributes_fnc_ctrlMap;
*
* Public: No
*/
#include "script_component.hpp"
#include "\z\mars\addons\common\macros.hpp"
params [
["_config", "", [""]],
["_idc", -1, [0]],
["_group", -1, [0]],
["_position", [0,0,0,0], [[]]]
];
_config = call compile _config;
_display = GETUVAR(GVAR(interface),displayNull);
_controlGroup = _display displayCtrl _group;
_ctrlMap = _display ctrlCreate ["MARS_gui_ctrlMap", _idc, _controlGroup];
_ctrlMapTemp = _display ctrlCreate ["MARS_gui_ctrlStaticBackground", _idc, _controlGroup];
_position set [3, (_position select 2)];
_ctrlMap ctrlSetPosition _position;
_ctrlMapTemp ctrlSetPosition _position;
_ctrlMapTemp ctrlSetBackgroundColor [1,0.5,0.25,1];
_startPosition = [call compile getText (_config >> "position"), getArray (_config >> "position")] select (isArray (_config >> "position"));
_ctrlMap ctrlMapAnimAdd [0, 0.1, _startPosition];
ctrlMapAnimCommit _ctrlMap;
_ctrlMap setVariable [QGVAR(controlKey), [_config] call FUNC(createControlKey)];
_ctrlMap setVariable [QGVAR(execReturnData), ""];
_ctrlMap ctrlCommit 0;
_ctrlMapTemp ctrlCommit 0;
mapAnimCommit;
systemChat format ["mapAnimDone: %1", mapAnimDone];
_ctrlMap
logging both positions returns the same thing, so there's no difference
tested using some other control?
also where you get the position from
_config is not set in your sqf file
thus it is hard to observe
https://github.com/marseditor/mars/blob/master/addons/attributes/functions/fnc_onAttributesLoad.sqf
this is the function that handles the main control creation - line 167 is the string code it calls. the positioning in there is messy but it works
as for the tested control, it uses this class https://github.com/marseditor/mars/blob/master/addons/common/UI/Controls/ctrlStatic.hpp#L64
and in this case _config refers to this class https://github.com/marseditor/mars/blob/master/addons/attributes/CfgAttributes.hpp#L35
thats the worst style i ever have seen dude ...
_requiredConfig,
format ["'%1'", QGVARMAIN(attributes)],
format ["'%1'", _component],
format ["'%1'", _attribute],
"'AttributeCategories'",
format ["'%1'", configName _catConfig],
"'AttributeItems'",
format ["'%1'", configName _itemConfig],
"'AttributeControls'",
format ["'%1'", configName _ctrlConfig]
] joinString " >> ";```
wanna tell me what this resolves to?
forget what i said
just saw you linked what i wanted
where you call the function? and get the position from?
cannot find the function call of the function you provided (and as said ... actually at work so cannot check deeply)
it's on onAttributesLoad.sqf, it's in there somewhere, but I wouldn't recommend sifting through it to find the position, not even I remember how that shit works
"[""%1"", %7, %8, [%2,%3,%4,%5]] call %6"
the array in that string is the position
so this:
CATEGORY_SPACING + LABEL_WIDTH + GRID_W + (_ctrlIndex * _ctrlIWidth),
_totalLabel + _itemLabelY,
_ctrlIWidth,
LABEL_HEIGHT,
pretty meaningless
actually that is where the whole problem most likely is located at
but it's not..
your code requires a rewrite dude ... that is clear at least ๐
will check it out when i am at home
alternativly, just create the control without the script around and check if that is the root cause
someone just suggested it could be the controls group offset
but as the gif shows, the map is technically in the right position because you can move the map itself clicking/dragging on the expected pos, it's just the image itself that is misaligned
not familiar yet with ctrlCreate scripting. what are the dimensions of the image and could the offset be due to that?
i would try a 2^X as a test and see if aligns correctly top left at least
controls groups are also the pure evil
best avoid that as much as possible
like I said, the position is correct: https://gyazo.com/1e9580f95f7e2d2c06c2cc2c7a512232
well interaction part seems to be correct. it could be just bugged controls groups
had a really bad time trying to use them 2-3 years ago
i tried making the map in the parent controls group, so not in the child, but same problem occurs
no idea if anything has improved meanwhile
control groups are necessary
and useful for things like scrolling a collection of controls
i would reduce the issue to a simple test case. if its still bugged, send it over to Karel or muf from BI and hope they fix it
any ideas why I can't ctrlCreate a progress bar?
buttons, sliders, images all work fine. can't create a progress bar for shit though.
just use a RscText with a background
center it
set the width to 0
then to the max value
and use ctrlCommit where the number is the time until the bar is full
have you used that technique before?
yes
nice, i'll give it a go
progress bars were a bitch with the last config defined ui i did, but i can't even get one to display with ctrlCreate, fk progress bars tbh
They've changed it since to use the dedicated progress bar control
2 space indentation?! living life on the edge
but that is pretty pointless imo
kingsley, in AGM this was the convention
thanks to Flummi
I didn't like it. I wanted four
cause everything looks the same with 2
yeah it does
at least on my 17.4"
Though, if you open AGM_Core you still see the resemblance to ace_common
I have no idea how we managed without include
jesus
you're saying progress bars have been annoying better scripters than me? excellent
trust me, everything to do with UI annoys all scripters
you get addicted if you do it to much
@rancid ruin SQF annoys all kind of scripters
commy what the hell does this do https://github.com/KoffeinFlummi/AGM/blob/master/AGM_Core/functions/fn_codeToLetter.sqf ?
very simple and outdated dik code to key lookup table
"1"
as in key 1 will report 2
which is the DIK code of 1
interestingly
Esc is 1
1 is 2
2 is 3
etc.
madness
pretty sure there are better solutions
I think it was for the AGM interaction menu "commy rose"
it only supported a-z and 1-9 and 0 as hotkeys, so it was sufficient
it's probably better to enter the DIK_Codes in code
by including the librabry for them
but that was not what we were doing in AGM
because we didn't know any better
And writing "R" is certainly better than writing 15
It's just that writing DIK_R is better than both
the real mystery is why you didn't put an easter egg in the first item in that array
I think it was so it reports "" if you use an invalid (or unspported) dik code
instead of erroring out
yeah but it could have reported "commy is best" instead
then the menu would show "commy is best" as shortcut when the button never had shortcuts configured
(almost none had these shortcuts)
only gestures uses a shortcut
ohhh i remember that radial menu
I remember making it ๐
when's it a good idea to start using CfgFunctions for your own scripts in a mission? ASAP? if it starts to get big? if you know you'll re-use the functions? always?
First protype. Made for BWMod when AGM didn't exist and everyone was waiting for a port of ACE2:
http://i.imgur.com/P1YpaaE.jpg
tornikee [sic] lol
when's it a good idea to start using CfgFunctions for your own scripts in a mission?
Functions are always good. When you use some piece of code twice it basically has to be a function imo
Even if you just use it once it can be beneficial
I'm not a fan of scripts with more than 200 lines personally
and just going mytag_myfunc = {} isn't technically making a function?
It is, but having fifty of them in one files isn't to good if you want to find and edit one
yeah i'm starting to see the importance of laying things out well
CfgFunctions also manages stuff like function caching
and prevents them from being overwritten by cheaters
somewhat
And it adds debug stuff like _scriptName and _scriptNameParent
it seems like it could take a little longer to get an understanding of how a project is laid out (like looking at AGM just then) but when it comes to debugging or collaborating it'll be worth it
You'd have to set up all this yourself
it seems like it could take a little longer to get an understanding of how a project is laid out (like looking at AGM just then) but when it comes to debugging or collaborating it'll be worth it
exactly
ACE is even more complicated, but it's easy to work with it if you know what youre doing
yeah ace was very overwhelming when i tried to investigate adding things to it's interaction menu
i'm gonna look at cfgFunctions today, thanks
feel like it'll be worth the effort if it makes me lay my projects out better
https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
^ this explains it all
even with colors
omg, discord breaks the link
just add the closing parenthesis
yeah i've read that but it doesn't really advise when is a good idea to start using them
actually i guess this line does
When writing a script, consider registering it into the Functions Library.
basically, always then. got it.
Yeah
I think CfgFunctions is the only way to execute functions on mission start
(outside of CBA)
with the postInit and preInit flags
interesting, i'm learning things today
apparently server admins might not like it if you hack as well
Server admins might blacklist your addon if they find out you're using the function for hacking.
so is preInit before simulation starts, right after clicking play on the lobby screen?
literally before init.sqf and initserver.sqf and initplayer.sqf are run?
Sort of in a conundrum, wondering what the cleanest way to execute this is
I have a JIP remoteexec that handles player setup, loadout, etc. At the end it attaches an event handler on respawn to delete their corpse.
Works well, of course now the issue is when they disconnect they leave bodies
I can't attach event handlers to JIP slots, so I can't flip it serverside
don't use a JIP remoteExec for that, use initPlayerLocal, for the disconnected problem you can use the proper EH serverside
gimme a sec, i'll link an example
addMissionEventHandler ["HandleDisconnect",{_this call TAG_fnc_disconnect; false;}];
the only disconnect handler I could find only returned session information?
Was the quickest one I could copy paste ๐
๐
addMissionEventHandler ["HandleDisconnect",{deleteVehicle (_this select 0);}]; kind of thing
oh, dangit -- I just found it now
I was lokoing at playerDisconnected
thanks @lone glade , @dusk sage ๐
Remember to pop it on the server
Ofc, I grok locality ๐
Oh my, these MissionEventHandlers are new to me though -- and god they really simplify a bit
๐
new command that will certainly interest a lot of you https://community.bistudio.com/wiki/addPlayerScores
was added a while ago, but the doc is new (ish)
also it seems that whomever enhanced the revive system read my feedback tracker ticket ๐
hello
does anyone know what the sneak peak command is for steam cmd
for example 107410 -beta development
guys, small numbers like 1.2123e something , is there a way to round them to let's say this format: 0.000 ?
The ARMA engine as like most languages will process numbers with exponential notation
If you leave this as a scalar, there is probably not. However, you can convert it to a string without said notation, if you wish to display it, etc
Which I can't see any other reason for
yeah im monitoring very small numbers but in the end i only work with numbers up to 0.01 so having it rounded to that would be awesome.
So you want to round the numbers? Or display the numbers in a readable format?
uhm. display only actually.
up to 2 or 3 digits after point.
like this: 0.001
[scalar] call BIS_fnc_numberText will output it correctly
im writing audio engine documentation for wiki, which is why i need to know this.
get into a jeep (devb ranch) and use this function. then put camera inside and watch the value go down into oblivion.
............... BIS_fnc_drawRespawnPositions is a while true do loop
lol does it have a sleep?
yes, 0.001......
Create your own BIS_fnc_drawRespawnPositions ๐
i wouldent doubt that
also, revive was finally improved, and they used params and param ๐
nah, I got mine
they still haven't fixed zeus saving owners into unit var instead of missionNamespace
zeus doesn't get reassigned after death if the unit is deleted
which BIS revive does
typeOf cursorObject is returning null on most buildings -- any smarter way?
just looking to grab "land_miloffices_v1_f" etc
aim better ?
oh common hear me out: casting it to a string returns the id, model file, etc
but typeOf returns a zero-length
typeOf cursorObject works perfectly fine in the debug console watch field
if you want classnames use 3DEN, place the building and copy the classname (there's a right click entry for that )
note that some 3DEN buildings do return empty strings for some reasons.
cc, thanks
is there a reliable way to detect if a unit is inside a building?
what technique? line intersects?
you can check for lineIntersections in a 360ยฐ radius
or check if the player bounding box is within a building' one.
my first thought was bounding box, but my 2nd thought was how inaccurate it'd be
the question is "why" you want to check that.
maybe we can find alternative solutions to your problem
Then again, using lineIntersects in that manner, may not be the optimal solution
i'm helping a friend with a mission he's making where the player has some kind of "exposure" level
I tried the scheduler today
a while true loop to print the FPS
just for debugging
I forgot the sleep
inb4 it crashed
It crashed 3 times after 10 seconds
lol
hahaah
game just died
Yeah the sound is what kills it
That wasn't the case in previous versions
I wasn't using silent, because I was listening to my mp3 player and had the pc sound turned off
That's just ridiculous
I thought I fucked up in my scripting
what was the fps though?
but it was definitely the while loop
@little eagle Up for testing if for "_i" from 0 to 1 step 0 do {}; is any better than a while true loop, ignoring the number of possible iterations in an un-scheduled environment ๐ ?
97
Not really, that will probably still run multiple times per frame
it was just for debugging
oh and the FPS was 97 after I added the sleep of 1
it went to 30 and below without sleep
But I guess thats to be expected?
But crashing the game? That's just dumb
how do I know that it doesn't crash the game after the first use
allvariables does report [] in MP
because some people think it was a security risk
or something
allvariables does report [] in MP
at least for mission and ui namespace
I though it was missionNamespace
Global in the sense everyone sees you get kicked for not responding
When your game instantly crashes out
@little eagle only for uiNamespace and profilenamespace
๐
ok rgr
like there is anything secret in the profile namespace
do you store your banking stuff there? I don't think so
it's silly. well, as long as it works on objects and locations I'm ok with it
allVariables shouldn't be used on these big namespaces anyway outside of debugging
Any handy method to convert XYZ anglular rotation to vectordirandup?
I'm trying to copy out a bunch of stuff I've placed down in the editor out of the SQM -- has to be placed on the fly, and I'd rather not just unhide it
vectorDir _obj params ["_x", "_y", "_z"];
_azimuth = _x atan2 _y;
_inclination = asin _z;
You have to keep the vectorUp to know the tilt of the object.
azimuth will be -180 ... 180
0: north, 90 east, 180/-180 south, -90 west
inclination will be -90 .. 90 with 0 being forwards
Yeah. That would be the easiest way. No idea wht he is doing exactly
I'm not sure anymore either, alganthe
Trying to createVehicle on the fly, and then rotate it properly -- it's on a hill so it's not pretty ๐ฆ
BIS_fnc_setPitchBank ?
yeah, was looking at that
Never knew they existed, taking a peek
Bah, I'm just going to have a fire event to copy it out of the editor -- shoulda done that before bothering you all
Thanks @tough abyss
what are all these BIS_fncs containing "OO"? left overs from the attempt to integrate java?
well ... using OOS should be the more simple way to use SQF with OOP modelling :3
guys. can you save code as a variable and then call that variable in order to "paste" the code?
like this:
code = {doStuff;
moreStuff;
Morestuff};
while {true} do {
code
};
?
ABC = {systemchat "wรถrks"};
while{true}do
{
call ABC;
};```
while {true} do ABC
Or that
thanks guys.
is there any way i can run several arma 3 clients on the same pc? i want to test mp scripting
I don't think you could if the server had battle eye running, but otherwise I guess you could
i've done it accidentally a few times
i think you need to edit server.cfg accordingly if it's a dedi, it's called allowDuplicateIDs or something
Here is one I have not been able to find anywhere.
How would one, based off a conditional, attempt to alter the point a individual unit spawns at.
I need to dynamicly rotate from a TDM type spawning system, into a round based spawning system, mid match.
I also need to alter what a unit spawns in with, given the same conditional.
I am guessing on player death
???
Designer?
sleep 0.5;
// Increase for west
if (_side isEqualTo west) then {
// Should never increase status if status is at 10
if !(_alpha isEqualTo 10) then {
systemChat "BLUE IS TAKING ALPHA!";
// _alpha = POINT_CONTROL_STATUS select 0;
POINT_CONTROL_STATUS set [0, (_alpha+1)];
sleep 0.5;
// _alpha = POINT_CONTROL_STATUS select 0;
systemChat format ["ALPHA STATUS IS NOW = %1", _alpha];
};
};```
With the above, _alpha is a int.
Assuming the conditions all line up to true, which in testing they are, why is my output for the first system chat, always the same as the second one.
Yet the incrementation is happening
And it's happening within the guidlines I want.
IE, never going over ten.
Output is something like
"ALPHA STATUS WAS = 0"
"BLUE IS TAKING ALPHA"
"ALPHA STATUS IS = 0"
"ALPHA STATUS WAS = 1"
"BLUE IS TAKING ALPHA"
"ALPHA STATUS IS = 1"
etc.
If I am leaving anything important out let me know.
Within the if statement you never increment _alpha but you still use that in your systemChat command. If you do systemChat format["ALPHA STATUS IS NOW = %1", POINT_CONTROL_STATUS select 0]; or uncomment the line right above the final systemChat then it should display the new value of _alpha.
So in order to get the real new value of the array element, I need to re assign it into alpha after incrementing?
_alpha = POINT_CONTROL_STATUS select 0;
That is _alphas creation.
I see, so alpha is still just a int.
And it has nothing to do with the actual value stored in my array.
correct?
Which one are you talking about? I see two of those lines commented out in different places in what you posted.
sleep 0.5;
// Increase for west
if (_side isEqualTo west) then {
// Should never increase status if status is at 10
if !(_alpha isEqualTo 10) then {
systemChat "BLUE IS TAKING ALPHA!";
POINT_CONTROL_STATUS set [0, (_alpha+1)];
sleep 0.5;
systemChat format ["ALPHA STATUS IS NOW = %1", _alpha];
};
};```\
Basicly, I mis understood what _alpha = POINT_CONTROL_STATUS select 0; was doing.
I thought it would update it self in accordance with the array element after creation.
But it's only a int.
And has nothing to do with the array element within POINT_CONTROL_STATUS
So, the only time it updated was when the script itself fired.
Because at the time, I re-set _alpha to the value of POINT_CONTROL_STATUS select 0
I see my mistake, just find it funny such a silly think to overlook.
// 1. Render the display of point capture status in coordination with ff_pointControlStatus
// 2. While rendered continuously update itself.
private["_display"];
disableSerialization;
_display = _this select 0;
_AlphaStatus = _display displayCtrl 1301;
_BravoStatus = _display displayCtrl 1302;
_CharlieStatus = _display displayCtrl 1303;
// Init the display variables
while {!isnull player && ACTION_PHASE} do {
// set and render?
// Set images for the point display crtls
_AlphaStatus ctrlSetText format["%1", ALPHA_DISPLAY_STATUS];
_BravoStatus ctrlSetText format["%1", BRAVO_DISPLAY_STATUS];
_CharlieStatus ctrlSetText format["%1", CHARLIE_DISPLAY_STATUS];
// alpha = 10 west owns, set flag image.
sleep 1;
waituntil {!isnull player};
// cut the display
cutRsc ["ffDisplay", "PLAIN"];
}; // while ```
The above indeed outputs a display, but it doesn't update the display with the ctrlSetText.
I know the variables are being assigned.
// INVOKE ACTION PHASE + START TIMER
[] spawn ff_hudManager;
systemChat format ["TIMER STATUS : %1", TIMER_RUNNING];
TIMER_RUNNING = true;
[ROUND_TIME] spawn ff_timer;
systemChat format ["TIMER STATUS : %1 and TIMER IS NOW RUNNING!", TIMER_RUNNING];
// START FLAG LOOPS
[] spawn ff_AlphaFlagHandler;
[] spawn ff_BravoFlagHandler;
[] spawn ff_CharlieFlagHandler;
// RUN ALL UNTIL TIMER IS UP
waituntil {!TIMER_RUNNING};
CURRENT_ROUND = CURRENT_ROUND + 1;
ACTION_PHASE = false;
};```
That loop first the hudmanager, which is what outputs the display.
The flaghandlers are what would be assiging the variables.
is this a correct statement?
[cursorobject,["HitEngine",1]] remoteexec ['sethitpointdamage'];
would that work? or should i just use
cursortarget sethitpointdamage [HitEngine,1];'
The problem i have is that i want damage to be applied globally, but i cant get it to work.
remoteExec on the server is setup correctly, the function for the script is also added to exceptions and loads without any error in postinit.
Each is a loop, which runs until ACTION_PHASE is false.
here is s part of the SQF file and config file.
#Config.cpp
class CfgFunctions
{
class IBZ
{
class Immobilizer
{
file = "\immobilizer";
class Immobilizer {postinit = 1;};
};
};
};
#\immobilizer\fn_immobilizer.sqf
if (hasInterface) then
{
vehicle player AddEventHandler ["Fired",
{
if (!isNull cursorObject && currentWeapon vehicle player == "Immobilizer" && vehicle player distance cursorObject < 200) then {
IBZ_targetHit = True;
hint 'Keep on target!';
player say "immobilizer_locking";
IBZ_target = typeof cursorobject;
[]spawn
{
if (isNull CursorObject) then {
IBZ_targetHit = False;
};
sleep 7;
if (IBZ_targetHit && currentWeapon vehicle player == "Immobilizer" && typeof cursorObject == IBZ_target) then
{
[cursorobject,["HitEngine",1]] remoteexec ['sethitpointdamage'];
hint 'Vehicle Immobilized!';
[]spawn {
currentvehicle = cursorobject;
[currentvehicle, "immobilized"] remoteExec ["say"];
if (!(isNil "enginesmoke")) then {deletevehicle enginesmoke};
enginesmoke = "#particlesource" createVehicle position currentvehicle;
enginesmoke setParticleClass "SmokeTrailEffect1";
enginesmoke attachto [cursorobject, [0,0,0]];
sleep 60;
deletevehicle enginesmoke;
};
player say "immobilizer_success";
cursortarget say "immobilized";
} else {if(IBZ_target != typeof cursorObject && currentweapon vehicle player == "Immobilizer") then {
hint 'Immobilization Failed!';
player say "immobilizer_failed";
};
};
};
}
its the same immobilizer i have been working on earlier, which i am determined to get to work. Im starting to think that it is an Exile issue.
i want to add that it works perfectly on a listen server and in the A3 editor.
is it because of cursortarget is not local?, i guess somehow i need to execute the
SetHitpointDamage locally somehow
im reading up on remoteExec and im kinda confused about locality. how would you suggest i call this action?
i just found KK's locality tutorial, and the pieces are starting to get together now ๐
not sure of the bigger picture, or if you're having issues with this bit of the script, but i was playing with cursorObject earlier and I think rather than
if (isNull CursorObject)
you should maybe test for
if (cursorObject isEqualTo objNull)
I'd use reveal for nearest objects before using cursorXyz, I've noticed that else cursorTarget and cursorObject are not very reliable on busy servers and sometimes take ages to get what's actually in front of you.
ah, ok.. but this is supposed to only affect what is being tracked with the crosshair
if i would use nearestObjects it would not really be that accurate, and it would be too easy toimmobilize, right now you actually need to track the target for 5 secs, it will only success to immobilize if you still have the cursor on the target after 5 seconds
but i understand what you say, as it might not really be a reliable solution
to give you the full perspective of the script.. it is a immobilizer script the co-pilot/gunner in a helicopter, the CCTV operator will track a vehicle with the camera, hit fire (which will trigger the script) and then it will:
- Find what the target is
- create a spawn with a timer that counts down.
- if the cursor remains on target after countdown it will, continue to execute the immobilization,, in this case SetHitPointDamage "HitEngine", i have read up on locality on KK's blog, and atleast i have understood that i need to run the command locally on each client via a publicvariable. im not at home right now, so cant test it yet, but i tried to modify his setfuel example. and this is what i got so far.
private ["_IBZ_target","_EngineHit"];
_IBZ_target = IBZ_target;
_EngineHit = 1;
if (local _IBZ_target) then {
_IBZ_target setHitPointDamage ["HitEngine",_EngineHit];
}
else
{
GlobalHit = _this;
publicVariable "GlobalHit";
};
};
"GlobalHit" addPublicVariableEventHandler {
_IBZ_target = _this select 1 select 0;
_EngineHit = 1;
if (local _IBZ_target) then {
_IBZ_target setHitPointDamage ["HitEngine",_EngineHit];
};
};
that is a very convoluted way of writing something that only needs one line
setHitPointDamage is global afaik
setHitPointDamage requires a local unit but has global effects
alright mr encyclopaedia ๐
[IBZ_target, ["HitEngine"_engineHit]] remoteExec ["setHitPointDamage", IBZ_target];
editied. It's something like that
note that this won't work for helicopters reliably, because those have multiple engine hitpoints since the heli dlc
HitEngine1, HitEngine2, HitEngine3 etc.
depending on the heli
You don't set the hitpoints of those with this function, which means that HitEngine, the master hitpoints, will be recalculated back to the previous damage if any of the other engine compartments are hit
Hitting it with a 5.56 bullet is enough in this case. It doesn't have to do actual "damage"
ok, well its mainly intended for groundvehicles as target
No vanilla vehicle has "dependsOn" (I think that's how they are called in config) HitEngine hit points
But addons might have
this was my last code i tried btw
[cursorobject,["HitEngine",1]] remoteexec ['sethitpointdamage'];
aha
setting HitEngine to 1 is also kinda pointless
The vehicle will explode
might as well use setDamage in that case
no actually the vehicle wont explode..that i know, because i have done it multiple times locally, i will post a link to a short demonstration video
aha
anyway in the video you see the script working.. Locally in the editor, also, it works as server, but not on our dedicated box, and the remoteExec is set up allright
i have even added the function to the exceptions there aswell
I don't think the error is with remoteexec in that case
you should add some diag_log to see if your code is even executed on the dedicated
interesting, how would i go about that?
but what you say hereis basically that i would aim for using remoteExec and not using the way i posted above?
this is the top of the actual code atm
if (hasInterface) then
{
vehicle player AddEventHandler ["Fired",
{
if (!isNull cursorObject && currentWeapon vehicle player == "Immobilizer" && vehicle player distance cursorObject < 200) then {
IBZ_targetHit = True;
hint 'Keep on target!';
player say "immobilizer_locking";
IBZ_target = typeof cursorobject;
[]spawn
{
if (isNull CursorObject) then {
IBZ_targetHit = False;
};
sleep 7;
if (IBZ_targetHit && currentWeapon vehicle player == "Immobilizer" && typeof cursorObject == IBZ_target) then
{
[cursorobject,["HitEngine",1]] remoteexec ['sethitpointdamage'];
I don't know if your code is executed on the dedicated or on a client
You are sure that sethitpointdamage isn't blacklisted on your server?
I think that is possible which is why I personally never use remoteExec - not reliable
no because i did it from the debug console in infistar, but just
cursorObject sethitpointdamage ["HitEngine",1];
you have to be the driver of the vehicle on the dedi for that to work
i dont want to use it either if i dont have to.. im just trying to find out the best way for my intentions
oh
well that aint gonna happen x
and it doenst have interface either so
vehicles switch locality depending on who is driving
so it's actually steerable ...
yeah read that on KKs blog
remoteExec is the way to go for mission makers
[cursorobject, ["HitEngine",1]] remoteexec ['sethitpointdamage', cursorobject];
try to only target the machine where the object is local
well if i target a moving vehicle, the driver should always be local right? P
i mean the car will be local to the driver
yes
but this isnt in a mission, its in a mod
hmm. I'll think about it, but I have to go now
here's the example KK did for setFuel
KK_fnc_setFuel = {
private ["_veh","_fuel"];
_veh = _this select 0;
_fuel = _this select 1;
if (local _veh) then {
_veh setFuel _fuel;
} else {
PVsetFuel = _this;
publicVariable "PVsetFuel";
};
};
"PVsetFuel" addPublicVariableEventHandler {
_veh = _this select 1 select 0;
_fuel = _this select 1 select 1;
if (local _veh) then {
_veh setFuel _fuel;
};
};
the onei edited for my purpose
he made this befor remoteexev was made
oh, ok
so you think i should totally focus this on getting it to work with remoteExec then?
the "say" and the smokeparticle spawn works atleast even on our server, its just the sethitpointdamage part... the other commands doesnt seem to need to be remotely executed
Any reason why some of the 'persistent' modes prefer to use the profile information rather than the player UID (steam id)?
Is it preferred to not have people able to know each other's ID (if its a database)
I'm basing this only on "don't delete your profile, or Koth/Arma life/persistent wasteland won't copy over" -- out of some developers mouths IIRC
Hey, is there a way to check if the player is freefalling?
maybe check if the players current animation is the freefall animation
yep, that did the trick, thanks!
@lean tiger it allows you to have multiple characters rather than just one tied to your UID
@lean tiger some game types like KOTH save a variable to your profileNamespace rather than having to hook up a database to each of their servers.
If the data stored clientside of course there are security risks envolved ๐
Its up to decide if you want data stored serverside that you could query / alter.
Or to store it clientside and hope the player don't mess with profile data i.e by accessing it via the editor.
Personally i perfer using a external database, it makes backups / restores alot easier than using profilenamespace
Means -> Securitywise a hugggeeeeeeeeeeeeeee(+10000 "e") hole
I know another reason why Torndeco is using external databases hue
But srsly, everything has been said ^
@tame portal in fact ... depending on the ammount of data, it can be smarter to use proper db systems
also, the database allows you to query the results
which you have to implement first for the non-database system
it also can't be modified by the player
nope ... it can be modified just like the non-db stuff
well, less easily at least
If done serverside -> Nope
If done serverside -> Nope
just gimme a week
can proove you wrong ๐
well, less easily at least
better
Still, done on server -> Without hacking -> Nope.
that ^
Still, done on server -> Without hacking -> Nope.
there have been ways
there might still be some
you just have to find them
You're talking to a database goon ^^
I guess I just meant to ask if playerUID relatively unbuggy? Nothing weird with players disconnecting in and out of those slots, etc
_syntaxHighlighting is underrated on this channel;```
goofy question, can you add a procedural texture on top of an existing texture?
for setObjectTexture*
It would replace it
any way to 'tint' it then perhaps?
without having to make a seperate .paa?
was hoping there was some poorly documented trick like
obj setObjectTexture [0, "images\asdf.paa#(rgb,8,8,3)color(0.5,200,0,0)"]
^^
Any tips on ending a PVP multiplayer mission with multiple ends per mission?
Would this work out or would it be problematic?
["END2"] remoteExecCall ['BIS_fnc_endMission', EAST];
sleep 15;
"END7" call BIS_fnc_endMissionServer;```
Have anyone an idea how to fix (or a workaround) that Arma3 Vanilla Item EXPLOIT, which I posted in #server_admins ?
Does anyone have in mind the 3d markers used on the bootcamp? How can those be created? Like in this video https://youtu.be/0tOSjYgGvHw?t=49
drawIcon and drawIcon3D are quite heavy
Got it,well thank you so much
class controlsBackground {
class Vignette: RscVignette {
idc = 114998;
onLoad = "(_this select 0) ctrlshow !is3DEN;";
};
1.62 onLoad for controls?
interesting
maybe it's bs and doesn't work
kinda unneeded if you would ask me
no one asked you
sorry, you went there
was too exploitable
it means that we can add onLoad scripts without overloading the onLoad of the display by adding dummy controls
no need to sorry, ppl rly never ask me and tend to do things on their own way even if i really know it better (eg. tenting ...)
but usually the normal display onLoad function can do as much as here ... and it is much cleaner using SQF file currently anyway as the UI-Editing is a nightmare already in arma
still this can get damn handy for my UI-Editor
any other new EHs we can use directly in the config?
haven't noticed anything else yet
would be glad if you could just randomly try the others (currently at work + would have to redownload apex again ...)
haven't checked if these work. I just noticed them because I have to adjust all displays in CBA for the new grid they use
nothing special
the configure display uses the centered grid now
and a few other similar adjustments...
ahhh
totally unnecessary
this alone breaks CBA compatibility between apex and the linux branch
: /
why not centering using safezone?
had some broken algorithm which accidently did exactly that in the UI-Editor ^^'
the GRID is safezone
why is X39 in the @muted_trolls group yet he isn't muted? ๐ค
not that I think he should be muted, just wondering
muted for dwarden and the BIMINIONS
just cannot access #general_chat_arma
they changed GUI_GRID_X to GUI_GRID_X_CENTER
lol
#define GUI_GRID_X (safezoneX)
got some solution for that in theory
you wont like it though ...
#define GUI_GRID_CENTER_X (safezoneX + (safezoneW - GUI_GRID_CENTER_WAbs)/2)
#define GUI_GRID_CENTER_X fooofooo
#endif```
should make keep compatibility
but has to be added everywhere
it's not that difficult. problem is that CBA keybinding doesn't use the macros , but the raw safezone math shit
so it's a bit cumbersome to edit
ohh hell ...
well ... i do know why i never even considered contributing to CBA
do you really need to keep compatibility with the linux port? It's so far behind and hopefully the port will be updated once APEX is released..
well ... i do know why i never even considered contributing to CBA
that's why no one likes you
do you really need to keep compatibility with the linux port? It's so far behind and hopefully the port will be updated once APEX is released..
people keep asking for it
yup
would have to commit a "few" changes first before i would even consider starting to work on it
you didn't even realize what I meant
It's not about CBA
but you didn't even consider helping out someone else
doesn't matter if it's CBA or not
i did realized
and i also told you what would be my personal problem
I doubt the linux branch will be updated to 1.62 on apex release
it's still on 1.54 atm, right ?
Same. Last I heard they are working on 1.58
waiting for APEX makes sense though
well. you can't release a CBA that works with APEX and stable
it's too different in some key places
So people will have to wait for JR with APEX weapons etc
stable being 1.62 without the APEX expansion?
oh right ^^
well ... you could however start releasing a linux & windows build
sure
would require some tricky merging and separated branching
but that would be a pain to maintain
but possible
maintainers prob kinda :3
would be solvable using macros
werent there some macro lovers here?
X39 , the reason you dont contribute to CBA, is that anything you submit would get rekt by the review members
#ifndef LINUX_BUILD
(_turrets select {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}) param [0, []]
#else
([_turrets, {{_x == _weapon} count (_vehicle weaponsTurret _x) > 0}] call BIS_fnc_conditionalSelect) param [0, []]
#endif
I know it looks horrible
but sometimes you have _this vs _x
@nocturne bluff lemme repeat: i would have to change a hell lot of things so that it would match me (not you)
not like i would let myself get stopped by some review members if i would have to get something into CBA ...
but not using CBA --> no need to get something into it
--> no need to satisfy somebody
Whatever makes you sleep at night.
it is that i know that many of you will sooner or later come in contact with some fiddle i wrote and that you will rage about the fact that you have been using it or thought "well ... not that bad" โค
loads of gibberish without commenting
Btw, you arent a useful asset to this community, stop pretending you are.
aww i โค you too @nocturne bluff
typical - my script is longer than yours
hahaha
((in fact: i was one of the key components before i stopped to maintain XMedSys as AGM arised, just to note))
still ... XMedSys was a pile of junk code
wonder that it ever worked
dreams crushed
not rly @foggy pike ... but i already can see where this would go to ... and i already got a strike on my ass
do not need a second one
anyway ... sorry then
๐ถ
@queen cargo CBA has established standards for code in there, just because I am wondering, what would you change to "fit your needs"?
i do not like those used by CBA and ACE
so what would the alternative standard be?
would have to review everything ... but it starts at the location of the {s eg
ok and why would anyone change the standard to fit your needs?
typical "my code style is best style" guy
so..
if (condition) then
{
};
```?
it doesn't wrap properly
Oh yes the 40 year old standard of wasting a line
nobody will @warped thicket
as i also said: do not need to contribute, so i do not need to take care of those style rules myself
which is infiurating
if (
condition
)
then
{
do stuff
};
I just don't see your reasoning of why anything should be like you want it to even consider contributing
thats garbage @little eagle and you know it ...
how are { different from ( ?
hypothetically, if i was in need to change something i would commit stuff in line with the style rules
that's good to hear
but as i am not, i also would not commit according to the style rules
but that's not what you said earlier
the discussion in regards of what is better @little eagle is complete nonsense ... it is mostly to personal style ...
started with java, used to hate the { in new line
started doing stuff in C/C++/C#, started seeing that the additional line for { actually can be pretty cool
I think all of that is completely subjective, one can be better for one thing the other for the other
but what is the newline { good for? i've never seen a difference other than styling
making configs look like giant stairs
feel free to google it @foggy pike ...there have been broad discussions all over the internet already
eg. here: https://programmers.stackexchange.com/questions/2715/should-curly-braces-appear-on-their-own-line
so one of those answers suggests that it's good for large codebases that perhaps have a lot of stuff inside if's. but i've worked with a lot of code inside if's using same line { and never had any problems. personal preference at the end of the day ofc
I followed that link
Whichever style you choose, be consistent
Write your code for other people.
no one said anything about change everything to your liking if you contribute to something already established
as i said @little eagle
no need to contribute for me --> no need to follow established rules
Don't freaking mess with my styling rules! I was taught that each curly braces need an own line, but it takes too much space and I feel it's ugly so I'll never use it.... same discussion like tabs vs spaces ~ I love tabs and I don't care what other people may use
if the UI editor is good it seems i'll be the first person to like x39 ๐
oh hey it's the creator of vscode sqf ๐
@rancid ruin you already can see where it is going
and much more is planned
nice, i'll register x39fanclub.com soon
you guys should really start using code beautifiers with local custom style and forced style on the server via commit hooks
meh, sounds like extra work
actually saves you work when integrated into your code editor/IDE
would also only work for the styling @velvet merlin
differences between eg. private <array>, private <string> and private <variable> could not easily be sorted out
private array is objectively worse
private array is obviously the best
followed by private variable
where private string is just stupid
how is it "obviously the best"?
it's verbose
you have to write the variable names one more time each
it's slower
when editing you code, you have to look at another place -> easy to miss one
when editing you code, you have to look at another place -> easy to miss one
nope
actually you just have to look at one place
and that is at the very top of given block
at one additional place, yes
using enforced private <array> will allow for everyone to see the private variables of given block in a single view
makes reviewing code more simple
as it prevents private usage in mid-code
but that's pointless
get a good editor which highlights "private" and you see all variables used in a block too.
and you get context
seeing all variables at one place doesn't help at all
foo = foo * 4;
private bar = foo + 1;
bar = if (foo < 2) then
{
[moarcode]
private foo = bar;
foo * 1
};```
we constantly had unused variables in these private arrays
or missing ones
that doesn't happen anymore
because you set the home scope of a variable when you define it
now someone can add new private variables inbetween two ifs ๐
not removing the variable from the private array is also just lazyness
There are so many foos, i have no idea what that code even does
lazyness is very good when you are coding
it is actually the worst ...
I have no idea what you are trying to says with that example code
you are using private there
private keyword that is
but naming two different variables the same is bad style
No. Sorry I don't understand what you mean at all
private _foo; is invalid syntax
unless _foo is you variable name as string
which makes no sense
god ... its a bloody example hell ... <code> is also no valid syntax
more happy now?
thing is: having everything at one spot (this also includes private <var> at the very top of each scope) causes a better overview
also, you tend to be more descriptive with your variables then
but you don't have "everything at one spot"
you have a additional place where you put all variables
the variables are scattered throughout the script
you do not get my point and i do not have the time to explain it in more detail ...
and private is just another place -> more work, especially when mainting
<code> is also no valid syntax
I get that that was a placeholder
back to this:
if(<condition> then {<code>};
private _foo = bar;
what's wrong with it?
I assume there must be something wrong with it, since it's using the keyword while you argue for array
looks fine to me (ignoring the one parenthesis)
[3:52 PM] X39: using enforced private <array> will allow for everyone to see the private variables of given block in a single view
[3:53 PM] X39: makes reviewing code more simple
[3:53 PM] X39: as it prevents private usage in mid-code
this demonstrates none of these points.
sorry, but when we were using private ARRAY, we had to write a python script to validate if we didn't miss a variable
and if we didn't set one that was never used
shrug, I personally prefer private _var = 0; over private ["_var"];. Just feels neater. ๐
neither of you is going to "win" the argument though, just like tabs vs spaces or vim vs emacs
Are we back to tabs vs spaces? ๐
oh crap, did I bring up a bad topic? ๐ฆ
tabs vs spaces is preference
mid code definition of variables is bad
thats the whole point i was trying to communicate here ...
private <array> prevents this unless somebody is a complete dumpass
so is the curly bracket on the newline
but seriously, private array is just worse
mid code definition of variables is bad
what?
if (<condition>) then {<code>};
private _foo = bar;
<morecode>```
mid var definition
there is nothing wrong with that
I give a meh, but I agree it confused me aswell when I started with sqf. on the other side "private _private" might aswell is a bit confusing for SQF newbies ^^
Defining variables at the beginning of the scope is neater than somewhere else, but if you have to, why not? It's not a big deal. :S
I guess that's a preference thing then ^^
it's a big deal actually
because vars going fuck wack is a big pain in the ass to figure out
private every local var
I grant you that I define my controls at the beginning of a UI script
well it's configs at this point
yeah
Yeah exactly. Likewise, defining a (expensive) variable at the top while the code might break out of the scope before it's used is weird as well.
private _result = 2;
private _var1 = allUnits select {alive _x && {!isPlayer _x} && {vehicle _x == _x}};
private _var2 = 2;
if (isServer) then {
{ /* code */ } forEach _var1;
} else {
_result = -1;
};
there's an example why you should always define variables when you need them
ah thank you for enforcing my line above it ๐
fixed
allUnits only reports alive units
I like how this turned to us critisizing kingsley's example
semantics
inb4: "you're missing the private keyword" ๐
shrug. I don't get any of your examples
yourstruly's one does absolutely nothing
unless you are trolling
Not trying to be offensive or anything but I feel like you have some trouble with imagination. It's good to know though, might improve the atmosphere in here a bit. ๐ค
Still love you for what you are ๐
improve the atmosphere
It's just passionate talk about Arma scripting, no worries
trouble with imagination.
It would help if an example about X contained X
my example is for defining variable when you need it
mhm, like I said, it would get rid of some "frustration" if people know that you prefer proper valid examples ๐
if you defined _var1 and var2 on the top - you'd never use _var2
at least between you and @queen cargo ๐
yourstruly:
private ["_var1", "_var2"];
_var1 = random 2 - 1;
if (_var1 > 0) then {
_var2 = 1;
};
private _var1 = random 2 - 1;
if (_var1 > 0) then {
private _var2 = 1;
};
not correct @little eagle
aka: you failed
what did I miss?
_var1 = random 2 - 1;
if (_var1 > 0) then {
private ["_var2"];
_var2 = 1;
};``` ๐
said: at the begining of each block
:facepalm:
rofl
mainly because this example barely makes any sense
f*ckin code nazis ๐
and got rid of the only benefit: _var2 beign defined in all scopes
if that was your intension, then it was correct what you provided
still it was not visible from the example provided that this was the intension
So what is your issue with using private _var ?
We use it
ye ... because that is the real reason @little eagle ... i hate everything you do
Hate is a strong word
is there anything cba/ace has built that you would consider good?
๐ฉ
You guys are arguing about private arrays, meanwhile people are being shot to death in Germany, the world is a funny place
there is nothing i would not find something to do crit @foggy pike
has there always been scripting drama? since ofp days?
Some guy with a gun in a cinema, Google it
@rancid ruin yea its called drArmA
It's in West Germany. I don't care. It can all burn down.
@tough abyss +1
15 years of drArmA
@dusk sage it's kinda bs to use that to complain about the arguing though...
I'm not complaining, I was just laughing at the contrast between the two. As I said, the world is a funny place. Keep arguing it's fun to read ๐ฟ
alright, view restored ๐
Do we need to rumble everything to happen again
Private arrays are the only sensible thing to use!!
tbh every line of code should be a string like this
_array = call compile "[1,2,3,4,5]";
_unit = call compile "player";
Hehehehe
How might I build an eventhandler for helicopters that would stop the helicopter from immediatly blowing up if it crashes?
Something like:
if (heli damage > 0.95) then {
stop damage};
Sleep 60;
set heli damage 1;
};```
Or some ish like that. Any advice or things I should look at?
HandleDamage?
Google isn't giving me the biki for that.
Oh! It is an event handler. Okay!
It might be a hard one though, as it'll be taking multiple lots of damage