#arma3_scripting
1 messages ยท Page 562 of 1
so gentlemen lol
do you think this might work
for my pop up issue
activation:
"raisetargetgrp1.sqf" / JDM_trainingStarted = true; 0 = [] spawn { sleep 180; JDM_trainingStarted = false; "lowergroup1.sqf" };
or would it be
activation:
'"raisetargetgrp1.sqf" = true; 0 = [] spawn { sleep 180; "raise targetgrp1"= false; "lowertargetgrp1.sqf" };
```sqf
/* your code */
```
fyi ๐
wouldn't work , you are applying "stringValue" = true, cannot work
"lowertargetgrp1.sqf" this does precisely nothing
if you want to execute the script you have to use something like execVM
I know in activation I could do something like
take a bus to the BIKI, leave on the second stop
hah yea ill be right back i was just headed there lol
on activation:
execVM raisetargetgrp1.sqf";
could i use the deactivation to make it sleep then?
on Deactivation
'"raisetargetgrp1.sqf" = true; 0 = [] spawn { sleep 180; "raise targetgrp1"= false;
lol so we are now trying waitUntil { triggerActivated trigger2 };
hey guys
anyone know if ACE compat RHS is going to be updated?
i get a notification at the beginning of any mission that its outdated for some reason
when was that, i launched the game 30 minutes ago after a few months xD
i thought all workshop content updates immediately
a couple days ago that was
hmm it didn't update for me in that case
at least i know what's up, any way to force re-check or simliar?
if your normal ace has updated, then the compats have too
they are included in the ace item
oooooh
i had the separately
them*
so i just need regular ace and no separate compac?
i also get ace_tracers.pbo is outdated on every mission
not sure what that's about
ace tracers is a optional pbo
apparently you are not loading the optionals correctly
hey silly question gents but how would i define
a global variable
raisetargetgrp1.sqf=
if (JDM_area != 1) {
target1 animate etc...;
target1 animate ["terc", 0];
target2 animate ["terc", 0];
target6 animate ["terc", 0];
target5 animate ["terc", 0];
JDM_area = 1;
}
But I am told I need to define JDM_area as a global variable
GlobalVar = value
@winter rose thanks for your help before
GlobalVar = JDM_area
if (JDM_area != 1) {
target1 animate ["terc", 0];
target2 animate ["terc", 0];
target6 animate ["terc", 0];
target5 animate ["terc", 0];
JDM_area = 1;
}
then in the trigger itself
0 = [] spawn {
execVM "raisetargetgrp1.sqf";
waitUntil { triggerActivated trigger2 };
};
honestly this should be so simple lol all I want it to do is not activate again until they get to trigger 2 lol
I am really sorry for asking so much but this thing has been driving me mad for 3 days
I have been building this mission for about 12hrs plus a day and this one thing is halting its progress ๐
So is there possibly a way if i set the trigger from repeatable to not repeatable to have it be "triggerable" so to speak after reaching the next tirgger?
GlobalVar = JDM_area ๐ค
theNameOfMyGlobalVar = 1;
@hollow gate
You missed what he was trying to say there. By saying JDM_area = 1;, you make it global. Issue is likely that it's an undefined variable during your if (JDM_area != 1) check
Yeah, that ^
can I define the global variable in the init.sqf so it works with multiple scripts?
Yes
ok so I want to try this then
I figure I can temporarily disable the trigger after it is activated
ideally surrounded with isServer so not to define useless variables on clients (or put them in initServer.sqf, your call)
then have it reactivate when they hit the next trigger
so I would need to have this in the init.sqf?
JDM_area = 1;
and that alone would define JDM_area as a variable for use in multiple scripts?
https://forums.bohemia.net/forums/topic/191234-temporarily-deactivate-trigger/
this is basically what I want to accomplish
also lemme just say you all blow my mind with your knowledge on this stuff
I felt happy just making an attachto script work
Thanks! I'm having a difficult time finding the class name for the assembled static automonous GMG and HMGs.. are those directly addressable?
have you tried the debug console?
sorry
the config viewer
if you place the object in the editor and right click on the config viewer
it will show you its classname and full path as well
or the wiki ๐
lol fair
found it. thanks. I was searching by term and it doesnt seem to called out witht he same same term for assembled/disassembled in the wiki... only the A is searchable
i placed one manually ๐
dang, ninja'd
simple = best ๐
also lemme just say you all blow my mind with your knowledge on this stuff
Time, practice, and persistence. Take it from the accountant who learned some of this stuff on the side. You'll get there.
oh, missed that - well yeah, practice makes it barely working ๐
we had time to practice, since 2001โฆ
honestly I am so confused at this point @winter rose I just want to make this happen
https://forums.bohemia.net/forums/topic/191234-temporarily-deactivate-trigger/
because it would be perfect
could you or someone walk me step by step how to do it from scratch?
I have two triggers down with
condition:
this && JD_checkpoint_active
on activation:
JD_checkpoint_active = false;
publicVariable "JD_checkpoint_active";
hand another trigger that executes a file that makes the targets pop up which works great
I guess what my question is would be what am i doing wrong because the targets pop up again even though i have triggered the //JD_checkpoint_active = false//
I get no errors though...It just doesnt work ๐ฆ
global var is not the same as public var โ๏ธ
https://youtu.be/Hr-vIBmJhi4 So today I made CBA statemachine debugging a bit easier, what next?
Has anyone successfully attached one of the automated turrets to a vehicle or drone and had it aggro and fire? I think I got it in there, but not firing.
@grave lotus search how to add crew to drones... yes, drones have invisible units in them which are doing the gunning, driving, etc
@still forum I think the standard arma state machine also has some debugger functionality?
AH! Thanks for the heads up. those little guys wont have one by default ๐
don't know how, haven't seen that yet. Would sure assume BI has a tool for that internally atleast
Internally yeah I guess
Also, the loadimage now resizes into the small floating frame at mission start or server login.. is there still a way to a display fullscreen image?
when you get an array corruption, i.e. [any, ...], how do you tell when you have that any? so far I figure typeName yields nil?
Q: re: for and outer scope private variables. I have code in an apply that has private _L = _x, right, and then I have a for that tries to reference the outer _L, but this is being reported as undefined. the scope boundary on for is just that strong that it cannot see the outer scope?
@dreamy kestrel check if the value is nil with isNil
For your second question, could you provide example of your code structure?
homing in on the issue, I've got a manager processing logistic state machine, into which change orders may be injected. the loop is picking up the next change order correctly, I see "processing" and "processed" log messages. but there is some sort of strange scheduling issue going on the call to the CO callback is out of sync somehow, so the response is never seen, or is "seen" as nil...
I do have a log entry for the CO itself, but it is out of sync with the manager before/after messages.
_changeOrder params ["_targetUuid", "_args", "_callback", "_cid"];
_M = [_L, _args, _logisticsCache, _cid] call _callback;
if (!isNil "_M") then {_L = _M};
I put the _M in to intercept any problems that might have been occurring, and which apparently are. is there a stronger guarantee than call that I can invoke a callback operating on _L and have it return immediately?
perhaps the outer loop should be using sleep instead of uiSleep? i.e. there is some strange scheduling snafu manifesting itself here?
yes change order
hmm, well I am thinking of isolating the change orders, maybe that will help them to resolve prior to the next step, which is for the state machine to actually run. that would probably be safer than co-mingling the two anyway.
basically was doing this,
_cache = _cache apply {
_L = _x;
// apply change order callbacks
// apply state machine callbacks
};
For which the CO's were coming back well out of sync with the parent apply scope.
What are your Change Orders? Are they arrays? You know that arrays are passed by reference in SQF, right?
yes, a CO is a "tuple", in the form, [targetUuid, args, callback, cid], the target UUID, the callback arguments, the callback itself (compiled code), and the client idenfitier.
where target UUID aligns with the _L, which is a tuple in the shape, [uuid, ...]
Tried reading and understanding that now like 10 times
Still have no clue what the issue, goal etc. Is
Or what is ment with sync
And changeorder
And... And... And...
I think it is some sort of scheduling snafu going on. so I am trying to isolate the steps a bit further in their own apply or other looping structures.
Start at the very begining
Continue from then
Honestly I also tried to understand but it's quite hard. As I understand, Michael has some threads processing requests(messages), and sometimes the returned value is nil, so he suspects asynchronous behaviour to be the root of his issue.
it seems to be a scheduler snafu, the change order callback not returning until another moment. so the calling context sees a nil "return" which is incorrect.
Your sentence makes no sense
so I'm trying to isolate the steps a bit further.
the callback does not return when it should.
What callback?
the change order callback, read above, I described the tuple.
_changeOrder params ["_targetUuid", "_args", "_callback", "_cid"];
_M = [_L, _args, _logisticsCache, _cid] call _callback;
if (!isNil "_M") then {_L = _M};
Yes we have a _callback here ๐ค
Okay are you sure that the callback is not nil itself?
Your whole scenario is incomplete and requires knowledge of your Code
Long Story short: check how to ask questions please and come back then
yes I did check that, and I have a log entry from within the callback itself, so pretty confident it is being run.
ok, so where do you put the return value to investigate that it's nil or not?
fair enough @queen cargo if I can elaborate at all I will.
originally was doing this,
_changeOrder params ["_targetUuid", "_args", "_callback", "_cid"];
_L = [_L, _args, _logisticsCache, _cid] call _callback;
and this yielded nil or any in the debugger view, which raised red flags with me.
so I put some guards in to see whether I got a return and guard the original,
_changeOrder params ["_targetUuid", "_args", "_callback", "_cid"];
_M = [_L, _args, _logisticsCache, _cid] call _callback;
if (!isNil "_M") then {_L = _M};
and here we are.
Why do you not do private _M by the way?
Regardless of your current issue, it is strongly advised to use private whenever you can
private ["_M"]; is elsewhere, but it could be there, you're correct.
if it's elsewhere then ok
also, it's better to use private _var = 123; syntax
Anyway... yeah... why would a plain call of a _callback jsut return nil then? ๐คทโโ๏ธ
I could try that, isolate a debugger invocation and see what happens.
At what point are you using spawn?
What is supposed to be returned by the callback Code?
Where is _L privated
What do you mean 'debugger'? Are you using a debugger? ๐ค
not using spawn anywhere in there. the callback operates on the target _L and returns the same, or a mutated same.
using the in game debugger, yes.
What do you mean by the in game debugger? Do you mean your debug console? Or you are using Dedmen's debugger?
So no scheduling involved plus you are using the debug interface
it is not a dedicated server if that's what you mean, local hosted, debugger in game.
which is awkward at times in client/server since client and server are both 2.
So no scheduling involved plus you are using the debug interface
Looks like it yeah, if you just click the 'local execute' button in the debug console, it is not scheduled, all the code is run in the context of the button event handler most likely
perhaps to debug any root cause issues, sure. but eventually it must land in the server, manager, contexts.
You really have to stop assuming we have the same knowledge of what you are trying to do as you have ๐ ๐ ๐
Scheduler has nothing to do with Client and Server comminication
Okay, so the problem you are currently observing does not involve any { ... code ... } which is created by spawn command, right?
put that to pasture, I am not spawning anything. the closest I get to that is the manager itself was kicked off with execVM. everything else is "scheduled" using call.
in this particular context anyhow
execVM "123.sqf" is same as spawn compile preprocessfilelinenumbers "123.sqf" so scheduler is involved yeah
Call is not scheduler related on the other Hand
Do you have any Prior coding knowledge @dreamy kestrel ?
@queen cargo kindly, if you do not have anything constructive to add do not waste my time. I will not dignify that with any other response.
Hey calm down guys
and to be clear, my log of the issue would indicate otherwise, that apparently there is some sort of scheduling snafu going on.
@astral dawn perfectly calm and civilized here.
anyway done banging on the issue tonight, appreciate the feedback. I'm going to try those couple of isolation techniques and see if that improves things.
Well I assume you have to show more code then...
what does your _callback look like, maybe callback itself does not return anything, it is also possible in SQF and can be destructive and annoying.
How do you add your 'requests' to the (I assume) queue of requests for the thread. Maybe something is not atomic there. Also from which context do you add it - from unscheduled or from scheduled context.
It's quite hard to tell.
Also you can use isNil to make critical sections and see if it changes anything.
"waste your time"... You are wasting time of people trying to help automatically the Moment you ask a question ๐คฆโโ๏ธ
At nรถ point I have been hostile or anything else
Having Prior knowledge in coding however leads to false expectations while nรถ Prior experience leads to rookie mistakes
Explain your issue clear, if you fail to do that then create a minimum example of your Code and Post that instead
Sparker and I are currently playing the guessing game, unless you provide proper presentation of your Problem
That is why I sent you the "how to ask a question" Stackoverflow link....
@astral dawn the latter Part should be detectable with sqf-vm quite easy Btw ๐ค๐ค gonna try to implement it in a few hours I think
You mean which part, sorry?
Missing return
ah that, cool
Actually how can you do that?
This would be very helpful, this has caused me to waste a lot of time in my various frameworks
The frameworks which had no unit-testing I mean
Question is only how to implement it ๐
Always assuming that Code snippets should return something is Bad
Comment annotating is currently not possible... Sooo... But the Moment that is clear, one can Start just checking if some endpoint is having something
So many ways to make a code-variable in SQF...
I guess that it's quite hard to implement
@queen cargo Not the first time, that this guy acts rude... no idea, what his problem is ยฏ_(ใ)_/ยฏ
๐คทโโ๏ธ๐คทโโ๏ธ
The guy just thinks loud in this channel and you guys think he actually asking for help. Just ignore
Does anyone know if its possible to get the position a bullet would impact before it would be fired?
wondering if arma has anything like this or would i have to build a custom CCIP script?
"Theoraticaly", it should be possible to calculate the trajectory (Mass of bullet, speed, etc.)
i'll be honest, i've not really got much experience with arma3 scripting, aside from little things in the editor.
Me and my friends wanted to build a dope chart for the .408 and i was thinking there might be something in vanilla arma.
I've used BIS_tracedShooter before to help filling in the data but its not perfect.
I've made a CCIP type of script in different game engines before and its very interesting.
however i've never been able to make a CCIP and leading system like the anti air guns in arma have though. The only way i've managed to do target leading is with a system that does not simulate drag. If Armas AA cannons on the Cheetah and Tigress have bullet drag and target leading im lost for words as to how they actually do it.
im lost for words as to how they actually do it
Well... definitely not with SQF
is such a thing not possible with SQF then?
i see that some mods do have custom CCIP scripts but idk much about SQF
CCIP if the thing which calculates impact point of your bullet and moving enemy, right
?
yeah i believe so. "constantly computed impact point" is what i think it means
Well... I assume that for an anti-air gun which in arma has range of ~2km and a pretty big cone of fire it's quite possible... depends on accuracy I guess?
No it should be quite possible with SQF I think
I assume the thing needs to integrate/simulate how bullet would fly, calculate some 3D transforms, project the impact point onto some plane, or something like that
SQF has a bunch of commands to work with vectors and some general conversions
most CCIP systems I've seen so far stay far away from any complicated math/physics stuff.
what they mostly seem to do in my experience is simulate a "bullet" in the script, and return it's impact point.
depending on the environment its fired in, drag and gravity and muzzle velocity are taken into consideration and then in a loop, the bullet is simulated over a "time step".
You can definitely try to write it in SQF, profile how fast it works, and decide if you want to optimize it. If you want to optimize it, you can make an addon which performs this calculation fast in C++/C#
I guess it will take like... 1ms or less on each frame, but I might be wrong by 1000% ๐
Also if you don't calculate your simulation on each frame, the perf. impact will be amortized
there are ways to optimize the process. as it can easily do 1000s of iterations and i'd imagine that might cause a fair bit of strain on sqf.
there is a process called RK4 that can take the iterations down from 1000s to less than a hundered with the relative accuracy.
If i'm honest, the maths involved is way above my understanding.
In SQF really the biggest performance impact is the operator count
its probly been asked 1000s of times, but any good resources on arma3 scripting and such? looks fun
check pinned msg, command overview incl. examples
tyvm
@dreamy kestrel
the change order callback not returning until another moment
no thats not at all how scheduling works.
private ["_M"]; is elsewhere
stop using private array, the performance is terrible, and its better for readability if you place it, where you need it.
and this yielded nil or any in the debugger view
that means either the _callback was nil, or the callback returned nil.
using the in game debugger, yes.
there is no ingame debugger. The only publicly available debugger is mine, and i doubt you are using that.
@queen cargo you can clearly see he has tons of other programming knowledge, and tries to apply other concepts that are VERY FAR away from SQF, directly to SQF and fail at that, like above mixing up scheduling, with out of order execution of modern cpu's, which are completely different and unrelated concepts.
Can also be some confused dude who read something at stackoverflow and used the words from there
Hence the question
Hello, do objects in game have a unique identifier (like weapons, vehicles, etc) ?
not weapons
Thats sad :[
(vu que t'es fr, j'en profite, donc il n'y a aucun moyen de diffรฉrencier deux armes identiques en jeu ?)
ok ! ty ๐
what are you trying to achieve?
I was thinking about a simple serial number system for weapons
hmyep, nope
Is Waffle SS's comment true at the bottom of this page? https://community.bistudio.com/wiki/createAgent Because that contradicts what is said in the Mission Optimization page of the wiki under the topic AI unit quantity. https://community.bistudio.com/wiki/Mission_Optimisation
more collision, less AI
Okay, thanks!
Weapons do have unique ids just not exposed to scripts
Could anyone please link me to a FB ticket or forum thread where it mentions that when you create object as simple object in 3den and give it a name, the variable with this name is nil on remote machines
It's on the wiki page for simple objects at least.
never heard of that ๐ค
I've also had issues in the past with CBA_fnc_addClassEventHandler and simple objects.
I was hoping there was a ticket
I have some feedback from my dilema last night. the function/callback change order in question does in fact compile, but any attempt to log anything does not log anything. it is as though I've hit a hard limit on the number of compileFinal code I can have? is this possible?
Let's assume for the moment that it is. I could run with ad hoc function variables instead in this instance? seems like a less robust, less secure way to stand this thing up, prone to hacks, etc, but what other recourse do I have?
is this possible?
no
Let's assume for the moment that it is.
no.
I could run with ad hoc function variables
whats that supposed to be?
but any attempt to log anything does not log anything
if your log line doesn't log, its not being executed
I assure you it is being executed. it's not rocket science. but it does seem like a hard A3 engine ceiling on the number of compiled fucntions.
literally along the lines,
_confirm = compileFinal preprocessFileLineNumbers "path\to\confirm.sqf";
_L = [1, [], [], 2] call _confirm
isNil "_L"; // returns true, expecting _L == 1
I have a diag_log in confirm.sqf and literally the only other thing it does is, if (true) exitWith {_this select 0};, yet here we are.
but it does seem like a hard A3 engine ceiling on the number of compiled fucntions.
doesn't exist.
give me the content of your confirm.sqf
try diag_log'ing diag_log _confirm before you call it
is that the same as _confirm; in the debugger?
"in the debugger"?
You still haven't said what "debugger" you are talking about
I assume diag_log is not the same as whatever you are using there
yes I have, a dozen times. the in game debugger.
when you host and/or are the admin... press escape, etc. what is that?
okay, that.
if you just write _confirm; there, then no. local variables are local, you cannot just see them by writing there name somewhere
I run it on the "server", however, when you host, client is the server... anyway, I get code listed there.
If he exรฉcute the code in the console and put _confirm at the end, it should return the content
yes, that is exactly what I see, the compiled code.
As X39 beautifully said
You really have to stop assuming we have the same knowledge of what you are trying to do as you have
You are giving basically no details at all, besides some code that you modified before showing us (potentially removing your errors in the process), and some cryptic description using some fancy words that make no sense.
We cannot see what you might be doing wrong, without seeing your code
whether I diag_log it or not, same result. the issue is not whether the code is compiled. A3 is not executing it. when I [...] call _confirm.
returns nil when I expect if (true) exitWith {_this select 0};
you are telling us what you expect, and what happens.
Okey but we cannot see the code...
I have some inline functions I've defined in one file, that I'd like to initialize during a pre-init. Should I #include those files, or should I execVM them?
I just told you.
it is returning nil, but I expect if (true) exitWith {_this select 0};
@tropic thunder include is probably easiest variant
I suppose with execVM I might run into some scheduling and timing issues?
@dreamy kestrel you expect it to return a piece of code? but you said you expect it to return 1, and you also said you added logging, but there is no logging in there.
Stop modifying and abbreviating stuff, just show the code
Thanks!
@tropic thunder potentially, but unlikely to cause issues, but its a waste of performance/effort to spawn it when it doesn't need to be
This "I know better than you, I know I'm doing everything correctly" but still asking other people here for help mentality is really annoying. If you know better than us, and don't want to provide the info needed for people to help you, why come here and waste peoples time?
give me the content of your confirm.sqf
here:
selectRandom [nil, 1];
no we are not passing any nil in. we are returning _this select 0 from a legit parameter.
literally I compile one and we see nil, nothing happens, nothing returned. we do not compile the other, and we get the expected result.
_confirm = compile { if (!isServer) exitWith {}; if (true) exitWith {_this select 0}; };
which to me beggars the question what is the A3 engine limitation around compiled code? along the same lines as with the while loop? i.e. that there are limits? under what conditions?
compile
Description:
Compiles String expression into Code.
Syntax:
compile expression
Parameters:
expression: String - expression to be compiled
Return Value:
Code - compiled expression
Running compile code probably will lead to some screwery
apparent-hard-ceiling-on-number-of-compiled-functions/
seriously? how often do you want me to repeat that thats not the case
which to me beggars the question what is the A3 engine limitation around compiled code?
are you serious right now?
Doesn't compile take a string input?
it does
LOL
He: My confirm doesn't execute
Me: I think it just returns nil, show me the code
He: Here is what i expectif (true) exitWith {_this select 0};
over an hour of refusing to show the actual code later, here is the ACTUAL code that I asked for all along
if (!isServer) exitWith {};๏ปฟ if (true) exitWith {_this select 0};
mh..
if !isServer then return nil.
MHHHHHHHH..... I WONDER...
And he compile the code, not the string (well accordingly to his post). No wonders that it doesn't work
Honestly, we should likely just get better at ignoring people who refuse to show their code and keep asking dumb questions
Wow I love this sentence from the forum
We know, for instance, [...], for instance, under certain conditions, for starters
uh... wat.
not exactly on-topic but _L? that's not a really helpful identifier ๐
And not even private _L ๐
oh, don't get me started on private
Testing/trying to learn with the following switch-do construction. Am thinking that either of the cases should fire depending on what's been pushBack'd into the _selected array but nothing happens when onMapSingleClicking between the two vehicles.
Got something wrong with the switch-do but don't really see what it could be
onMapSingleClick
{
_vehicles = [Civ_1, Civ_2] select {(_pos distance2D getPos _x < 10)};
selectedVehicle = _vehicles select 0;
_selected = [];
_selected pushBack selectedVehicle;
systemChat str _selected;
switch (_selected) do {
case (Civ_1): {
systemChat "This is civilian vehicle #1";
};
case (Civ_2): {
systemChat "This is civilian vehicle #2";
};
};
};```
case [Civ_1], nah? unless there is array reference
array cannot equal object
also why put it into an array at all, if you only have one element in it?
can array equal array though, in switch?
It might use isEqualTo internally
That's assuming someone updated it after isEqualTo was implemented though, correct?
Ahh, gotchya
The onMapSingleClick fills the array with the selected vehicle (or empties the array) so I thought I could get something out of that. Sort of "do this if in the array there is this particular vehicle" and "do that if there's some other vehicle or no vehicle" ๐คท๐ผโโ๏ธ
You can still do that; just drop the array (make _selected an object reference), and add a default switch case for "no vehicle or not a specified vehicle"
switch (_array select 0)
```too
Thank you Lou for that. Stuff started going forward though naturally just to come to an abrupt halt.
OR should work in above case? At least if given in correct format?
This is giving Generic error in expression
case (Civ_1 || Civ_2): {
yep, || only works on boolean, not objects
you also don't check if no vehicle is returned โ๏ธ
I try to get to that at some point ๐
onMapSingleClick
{
private _possibleVehicles = [Civ_1, Civ_2];
private _vehiclesCloseBy = _possibleVehicles select { _pos distance2D getPos _x < 10 };
if (count _vehiclesCloseBy == 0) exitWith {};
private _selectedVehicle = _vehiclesCloseBy select 0;
switch (_selectedVehicle) do {
case (Civ_1): {
systemChat "This is civilian vehicle #1";
};
case (Civ_2): {
systemChat "This is civilian vehicle #2";
};
};
};
};
I felt generous ๐
@forest ore โ
Oh so that's one way to check if no vehicle was select ๐ค
I would have probably tried to hammer another case for that ๐
if you only want the first anyway, you probably wanted findIf anyway
2ร anyway Combo!
No, not the first always. Either of the two or if there's more (to come) then any of those
why switch though?
That is even beyond me heh. Like I said in the initial question "Testing/Trying to learn"
oh okay, I thought you had something specific in mind
but yes, findIf is the way to go - if you want to get them sorted by distance, it's another thing (BIS_fnc_sortBy for example)
There's always at least two ways to achieve something and thus far I had stumbled on switch ๐
Is there a way to sleep exactly one frame? Would uiSleep 0.0001 or uiSleep 0 work?
https://community.bistudio.com/wiki/diag_deltaTime may be a good start
@plain current no
uiSleep 0.0001 Wow... ARMA can run at that fps??????? ๐ฑ
you can sleep atleast one frame with 0.01
but.. might also sleep for a few minutes
I mean if you just want something to run each frame then see https://community.bistudio.com/wiki/onEachFrame
Or EachFrame, which is apparently stackable
Some sort of variable index could be used to skip a frame too?
sleep in Arma is like an IRL nap without an alarmโฆ depending on the stress, you may go for longer than expected ๐
what if i do a spawn, eg
diag_log diag_frameNo;
[] spawn {
diag_log diag_frameNo;
};
Diagfps gives you average of last 16 frames. Could be better if you really need that
As for a previous poster. We are just guessing at stuff cause we don't know what you are trying to do
^^ spawning seems consistent in editor, but so seems uiSleep 0.001
it's a bit difficult to simulate a real scenario with +20 script threads, 80 players and a ton of props
consistent in editor with a single spawned script running yes.
as its checked every frame
hey guys, i need a bit of help with a gui eventhandler. I am having a mission here where players start at random positions and they have to find out where they are and how to get to the point they should meet at. The problem is that the arma map is centered on the current position upon the first opening of the map. Therefore i would need a method to make the map center on something else. Another random spot or something simple like the lower left corner. Apart from the fact that i currently dont know how to move the map via script i cant even get a gui eventhandler working on the map. Anybody giving me a bit of insight would be really appreciated
Probably use https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#Map, coupled with the code from that thread such that when the map is opened, the following executes to center the map on the center of the world ```sqf
(findDisplay 12 displayCtrl 51) ctrlMapAnimAdd [0, 0.05, [worldSize / 2, worldsize / 2, 0]];
ctrlMapAnimCommit (findDisplay 12 displayCtrl 51);
I'd assume that would be sufficient anyway.
Nice thank you. Gonna learn about GUI eventhandlers another day then.
@knotty mantle Also keep in mind: There is a button in the Map-Screen, that centers on your player.
Meh... only for plebs who don't use ACE ๐
ace, meh
lol
๐
Nice thanks for the info Dscha. Using ace so it should be fine but i guess that is the end of my plans for a possible vanilla version of the mission ๐
You could try to disable the buttons, via eventhandler and ctrlShow / ctrlEnable, when the Map is opened.
Nice had to do some adjustments but i got it working. Thanks for the provided links Gnashes ๐
Yeah i could dscha. But i dont think the interest in the mission is big enough for that ๐
Yet...
@knotty mantle Add this map event handler for basic functionality to remove the "centre map on player position" button (h/t a snippet of code from Larrow on the BI forum): sqf myMapEH = addMissionEventHandler ["Map", { _display = uiNamespace getVariable "RSCDiary"; _ctrl = _display displayCtrl 1202; _ctrl ctrlEnable false; _ctrl ctrlsettextcolor [0,0,0,0]; _ctrl ctrlSetTooltip ""; _ctrl ctrlCommit 0; }];Obviously you'll need to handle respawning players and some other cases
Question, I am checking for nearest objects and hinting it, and the boolean it hints is correct however when I put it into a if exitwith statement it feels like i am mkaing an error
if (_check = false) exitWith {hint "test"};
if (_check = false)```
No! Just, NO!
```sqf
if (!_check)``` for example
1: _var = false defines a var
2: _var == false check a var
3: if(_BoolVar)then executes, when _BoolVar == true
4: if(!_BoolVar)then executes, when _BoolVar == false
That helps a lot of my mistakes, thank you Dscha
๐
@jade abyss how would i check if an array is empty or not?
_arr = [];
if(_arr isEqualTo [])then{}```
_array isEqualTo []
if array equals empty array, its empty
ah right
could also
count _array == 0
if array has 0 elements in it, its empty too
iirc, you can, it's just slower
Or was that the limitation of ==? i can't remember
Never used it after isEqualTo
Ah, count _arr, then check if 0, was the way before
Long long time ago
Dedmen. Any difference in performance between your two examples. I use isEqualTo all the time
isEqualTo faster
isEqualTo is faster
Ah, count _arr, then check if 0, was the way before
Long long time ago
The time before isEqualTo
@restive leaf
https://community.bistudio.com/wiki/Code_Optimisation
I remember going through all the scripts I used in the move to selectRandom
hmm, in relation to my question above, i'm checking a variable and if the variable is not set, it is returned as nothing, i thought isnil would do the trick but apparently not? E.g. isnil "_var" exitwith
my FavPart
heh =)
@mortal nacelle isNil works
if (isNil "_myVar") exitWith {};
hint str _myVar;
yep
BUT:
if (!isNil "_myVar" && _myVar) // WRONG
if (!isNil "_myVar" && { _myVar }) // CORRECT
hu?
why would someone doublecheck the same var?
no, for example if _myVar is a boolean
if (not isNil "_theUnit" && alive _theUnit) // buzzz
took a while, its late.
don't use daytime as an excuse, we know who we are talking to :p
dumdidum
(but it's 2am here too, and I have to triple check that I don't write stoopid stuffz)
triple check for the wiki, -1 check here :p
๐
Just use Nvidia's built in daytime at night hack and you'll be back up and frosty ๐ก
?
https://community.bistudio.com/wiki/queryItemsPool pretty proud of this one though :p
Don't want to post it here @jade abyss can I PM you?
Basically zero point in doing PvP servers with night time for any game at this point...
on public servers* โ๏ธ
Doesn't matter... it's what Nvidia does on your GPU
Oh... I see what you mean... even private servers if you have someone who is crap
Don't play with stupid people yeah ;-)
Ah, that autogammaadjusting thingy
That's pretty old, tho... a friend of mine had that stuff in his monitor >5 Years ago
Did it work for games that had done things to mitigate the gamma rubbish that people were doing...
Because nvidia have blown that apart... though OT...
ยฏ_(ใ)_/ยฏ
Lot of games had adjusted lighting to reduce the impact of gamma changes... the new stuff just makes it look like a crap daylight... even shadowed areas at night
if (not isNil "_theUnit" && alive _theUnit) // buzzz
Error if nil, both are evaluated at same time, needs lazy eval.
@winter rose
@hollow thistle excuse me, but "no sh*t Sherlock" ๐
See 7 messages above ๐

is there a way these days to check what object/target the player/vehicle gunner/commander has locked? (assignedTarget is sth else and even doesnt work for the player vehicle if effectiveCommander)
cursorTarget , but it also works when nothing is locked >_>
yeah no ๐
checkVisibility seems to continue to return 1 even when no longer visible or outside viewdistance/objectDrawDistance..
https://discordapp.com/channels/105462288051380224/105462984087728128/571879895182082048
that post you linked has max distance of 25m, why is this relevant?
fnc_spacePressed={
if ((_this select 1) == 57 ) then {
(findDisplay 46) displayRemoveEventHandler ["keyDown",keydown_ev];
systemChat "this should only runn once";
};
};
waituntil {!(IsNull (findDisplay 46))};
keydown_ev = (FindDisplay 46) displayAddEventHandler ["keydown","_this call fnc_spacePressed"];
hi can someone explain me why i cant remove the event handler ?
I want to only runn it once and then remove the event
you mean it continues running even after youve removed it?
yes it triggers multiple times but i want it to trigger only once and then remove it self
for one, you shouldn't need findDisplay, as _this already contains the display
second you use "keydown" in one, and "keyDown" in the other, that shouldn't matter, but they should still be the same
maybe your script executes multiple times? you add multiple handlers, but only remove the one that was added last?
after mission restart it still heppens
Yep, remove it from inside the EH
@unique sundial the issue is that checkVisibility is sticking to 1 even when no longer in VD - multiple reports on this discord about the issue
Anyone have a good guide/tutorial on how to connect ARMA with a database? I an also looking for a banking and shopping script to connect with it... anyone know any good frameworks or scripts?
Extdb3 for the database
@cunning crown Ok, is it possible to use for example MongoDB with Arma?
That's the only thing I was able to find https://forums.bohemia.net/forums/topic/173743-stats-server-and-client-api-with-support-for-sql-and-nosql-databases/
But not sure if it still works or if it's better than ExtDB.
you can use anything with arma. But you have to program it yourself if there isn't already a mod for it
@cunning crown Ah, nice...gonna look through it.
@still forum Yes, thus I am asking if anyone already have tested and have some experience with existing mods for such.
The idea is to use js-based stuff, and connect with NodeJS for a lightweight server..
This nosql-link seems interesting... going to give it a try.
Python is also an option using https://github.com/overfl0/Pythia
This is insane!
How to remoteExec the following?
triggerName attachTo [Vehicule, [0, 0, 0]];
This is not the way {triggerName, [Vehicule, [0, 0, 0]]} remoteExecCall ["attachTo", -2];
@forest ore remoteExec takes Array
So [ ], not { }
also, -2 is "for everyone but the server". Don't forget that a server can be a playerโฆ
Hey Lou,
I'm just now using debug console on a dedicated server to exec [triggerName, [Vehicule, [0, 0, 0]]] remoteExecCall ["attachTo", -2]; with the SERVER option and the debug console is showing "". triggerName is not attaching to the Vehicule but stays in its current position
Did test with 0 (instead of -2). It occurred that triggerName wanted to budge only with Global/Local Exec but not with Server Exec
How would I refresh a function every X seconds? That made no sense, let me make an example. I got a GPS dialog here, it works but it doesn't refresh when the player moves, how could I do that?
GPS display* , I guess
Hmm? No, I mean it is a custom GPS inside of a new GUI, but it doesn't track the player, it is just a static map, so what I'm asking is, how can I make it track the player like an actual GPS
dialog means "clickable interface and player can't move until closed"
(more or less)
Oh sorry I didn't mean dialog then
make it that on opening, while display is open then refresh, wait 1s, refresh etc
so i'd use finddisplay to check if its open, right?
well, how do you open it
Haven't got there yet, just a question i been thinking about for ages, how to refresh every few seconds etc, so i'll just use while
@forest ore so:
a trigger attached to a vehicle works and moves with the vehicle.
now: is it a server-only trigger?
@forest ore https://community.bistudio.com/wiki/attachTo
attachTo takes any param, if run once anywhere it is attached on every machine. no need to remoteExec.
The trigger should be local to the player considering how it is created. But having read about triggers in general from here and there I can't say for sure.
is there any solution to make an AI chopper stay in the "GUARDED BY BLUFOR" trigger? The chopper has a guard waypoint, but well also flies outside of it
how is it createdโฆ?
no way to "force" it no, but it should fly in and around to cover the are @hollow lantern
well yeah it does indeed
function called from InitPlayerLocal where-in a createTrigger made
@forest ore createTriggeryou sayโฆ
https://community.bistudio.com/wiki/createTrigger
triggers can be created locally on clients setting optional param makeGlobal to false
and by default triggers are global yes, yes
and what then
well you have (numberOfPlayers) triggers then
unless you create them locally?
and if they are created locally, they cannot be remoteExec'ed since they don't exist on remote machines
was trying to find a way to reattach the already created trigger to the destroyed vehicle
Was beginning to slowly figure out what you typed there Lou
THOUGH, the trigger is created as Global
but that doesn't apparently make it available to the server anyway
either you have "one" global cross-machines trigger (then make it dealt with by the server)
or have one local trigger on every machine where the local script deals with it.
the simplest way would be to start from scratch, and tell me what you want to do ๐
haha ๐
if all local triggers are created only to have the same behaviour, better have only one trigger (it all depends on what you want to do)
Having spend time hammering around with this trigger stuff it sort of came back to me that these days it should be possible to check if an object is inArea of a marker. Since I already create local markers for players to do "some stuff" maybe if I just create one more marker to do what I'm trying to achieve with a trigger.
Will certainly be easy as everything else in this world
wait. stop. don't.
what are you trying to achieve
tell me now, or I execute every hostage at hand
Let me just.. try once (or maybe a few more times) if I just create a handfull of global triggers instead of every player creating their own. And see if that would lead anywhere.
or explain your goal and maybe there is a better way of doing it
also I wonder if the GUARDED BY trigger is reasonable or rather a small point should be selected https://i.imgur.com/tKT8qZD.jpg My hope was that the chopper that provides support sticks to the airbase instead of flying miles away from it lol
but Arma
ยฏ_(ใ)_/ยฏ
you could maybe add it a "circle" waypoint, with a disabled pilot AI
hmmm fair point
Aebian,
I've noticed that if a unit has been given a GUARD waypoint it will go on its way to find some action if info about enemy presence gets relayed to this guarding unit somehow (no idea what the logic behind that is). In my opinion you'd be better off with some other waypoint, HOLD perhaps, if you want to make the unit stay in place
it's a chopper (AH-64) so hold is no option. It just should patrol the airfield like they do in Bagram e.g. I probably do the Lou approach. Just force the pilot to fly a specific path.
@forest ore , how is (are) your trigger(s) doing? ๐
I will see juust now ๐
@winter rose
'Stuff' began to get in working order after moving the triggers to be created by the server. Saves the trouble of having to think how to reattach the (local) triggers back to destroyed vehicles
@winter rose the LOITER wp with it's "CIRCLE" seems ok so far and the chopper sticks to one point. However it is sadly to round to be useful. I think I need to create a rectangle myself and lower the speed of the chopper :D
Hey guys. Is it possible to solve this issue? https://cdn.discordapp.com/attachments/620394340748886016/663502740001128459/unknown.png Using UnitPlay, and the unit, is hovering, not walking.
Start/All the way through UnitPlay: https://cdn.discordapp.com/attachments/620394340748886016/663503087721250836/unknown.png
looks like it's "falling", constantly. Is the model setup correctly?
Have you tested it on normal terrain?
I believe normal terrain would work.
Entity is selected in this SS: https://cdn.discordapp.com/attachments/620394340748886016/663505382215254036/unknown.png
@drowsy axle unitPlay "teleports" or "drags" the unit, so it is really only useful for air vehicles and nothing else in mind (e.g vehicles will constantly be braking and not turning wheels)
@winter rose In regards to my question earlier about using while to fresh my gps, im using cutrsc to open it, any pointers?
I would do ```sqf
while { not isNull (findDisplay _returnedDisplay) } do {
/* refresh */
sleep 1;
};
or something like this (again, I am not a UI pro)
@mortal nacelle ^
set and getVariable, when opening/closing the RscDialog
not a dialog though, a display?
Yeah, Display
can you detect when a display "closes"?
Example:
displayFile:
class yourDisp
{
idd = 123;
duration = 10e10;
movingEnable = 0;
fadein = 0;
fadeout = 0;
name = "yourDisp";
onLoad = "uiNamespace setVariable ['yourDisp', _this select 0]";
onUnload = "uiNamespace setVariable ['yourDisp', displayNull]";
objects[] = {};
controls[] =
{
ctrlA,
ctrlB
};
};```
In the Script:
```sqf
waitUntil{!isNull (uiNamespace getVariable ["yourRSC", DisplayNull])};
_display = uiNamespace getVariable ["yourRSC", DisplayNull];
//doStuff```
refresh?
well i made a custom gps and a gui with it, but it doesn't refresh the players location on the map, it is just a static map, i can use lou's method, but you on about uinamespace
waitUntil{!isNull (uiNamespace getVariable ["yourRSC", DisplayNull])};
_display = uiNamespace getVariable ["yourRSC", DisplayNull];
while {true} do {
//doStuff
_ctrl = _display displayCtrl 123;
_ctrl ctrlDoSomething;
uisleep 1;
};```
Instead of checking for the display over and over again, in the whileLoop
expanded
while {not isNull uiNamespace getVariable ["yourRSC", DisplayNull]}
```nah?
nah
b-b-but why?
Why constantly check for the rsc?
won't the script keep on running, if the display gets closed?
Will it be closed?
1 sec, reading msgs
๐
see, Lou ๐
๐
heh
You could also go with abusing the WaitUntil
I am allergic to non-justified while { true }
sometimes, it's just not needed to constantly check for something over and over again
e.g. when you know, the state of something won't change
also, some butchery like this should also be possible:
waitUntil
{
_display = uiNamespace getVariable ["yourRSC", DisplayNull];
_ctrl = _display displayCtrl 123;
_ctrl ctrlDoSomething;
uisleep 1;
isNull (uiNamespace getVariable ["yourRSC", DisplayNull])
};```
PER-FECT! ๐
Couldn't think of a command there ๐
Ugh @jade abyss any idea why this keeps happening to me ? https://gyazo.com/bc9f2bc4384998027ed172f06fe41ef2
Am I missing a defines.hpp class?
one sec expired
widthRailWay = 1; ?
Inherit your map from
class RscMapControl;
class GPS_MAP: RscMapControl
{
//defineSizes, idc
};```
This should set all the needed values automaticaly
class GPS_MAP: RscMapControl {
idc = 23539;
x = 0.0514062 * safezoneW + safezoneX;
y = 0.819 * safezoneH + safezoneY;
w = 0.144375 * safezoneW;
h = 0.154 * safezoneH;
};```
Like this?
class RscMapControl;
class myMapCtrl: RscMapControl
{
idc = 123;
x = 0.1;
y = 0.1;
w = 0.1;
h = 0.1;
};```
Yeah
Wait
I don't need class RscMapControl; above my class?
Ah
๐
I seen that sneaky edit
You need, just edited ๐
Ok cheers bud, testing it now ๐
class RscMapControl;
Loads it
and:
class myMapCtrl: RscMapControl{};
would literaly be the same as RscMapControl, all config entrys inherited*
So
class RscMapControl;
class myMapCtrl: RscMapControl
{
idc = 123;
x = 0.1;
y = 0.1;
w = 0.1;
h = 0.1;
};```
So this is technicaly a copy of RscMapControl, with changed values for idc, x,y,w and h
Oh, now my map has completely disappeared ๐
@jade abyss Qualitรคt ๐ ๐
๐ ๐
I am laughing out loud right now ๐
Nothing in .rpt regarding GPS, everything else is working, except the map
just a blank box lol
only since i done that .hpp mapcontrols thing tho, let me revert it
try exchanging rscMapControl with RscButton
Its fixed now, map is back, it is rather weird though, my gps just goes to grid coordinates 0,0 and doesn't even come to my player anymore 
what was the problem?
idk, i added widthrail or whatever to my rscmapcontrols class in defines and that error isn't there anymore
๐ค
_ctrl_map = _display displayCtrl blabla;
_ctrl_map ctrlMapAnimAdd [0, 0.15, getPos player];
ctrlMapAnimCommit _ctrl_map;
idk, i added widthrail or whatever to my rscmapcontrols class in defines and that error isn't there anymore
Somethings strange there
What is better for performance, oneachframe or animadd?
could refresh it oneachframe too i guess
animAdd
I wouldn't even exec it each frame
Maybe every 0.25-0.5 as min. value
(personaly, i would go for ~1s)
use a marker
createMarkerLocal etc.
Also check Additional Informationin there
iirc, when you use setMarkerPos, instead of setMarkerPosLocal the marker becomes visible for everyone
yeah i got my own little arrow here for the gps
Ah:
Local markers have own set of local commands "xxmarkerxxLocal" to work with. If you use global marker command on a local marker, the local marker will become global marker.
hmm yeah i can add my marker in cfgmarkers and then use it with createmarkerlocal right
only if you don't use already available marker shapes
yh got a custom.paa here
@winter rose Am I using these in the correct order??
_marker = createMarkerLocal ["gpsMarker", position player]; _marker = "gpsMarker" setMarkerTypeLocal "gpsMarker"];
Yep
but
Yep
Did you enable scriptErrors?
@mortal nacelle please use -showScriptErrors :-)
"great minds", yadda yadda ๐
yadda yadda
Dscha12/30/2019
check the A3-Launcher
There is the Button "Parameters"
https://i.gyazo.com/d01623b6937b62339ca4c3cf2ff1334f.png
yeah that'll probably be very helpful ๐
probably need to post https://community.bistudio.com/wiki/Debugging_Techniques more often ๐
it's written there ๐
Be sure to use -showScriptErrors startup parameter to display the error on-screen when it happens
Doesn't say A3-Launcher, or?
Ah, some lines earlier
Make sure you enable Show Script Errors in the Launcher (for Arma 3) or set the corresponding -showScriptErrors startup parameter.
damnit lou
stop correcting me, when i am wrong
sowwyyy
everyone learns something, even the strange blue people on this Discord ๐คฃ
I was worried I forgot to mention the launcher, you made me check @jade abyss ๐
Not "learning", just not reading the page properly ๐
learning to read is also learning ๐คฃ
this damn marker is causing me problems
(not giving any errors b t w )
just not coming through my gps!
debug it.
_mpos = getMarkerPos "gpsMarker";
systemchat str [getPos player, _mpos];```
If those are the same -> check with a standard Marker
When this works, change to yours.
I just assume, your marker is there, just doesn't find it's "texture"
_gps = (findDisplay 12 displayCtrl 51);
It's not the standard GPS
Not when he creates his own ctrl
yep
marker is defintely working as its following me, I just cannot see it ๐
following you on the map, not showing on your GPS then?
does it follow you in the "normal Arma Map"?
if so I would then tend to believe it's a config issue then, like a "showCustomMarker = true" or something, in map definition
yes, but do you see it in the normal Arma map
I do not
then it's your marker that has an issue ๐
Ugh
Anyone know how I can hint a player a list of admins that are currently online on an altis life server? I added an admin button into my Y menu and I want it to either open up a dialog with a list of active admins or just hint the player a list of active admins?
OH lou i made progress
the marker is ingame!
however, it doesn't follow me
๐
Yeah I know, but I'm figuring out how I can hint a list, I know I can use the adminlevel >1 and stuff but I'm wondering how I can make a list with the hint
Currently I'm clueless how I can make a list with it that lists active admins
this is not L*fe support though, as this is very L*fe specific
try their Discord
Aight, I'll have a look
I'd have to use foreach to track a player with a marker right
forEach , createMarker, getPosATL , plenty of commands yes
hmm but i am only looking to track one object (the player) so what would the foreach array be?
for your test only?
[_myMarker, _myUnit] spawn {
params ["_marker", "_unit"];
while { sleep 1; true } do {
_marker setMarkerPosLocal getPosATL _unit;
};```
I've scrapped that admin thing, now I'm just wondering if there is a way of checking if a player is online? I'm using a hint script that displays text in a list, but I'm wondering how you can check if a specific player is online?
get all players, check if name corresponds (or better, player UID)
So if I put a list of player uid's, then I would be able to make a script to check if they are currently active on the server?
Lou was I ment to close that spawn after entering params or? It is saying _marker is not defined
@mortal nacelle why would you change my code ๐
i didnt change it
Yeah I know that, now it's just getting the uid's in a list and being able to find that specific uid on the server
Ty
replace _myMarker and _myUnit with what fits @mortal nacelle
๐
?
so confused ๐
[_myMarker, _myUnit] spawn {
params ["_marker", "_unit"];
while { sleep 1; true } do {
_marker setMarkerPosLocal getPosATL _unit;
};```
uisleep. instead of sleep
getPosATL doesn't matter, ordinary getPos works fine (just for the sake of keeping it simple)
if you want a marker to follow a unit, you need:
- a marker
- a unit
once you created the marker, pass its name to this function
getPosATL is fffaster
Negative; check performance
and I would use addMissionEventHandler ["EachFrame", {}]; instead of while... since the map needs to be updated on every frame
so _myMarker needs to be gpsMarker?
every time you open the map, it will rerender...
:x
a marker which needs to move ๐
And it's not a "map", it's a cutRSC
Yeah, how many meter do you move per frame?
(rhetorical question)
yeah dscha i havent even got the marker on my cutrsc yet, i'll leave that till last, trying to understand what i have just been fed ๐
tbh, moving a marker is pretty easy :/
Do I actually need to change _myMarker? i've never used spawn
jumps in tank and have someone drive a bike against me
lightspeed!
๐
using forEach EH for this, is like... erm... putting a Jetturbine on a Bike. Looks nice, but it's overpowered
wayyyyyyyyyyyyyyyyyyyyyyyyyyyyyy overpowered.
So, @mortal nacelle does the marker appear on the map?
(just starting from scratch)
well it did
yeah
its static though
_marker = createMarkerLocal ["gpsMarker", position player];
_marker = "gpsMarker" setMarkerTypeLocal "mil_warning";
_marker = "gpsMarker" setMarkerAlphaLocal 1;
_marker = "gpsMarker" setMarkerColorLocal "ColorRed";
_marker = "gpsMarker" setMarkerDirLocal _dir;```
position player = getPos player
So in relation to that spawn bit you sent, is any of what i wrote relevant
"gpsMarker" setMarkerPosLocal (getPos player);
"gpsMarker" setMarkerDirLocal (getDir player);
this needs to be addedto the "while" loop
and what about the params?
wich params?
[_myMarker, _myUnit] spawn {
params ["_marker", "_unit"];<<
while { sleep 1; true } do {
_marker setMarkerPosLocal getPosATL _unit;
};
yeah i know because its in "", but _unit, what am i actually using that for
"" = string
_unit = player
["markerName", player] spawn {bla};
[STRING, OBJECT] spawn {bla};
["markerName", player] spawn
{
params["_marker","_unit"];
while { sleep 1; true } do
{
_marker setMarkerPosLocal (getPos _unit);
_marker setMarkerDirLocal (getDir _unit);
};
}; ```
so in this case, param [0] or _marker is slecting 0 from the spawn arguments array right?
use paramS, when using/defining multiple entrys
ok so params["_marker"] is selecting "markername" that i just spawned in, correct?
[0,1,2] params["_index_0","_index_1","_index_2"];
systemchat str _index_0; //"0"
systemchat str _index_1; //"1"
systemchat str _index_2; //"2"
ok i think i understand it now
adjusted
if there is nothing infront of params -> it takes _this as argument
So the stuff that was in [HERE] spawn {}
So taking the example from before:
["markerName1", player] spawn
{
params["_marker","_unit"];```
`_marker` is `"markerName1"`
```sqf
["LouIsOld", player] spawn
{
params["_marker","_unit"];```
`_marker` is `"LouIsOld"`
```sqf
["DschaIsTheBest", player] spawn
{
params["_marker","_unit"];```
`_marker` is `"DschaIsTheBest"`
etc.
yeah, ok i understand that now
๐
_marker = "gpsMarker" setMarkerTypeLocal "mil_warning";
["gpsMarker",player] spawn {
params["_marker","_unit"];
while {sleep 1; true} do{
_marker setMarkerPoslocal (getPos _unit);
_marker setMarkerDirLocal (getDir _unit)
};
};```
๐
Now dscha. all i need to do is get it on my cutrsc
private _myArray = [76561198864557712]; if (_myArray == 76561198864557712) then {hint "That UID is Valid"}; I got this to hint me the message it was supposed to hint me but now it doesn't hint me anymore when I execute the script?
There is really nothing much to this simple script, it's just that it doesn't display it whenever I execute it the second time
@mortal nacelle
Where do you open the gps?
its opened on server start
init.sqf?
no server_start_function
_myArray == 76561198864557712 is wrong...
First of all == doesn't exist in SQF, and second... an array is never the same as an integer
if (_value in _myArray) then {
that is where i am going to do it, right now I am executing it in debug
73673 cutRsc ["Dialog_Hud_GPS", "PLAIN"]
for testing:
myljc_fnc_superDuperStuff =
{
_marker = createMarkerLocal ["gpsMarker", position player];
_marker = "gpsMarker" setMarkerTypeLocal "mil_warning";
["gpsMarker",player] spawn
{
params["_marker","_unit"];
while {uisleep 1; true} do
{
_marker setMarkerPoslocal (getPos _unit);
_marker setMarkerDirLocal (getDir _unit)
};
};
};
73673 cutRsc ["Dialog_Hud_GPS", "PLAIN"];
In your .hpp file for the UI, there should be something like onLoad, correct?
add this, at the end:
onLoad = "uiNamespace setVariable [""Dialog_HUD_GPS"", _this select 0]; call myljc_fnc_superDuperStuff";
uiNamespace setVariable [""Dialog_HUD_GPS"", _this select 0]";
if i call the function will it put all the markers on there??
Only those, who are named "gpsMarker"
And since it's beeing executed on the client, and is local to them, it only moves the marker for the player himself.
Also mean: The other players don't see the marker of other players
Yep, that's why i mentioned createMarkerLocal in the very beginning ๐ I thought so
yeah
Curious to the code snippet above Dscha
call myljc_fnc_superDuperStuff";
Whats up with the random speech marks?
Accident or?
speech marks?
' '
Yeah ๐
fixed above, missed to remove one
got it, thank you
@mortal nacelle
https://community.bistudio.com/wiki/Event_Scripts
"initPlayerLocal.sqf"
Code from could be inserted in that file, so it autostarts, when a player joins the game.
Okay, thank you. I asked this earlier, but could I use oneachframe instead of ctrlMapAnimAdd, because it is prettylaggy even at 0.15,
GPS would be nicer smooth
Adjust the time, according to your uisleep time
[time, zoom, position]:
e.g.
uisleep 0.15;
_ctrl ctrlMapAnimAdd [0.15, 0.1, getPos player];```
for some reason when i execute 73673 cutRsc ["Dialog_Hud_GPS", "PLAIN"]; in a script it is crashing my game
is it ment to go above or below all my gps stuff
below
Oh, you might exchange call myljc_fnc_superDuperStuff with [] spawn myljc_fnc_superDuperStuff in the hpp
is that what crashing my game?
possible
only happens when i try to load the gui so i guess it is
There are some quirks and borks with the UI stuff
ugh
back to 0,0 again
๐
works fine on the main map though
how weird
i ran this in the script and spawneed it like you said, the gui comes up now fine, but doesnt show any info, if i remove the script and run 73673 cutRsc ["Dialog_Hud_GPS", "PLAIN"]; on debug it gives me all the info, but not the markers
๐ง
As mentioned in the early beginning: I assume somethings wrong with the mapCtrl. iirc, you switched back to your own one.
Using the one you gave at the start ```sqf
_control = _display displayCtrl 23539;
_control ctrlMapAnimAdd [0,0.15,getPos player];
ctrlMapAnimCommit _control;
RscMapControl
Oh
Reverted back to what you said, trying again
Nope adding that class above mapctrl class just removes the map completely
This is pretty annoying
okay
class RscMapControl;
class GPS_MAP: RscMapControl```
->
```cpp
class RscButton;
class GPS_MAP: RscButton```
yeah changed both and still same
you broke something ๐
Looks good to me ยฏ_(ใ)_/ยฏ
Does ropeCreate have a limit to length?
I have a file which has a bunch of characters, nothing special, just 123, no newline at the end.
I want to use preprocessor to craft something like this:
varName = "123";
So I want to include file contents and then wrap it into quotes. Is it possible?
It's not for SQF so I can't format it, it's for config.
#include?
Yes but file contents have no quotes, just 123 characters
Anyway I have made my build tool thing produce the needed file which I just include entirely in config, thanks for trying to help
@tough abyss On the object you want the scroll wheel action put this in it's init field
this addAction ["Skip Time", "skipTime.sqf"];
Make a new .txt file in your mission folder called skipTime.sqf make sure your replace .txt with .sqf, inside that file write this
skipTime 2;
If this is for MP you might have to add a global argument, but we will see or the blue mafia will point out my error ๐
@covert inlet thanks buddy i really appreciate it
can i get the one with the global argument?
honestly man tysm i would have spent sooo much time otherwise
try it first, i cant remember how of that top of my head, it might not even need one
can you put the fade out and fade in effect?
fairly sure that is default behaviour of the skipTime function
@covert inlet skipTime command doesn't do the fadeout/fadein
see https://community.bistudio.com/wiki/cutText @tough abyss
im sorry man im so clueless i have no idea what im doing
see i said the blue mafia would point out my dumb dumb ๐
snake how do i combine it with the time skip effect
by adding it before and after the skipTime command in your script
cutText ["", "BLACK OUT", 1];
sleep 1; // wait for the black to apply
skipTime 6; // will skip 6 hours
cutText ["", "BLACK IN", 1];
sniped
Does ropeCreate have a limit to length?
@willow rover I don't know, but there might be a hardcoded limit
if you find it, I will add it to the wiki
@tough abyss You can also add 2 Hours Later inside the empty quotes, to the left of the BLACK OUT/IN param
@winter rose @covert inlet thanks you two, i really appreciate it.
I think it would be best added to the BLACK IN one
https://community.bistudio.com/wiki/BIS_fnc_setDate does the job
with setDate you can set the time to 25h 70min and it will still compute properly ๐
lol wot
but there was an A2 function that displayed the 16:30 โ 18:30 time, I am looking for it
ah no, just BIS_fnc_showTime shows, but doesn't skip
says invalid number in expression
oh and i want to be able to do it repeatedly is that possible
```sqf
/* your code here */
player setDamage 1;
```
โโโ
/* your code here */
player setDamage 1;
paste your code here?
what?
copy-paste your code so we can see what's wrong
cutText ["", "BLACK OUT", 1];
sleep 1; // wait for the black to apply
skipTime 6; // will skip 6 hours
cutText ["", "BLACK IN", 1];
the one you sent me lmao i literally just copy pasted it
which init?
of an object, a laptop to be specific
```sqf
cutText ["", "BLACK OUT", 1];
sleep 1; // wait for the black to apply
skipTime 6; // will skip 6 hours
cutText ["", "BLACK IN", 1];
```
gives
cutText ["", "BLACK OUT", 1];
sleep 1; // wait for the black to apply
skipTime 6; // will skip 6 hours
cutText ["", "BLACK IN", 1];
@tough abyss yeah, don't put that code in an init. put it in your script file
You need to put it in the myskipTime.sqf file i told you to put in your myMissionname.mapName folder
myMission.Altis
myMission.Altis\myScript.sqf
yes
On the object you want the scroll wheel action put this in it's init field
this addAction ["Skip Time", "myskipTime.sqf"];Make a new .txt file in your mission folder called myskipTime.sqf make sure your replace .txt with .sqf, inside that file write this
cutText ["", "BLACK OUT", 1]; sleep 1; // wait for the black to apply skipTime 6; // will skip 6 hours cutText ["", "BLACK IN", 1];
gosh where would i be without this discord xD
on the biki, hopefully!
To be fair the biki examples are usually terrible for someone just starting out, i found its confusing AF even when i had just done a year of Python at uni
i cant find the mission file, im supposed to export it right? but even if i click do not binarize its still a pbo
do not export it until you finished it
it should reside in c:\Users\%username%\Documents\Arma 3\missions\
it should be in %USERPROFILE%\Documents\Arma 3\missions\ indeed
or "Arma 3 Other Profiles" if you didn't use the default profile
%USERPROFILE%\Documents\Arma 3\missions\myMissionName.mapName to be precise
and i put the text doc right under mission.sqm
yep
beside it yes
alright im gonna test it now
and make sure you change the file extension from .txt > .sqf
is it in the root folder and named like myskipTime.sqf ?
yeah
it's not a txt is it
i think its cus i put it in after i booted the game though so im restarting it rn
no its an sqf
you only have to restart the editor not the game
you don't even need that
but if you didn't see the file extension, just adding .sqf won't do
you only need to launch the misison. Only for description.ext a reload of the misison need to be done
There might be a possibility that filename extensions (.txt, .exe and so on) are hidden? Which could make the file myskipTime.sqf.txt
new text file(.txt) โ rename โ new text file.sqf(.txt)
in Windows Explorer, activate "view file extension"
when you first add a new script you do dont you, i know edits dont need a restart
nope
only when changing the description.ext a editor reload of the mission is needed. Otherwise not
description.ext doesn't even need that (maybe a "save")
myskipTime.sqf
@winter rose from all my testing 100 meters is the biggest I can create.
then you have your answer ๐
@willow rover thanks! I will add it to the biki ๐
hmm it still says its a text document
@tough abyss BUT
when you create a file, do you see "new text file**.txt**" or only "new text file"?
i see it with the txt
doesn't it start getting really wack in MP when its that long
@tough abyss https://www.howtogeek.com/205086/beginner-how-to-make-windows-show-file-extensions/
show file extension then
Thank you wiki. In the 2D Editor the mission has to be reloaded for changes to be applied. https://community.bistudio.com/wiki/Description.ext <--
so it is a 2D relict
@hollow lantern 2D editor yes; in Eden a simple Ctrl+S reloads it
get to work Lou *cracks wip
IT WORKED! IT WOOOOORKED
Additionally, many attributes can also be set via the Eden Editor, where changes are automatically refreshed upon scenario preview
I don't need to work, I already did
haha
๐
Good Work Hawky, getting your first script working is always a good feeling even when it was spoon fed to you
"I made a hint!" ๐
but yeah, it's good it works ๐
after all, an expert is someone that made all the possible errors in his field!
I have to start somewhere right guys?
plus this is good experience, i always wanted to learn how to code
SQF is a terrible language to learn, its backwards and stupid, but learning coding via a game is much more fun than doing "Hello world" exercises
does the CYCLE waypoint needs a certain distance to the first wp in order to form a "loop" ? I'm currently scripting a loop made out of 4 waypoints to form a rectangle loop
@covert inlet yeah your so right
One of the guys in are unit showed some SQF to the OG coding wizard at is work and the guy just got angry and kept saying "That is wrong and stupid!" ๐คฃ
@tough abyss we are "joking" a bit but we are not mocking, don't you doubt about that ๐