#arma3_scripting
1 messages Β· Page 348 of 1
always B
B
I don't know why the parenthesis variant takes longer to execute :o. Maybe you are forcing a different order of execution than Arma would
Thing when you use parenthesis you dont need, is that the engine will probably be looking for addtional code, which will come at a cost of performance
If B then
IMO you shouldn't use parenthesis unless required
is false
SimZor, A or B? :(((
A
Yes @still forum
^^
@rotund cypress Parenthesis are removed at compileTime. So they don't exist at runtime. So no difference at runtime
I prefer B, but that is because I don't like how binary + has highr priority than other binary commands.
Not a huge difference tbh, I got total 15k of code in my mission (including mission.sqm) so i still got a lot of headroom
*15k total code
I mean for people who are starting out I would understand the overuse of parenthesis since it can be easier to read code then
π
But i dont like them, i think its cleaner with little as possible
At one point I put a spacebar before and after every parenthesis
It was a mistake...
When i have only one value as a condition i end up doing if _value then {}
Without parenthesis
urg
Cray cray
@peak plover ive been there myself long time ago
I used a lot of parenthesis and space between beginning and end
Semi colons are over-rated. Use commas instead!
Try it
You are not joking?
Never
Holy shit
Second magic trick of today
π€
π
Heeh
for "_i" from 0 to 100000 do {private _h = 'lol'}
//68.2667 ms
for "_i" from 0 to 100000 do {private _h = "lol"}
//69.0667 ms
Take that aethists!
If you are not using superior ' then you are losing a whooping 0.8 ms per 100k strings!
And another thing that is done at compile time and causes a apparent runtime difference for no reason
If there is no difference at compile time, then why:
{'a'} isEqualTo {"a"} // false
WHAT}
phew
_a1 = "a";_a2 = 'a'; _a1 isEqualTo _a2
// true
Thank god that one works....
"""a""" == "'a'" // false
but that would include the " and ' into the string or not?
compile """a""" isEqualTo compile "'a'" // false
call compile """a""" isEqualTo call compile "'a'" // true
which is indeed not equal
Because isEqualTo compares the underlying string. Which is the code after preproc and before compile
Which still contains " and '. And that is not the code after compiling
https://github.com/intercept/intercept/blob/develop/src/client/headers/shared/types.hpp#L1732 That one to be exact.
The real compiled code is binary only below that
objNull == objNull // false
grpNull == grpNull // false
locationNull == locationNull // false
teamMemberNull == teamMemberNull // false
taskNull == taskNull // false
displayNull == displayNull // false
controlNull == controlNull // false
configNull == configNull // true
scriptNull == scriptNull // ERROR
Consistency.
But that would be the same way because of how the datatypes work like defautl value is not null or control, you would write controlNull
there is this military simulation game called arma. And this is what I am doing with it: http://i.imgur.com/rimRCqS.jpg π
@pulsar anchor lovely, can't wait to see some rust sign-painting action. π
QUESTION: Using Alive I "made a faction", how can I add this faction to my mission for Multipayer use?
Atleast SQF is more consistend than this:
1 + 1 + β1β -> 21
β1β + 1 + 1 -> 111
-β69β + 69 -> 0
π
@gentle island How exactly did you "make a faction" ? And wouldn't it be easier to ask at Alive discord? Because we probably don't know how their stuff works
What's better though. Any answer or an error.
@still forum I will see if there is an ALiVE discord.
There is #channel_invites_list
AliVE has a module you can place in the editor that lets you pick and pull units from factions and build your own custom faction. Then it generates two files pretty much. I think one that includes the units and group's you made. Then the second one is I think a .hpp that covers any inventory edits.
@still forum Thank you, I wil ask around in there.
@cosmic kettle well thats excatly what I am aiming for π
@gentle island Also don't post the same question in multiple channels. It's bad :u
You're bad ;)
Shots. Fired.
True words. Badmen.. Eh. Dedmen
Da da da da da da da da Dedmen!
All i am saying is: @still forum and badmen where never seen in the same room at once
Hello there. I am currently working on a server (working fine). Only one problem. It takes about 3-5min to connect for some weird reason.
Would anyone be able to help me out with this if you have any knowlege of this ofc.
When i then restart my game it works perfect again.
Makes no sence in my head.
How about... I don't know... Maybe #server_admins ?
Question: How to force helicopter to shoot rocket at unit (marker) on ground?
heli doWatch (getPos target);
heli fire ((weapons heli) select 2);
You answered your own question?
well problem is, that helicopter fire, but it goes strait as helicopter is hovering ( don't have angle to ground ) and not pointing to target
add a sleep 4; or so to give it time to aim.
_playerUIDs = {getPlayerUID player} count allPlayers;``` Isn't that the right syntax? π€
nope
No
cheers!
I'm a bit too stupid for the examples in BIKI. Is this proper syntax?
params [variableName, defaultValue, expectedDataTypes],
[variableName, defaultValue, expectedDataTypes],
[variableName, defaultValue, expectedDataTypes];
No.
Would you mind elaborating what would be proper?
params [[variableName, defaultValue, expectedDataTypes],
[variableName, defaultValue, expectedDataTypes],
[variableName, defaultValue, expectedDataTypes]];
??
params can look pretty nasty with all those arrays:
params [["_anArray", [], [[]]]];
you lack defines:
#define p(x, y, z) [x, y, z]
params [p("_anArray", [], [[]])]```
Whhhhy.
And you just wrote a lower case macro.
πΏ
can further be improved: ```sqf
#define var(x) #x
#define p(x, y, z) [x, y, z]
#define emptyarray []
#define array1(x) [x]
params [p("_anArray", [], [[]])]
params array1(p(var(_anArray), emptyarray, array1(emptyarray))```
much cleaner now β€
Now that the debug console handles // more or less correctly, can we at least agree that comment is an absolutely pointless command?
never said it wasnt pointless
it just had its usefullness in certain areas when using external tools
in all other cases that command is garbage that still is required for SQS
SQS doesn't support comments?
You contradicted yourself in two statements Congratulations.
thats why there is that command @tough abyss
Wow, SQS is more retarded than I thought.
You can just put a comment as string inside SQS in a single line without the comment command.
And you don't lose anything.
Strings are comments? π€¦
There is no difference. You need to make it a string anyway with the comment command.
unconsumed values will get thrown away
This.
And SQS has no return values. (In SQF you could just put a nil in the next line)
comment is pointless.
So this is a vaild comment in SQF? ```SQF
"Important things";
nil;
Yes.
Is it faster than //?
i made my params pretteh
params [["_r", 5, [0]],
["_point_count", 100, [0]],
["_theta", nil, objNull],
["_array_pos", nil, objNull]];
I am actually not even sure if the compiler keeps unused constants.
You did it wrong, asdf
but it wΓΆrks?
It probably does. because the compiler is retarded.
objNull should be [objNull]
damn.
params [
["_r", 5, [0]],
["_point_count", 100, [0]],
["_theta", nil, [objNull]],
["_array_pos", nil, [objNull]]
];```
there you go @waxen tide
Uhm.. One sec. Have to think
expectedDataTypes (Optional): Array of direct Data Types - checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.
Woa
When did they change this?
yes! #Intercept
Nvm. I read "of" as "or".
buhhhh
use sqf
sqf will get language for programming in real
sqf-vm rocks
blub bla bum beeep
recreating wget in SQF like a boss π
Nah, I misread it.
But that's when that sentence was changed π
besides
the comment stuff reminded me: SQF-VM still reads comments in the tokenizer
GG.
_content = curl "https://google.com";
``` #Intercept
is there a way to point helicopter to ground at some angle ?
setVectorDirAndUp
Why not sleep?
I got helicopter flying around target and I want to helicopter randomly shoot near target, why loitering around him
sleep
so it randomly breaks loiter and do airstrike with rocket
how would i describe the datatype of an array that has any amount of elements looking like [[0],[0],[0]] to params?
_flag = nearestObject [player, "Construction_Flag_Static"];
_buildRights = _flag getVariable ["TerritoryBuildRights",[]];
_radius = _flag getVariable ["TerritorySize", 15];
_enemyplayer = {player distance _x < _radius && alive _x} count allPlayers;
private _playerUIDs = allPlayers apply {getPlayerUID _x};
if(_enemyplayer > 1) && !(_playerUIDs in _buildRights){
["ErrorTitleAndText", ["Construction aborted!", "You cannot build while enemy is near."]] call Client_Notification;
}``` Output of _buildingRights is: ["UID", "UID"] and since the output of _playerUIDs is also ["UID", "UID"] where would i start if i only one or more UIDS are in _buildingRights?
@waxen tide That is an array of arrays. The datatype would be array
i can't specify what the elements must look like?
No.
You can.
ok
They are Arrays. That's what they look like. They look like arrays.
You can probably do something with
isEqualTypeParams / isEqualTypeArray after params for input validation, but these commands are very confusing to me.
that would be overkill i guess.
params params params [...] That would be nuts.. But fun.
params [["_array1", [], [[]]]];
_array1 params [["_num1", -1, [0]], ["_num2", -1, [0]]];
^ This is what I do all the time.
i'm confus
How so?
how do i skip the default value, IE i dont care what it is?
It would turn:
_this = [[1,2]];
into
_num1 = 1;
_num2 = 2;
essentially
oh i guess []
arg : [[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905]]
params [
["_array1", [], [[]]]
];
{
_x params [
["_array2"], [0,0], [[0],[0]]]
];
} forEach _array1;
can i do that?
good news @little eagle, the SQF-VM now supports the comment command
we all can go to sleep again
And what is the "SQF-VM"?
I was away for a week.
well ... started that one last week so youre given a sorry
That's why it was so boring in this channel.
Does this handle
currentMuzzle objNull // 0
"correctly"?
3rd magic trick of the day btw.
objects are not yet included
still not sure how to handle them at all
why are you trying to emulate SQF when it's so broken and weird in the first place?
Been looking in the pbo's but can't seem to find the location of the icons they use for the dlc's. in for example eden or virtual arsenal to mark that these items are from a dlc.
Anybody does know in what pbo these are located?
@rancid ruin SQF is not broken actually
it is the commands at max
the language itself is fairly simple
mmm in logos
Just noticed
The Air Dlc one is an ebo
Guess I need to download something for that then ...
Can't open that shit with the pbo opener
Why can't you draw your own? Those are not that pretty anyway.
They don't need to be pretty
I just want to put them next to the equipement related to that dlc
Withouth the need of custom images
Then it being in EPBO shouldn't matter. Just copy paste the path.
yeh but I can't open the path
As I don't have an ebo opener atm
As you can see for the others it's: E:\Steam\steamapps\common\Arma 3\Heli\Addons\Addons\data_f_heli\Logos\arma3_heli_icon_ca.paa
But can't open the freaking ebo of course
There is no need to open them.
Just use the config browser to get the path.
CfgMods
_flag = nearestObject [player, "Construction_Flag_Static"];
_buildRights = _flag getVariable ["TerritoryBuildRights",[]];
_radius = _flag getVariable ["TerritorySize", 15];
_enemyplayer = {player distance _x < _radius && alive _x} count allPlayers;
private _playerUIDs = allPlayers apply {getPlayerUID _x};
if(_enemyplayer > 1) && !(_playerUIDs in _buildRights){
["ErrorTitleAndText", ["Construction aborted!", "You cannot build while enemy is near."]] call Client_Notification;
}``` Output of _buildingRights is: ["UID", "UID"] and since the output of _playerUIDs is also ["UID", "UID"] where would i start if i only want one or more UIDS found out of _playerUIDS in _buildingRights?
count (_playerUIDs arrayIntersect _buildRights) > 0
KillzoneKids example
KK_fnc_inHouse = {
lineIntersectsSurfaces [
getPosWorld _this,
getPosWorld _this vectorAdd [0, 0, 50],
_this, objNull, true, 1, "GEOM", "NONE"
] select 0 params ["","","","_house"];
if (_house isKindOf "House") exitWith {true};
false
};
onEachFrame {hintSilent str (player call KK_fnc_inHouse)};
he selects the 4th return argument
Return Value:
Array of intersections in format [[intersectPosASL, surfaceNormal, intersectObj, parentObject],...]
parentObject? that should be the player
_house contains bis_o1 for me
so i think either the function was changed, KK made an error, or i'm stupid
the latter seems quite likely
Make sure to put the player as ignored object.
Line 5 in the posted example. The _this
Also
if (_house isKindOf "House") exitWith {true};
false
π€’
hands a paper bag to commy2
LIS can report an empty array, so after select 0, params would be fed with nil. I don't think this works in that case.
([] select 0) params [["_a", 1]];
isNil "_a" // true
yup
I don't follow
The function is erroneous.
i made a script for checking if a unit is inside a building, but i did it a bit different to KK i think
if you just check above the unit's head like he does then you get inaccurate results a lot of the time
what i did was to check if there's a house above the unit's head, then raycast in 8 directions (n,e,s,w,ne,nw,se,sw) and return true if >=5 of those intersect a building
found it
i wrote this years ago when i was even more noob
but it does work last time i checked it https://hastebin.com/beneqeregi.php
so, turns out my circle script doesn't actually create points on a circle, but creates the same point on the circle a lot because i'm too stupid for loops
so, turns out ASL and ATL coordinates are different
so, turns out KK's example in BIKI is fault
my day sucked.
protip: if you want to mess with lots of points in space spawn some god damn 3d objects in the air so you see where your points are.
@rancid ruin thanks
i've written a similar function
i'm passing a number to it, and it returns how many checks of the requested checks were true
@rancid ruin yours returns [bis_o1] as well
it does? what does that mean?
it worked perfectly when i last tested it about....3 years ago
i am quite sure bis_o1 is the parent object
so the player in this case
i think likely the function was changed.
.....and this is why i can't be fucked writing SQF these days
call me when they release arma 4 and thus stop breaking things in arma 3
i'm not sure
i just suspect it
because 2 examples not working
maybe i'm stupid tho
@waxen tide my script literally returns bis_o1 ? cos it should just return a bool
to be precise, it returns [bis_o1]
i used the command you added in the script comments to call it
and you made sure the function was fnc_insideBuilding?
yes.
@rancid ruin i'm a retard tho, so don't take anything i say for granted unless someone confirms it.
@waxen tide i just tested my function in the editor, works as well as it did 3 years ago
okay.
i asked for a display method like the one used in the example and nobody told me π’
Get the BoundingBoxReal of House -> Check if player inArea -> +Maybe check if 5m above is something with LIS (if LIS Target == house checked with BBR) -> Done
The parent object of a house is not the player.
Unless you attachTo the house to the player or something like that.
No clue why you mention that, but okay
Not sure if this is the right place to ask, ive been working on fading in dialog for a player menu, I have tried, cutRsc, but its not letting me move my mouse , any ideas
Dscha, asdfghj keeps saying that the parent object of the building is the player... That cannot be. They should finally post their script, so the error can be pointed out.
ItsLeigham, if the dialog doesn't allow moving your mouse, then you can't make it allow it while it fades out.
does fade = 1 work in dialog ?
I think you mean cursor by "moving your mouse"?
But there is a cursor?
nope
It makes them fade immediately or after 1 second.
hmm, thats enough time xD does it work the same for fade out
I have no idea what you're talking about. Is this still about cutRsc?
createDialog, i cant get mouse to work in cutRsc
cutRsc doesn't give you a cursor. That is correct. createDialog and createDisplay give you one.
As for fading them
_display = _this select 0;
if(isNil "ADT_CurrentDialog")then{
_allControls = allControls ADT_CurrentDialog;
{
_x ctrlSetFade 0;
_x ctrlCommit 1;
}forEach _allControls;
}else{
_OldControls = allControls ADT_CurrentDialog;
_newControls = allControls _display;
{
_x ctrlSetFade 1;
_x ctrlCommit 1;
}forEach _OldControls;
{
_x ctrlSetFade 0;
_x ctrlCommit 1;
}forEach _newControls;
ADT_CurrentDialog = _display;
};
``` so something like that ? hopefully I can use this as a global for all my tablets displays
Should there not be a ! in front of your condition
Otherwise the top piece of code will always run
Unless you're setting the GVAR in another script I suppose
but then no matter which way your condition is, a piece of code is using a nil value immediately after checking it π
Plus, you might as well set the initial fade in the display config rather than via sqf
I have changed it all completly since hten
// fn_DeleteandCreate.sqf
params ["_displaytoOpen"];
FindControls = {
params ["_displayName"];
_controls = switch (_displayName) do {
case "Lega_CustomTablet_Gang_Create": {
[9000, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9010, 9011, 9012, 9013, 9014, 9015, 9016];
};
case "Lega_CustomTablet_Admin": {
[8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025];
};
case "Lega_CustomTablet_Gang_Management": {
[7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021];
};
};
_controls;
};
_displays = ["Lega_CustomTablet_Gang_Create", "Lega_CustomTablet_Admin", "Lega_CustomTablet_Gang_Management"];
_currentDisplay = displayNull;
{
if (!isnull(uiNamespace getVariable [_x, displayNull])) exitWith {
_currentDisplay = _x;
};
} forEach _displays;
if (isNull _currentDisplay) then {
_oldCtrls = [_currentDisplay] call FindControls;
{
// Slow Fade out :D
_x ctrlSetFade 1;
_x ctrlCommit 1;
} forEach _oldCtrls;
closeDialog 0;
};
_NewCtrls = [_displaytoOpen] call FindControls;
{
// Insta Hide.
_x ctrlSetFade 1;
_x ctrlCommit 0;
// Fade in ?
_x ctrlSetFade 0;
_x ctrlCommit 1;
} forEach _NewCtrls;
createDialog _displaytoOpen;
``` Still have to add a few displays, but getting there
FindControls has no OFPEC tag
?
ACE_fnc_addAction
^
ACE is the OFPEC tag
This code still doesn't make sense:
if (isNull _currentDisplay) then {
_oldCtrls = [_currentDisplay] call FindControls;
If the display is null, there are no controls to be found
was meant to be !isnull
The other issue is you're setting the fade of controls on new display before it has been created
Also only supplying their idc which won't work
Already changed tha , ill edit.
Could put all the controls you want to fade in into a controls group and fade in that instead. Less ugly.
most of my dialogs are complete xD
if i had thought of this when i started it I would have
// fn_DeleteandCreate.sqf
params ["_displaytoOpen"];
_FindControls = {
params ["_displayName"];
_controls = switch (_displayName) do {
case "Lega_CustomTablet_Gang_Create": {
[9000, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9010, 9011, 9012, 9013, 9014, 9015, 9016];
};
case "Lega_CustomTablet_Admin": {
[8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025];
};
case "Lega_CustomTablet_Gang_Management": {
[7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021];
};
};
_controls;
};
_displays = ["Lega_CustomTablet_Gang_Create", "Lega_CustomTablet_Admin", "Lega_CustomTablet_Gang_Management"];
_currentDisplay = displayNull;
{
if (!isnull(uiNamespace getVariable [_x, displayNull])) exitWith {
_currentDisplay = _x;
};
} forEach _displays;
if (!(isNull _currentDisplay)) then {
_oldCtrls = [_currentDisplay] call _FindControls;
{
// Slow Fade out :D
(uiNamespace getVariable [_currentDisplay,displayNull] displayctrl _x) ctrlSetFade 1;
(uiNamespace getVariable [_currentDisplay,displayNull] displayctrl _x) ctrlCommit 1;
} forEach _oldCtrls;
closeDialog 0;
};
createDialog _displaytoOpen;
_NewCtrls = [_displaytoOpen] call _FindControls;
{
// Insta Hide.
(uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlSetFade 1;
(uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlCommit 0;
// Fade in ?
(uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlSetFade 0;
(uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlCommit 1;
} forEach _NewCtrls;
Wouldnt let me update XD
The closeDialog will close it before the fade out effect finished.
how would I change that ?
spawn, sleep I guess. And cross fingers the scheduler doesn't fuck you over when one clicks very fast.
Could put (uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) into a variable, unless you're paid per file size ofc.
.good point
_displayCtrlConfig = "true" configClasses(missionconfigfile >> _displaytoOpen >> "Controls");
{_controls pushback (getNumber(_x >> "IDC"))}forEach _displayCtrlConfig;
``` this should work right ?
an im making this for myself π
At that point you might as well use allControls.
i tried, it included background controls.
I see,
the background is the same on all and didnt want to include the background in the fade
Well this way it won't work on controls with idc=-1
why they would include background in allcontrols idk, it also includes -1
Because the command is named ALL controls I guess.
i havent got any -1, I have gone through and made one display 5000 + the next 6000 + etc
So i dont get any issues with that.
configClasses doesn't include classes that are inherited. Which could be a problem if you do that.
class RscDisplay1 {
class controls {
control1{...};
};
};
class RscDisplay2: RscDisplay1 {
class controls: controls {
control2 {...};
};
};
private _class = missionConfigFile >> "RscDisplay2" >> "controls";
"true" configClasses _class // [control2]
configProperties [_class, "isClass _x"] // [control1, control2]
hmm Ill take a look in a sec π
its not liking that.
What does it complain about?
generic error
Hey, I'm not crazy, am I? 3rdPersonView was an attribute at one point, wasn't it? One of my missions from 2015 used it, but nowhere online I can find that it exists.
Replace
{_controls pushback (getNumber(_x >> "IDC"))}forEach _displayCtrlConfig;
with
_controls append (_displayCtrlConfig apply {getNumber (_x >> "idc")});
testing now π
You mean in the editor, Luro?
Because it's a difficulty setting of the client / server.
Yeah, I realized that now. I had it in a description.ext from a while back, for some reason.
β€ commy
I was thinking about whether or not it would be possible, or easy enough to allow one team to have access to thirdpersonview, overriding the server's settings.
Maybe not so much the last part, but the one-team only thing would be great.
@little eagle do you has pp ?
There are scripts that change to first person view when you're switching to thrid person view.
What is pp?
paypal ?
I used to. yw, need no donations.
dude , im not asking xD the Arma Community, is toxic these days, so Its cool when someone isnt π
Life community*
yeah
Im starting a community, its gunna be a nofucksgiven community, any bullshit, and people are out π
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
``` Am i right in saying, these can be replaced with images ?
im looking at getting the buttons, as controls.
Too bad it wasn't an action that EVH uses. Saves me having to use sleep timers.
umm. dafuq. closedialog isnt working xD
Unless you might know a way, Commy. Disabling it ourright would be great, to avoid that split-second of third person someone gets if they keep spamming it. Anyway, be back in a second!
You can't disable it for certain people only afaik.
If you change back each frame, then it should be good enough, even when the key is spammed.
Is there a way to grey out certain controls until a player has met a certain condition?
addMissionEventHandler ["EachFrame", {
if (cameraView isEqualTo "EXTERNAL") then {
cameraOn switchCamera "INTERNAL";
};
}];
Controls as in buttons and stuff
@little eagle thanks!
Ooh, didn't know about each frame! Thank you, @little eagle! Will give that a try in a second.
hmm, fading out doesnt wanna work xD
@atomic epoch
private _fnc_update = {
params ["_diplay"];
private _control = _display displayCtrl IDC_CONTROL;
_control ctrlEnable (CONDITION);
};
_display displayAddEventHandler ["MouseMoving", _fnc_update];
_display displayAddEventHandler ["MouseHolding", _fnc_update];
Maybe that helps. Updates the control every frame the display is active.
waituntil{
{
(ctrlFade (uiNamespace getVariable [_currentDisplay,displayNull])displayCtrl _x) == 1
}forEach _oldCtrls
};
``` can i do something like that commy ?
It looks confusing without line breaks,.
Hey @little eagle, would addMissionEventHandler be a global function, or local? I did actually check the page! Though there wasn't anything there to say otherwise. Also, sorry for interrupting!
No, Leigham.
The code has wrong parenthesis and forEach doesn't work like this. Also ctrlFade reports the targeted fade, not the current one.
ctrlCommited would work though.
You only need to check one control, not all of them.
i cant find comitted on the wiki
waitUntil {ctrlCommitted _control};
And let _control be any one of the foreground ones.
two m and two t ^^
@spice kayak addMissionEventHandler has local effects (and no arguments that could be considered local or global).
You don't need an actually random one. Just pick the first one,.
Ah, thanks man!
doesnt like something xD
i think schedular doesnt like it xD
also seems to be instantly fading out
Lookin' even better! Thanks again! http://i.imgur.com/gkbamTY.png
@little eagle I tried putting them into a controlsgroup cant get it to work.
Hmm, can someone explain the different between 0 setOvercast 1; and [1] call BIS_fnc_setOvercast; ?
Ah, don't worry, I think I've pretty much gotten it. Thanks anyway. Was hoping there was a BIS_fnc_setRain, but I don't think there is.
_math is 2
^^
The / command only accepts NUMBER's.
Actually, I think there is a CONFIG / CLASSNAME syntax too.
Aw, so my weather settings wouldn't work at all? :(
Ah, sorry, rain works, but overcast doesn't.
Damn.
params [
["_centerpos", [], [[0],[0],[0]]],
["_r", 10, [0]],
["_precision", "20",[0]],
["_lazy", true, [true,false]]
];
"accept only numbers, but default is a string"
totally makes sense.
It's tricky and stupid and broken. It kinda works., which is the worst kind of, because your players think you're just too stupid / lazy.
Hmm, what about the mission parameters, \a3\functions_f\Params\paramWeather.hpp thing?
actually, yeah, ignore that.
π€·
Was reading it wrong.
Damn it. I got all these parameters \o/
I mean, these changes take place before the clients load in. Would that work, because it's not technically 'syncing' if it's there when they join / load?
I don't know. In my experience, it helps if you disable auto weather.
autoweather?
This is done by clicking "manual overwrite" for all the weather things in Eden (and removig the entries from the description.ext).
What entries in description.ext? The parameter ones that I put there myself?
But yeah, manual override was already selected where it could be. The only weather-based entries I have in description.ext are my parameter ones, which allows the host to change the values pre-mission launch.
Sounds good to me.
Shweet.
Now you have to convince Arma.
pls arma pls.
\[--]/
Okay, so, after reading that post, I'm certain most of my weather settings should sync. Hopefully.
Arma is seriously fucking with me today
@little eagle If send you a mission, could you take a look, im basically starting from scratch,(missionwise ) trying to get this fading to work.
Good luck, man. Arma screws us all!
+1
so yeah once i open the admin menu, all the other buttons disable them selves xD
and the licenses dont open whatsoever.
Do you really want that fade effect? It's something that would annoy me.
turns out i placed my markers to visually check what i was doing in ATL coordinates and then checked ATL coordinates with a function expecting ASL
I always convert everything* to ASL immediately.
And only back to AGL if it's one of those commands that need it.
Yeah i did xD
its starting to trigger me ngl
ive litteraly started from scratch, and commented out most in the license dialog.
and nothing
did you figure out why mine was returning unexpected results?
Loiter waypoint is not working. Helicopter go there and just hover. After I kill civilian, it fly away and delete it self.
0 = [] spawn
{
_spawnPos = [player, 1000, (random 360)] call BIS_fnc_relPos;
_vehicleArray = [_spawnPoS, random 360, "I_Heli_light_03_F", east] call BIS_fnc_spawnVehicle;
_vehicleArray params ["_helicopter", "_crew", "_group"];
_helicopter flyInHeight 100;
_wp1 = _group addWaypoint [position player, 50];
_wp1 setWaypointType "Loiter";
_wp1 setWaypointCombatMode "red";
_wp1 setWaypointLoiterRadius 100;
_wp1 setWaypointStatements ["{ alive _x && side _x in [civilian] } count (allUnits - allPlayers) == 0", "systemChat 'done loitering';"];
_wp2 = _group addWaypoint [_spawnPos, 0];
_wp2 setWaypointBehaviour "Careless";
_wp2 setWaypointType "Move";
_wp2 setWaypointSpeed "Full";
_wp2 setWaypointStatements ["true", "systemChat 'delete'; deleteVehicle (vehicle this); {deleteVehicle _x} forEach (units (group this)); deleteGroup (group this);"];
};
if I recall correctly the condition needs to be true before the waypoint is executed
so when you kill the civilian it executes the loiter waypoint but also immediately jumps to the second waypoint
the civilian check thingy probably needs to be done in the 2nd waypoint's condition
with that logic, helicopter should hover on spawn point, not do "MOVE" waypoint to player position
So I Have my dialogs fading now, but i cant interact with any of the controls now -_-
you're probably drawing something over them
http://i.imgur.com/z0xPXC3.jpg finally success
function checks a position for a ceiling above (return true/false) and returns a percentage of cover in the X,Y plane. this garage has 3 positions with 61%, 85% and 93% cover
Anyone here with ideas of how to return the AI who opened a door? I'm stumped
I don't think that is possible.
You'd have to do that in a loop though.
well you will always have a trigger somewher to satrt a sequence
im sure Ai wont be checking all doors everywhere
even the most dynamic mission have event checks somewhere
@waxen tide How does it determine that?
I guess it depends on how many doors we're talking about.
I assume it does so by checking for each dot around the given position where LOS is there?
Must. Stop. Adding. Parameters. http://i.imgur.com/lCtvVb1.png
Before I know it, the whole mission is going to be a variable.
So, I'm trying to position a groundweaponholder as close on the surface of an object as possible
"surface of an object" ?
Because the given building positions of said building are floating in the air and rather than fixing every building manually I want to write a function to input a position and find the next point it would intersect with the floor which then is the lowest position
I tried something like this
_pos = param[0,[0,0,0],[[]]];
_pos = AGLToASL _pos;
// Exceptions
if (_pos isEqualTo [0,0,0]) exitWith {[0,0,0]};
// Code
_intersectsAt = lineIntersectsSurfaces [_pos, _pos vectorAdd [0, 0, -50], player, objNull, true, 1, "GEOM", "NONE"];
if (count _intersectsAt > 0) then {
ASLToAGL (((_intersectsAt select 0) select 0))
} else {
[0,0,0]
};
But it doesn't really appear to work correct :/ The positions occasionally on some buildings still float in the air and I'm out of ideas π
Ground weapon holders inside buildings?
Yep
Wouldn't the item appear in the same position for each building of the same type?
Yep, it's baked into the buildingpositions of that building
yeah write an array for each building then use the array for building type ?
I could fix it manually for each building and define new offsets myself
but thats sooo much work
Because a lot of buildings have weird offsets for their buildingpositions
get the model pos of some memory points and use a known offset
typeof building = _x then offset = _y
maybe use doorhandle positions or something ?
The distance between nearest point to the ground and the buildingposition is not the same for every buildingposition within one building
So I can't use a fixed "correction" offset ontop of the offsets buildingsposition gives me
there wont be many you need though and they will always be the same for that building type
I'm talking about hundreds of building types
plus roadways set ASL to 0 so it can be a nightmare doing it dynamically
Whats more of an nightmare, correct positions manually or write a function to fix them in realtime? π
No, ASL is always the same height.
i used to do it witrh furniture on altis
You're thinking of AGLS
yeah probably i am been 2 years since iscripted
Is fixing the positions only like +/- one meter?
i think even ASL was disrupted by stormy seas too lol ?
No, that is ASLW (wave)
Which is equivalent to AGL over water.
ASL is the best system.
ill remember that
@little eagle Mostly, yes
I'd say the majority of positions is wrong by lets say max +1 z
Is it only plus?
Yes
So floating?
Yep
ok
Use getPos _gwh select 2 to get the height above the first pathway lod below the weapon holder.
And then _gwh setPosASL (getPosASL _gwh vectorAdd [0,0,-_offset]);
Yeah thats good
I dont think of something like this because I dont reaaaally look into ASL, AGL, bliblablubb much
π
Lets hope the buildings have correct pathways lods defined then π
Thinking about this is still more relaxing than calculating anti-derivats by hand.
That's because they haven't gotten bad enough already.
Quick question, the difference between AGL and AGLS
What counts as a surface in AGLS?
AGL is over land the same as ATL. z=0 being the terrain surface.
Yes
AGLS (s for surface) has z=0 as the first pathway LOD below the lowest road contact poit of the object in question.
So the same as AGL and ATL in the wild, but different in/on buildings and stones etc.
There are multiple surfaces in a building (1nd story, 2nd story, roof) as well as the terrain below the building.
So there are multiple z=0 for every X,Y position in the AGLS system.
Which is why getPos sucks and you should use ASLToAGL getPosASL obj if you need the AGL position of something.
Are you serious
So
player setPos getPos player
Oh my god
moves you on the terrain inside the building when you were standing on the roof
Try it.
Just checked the wiki yeah
Well that's a bunch of consistency again there
Very consistent
It's one of those pitfalls I keep talking about.
First magic trick of the day I guess.
I'll try the offset thing and hope the buildings have their paths defined correctly
There can't be a setPosAGLS, because there are multiple z=0 for every X,Y
Yeah
Would have to be: obj setPosAGLS [x,y,z,layer];
I don't know, I think this system is just making it more complicated
Yeah was about to suggest that
The naming of these commands is just not on point
@tame portal i do a lineintersectsSurface check. well not one.
Using AI positions for loot positions to spawn isn't great
Better off to just define building loot positions.
Plenty of sqf snippets out there to help you create them.
Its really not that much work
@tough abyss It's no problem to write such snippet myself, it's just that I like looking for the easier solution first before I do repetitive work
my policy is to strictly avoid scripting anything that relies on fixed input if i can help it. i'm detecting everything by script instead of fetching manually compiled lists.
so far my script doesn't even care about the map it runs on.
Yeah, I hate lookup tables too.
Really only takes like a hour or 2 todo all the building types on map.
Otherwise just fallback to building position.
Building AI positions is a lookup table π
currently i have zero pre-placed objects on the map.
Anyone here with ideas of how to return the position of a door from a building?
i don't compile a lookup table, i merely do a check for suitable positions when i want to spawn and then do spawn.
Building AI positions is a lookup table
It's one that's already there. So you're not making another one.
^
well the ai position dont make very good loot position for a start
why not?
cos there just randomly placed on the floor, instead of like on tables/shelfs etc
also, i'm actually spawning AI. idk about OPTIX
fine for ai lol
makes sense, but then arma doesn't really have tables/shelves preplaced too much?
@atomic epoch AI don't Open doors. They just walk through the wall right next to it
πΏ dedmen typing
No real difference in overhead / performance from using another table
Adding a script to attempt to offset loot piles correctly is extra work for arma aswell
@brazen sparrow Was sufficient for my things but guess Ill take the time anyway for those new open buildings on chernarus
Back in my day everything was closed!1
what 6 months ago? π
Too much time has passed, yes
@atomic epoch You might be able to override the configs for when AI opens a door to run an extra piece for sqf code. But that would mean overriding each building class. Abit overkill though
Don't think you can do that.
Is that even possible without mods @tough abyss
Definitely not without mod.
There is a config entry that ai runs to animate the door. Should be able to run sqf code via it
But would require an addon
if you can easily detect by script if a door is opened, you could check which AI is closest.
Only really viable if you only want to check on a certain building type
I wonder if AI actually use these actions or if they just animate the door they walk through.
Well, at least there's a solution. Thanks for answering
That's what I've been wondering to @little eagle
Yeah they do, was recently messing with it. Otherwise they just walk through it
BIS_fnc_DoorNoHandleOpen
BIS_fnc_DoorOpen
Maybe overwrite these?
You can overwrite BIS functions with CfgFunctions in missions, no?
@waxen tide that would require returning the position of the door from the building. The only way I know how is to do lineintersect from the AI's eyepoa, which is not full proof
i see
You can overwrite, yes. That's a good suggestion !
yay
Is it possible to overwrite the BI function through description? Idk how to do it without sqf.
You can't do it with script, because they're protected, but if CfgFunction handles it...
You want to look at Overriding BIS_fnc_Door, that is the function used by most of a3 buildings
DoorOpen and DoorNoHandleOpen
I just checked the a3 configs ;P
The useractions which ai use call BIS_fnc_door
DoorOpen is only used on a heli
My all in one config is from 1.72, so maybe it changed.
screw override them all ;P
You guys have been really helpful. If its not too much trouble, could you guys give me an example of overwriting? I only know how to make new functions, but not replacing existing ones
I don't know if you can. I never do missions.
And BTW, you can recompile through sqf if you use allowFunctionsRecompile = 1 in description. So all is not lost :)
Thanks guys, I really appreciate it.
i would be in the nuthouse without allowFunctionsRecompile
What do you use it for?
well i implemented generic things as functions
to re-use them for mutiple tasks
one function handles NPC dialogues and is called ~60 times when that mission pops up
other one generates points on a circle around a position for various checks
stuff like that
?
i figured implementing as much as possible as a function can't be a horrible idea
I don't see how that requires allowFunctionsRecompile. Creating functions inside CfgFunctions would work just as well
i'm doing that but if i don't want to reload the mission i have to allow recompile to recompile them while testing?
Ah I get it. It allows you to recompile without restarting the mission. Never thought of that.
Thanks for the tip
:)
exactly.
I tried, but didn't manage to overwrite it with CfgFunctions.
BIS_fnc_Door failed?
NOOOOOOO
I'll try myself tomorrow.
BIS_fnc_moduleCurator worked for me. It says "HI" now
i want to attach a marker to an object/unit that is in motion while a dialog is open. Is there a way of doing this outside of setMarkerPos?
Hello, everyone, i wanted to display a dialog when the player open his map so i made this : addMissionEventHandler ["Map",{createDialog "markers"}];
But i got a problem, when my dialog is opened, any other input is disable, so i cannot type on the map or move it for example. Is there a solution to that, can we manage the priority between different dialogs ?
main issue here is i have multiple markers whose names are stored in an array so referencing their names would be difficult
@compact maple do you need to interact with the dialog? or could you use a HUD?
I need to interact with it, is it possible ?
what you could do is create your dialog controls within the map dialog itself
i've used that technique to add buttons to the map and stuff
or put a map in your dialog?
indeed, but then you miss out on the vanilla map dialog stuff like marker placement etc
he might want that
good point
hum interesting, and where can I found the map dialog ?
btw i need the basic map with all the markers
(findDisplay 12)
(findDisplay 12 displayCtrl 51)
think display 12 is the map display, and 51 is the actual rscMap control within the display
ancient noobscript incoming
add_map_button_at_player = {
disableSerialization;
_xy = ((findDisplay 12 displayCtrl 51) ctrlMapWorldToScreen position player);
_map = (findDisplay 12);
map_button_player = _map ctrlCreate ["RscButton",6558];
map_button_player ctrlSetPosition [
_xy select 0,
_xy select 1,
(2 / 1920) * SafeZoneW,
(2 / 1080) * SafeZoneH
];
map_button_player ctrlCommit 0;
map_button_player ctrlSetText "a";
(findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["draw",{
_xy = (findDisplay 12 displayCtrl 51) ctrlMapWorldToScreen position player;
map_button_player ctrlSetPosition [
_xy select 0,
_xy select 1,
(184 / 1920) * SafeZoneW,
(34.75 / 1080) * SafeZoneH
];
map_button_player ctrlCommit 0;
}];
};
can't remember what that script does but it's the first result i got in a search on my ssd
np, glhf
@atomic epoch
// init.sqf
{
missionNamespace setVariable [_x, compile format ["call %1; call %2", missionNamespace getVariable _x, {
systemChat str _this;
}]];
} forEach ["BIS_fnc_Door", "BIS_fnc_doorOpen", "BIS_fnc_DoorNoHandleOpen"];
// description.ext
allowFunctionsRecompile = 1;
This worked for me.
You still have to do tricky stuff to get the unit, but at least you now have some sort of "eventhandler".
π
Also, apparently these door actions check cameraOn, so if AI actually use these actions, then server owned AI should never use doors...
I'm very happy right now, dont ruin this for me.
One problem at the time!!!
Idk. I always see BIS_fnc_DoorOpen, not BIS_fnc_Door. What do I know.
sorry to circle back, but... I want to attach a marker to an object/unit that is in motion while a dialog is open. Is there a way of doing this outside of setMarkerPos?
use a draw event handler
Markers cannot be attached. The only thing you can do is to update the markers position in a loop.
bummer, that's doable but annoying, thanks
markers don't really have any benefit over a draw EH though
in fact they're less versatile
only good thing about them is that the player can make them easily on the vanilla map
do draw3D icons apear in 3d space for the curator? that might be worth trying for me.
i don't see why not, you just draw them on to the main mission display right
i like it, that will make the next 3 scripts i was going to right useless. many thanks @merry turtle
I would like to implement a global debug switch that i can set in one central place to trigger additional debug output. I've seen #define debug and #ifdef #endif being used to do that with preprocessor? instructions, but i saw odd behaviour with this and i've read that it can only be used once per file?
why not use a mission parameter, or just blah_debug = true in init.sqf?
well i have considered that, but i suspect someone has a genius magic trick
Is there a good script for dynamic loadout for jets?
@coarse atlas Firewill has some plane mods, like F-15, F-16 etc will very nicely done scripts for that. Maybe he made them public somewhere for you to use.
well, I'd prefer they make use of the scripts from the jets DLC XD
oh, right. there was a thread in the bohemia forum about that and people did some proof of concept in there. maybe it advanced into something proper.
Does anyone know of a BIS Fnc that spawns units in random building positions?
this returns positions suitable for unit placement inside buildings
you basically just need to attach a createvehicle line to that
Yea thats what im doing now, was just wondering if the was an exsiting function with it rolled into one. Thanks anyway.
i'm very glad i got those functions already
This seems to work really well:
_buildings = [cqb_0,cqb_1,...];
{
_positions = [_x] call BIS_fnc_buildingPositions;
_noOfPos = count _positions;
_noOfUnits = random [0,3,5];
for "_i" from 0 to _noOfUnits do {_unit = "C_man_1_1_F" createVehicle (_positions select (random [0, (_noOfPos /2), _noOfPos]))};
} forEach _buildings;
some houses have less than 5 tho
yea its not clean at all - doesnt seems to error with small buildings. It's only a small script for a very specific purpose. Works well enough.
_noOfUnits = floor random _noOfPos;
Cheers
@little eagle What would be the fastest way to get a unique array of classnames of objects inherting from the class House on an entire map
Are there any other objects rather than fetching all objects, and making an array of classnames out of it?
is there a way to get the size of a house out of the cfg or from the model?
must not be terribly precise
i've read the wiki page for exitWith a few times, and i've played around with it. yet i am not 100% sure what i should expect of it. No matter how deep i nest it into loops and whatnot, if i use it to exit i always exit the entire script?
exitWith just exits the current scope
I think (or thought) it exits for and foreach yes
if you exitWith at the root scope it exits without problem the whole script
so does it exit for and foreach?
from the wiki Β« Often used for exiting do, for, count or forEach. Β»
i'm not very bright.
And to my defense, i've probably read 100 wiki pages in the last 3 days
i fiddled with exitwith 2 days ago and gave up after a few hours. and i never bothered to ask here. but probably exitwith wasn't the issue but some other errors i had.
i'm not very bright.
get some rest, sqf does make you pay any lack of energy π
i'm well rested currently.
thanks for the link, i've read and understood that
Just thought it might give you an insight in some way. What's the deal with 'em then?
Nothing now, i've figured out my other errors that made me believe i wasn't exiting the proper scope and ending up in the next one.
also i started breaking down my scripts into smaller functions
i was writing way too large abominations
At first they can seem tricky, but knowing how to deal with scopes helps a lot.
indeed
https://community.bistudio.com/wiki/Code_Optimisation is also a page I used to visit often.
yeah thats the 4th bookmark in my bookmark bar right now.
Smaller functions are the way to go indeed. If you wrote it twice it should be a function.
I'm wondering, you guys wrote about doors earlier
i found the BIS_fn_door in the functions viewer
but i have no idea how to check if an object has a door
and how to access it?
iirc it's defined in the config.
i couldn't find the config for any house. do you know from the top of your head where i need to look?
https://community.bistudio.com/wiki/selectionPosition
https://community.bistudio.com/wiki/getAllHitPointsDamage
@waxen tide You can use these to find selections in a model and then to get the positions of those selections.
"programmers doing things because they want to show how clever they are rather than getting the job done"
i chuckled
Yeah that's from the wiki I believe, Like it π
thanks stickie
No problem
i had the idea to ambush players with pre-placed units. so i thought locking all doors in a house and spawning enemies only where they can't be immediately seen would be a nice touch
has keept me busy 2 days now
Well there are very fancy ways of doing that. Hope u get it working!
well it isn't looking entirely hopeless
this function does 3 circle checks around buildingPOS for intersections and returns a % value of success
so when its 100 i know its ideal
i'm re-writing it a bit to do more iterative checks to be able to abort early on fail to keep the total intersect check amounts down
no point to check for walls if there isn't a ceiling, no point in checking for window or door gaps if there aren't any walls in north, south, east, west
the cyan arrow is the only suitable pos the script found
doesn't care about doors yet.
Well it seems you're gonna be able to do that then π
i was wondering, what happens if i throw a script that needs several seconds to execute into the scheduler? like whats the performance impact?
how does it take into account the MP aspect of it?
MP aspect?
like one player can see that position, another one can't
oh it doesn't care about players. it checks if an AI soldier i place on that position can be seen from the outside, basically
and i only spawn a soldier if he can't be seen
if you call the script I believe image will freeze until execution? not sure really.
in scheduled? no
oh
i made a mistake once and the script took 13s to execute, game ran fine
i'm just wondering what happens on a busy server
(if i don't spawn thousands of markers for visualising the checks i do for debug reasons the script runs in like 100ms)
seems fine to me. It's hard to tell, if you're only running that I don't see how it should affect performance.
well i plan to run a whole lot more in parallel. but i don'T care how long it takes to execute this script since spawning a new mission can take minutes before it affects my mission flow
well premature optimisation is the bane of all evil or something like that.
Yeah get it working first is a good thing π
its just a bit concerning to see a script running for 13s.
How would you add an item (optic_nightstalker) to a weapon(srifle_llr_f) through the inet of a player
You mean init?
player addPrimaryWeaponItem "muzzle_snds_H";
You'd change the "muzzle_snds_H" to the optic_nightstalker, whatever that item is called.
Actually, if the weapon doesn't support the attachment by default (you can check in arsenal, it won't be added to the weapon.
The srifle_LRR_SOS_F supports the optic_SOS, and the srifle_LRR_LRPS_F supports optic_LRPS, but the base srifle_LRR_F doesn't seem to support any attachments.
Honestly, you're better off just right-clicking the unit and using the arsenal if you can. That way you can customize it however you want, without the need for code. But if you insist, here is the page i used. https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Weapons
Yeah, I wasn't 100% certain. Sorry.
What made you think it might not work?
Not entirely sure. I mean, I had a feeling it would, but I wasn't sure how looped actions would work inside an if statement which doesn't loop. That was my only real concern, but it was a minor one.
I'd also have to rewrite an entire script for what I'm trying to do, so if there was the chance it wasn't going to work, I didn't really want to waste the time.
How would looped actions work in any script that doesn't loop?
[] spawn {
while...
}
spawn spawns a script that doesn't loop
Yeah, good point. I didn't really understand the point of [] spawn outside of it's initialization usages.
?
It's just an argument you pass, which becomes the _this variable inside the code block. Just like call, except mandatory for no reason.
[] or 0 is just what you put there to satisfy the game when you don't want to pass anything.
execVM has alternative syntax without arguments array whereas spawn doesn't
i wonder why they made that decision
@little eagle Thanks for the help yesterday, didnt manage to get it perfect, but its looking clean π
@spice kayak for me it did support the night stalker and i am playing argo so the llr it self cant be selected in the arsenal so i had to script it and i was asking because there is a thermal scope in the game
{
systemChat format ["%1", _x]; // [18827.1,16357,30.3428]
_check1 = [_x,10,100,true] call Ivan_fnc_eval_position_cover;
_check2 = [(_x vectorAdd [0,0,0.75]),10,100,true] call Ivan_fnc_eval_position_cover;
_check3 = [(_x vectorAdd [0,0,1.5]),10,100,true] call Ivan_fnc_eval_position_cover;
systemChat format ["%1", (_check1 + _check2 + _check3)];
if ((_check1 + _check2 + _check3) isEqualTo [true,100,true,100,true,100]) then {_spawnPosASL pushBackUnique _x};
} forEach _buildingPosASL;
Script Error:
_check1 |#|= [_x,10,100,true] call Ivan_fnc_eval_position_cover...'
Error Generic error in expression
@rotund cypress when I get the hang of this fading malarky, im making another one xD
Dialogs arent my thing
@waxen tide post Ivan_fnc_eval_position_cover
It probably reports the assignment operator.
so you're saying the syntax there looks alright?
@little eagle ```sqf
params [
["_centerposASL", [], [[0],[0],[0]]],
["_hprecision", false, [true, false]],
["_abort", true, [true,false]]
];
private ["_checkposASL","_object","_check1","_check2","_ceiling","_result"];
systemChat "eval_pos_cov";
What is that?
If this is Ivan_fnc_eval_position_cover then
_check2 = [(_x vectorAdd [0,0,0.75]),10,100,true] call Ivan_fnc_eval_position_cover;
should not error.
Unless you took out something.
i commented everything else out
Post it all.
Hmm, idk.
but
_check1 |#|= [_x,10,100,true] call Ivan_fnc_eval_position_cover...'
Error Generic error in expression
Can easily reproduced:
_a = {
_b = 1;
};
_c = call _a
So my guess is, that you had this function have an assignment as last operator at some point.
@waxen tide Does your method return something correctly?
not yet
I don't really know how it behaves in that case but if you do _check1 = [] call blubb; blubb would need to return atleast nil
I don't think it automatically assigns nil if nothing is returned
You can end your function with systemChat or any other command that reports nil just fine.
Except an assignment.
=
makes sense
Not really. It's a bug in SQF.
okay i added "false" as last line in my function and now it works fine
It's the only reason I know of to cause |#|= as error message.
i commented lots of code out to narrow down my issues and removed the return value
Post what you had when it errored.
i did?
Don't think it errors that way. Try again. Probably forgot to save a file.
If
_check2 = call Ivan_fnc_circle_check;
for example was the last line, then calling this function and assigning it's return value would error.
But not with:
systemChat "eval_pos_cov";
i can't replicate it
it indeed does
Yes. Never end a function with an assignment if you want it get approved by me.
uhm, what does arma do with sqf /* code
?
well if you write code after a /* but forget the */
The comment would go to the end of the file.
well i'm sorry i can't replace exactly what happened.
but i didn't forget to safe, i hammer STRG+S all the time even in the editor console because its a habit
The only way to make sure is to reproduce. I can reproduce it. You can't : )
?
Reproduce the error.
It works with what I said. But not with ... systemChat.
Therefore you must've made a mistake or misremember.
well i chained 5 functions in a row and i've made some changes in 3 of them and i'm not always perfectly sure where to start.
It would be easier if the game didn't give such vague directions.
possibly.
Or this particular thing didn't error for no reason in the first place...
well obviously i changed something i forgot about
but you have to believe me, i would never hide something from you commy2.
This is the work around btw, in case you need to execute and store the return value of a unknown function:
_func = {
_b = 1;
};
//_a = call _func; errors!
_a = [nil] apply _func select 0;
apply creates a new array right?
Yes.
thanks!
_a = [];
_b = [_a] apply {_x} select 0;
_b pushBack 1;
_a // [1]
But the array-element inside the array is still the same.
function calls are scheduled, right?
What do you mean?
if i call the function it is executed in scheduled enviroment?
If you call a function from scheduled environment, then the function will also be executed in scheduled environment. too
If you call a function from unscheduled environment, then the function will also be executed in unscheduled environment too.
i see, that makes a lot of sense
i was also wondering what happens when i call a script in scheduled environment that takes a long time to complete, say 10 seconds. From what i read i would expect the scheduler to allocate 3ms per frame to it until it is done, and also schedule other scripts on each frame in parallel. so basically it only delays other scripts slightly, but should not ruin performance?
The more scripts you run the more performance it will cost. Scheduler only helps in theory.
i see
Also I'd be worried if my script takes 10 seconds. That could easily be minutes on a slow machine and in MP.
well i was planning to run that script only on the server
also the 10 seconds were a result of combining too many checks (reduced them meanwhile) an error i made that lead to some unnecessary duplications, and spawning 1000+ 3d objects for debugging what i'm actually doing in 3d space.
i was just wondering what would happen if a script would be optimised and working fine and still running for 10s
It would take forever to complete on my machine and take away time from all other scripts I guess.
http://i.imgur.com/6sIMRu5.jpg lineIntersectsSurface checks from center to each yellow dot.
- bugs
structural integrity check.
That looks very pretty
i want to spawn AI that certainly can't be spotted from outside by players
so i need to check for windows, doors,
i've made it multistage by now
Is this a once at mission start function?
couldn't you precalculate all the buildings and save the objectSpace positions
first check for ceiling, then north,south,east,west, then take the bounding box of the first object found and use its size as new max check length, and then re-do on 3 different heights with 8 checks in a circle. abort if anything fails.
@tough abyss i was planning on implementing that
π
You could cache the results in the servers profile namespace...
that sounds like magic
the nicest thing would be to save lookup tables as a file automatically. if the detected map is unknown, run the checks, but else use a table
but i think i would need some kind of extension on the server for that
If you cache it, you have the benefits of both and don't need to worry about updates if you discard the cache if the map version changed.
Once per map and server.
?
ohhhh
ohhhh
the server has a profile
i see
is that your magic trick for today already?
Nah.
i've also written a script that greps cfg for all interesting map locations. i'll cache that too
now that seems highly acceptable to me
http://i.imgur.com/VvlDcb3.jpg with debug markers
It's totally not :U 39ms is a decade...
for a script that runs once on server start?
205 :u suffocates
Do you play with enabled debug markers, Dedmen?
dedmen, it's once per mission.
negative still suffocates
can i use script commands to restart the server?
Post the code, so we can take it apart πΏ
can i lock the server with a script to deny players joining?
you can use serverCommand to #lock
excellent. so if there is no lookup table for the map, i lock the server, create one, and restart.
@little eagle you want every file a single pastebin or all i none?
At best everything in a Github repository that allows Pullrequests
jeez you guys.
everything ISO standard commented as well
I was not joking actually...
There is an ISO standard for comments?
i always start off with the assumption there is one
but they have numbers for your resume
back on topic: i always like the debug orbs
makes debugging feel real fancy
They also look pretty.
+1