#arma3_scripting
1 messages ยท Page 306 of 1
I can do so much except what I wat.
It usually is that way
I've air dropped submarines from helicopters with crew inside. I've set chain explosions, VBIEDs...I can't set a helicopter to hover lower than normal or hide a task
I only needed the task to be hidden from the beginning of the mission and then unhide it, so I ended up just syncing the creation with my trigger
And thus creating it midgame
Not having it hidden from the start
is there a way to get return value from function using spawn?
im always getting a handle
guess it's impossible as it's async
Getting a return value from spawn itself? Or from a outer function.
well, if you don't mind the rest of your script waiting for it, you can use a global variable and waitUntil {scriptDone _handle};
oh, you can't just edit a precompiled function though...
If yall get the time, any opinions(suggestions)? http://prntscr.com/esxxjx
whats ESP
Extrasensory perception - And or: http://prntscr.com/esxz05 (basically shows you where everyone is)
how do you implement infinite ammo btw?
I used EventHandlers.
this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]
_evc = _target addEventHandler ["Fired", {
_ply = _this select 0;
_ply setVehicleAmmo 1;
}];
_target setVariable ["dy_fnc_infammo", _evc];
player sideChat Format["Infinite Ammo Enabled For %1", (name _target)];
} else {
_ev = _target getVariable "dy_fnc_infammo";
_target removeEventHandler ["Fired", _ev];
player sideChat Format["Infinite Ammo Removed For %1", (name _target)];
_target setVariable ["dy_fnc_infammo", nil];
};```
Probably could shave mine down but it works.
it looks useful
but a tad big to my liking, a lot of empty space
like, what's up with that right hand side empty block
Huh? The UI itself?
yeah , thats what u wanted opinions on ๐
I thought you were mentioning the code ๐ - That was for a command description, but I left it there maybe for a map. For leftclick teleport.
Hi everyone :), So I had made a magazin as FirstAidKit. How do I made it useable like a firstaidkit? ๐ Thanks.
Or able to dobbelt click on a magazine and call a fnc.
@HappyDuckie#8107 take a look https://forums.bistudio.com/forums/topic/151006-interaction-with-inventory-items/
soo, FSM
Does it run "slower" or have the risk of costing more performance than a regular sqf
From what I've seen 'til now it's a great way of visualizing things, but other then that, same things can be done with SQF
AFAIK FSM is a statemachine that checks every frame or every few frames if the condition needed to get to the next state is true. Don't know much about fsm. just assuming.
My recommendation. Stay with SQF.
doesn't FSM outperform SQF for things it's designed for? i.e AI routines
Once a condition is met (which it tries to evaluate / frame), all code is executed at the same time (scheduled)
if it's scheduled, it's not necessarily at the same time?
@vapid frigate It proceeds to run all the code - in a scheduled env
I really don't see how FSM is different from a waitUntil loops etc. Is there anything that can be done with FSM that cannot be done with SQF? I reckon using it for ai to move through a building will work, but it will also work with waitUntil etc.
it's designed for a specific purpose, managing states of things
if you don't need to use it, or prefer SQF, there's no need
but FSM has it's own editor, and you see FSM used in a lot of different mods, so it's clearly useful
If you feel the need for a statemachine. You may use FSM. Otherwise stay with SQF
Btw FSM is basically just a bunch of SQF
So there's no difference between FSM and
waitUntil{
if (condition1)then{};
if(condition2)then{};
(condition3)
};
Thanks
It's not that simple... But if you don't know what a statemachine is and what it's used for stop asking about FSM ๐
Imagine scripting being an office you have to manage
SQF is how the different zones of your office work and what they do
You can manually connect them with once again SQF and manage projects that undergo many zones in your office like that
Or you create a general plan for how projects should be worked on more correctly where and under what conditions your project switches to a different zonw
*zone
SQF is the work done to the project, FSM is the management
looks to me like the worst explaination for a finit state machine i ever have seen ๐
assuming you got 3 states
A, B, C
A is where you start
to get from A to B, the unit has to be alive --> B is our "alive" state
to get from B to C, a unit has to be dead --> C is out "dead" state
transition from A to B will be instant and equals a waitUntil {alive <UNIT>};
the rest however, is where the actual fun starts
A, B and C all can have their own code running whilst being the active state in a way more effincent and logical way then doing it in pure SQF
the best example for this would be AI
AI, having multiple states of "what to do", requires such things due to complexity
doing theese things in SQF makes creates WAY too much room for mistakes
states range from "IDLE" where the actual SQF behind would do ... well .. nothign to "SEEK COVER" where SQF would search for cover randomly up to "RUN COVER" where the cover found needs to be reached
this obviously is just a small portion but it should give you a rough idea
can the same be archived via SQF? yes
will it be simpler? no, as the SQF file will fastly grow to a size that is simply not maintainable anymore
as lil visualization: https://cdn.tutsplus.com/gamedev/uploads/2013/10/fsm_enemy_brain.png
in regards of performance: FSM is faster in certein situations as for example AI
unless you fuck up
but in that case all is horrible and unusable in performance terms
alright, now what about turing machines?
turing machines are FSMs
Okay well to my defence
I was in the bathroom and had a minute to type it up because otherwise I would have missed my bus
That's no defense..
@tough abyss Multiple nested If-else should be replaced for switch
Even if it is slower. I love and hate ArmA 3, but if the game were to suddenly be no longer bottlenecked. I would elated.
why?
switch doesn't have the some function as nested if/else unless you recheck some conditions
or have nested switches
nested elif in sqf are a pain for the eye
But sacrificing ALOT of performance for a visual acceptable state?
Hey, imo in Arma performance > 'clean' code. You can make it look not that bad tho.
switch(true) do {
case(_cond1 && !_cond2 && !_cond3) : { }
case(_cond1 && _cond2 && !_cond3) : { }
case(_cond1 && _cond2 && _cond3) : { }
case(_cond1 && !_cond2 && _cond3) : { }
case(!_cond1 && _cond2 && _cond3) : { }
case(!_cond1 && !_cond2 && _cond3) : { }
case(!_cond1 && !_cond2 && !_cond3) : { }
case(_cond1 && _cond2 && _cond3) : { }
case(_cond1 && _cond2 && !_cond3) : { }
case(!_cond1 && _cond2 && _cond3) : { }
}
much easier on the eye!
/sarcasm
Yeah and it checks absolutely everything, just to be sure to waste alot of time, checking for stuff =}
i agree, but don't see how else you do the equivelent of nested if/elses with switch
Make the conditional check into a function
with the boolean operators within it
Doesn't switch check all cases even if one matches? As in, if case1 matches, it will also check if case2, case3, etc match?
yeh thats why my example does 3 checks for each
fnc_checkCondition = {
params ["_conditionA","_conditionB"];
_returnedCondition = _conditionA || _conditionB;
_returnedCondition;
};
maybe not if you break though? can't remember
and what do you do with that bool?
switch(_returnedCondition) ?
Checks if the given parameter matches any case. If so, the code block of that case will be executed. After that the switch ends so no further cases will be checked.
Seems like I was wrong.
But people do dirty things like switch (true) do {}
only place I've seen that as acceptable in the programming world. Was networking loops
, or input loops
k.. i still don't get what you mean by GeekyGuy5401: @Quiksilver Multiple nested If-else should be replaced for switch
Well. I also have read if you can't get away with not using multiple nested if-else.
Then you should rethink your codes functionality
or how it works.
๐คฆ
Don't think so @jade abyss ?
I know for a fact I actually replaced multiple if-else, then switch do with a single array
and simply selected the indexes of the array
Using "switch" just because of astethic reasons is just... no.
Yet the parser is using C++...
it doesn't compile or run anything like c++
Does it actually compile?
only similar thing might be the preprocessor
Does ArmA 3 use bytecode or some other translation?
i think it uses text, not certain
So it is an expression parser?
Which is implemented in C++?
you could say it's implemented in every language.. in arma i think it runs the script with an expression at a time rather than compiling it
but i could be wrong
So it takes verbal word's parses the expression then uses the equivalent C++ operation internally within it's own namespace?
it uses an operation internally in C++ code obviously, yeah
but that doesn't mean SQF switch = C++ switch
Some of the things ArmA 3 does....
A block of code should evaluate to the condition becomes true, and not even bother evaluating after that.
But no...
it does if you use A && { B }
(A || { B }) && {! C || {D} }
also: If you need an statement like that... urgs...
I have seen the need for it...
Yeah, i forgot. You know everything "for a fact" ๐
check the wiki for them
@jade abyss I remember where I read it now.
Bi's own wiki. About the complexity of scripts
Funny this line.
** Be careful: Scripting isn't a solution to everything. **
Yet, we a lead to believe this...
True @vapid frigate
?
"Scripting isn't a solution to everything." Most of the things can't be done without scripting tho
Whats your point?! I don't get it.
i dont recall being lead to believe that
Comes full circle... How can you expect a game of this scale to work with the limitations it has....
?
sorry you lost me
Do you have any clue what he is talking about, Lecks?
Whats advertised on the box... is false advertisement?
no
Okay, i am not alone then.
Do you mean the sandbox limitations ?
I am confused about how this game, was allowed to be developed with the banner on the box...
** True combat gameplay in a massive military sandbox" "Experience a variety of singleplayer missions","Scenarios and challenges, or Teamup in multiplayer battles online authentic, Diverse, Open.
and yes...
@simple fiber I loved ArmA 3 and that love turned to hate.
When I micro-optimized every mission to run as best as I could get it.
Then hit both on the client side and server-side that performance wall
Ikr it's frustating sometimes but hey, it's the game. By optimizing again and again you acquire more experience.
There is always an end even in C++
"I loved ArmA 3 and that love turned to hate."
Then why are you still here?
That confuses me^^
Help other people with scripting issues? I do do it...
I haven't seen it yet, tbh. Only seeing you, stating facts you can't back up or just make up. Sry, but thats what i read the last days.
If you are frustated by the engine limitation you should probably try another sandbox game or make your own ๐
At least all the work I put in learning the SQF engine won't go to waste. And I am sorry if it looks like I don't know anything, but when you come across a language, that just is a mess, because it really is, that goes against anything and everything you learn or continue to learn can you see how frustrating it is?
And again... just ranting ranting ranting
And if frustrates you -> Why do you still bother? Carry one and don't let you bother with it oO
ยฏ_(ใ)_/ยฏ
No I want change... thats all I ask for...
Sad thing is that BI can just fix 2-3 things to make it really good but I think it's quite ok as it is rn. Of course it can be messy sometimes with all the HC stuff, weird syntax, heavy functions. But hey, it's what it make it's charm
Won't happen until Enfusion, you know that, yet you still rant around like 80Year old Grandma with no Garndkids that is frustrated
ยฏ_(ใ)_/ยฏ
sigh microsoft WDS server is less frustrating than ArmA 3...
๐คฆ and again
@jade abyss The guy who clipboards "ยฏ_(ใ)_/ยฏ"
Imagine how frustrating Arma3 would be without any scripting language available...
Hey Guys can someone help me please im trying to get a script to wait for the other to finish before executing but i cant seem to get it right i have this so far
_video = execVM "video.sqf";
waitUntil {scriptdone _video};
_intro = execVM "intro.sqf";
waitUntil {scriptdone _intro};
Is Enfusion even happing for Arma? Wasn't that a DayZ thing?
@soft crest It probably starts right after its done calling "video.sqf". Add a sleep N at the end.
its starting at the same time
Or add a Var to the beginning like: Dis_ExecDone = false; and after video.sqf was finished -> "Dis_ExecDone = true;" (changing the waitUntil to: waitUntil{Dis_ExecDone}; )
or both together
That sounds like a plan can u give me an example on the one of the lines i sent
ill try then and then maybe will u cehck it ?
Try it and check it for yourself.
@jade abyss doesn't particularly like to hold hands... ๐
will do
You won't learn anything, if somebody else would do it for you, everytime :/
100%
True.
I give hints, for easy stuff, but i won't make it for them ๐
@polar folio thanks ๐ I will take a look. @rancid ruin I had been in here in long time. I live in denmark so when I wrote the message it was 01.52 and I waited 30 min and I was going in bed.
Next time think before you make a conclusion. We all here do not live in the same time zone and country ๐ Have a great day
@jade abyss I did this is this on the right track ? it still plays together though
video_Done = false;
video_Done = execVM "video.sqf";
video_Done = true;
waitUntil{video_Done = true then execVM "intro.sqf" };
You are setting video_done to true right away?
ok what did i do wrong there
video_done = false is obsolet because you overwrite it right after that
WaitUntil is obsolet because you set the condition to true just a line before it
Use scriptDone if you need to wait until the script is done
i did that above with no luck
_video = execVM "video.sqf";
waitUntil {scriptdone _video};
_intro = execVM "intro.sqf";
waitUntil {scriptdone _intro};
ill try understand what u mean in the above and try again
Content of the video.sqf?
its a ogv file ran like this
[] spawn {
scriptName "initMission.hpp: mission start";
["rsc\ARMA_3.ogv",0,0,1920,1080,true] spawn BIS_fnc_titlecard;
waitUntil {!isNil "BIS_fnc_titlecard_finished"};
};
so the video plays as aintro to my mission then i have a camera script wich i want to run directlly after
but yea they running together
If you want both to run together why even using waitUntil?
i want the intro.sqf to run after
now the video is skipable wich is bad
and the intro is playing at the same time as video
And using spawn in an SQF where there is only one scope is kinda pointless. Well how big is the delay between intro and video supposed to be?
35 second i can use sleep but if they skip the video they wait pointlesslly
so i can either make the video unskipable
butr dont know how
or have the one script wait for the other to finish
Get rid of spawn
ok
Spawn creates basically a "new script"
So the video.sqf spawns the thing and says its done. You could give the spawned scope a name too though
yea i ran a main.sqf in the INIT wich has the video and intro script in
but i just need to fogure out how to let the intro wait for the video
if i take out the spawn should that fix the skipable option ?
No but then the intro can wait for the video
ahhh isee then should i use the code i had the scriptdone
ok ill try thanks amillion
it wont be a spawn script then right it will just be normal
Somename = [] spawn {CODE}; waitUntil {scriptDone somename} is a thing
ok let me try thanks
Np
Working perfectlly the intro runs after the video
๐
but the issue is the video is still skipable can i turn that off
@turbid thunder
I dont know. Never used the videoplay option before
mmmm
Lemme research
thanks for the trouble
That command is dangerous D:
It is
@soft crest if you use the command above, make sure that you have a way to re-enable the input
You wont be able to do anything in arma if you disable the input, not even ESC sooo yeah
i like this hahaha
You can just do something ugly like
[] spawn {
sleep approxtimeoftheintrominusfewsecs;
disableUserInput false;
};
disableUserInput true
_video = execVM "video.sqf";
waitUntil {scriptdone _video};
_intro = execVM "intro.sqf";
waitUntil {scriptdone _intro};
disableUserInput false
hows that ?
missing ;
^
the timout ?
First and last line dont have ;
And do waitUntil {globalvar_script_done};
//--------------------------------------------------------------
//------------------------Distinct Video -----------------------
//--------------------------------------------------------------
disableUserInput true;
_video = execVM "video.sqf";
waitUntil {scriptdone _video};
_intro = execVM "intro.sqf";
waitUntil {scriptdone _intro};
disableUserInput false;
Yes
Because global vars are the root of all evil ?
But why execVM it? Is this not in a established mission?
Be sure tho to have a timeout on the cmd in case it crashes(edited) ????
how do i do this
๐ฟ
@soft crest
^ this guy
no its custom one i built from the ground up
But not from you.
Why use execVM?
recreating 13 hours
What kind of mission is it?
Sorting stuff is fun
Unless this is one script you would use only for this function, I don't see a point of using execVM, either you have your own function with compiling scripts or you use cfgFunctions. Why ever use execVM?
Sleep YOURTIMR:
You should start with something basic first, but... meh, why do i even say something^^
@rotund cypress to run sqf files?
Ill continue eating ๐ฟ omnomnom
what u mean @jade abyss ? ive created plenty missions before
@soft crest Sry, thats what i 10000% NOT BELIEVE
You don't even know what "sleep" is. Or how to make an if Statement
^^
oviouslly i know sleep
Plenty of missions =/= plenty of scripts
but still learning others
This is one of the most basic things to make @soft crest
๐คฃ
*;
hahah
๐ค
i mlol
๐ฟ
Why can't ppl just be honest and say, that they got no idea.
i dont do scripts but i like making missions
I don't wanna see one, tbh.
Ye ๐ฟ ๐คฃ
last week we made black hawk down
Dscha vs Discord
Okey @soft crest do you know the difference between spawn and call?
I'm not throwing a piss at you, just you might as well be honest while we're trying to help you
http://steamcommunity.com/sharedfiles/filedetails/?id=897295039 Hello guys i recently got this mod and it seems the script requires us to join as zeus in the first place to work
What do you mean spawn is new?
@plucky beacon -> @unique inlet
What is the difference between the two?
Oh nice thanks
Spawn = code. Call = function? @rotund cypress
dfgdfsibg dfsb gdfsg
wtf
๐คฆ
Spawn = scheduled
Spawn = Creates a new thread
Call = unscheduled
Call = Run in current thread
Good thing I dont know the difference between those two :x
[]spawn{hint "i am done here, i give up"};
!=
[]call{hint "i am done here, i give up"};
thanks for the help earlier
[]spawn{hint "i am done here, i give up"; sleep 1;}; //will Work
[]call{hint "i am done here, i give up"; sleep 1;}; //Error
(if called from unsheduled (not spawned/execVMd before)
Not true @jade abyss
Only if xou call from un-scheduled..
At least that is how it should be...
No @scarlet spoke
true, unsheduled. I mix those words always^^
If you call a function in scheduled, you still can't sleep in that function
but call itself does not change the script environment
I never said it does.
No
so if arma crashes after u disable user inputs and they come back in what happens nothing ?
@soft crest they'll have input again
๐คฆ
lol
of course, it resets back to normal.
//--------------------------------------------------------------
//------------------------Distinct Video -----------------------
//--------------------------------------------------------------
disableUserInput true;
_video = execVM "video.sqf";
waitUntil {scriptdone _video};
_intro = execVM "intro.sqf";
waitUntil {scriptdone _intro};
sleep 1;
disableUserInput false;
But if it doesn't why shouldn't sleeps be possible when calling from scheduled environment?
this good ?
Have a read @soft crest
https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
@rotund cypress see the notes for call https://community.bistudio.com/wiki/call
There it says that suspension can be used when the call stems from a scheduled environment
will do
It doesn't make any sense @scarlet spoke I might be incorrect, but from what I remember still when I have called from a scheduled environment I've still gotten errors
The wiki isnt always correct
^^
๐ญ
There you go ๐
My bad...
@turbid thunder not always but this time ๐
Spawn to call a sleep
pretty often, tbh.
ok i can see why that input is so dangerous i can get past map screen
you mean "can't"?
The scriprt is diabling the inputs before i can click continue
so will need to move it
you could just go and copy the titlecard function and make your own version of it without the skipping functionality and call that. might be a bit backwards but maybe easier after all. dunno.
You can nest call within spawn? That's pretty cool.
Sure, why not oO
[] spawn
{
[] spawn
{
[] call
{
[] spawn
{
[] spawn
{
sleep 1;
[] call
{
hint "Hi";
};
};
};
};
};
};```
Although does seem pretty self explanatory looking back at it...
Fixed ๐ฌ ```SQF
[] spawn {
[] spawn {
[] call {
[] spawn {
[] spawn {
sleep 1;
[] call {
hint "Hi";
};
};
};
};
};
};
you forgot to wrap it all in remote exec
more over no "[] call compile str {}"
this makes it 10x better ... at least!!!1!!
10000% !!
This is pure rape
You wouldnt believe the things I have seen
*call compileFinal <-- this is
this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]
Would this cause a lot of lag with the tracer module?
[] call compile format["",{}];
IF I have like 20 or so down?
will you use that on AI?
ahh ok
You know the one that fires a few rounds randomly into the air.
well, if thats true it also resets the fire delay, so that there is nearly no RPM limit
Ah, that's bad.
however, I dont think it causes lag
I just want it to fire forever, because right now they run out of ammo.
you can just use the reloaded EH
Reloaded EH?
if they are units
Ah.
this addeventhandler ["Reloaded", {(_this select 0) setvehicleammo 1}]
its Local Exec only too
I would rather give them 2 Mags in advance and give them another new mag
I don't even know if they operate on the principle of mags.
Or if they just have one big.
And if they even reload automatically.
Gotta try that out.
If they are units the need magazines
I dunno if the reloaded eh works correctly on vehicles tho
regarding the mags, but for your case it should be fine
I used that way to give my AI inf ammo without them shooting 1000 bullets in a row without reloading ^
Wait.
Shouldn't I just use setammo then
Since that sets the ammo in the current mag.
this addeventhandler ["Reloaded", {(_this select 0) setammo 30}]
Well, I will try it.
Speaking of, since I never done that.
Can I just copy that line into the module init and it should work?
"this" must be changed to the unit the module refers to
Ah damn.
By doing so you question nearly all western countries exam system..
Time pressure is no point for invalid answers
What am I doing wrong here?
["You have played in opposing team earlier during this round and you've been locked to that side. Teamswapping is not allowed to keep the game fair. Please join the opposing team.", "PLAIN", 10] remoteExec ["cutText", _player];
well what do you expect it to do?
It's called when client is in the custom loading screen (shown by mission)
Should I add some waitUntil clause?
If send from Server -> No Filter needed
Well, it doesn't work. RPT is clean as well
Shouldn't I be able to send multiple messages on the screen with cutText instead of titleText?
from memory if you use different layers you can
@jade abyss you never know ^^
i do ๐
Ahh yeah sorry forgot about that ๐
You can send everything from the Server. No Restriction ๐
What I was trying to say: You never know where its coming from
I added everything to the RE Whitelist before, then forgot it once, still worked, ignored it from now on for ServerSended stuff.
Ah, yeah. Thats true.
What's the syntax for adding this command with remoteExec?
layer cutText [text, type, speed, showOnMap]
Where do I place that "layer" variable?
[layer, [text, type, speed, showOnMap]] remoteExec ["cutText"..
So the engine knows automatically where to place the arguments? Nice, thanks ๐
nope, dont think so
unless u need brackets around the last part maybe
Its alternative syntax if anything
that edit should work
[<params1>, <params2>] remoteExec ["someScriptCommand", targets, JIP];```
i think.. it's not real clear for something with _obj command _array
@jade abyss do you know by any chance if publicVariableClient'd variables are received in the order they were sent?
well same thing for remoteExec I guess
iirc, RECall is instant
RE can have a delay on the Client
(not 100% confirmed - just logical thinking - 1 is "spawn" one is "call")
yeah, thats what I remember too
but for some init stuff, it would be good to know if I have to check for all varibles to be there or just for the last one
That didnt work out for me somehow
It should oO
Yeah I was wondering too
You can even go the nasty way and create something like: (one moment)
Sen_fnc_MyVars =
{
{
missionNameSpace setVariable [_x select 0, _x select 1];
}forEach _this;
};
[[_Var1,true],[_Var2,false]] remoteExecCall ["Sen_fnc_MyVars",(owner _player)];```
very nasty
OR:
[[_Var1,true],{ missionNameSpace setVariable [_this select 0, _this select 1]; } ] remoteExecCall ["call", (owner _player)];;```
Nasty, but works
the second one is missing the forEach tho
Nah, i forgot to remove the 2nd Array
Thanks first of all
I've already been trying out something like this
but as I said somehow didnt work out
The code above works. Feel free to use it =}
or... even easier, when i think about it:
[missionNameSpace,[_Var1,true]] remoteExecCall ["setVariable", (owner _player)];
would that work?
I mean, idk if the missionnamespace can be broadcasted in that way
Yep, was about to write that^^
No Lecks, it only sends the info over, wich one to select
yeah it's unlikely to do that
But possible
yeah it doesn't say what it'll do with a namespace
it seems sort of like sending a 'createvehiclelocal' object
if it wouldn't work, then even the codeexample above shouldnt work.
I guess you would need to str the missionnamespace setVariable part and compile it on client first
(haven't done much with setVariable in RE. Maybe just works with Objects.
Ya... I am trying to have an AI operated helicopter transport other AI around until it gets shot down or the pilot dies. Pilot dying is easy. But sometimes it gets damaged and it just lands and sits there indefinitely.
I need to be able to detect that =/
Not sure how atm
not sure if this works for aircrafts but give it a try https://community.bistudio.com/wiki/canMove
Good catch. I will have to test it
Also, is it possible to place a zeus "missile strike, CAS, fire support" module via script?
I've never tried it before.
no fuel shouldn't be able to accellerate at least.. no main rotor will drop a lot faster
What was the Discord syntax of adding SQF properly formatted again?
~```sqf
Ah, thanks ๐
๐
The feeling when a script is being called every five seconds and you have no idea why
@tender fossil Jesus take the wheel
I've searched the whole mission file and I've no idea what calls it repeatedly
What exactly is being called every 5 seconds
Use notepad++ search in files feature to search for what is being called. It has to be coded...
Oh ya, I forgot Arma has a new feature. The call random function every 5 seconds...
haha
Thanks for nothing Obama
Those obama phones I tell you.
It auto corrected right to righr
This is more suspicious than Illuminati spelled backwords
itanimullI
The whole mission file is on GitHub, I've searched it through with the search
*backwards
Send us the link then ๐
It's private repo unfortunately, I can't/don't have the right to share it
If you know the function variable, just search for it
Well it needs to be somewhere to be run.
I've searched with the function variable, still no results... I don't really understand what's happening here ๐
Is the mission file binarized? Maybe it is in there.
Did you only try GitHub search?
@dusk sage Yes
Maybe try locally, GH search is crap
I would try using notepad++. Gets the job done
Maybe the function is within a script and that script is being called every 5 seconds........
Yeah, it was fault of shitty GitHub search
We found it by manual search
@dusk sage @tough abyss
Glad you found it.
I don't understand the GitHub search... It tells you it searches through the code in repository but still doesn't
It does only search the master branch @tender fossil
Well, that explains a lot (and makes sense) @scarlet spoke
Got the CAS Module for Zeus converted to a script if anyone wants it.
https://i.gyazo.com/4152375baabf77e89bf9b0a528c0c51a.mp4
ewww, pastebin
Well pasting 170 lines of code (even though impossibru) is highly frowned upon here in discord
Well I actually forgot what was wrong about pastebin again, probably the ads because someone literally kept telling me "eww pastebin use github" and such things >_>
lol
but github is actually pretty good although I havent used more than pasting my code in there so I can share it, I do know that it has more functionalities than that
The feeling when a script is being called every five seconds and you have no idea why use a debugger and see what's calling it ๐ advertising
lol dedmen
So is there a place for important display IDs I'm missing or am I just a goof
Config. I have my all-in-one config and just search for idd and then I look through all of them till I find the correct one.
I mean, I know I'm a goof regardless but I'm looking for the one with curator interface
Or generally you can use the Ingame config-viewer and just look for RscDisplay
I can give you that one sec
sweet
RscDisplayCurator .. idd=312
thanks
To find that yourself you would just go to the config-viewer and scroll down to RscDisplay and then look through each of them till you find what you need. RscDisplayCurator is quite obvious when you are searching the Curator Display
good to know
I remember finding the interface for rsc spectator by making a hint that output active displays, and finding the one that wasn't there before spectator
also it was easy because the spectator display is lik 6 digits
@plucky beacon just came up with this. any ideas on the best way to format it nicely so it can be copy pasted into a text document for reference?
_idds = "!isNull (_x >> 'idd')" configClasses (configFile);
_idds = _idds apply {[getNumber (configFile >> configName _x >> "idd"), configName _x]}
good point
so i guess copytoclipboard will not be able to have line breaks?
sweet. thx
while (isNull ( findDisplay 312 ) ) { //312 is zeus interface
sleep 5;
};
this should keep someone in the loop until they open zeus correct?
will waituntil check every frame?
Optimally, yes
oh you CAN sleep in a waituntil
okay
gotcha, the last thing you want to do is return the bool
I see
well besides it just not having a semicolon ya
I think you're onto something there
@plucky beacon Do you use CBA? You can just use a DisplayLoad eventhandler if you need to know when a player opens the interfae
Key. Then you have to stay with that crappy script way to detect it ^^
lol
crappy script way
I'll have you know I like my crappy script way
HAHA
you going to ask me if I've heard the good word of XEH?
It's just bad that there is no better way than having a scriptVM that checks every frame if something happened. Instead of having an eventhandler for that
Im surprised there wasn't an event handler for opening curator interface
I thought that was only the assignment
ยฏ_(ใ)_/ยฏ
note taken
thats the whole point of scheduled, so you can suspend
without the ability to delay execution, scheduled is useless
That's a funny way to look at it
Or just wish to run non-blocking code
You said without suspension, it's useless
hm?
thats the whole point of scheduled, so you can suspend
Even if you don't wish to suspend, of course there is reasons to run code scheduled
You've lost me ๐คฃ
What are those reasons?
Waituntil while and sleep all count as suspension so without using those, what reasons for scheduling are left?
offloading heavy tasks.
Because scheduled only runs for 3ms a frame. If you have some heavy code that runs 30 milliseconds. Unscheduled would cause massive framedrop. Scheduled would automatically spread it over 10 frames
Not if those 30 ms are caused by the use of heavy commands
no heavy command takes 30ms
there may be some commands that take 3 ms.. But that means the scheduler will just stop right after that heavy command
Writing a script that is useful and takes 30 ms to execute without using suspension is questionable on it's own
Sounds too unlikely
Still happens. For example spawning a bunch of vehicles. createVehicle takes quite some time
In other words scheduling is good for loops and suspension
Anything you don't want to be blocking ๐
Basically if you don't care about when something executes. Main reason for using unscheduled is that you know it will be executed right there and then till it's done.
True
@tough abyss Like in every programming language many people just don't care and 'make it run'
Render scope stuff
shh commy will come and talk about the scheduler
but some people use per-frame for everything,
Exactly...
like with Trigger -> Do you rly need the command every 0.5s / each Frame?
@jade abyss Since after my massive trigger spam, I'm fairly certain that it doesnt hit on performance very hard at all
Funfact. I removed all scheduled code besides one spawnin TFAR and turned everything into unscheduled.
So what creates unscheduled environments anyways?
Eventhandlers, isNil and... Some other script commands.
@turbid thunder Do you even read, what i write? Just once?
@jade abyss Yes
Doesn't seem so
EVHs/calling from an unscheduled environment/remoteExec & remoteExecCall for commands (and execCall for functions)/isNil
Maybe some others
I said -> " Do you rly need the command every 0.5s" You said -> "It doesn't hit performance"
You see.... thats like me saying: "I like Trains" and you say: "Yeah, but on Mars is Sand".
It just doesn't connect to eachother.
Call expecting return? Not rly. A call is a call.
Not necessarily (i fkn hate that word)
What kind of trigger spam are you talking about @turbid thunder I once looked at a mission that only had 5 fps... Turns out one guy had some trigger duplicated. Deleted all the duplicates and got up to 20 fps. Depends on how long the trigger condition takes to execute
Blocking the sending client, and returning to that exact point in execution to return
The thing is it doesnt matter if it executes the check every half a second because triggers are way easier to set up than making your own SQF that does the same thing with a result that is not different from using the easier way
@still forum Useless to argument^^
Oh btw.: Beeing alone in a mission doesn't count. ๐
@still forum A simple "Any present" trigger, 100x100x20
Imagine the deadlocks ๐
with like 40 - 60 other AI's
^^
100x100 okey.. yeah.. Thats not big enough to matter much
I hope not
Who needs triggers pff
@still forum Well I'm usually never using triggers bigger than that
while {true} do {
if (player inArea "..") then {}
}
we need to check 1000's of times per second
Thats what I thought today too
We told him that... idk... no clue how often.
oh lord
You never explain your original point against triggers to begin with
isNil {
while {true} do {
if (player inArea "..") then {}
};
};
10k times per frame!
yes, that's better
(if you remember Mason, the Discussion started as i mentioned "There is no reason to use Triggers anymore, since inArea exists)
The German Mason - Today at 7:47 PM
You never explain your original point against triggers to begin with```
Excuse me??
@still forum I don't think you should've given that to me ๐
I don't have to play your missions ^^ I don't care
โ *time
You clearly never read, what i wrote, Mr. Mason. tztztz.
@jade abyss ยฏ_(ใ)_/ยฏ
Okay, i quote a text from roughly 5min ago:
like with Trigger -> Do you rly need the command every 0.5s / each Frame?
@jade abyss that's what you get for advocating braces on a new line ๐
NO!
I don't get why it would matter
๐คฆ
And thats why i answere with "w/e" ๐ hf
@halcyon crypt But it looks so much cleaner!
I use new lines before brace in everything but SQF
Just seems line the norm to inline in SQF
Heresy
!
Then I assume that it literally doesn't matter ๐
pff lets combine that into a nightmare.sqf
It was great
Sounds like someone wants his FPS drained to 1 and below. And yeah, that Distinct guy
He actually sent me a private message because, quote "but these guys will rip me apart if i ask on general"
This helicopter is scripted to land on the helipad. LOL
https://gyazo.com/a62c87dc8efa488afb7d5143d493c9e4
and I saw the spawn inside spawn inside spawn inside spawn inside spawn inside spawn inside spawn with a hint
Hellcats are useless when used by the AI xD
LOL the AI went up unto the tower to get into the heli and now it is taking off like nothing happened.
#win?
#halffail?
@tough abyss I forgot which channel it was on, either here or general but scroll up about, 8 hours from now and you'll find it. (Or search his name)
halffail
Depends
How many died?
All units accounted for
huh.... well, #halffail
you know thats weird because if you use the "LAND" waypoint, the helicopter will be somewhat forced to look for a helipad nearby and land there
thats why invisible helipads are a mission makers best friend for AI heli landings
Ya, its been a bitch to get the AI to work the way I want them to. To transport other AI from where they spawn to the appropriate sector. But it works pretty nice.
Did you also manage to make them ignore enemy fire?
Yep.
yey
I think this does the trick:
_wpMove setWaypointBehaviour "CARELESS";
Ya
I'm currently thinking of a way to optimize the custom AI for my horror missions
Its so performance heavy that 10 AI's is the absolute maximum I can go to before their reaction times are significantly reduced
You have to use more trigger
๐
Fun fact: The mission actually doesnt have a single trigger
Instead, it has a massive gamelogic spam because, well, even the pathfinding in that is custom
then add some
๐ค
@jade abyss
if (name player == "Dscha") then {player addTriggerLoveRating 9000}
ikr
@hollow lantern "okay" ๐
@simple fiber It misses something
Me getting Triggered
But yeah that pic is, a masterpiece
not rly but heyyyy
I mean hey lets stop handwriting, there are computers available, there is no need for handwriting lol
ยฏ_(ใ)_/ยฏ
Btw does everyone has "ยฏ_(ใ)_/ยฏ" in a notepad always open or what lel
--> /shrug
Ehm
@simple fiber
I actually do
Noob ยฏ_(ใ)_/ยฏ
Notepad with like 5 files open I always need
Third file, second line, is ยฏ_(ใ)_/ยฏ
Filename: "D.txt" (Dont ask why I dunno ;_;)
( อกยฐ อส อกยฐ)
I have that one too
lmao
fliptable ?
xD
okay okay okay okay okay, guys. Too much offtopic #offtopic_arma <-- =}
(โโก_โก)
#triggered
Alright, my txt has three more additions
Dem jokes
I need to stop that before I get kicked xD
We should probably stop before @open vigil just kick us all out
hmm caller (_this select 1) do I need the select or can I just say params["caller"]; ?
@tough abyss LMAO
AHAHAH
Seeing as it's telling us to never talk about 'script' here
That will improve my scripts by a lot now
Holy shit @tough abyss make an obfuscator with this syntax
I wonder if ( อกยฐ อส อกยฐ ) will look good in hint, like, Hint "( อกยฐ อส อกยฐ )"
would this be the right place to ask about how to path a config.cpp so I can replace textures for interiors? o.o
hacks!!!!!1
Watermarks are the worst
Problem is, even if you are just a passenger you still get the ad that you can buy it like, right now
will you make a release for jets dlc plz? @tough abyss
๐ฎ
I saw people talking about a way to get the DLCs free the other day
Some tool or something
Lame
@tough abyss People with that logic are countered by "You don't want it? Then dont pirate it"
Except it isnt really pirating and the content is right in your face and arma has countless ways to still equip all that stuff but also countless ways of it preventing you from enjoying it
guys, #general_chat_arma
This is scripting
does anyone here know how to set up a config.cpp for textures?
if (@The German Mason) then {
hint "You are right my dud";
}
I wonder if you get those watermarks in karts and helis aswell though
it isnt
Not touchable by scripts :/
I think that we once looked for that
actually, I forgot
But I doubt they would make it that easy
I've always seen the Arma 3 DLC more as a "Donation with small reward" because they are doing so much for the game just for free that there simply is no other way for them to earn money
Well lets hope it doesnt take up until Arma 4 to get it fixed
Arma just has certain habits of bad things that never go away despite being reported so lets hope that the 3 FPS bug isnt going to be one of those
Like, the hellcat not engaging targets or the crane destruction animation being somewhat broken (Fun fact: In CUP, the animation plays just fine)
Yeah
Unless TFAR and ACRE work with x64, they'll have to use 32 bit --> 3 FPS bug?
TFAR and ACRE work with x64
guess that solves it
lol
/*
author: @Aebian
description: Entrance script
returns: nothing
// _null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab]
*/
params["_state","_caller"];
A_Caller = _caller;
A_State = _state;
if (rank A_Caller isEqualTo "SERGEANT" && A_State isEqualTo "toLab") then
{
A_Caller setPos [10623.1,7409.35,16.1496];
GateBunker animate ["TurnDoor",1];
sleep 3;
GateBunker animate ["MoveDoor",1];
};
if (rank A_Caller isEqualTo "SERGEANT" && A_State isEqualTo "toBase") then
{
A_Caller setPos [7541.05,7392.53,0.43043];
};``` Anyone can point me in the right direction? I'm not able to get the caller. I don't get any script errors but I don't get teleported
GateBunker animate ["TurnDoor",1];
sleep 3;
GateBunker animate ["MoveDoor",1];```
animateSource is awesome, when model is configured to it
yeah but this specific model isn't ๐
Question
if isEqualTo is basically just an optimized version of ==, then why ever use ==? Whats the difference? Or why isnt == just doing the isEqualTo operation for the sake of performance?
@turbid thunder isEqualTo is slightly faster then ==
@hollow lantern if isEqualTo is basically just an optimized version of == That's what I already said
Wasnt my question D:
Some differences between isEqualTo and ==:
It performs case sensitive comparison on Strings
It doesn't throw error when comparing different types, i.e. ("eleven" isEqualTo 11)
It can compare Arrays, Scripts and Booleans (alive player isEqualTo true)
It can compare non-existent game objects (grpNull isEqualTo grpNull)
It can compare Namespaces (As of Arma 3 v1.47)
It is slightly faster than ==, especially when comparing Strings```
@turbid thunder
Yep
well then just write B_MRAP_01_F as it is written in the editor and its also true. But yeah it depends on the use case.
setVariable public doesn't work inside the init eventhandler
Value is not synched.
Only defined on the machine that created the object.
Ok thx
Hmmm, I guess if one had an ingame password system, case sensitivity could be good ๐
You guys know if exessive line of sight checks take long to process?
That's ambiguous
But considering you said excessive, I'm going to say they take longer than non-excessive ones
If they are excessive, then they by definition take long to process, no?
Why else would they be "excessive"
Well I need line of sight checks for custom AI and for faster response time, the code needs to run faster
in a loop
aaaaaaand I think that line of sight check + direction unit is looking check + distance check +, ehm, let me see real quick
basically point is: I managed to achieve what I wanted but not on the level of performance I would like to
This is still really ambiguous
We have no idea where you're running code, how you're running it, what code you're running, how often
Anything
executed via execVM
And I'm pretty sure that line 123 is the bottleneck that causes highly noticable slow reaction when I have multiple of those guys wandering around
I tried to read that, but indentation!!
wparraysort = wparraysort + [[_distance, _x]]; use pushBack
Makes it 100 times harder to read
good question
nul = [_freddy] spawn why save that in a variable if you don't need it
why do you have a spawn inside a spawn inside a spawn inside a execVM ?
nul = [_freddy] spawn That was because I was too big of a dummy to get animspeedcoef global
Agreed there might be a real reason for doing it like this. But it looks bad
Dedmen, don't argue with infallible logic
Aaaaaaaaand also, you know the issue with sounds having an insane distance?
Either way @turbid thunder This is also run scheduled, this isn't going to cause any noticable perf issues
Well, this is what I had to do before they added a third parameter for sounds in the description to have a audible distance defined so I had to figure smth out
{
if (_freddy distance _x <= 2 && _mode != 0) then
{
_victim = _x;
_selected = true;
};
} foreach _targetlist;
You are iterating through all targets. But only use one in the end. Why not stop after you found one?
Unless you are relying on it being quick
@BoGuu#1044 Yup. Problem is that the slow response time makes them miss their waypoint or take too long to react
@BoGuu#1044 test
ok....
@still forum How can one exit a forEach?
{_reldir = _freddy getRelDir _x;
if ((_x != _freddy) && (side _x == west || side _x == east) && ((!lineIntersects [eyePos _x, eyepos _freddy, _x, _freddy]) || (!lineIntersects [getPosASL _x, eyepos _freddy, _x, _freddy])) && ((_reldir > _fov1 || _reldir < _fov2) || (_freddy distance _x < 20 && _x isFlashlightOn (currentWeapon _x)) || ((speed _x < -0.1 || speed _x > 0.1) && _freddy distance _x < 5)) && !isObjectHidden _x) then
{_targetlist = _targetlist + [_x]};
} foreach allUnits;
why allUnits? don't you only need the units in range? use nearEntities or something. Also use lazy eval for the condition
Ikr
Blame the fact people can lean their head inside walls
@barren stone
Reposting here, because it's pretty important:
["B_MRAP_01_F", "init", {(_this select 0) setVariable ["test1", true, true]}] call CBA_fnc_addClassEventHandler;
_v = "B_MRAP_01_F" createVehicle position player;
_v setVariable ["test2", true, true];
missionNamespace setVariable ["v", _v, true];
On local machine: test1 and test2 are defined
On remote machine: test1 undefined, test2 defined
-> setVariable public doesn't work inside the init eventhandler
We have initPost, which solves this for editor placed objects (init artificially delayed until postInit eventhandler), but it fails for objects created mid mission, which is a pretty nasty inconsistency.
I plan to fix this in the next CBA update by delaying initPost one frame artifically if postInit already happened.
This is the reason the texture sync of the licence plates doesn't work too. setObjectTextureGlobal also has the same problem -> no texture, no variable.
That is probably your problem right there. Even if first condition is false you are still checking if any of the other conditions is true. Although it doesn't matter. And then you run that on all Units. Although you only want units in a certain distance
if (((lineIntersects [eyePos _freddy_target, eyepos _freddy, _freddy_target, _freddy]) && (lineIntersects [getPosASL _freddy_target, eyepos _freddy, _freddy_target, _freddy])) || isObjectHidden _freddy_target) then {_mode = 2; _busted = false} else {_lastpos = getpos _freddy_target};
Lazy eval again
nearEntities you say
I guess that'll help
You also mentioned smth about pushBack
You are using the slowest known method of appending elements to an array
Because I didnt research ๐
Though that is only ever used once the AI loses their target and need to return back to a waypoint
wparraysort = wparray apply {[_freddy distance _x, _x];};
wparraysort sort true;
There you have a better sorting thingy
huh
That is even an example on the sort page https://community.bistudio.com/wiki/sort see Example 4
Your todo list:
Indent your code properly
Remove unused variables
Improve your waypoint sorting thingy (Which I already solved for you)
Lazy eval in your conditions
Don't iterate over allUnits.
Because "apply" is unknown to me and just reading the wiki didnt help me understand what exactly it does
You are first checking if the AI has line of sight to a unit. And after that you check if that unit is even in range
Not the other way around?
there are examples on the wiki
Like, first distance then LOS?
Thats what you should do. But you are doing the opposite as far as I see
You forgot to use Trigger!!111oneoneoneeleven
Now just fix all these issues. And then come back and we might find more
no, add more trigger
@still forum Will do. Tomorrow
Did anyone ever get any quantitative comparison between pvar vs remoteExec (with whitelisting enabled)?
jokoho did something back when it appeared to bugged and was like twice the traffic and 200 times the processing time.
But that was years ago
- BS numbers from vage memory
In favour of pVar I assume?
Yes.
And only with white listing
Which also increased the traffic, which must be a bug
Yeah. Someone should test.
Although.
We did some testing with setVariable public on init eventhandler recently and found having lots of these is not so bad.
And now it turns out that they don't even work.
_null = [] execVM "client\init_client.sqf";
} else {
_null = [] execVM "server\init_server.sqf";
};``` would be how you execute with the difference of a client and server on init yes?
No. A server is not necessarily a dedicated server.
"init_server.sqf" would never be executed in SP or in local hosted MP, which makes this script very hard to debug.
And the names of the files are technically wrong too.
Technically they would have to be named:
init_dedicated
and
init_notDedicated
Would that technically affect any scripting(via init itself)?
Well the script would be potentially executed on the wrong machine or init_"server".sqf not on the local hosted server
But if this is for Exile or Altis Life then you might get away with this, since they don't recognize this difference either and makes their missions/mods impossible to be played in SP or on a local hosted Server anyway.
Ah. Currently its just a little locally hosted gamemode.
if (isServer) then {
execVM "server\init_server.sqf";
};
execVM "client\init_client.sqf";
Gotcha.
This would be "correct", but it obviously also depends on the contents of these script files.
oops, mixed up the folders. fixed*
Sometimes you don't want to execute stuff on machines that don't have a player sitting behind the monitor
E.g. dedicated server or headless client
if (hasInterface) then {
...
};
isDedicated isn't that useful generally in my opinion.
Hmmm. I've never really messed with init that much so its good to know. (As in executing whatever on the init and server)
It's always important to know which script runs on which machine.
Step 2 is to know in which order ๐
Indeed.
I haven't coded too much since the arma 2 days so its been a while.
I mean currently im just executing the really basic stuff (PreprocessLineNumbers, setVariables....)
The "bread and butter"!
Yup.
I mean currently im just executing the really basic stuff (PreprocessLineNumbers, setVariables....)
Thats advanced, for most of the ppl here ๐
You know how to make an if-statement and knows how to set sleep? -> Advanced.
๐
Haha
You know the difference between sleep and uiSleep -> Expert
You know the actual difference between sleep and uiSleep -> Ascended
(You laugh, i rly mean it^^)
I can suppose. (scratches head at commy2, googles uiSleep) never even heard of it lol.