#arma3_scripting
1 messages ยท Page 307 of 1
Is there a difference?
Thats for you to find out.
Not in MP
Of course in mp
See? Dscha is "only" an Expert
Quiksilver too is only an expert.
๐คฆ
Wateryer? Seems legit to me.
You see, we are a big Family here.
Everyone hates everyone.
from the bottom of their buttocks.
diag_tickTime is a really bad idea when you want to make your missions work in savegames
uiSleep still pauses when you don't use -noPause, QS.
I thought that time ended, when ISDN was introduced.
It takes Systemtime oO
So it shouldn't pause
gonna start arma
uiSleep doesn't use system time. Ask dedmen which checked the source code.
uiSleep is basically using the system time (uiTime more specifically) and not simulation time
uiSleep is the same as simulation time of sleep, but ignores pausing the game with ESC menu in SP and setACCTime.
The wiki is obviously wrong.
Then its time to edit the Wiki Page
diag_tickTime does use the clock, but uiSleep doesn't
I tab out 24/7. Mostly for finding missed ; ๐
Yes, because simulation stops when you tab out without -noPause
See what you started, DylanSMR?
๐
You don't like QS?
Who?
Wrong Commy
You were wrong
uiSleep executed when tabbed out.
[] spawn
{
systemchat str diag_TickTime;
sleep 5;
systemchat str diag_TickTime;
uisleep 5;
systemchat str diag_TickTime;
};```
Would make sense @tough abyss My variables tags are dy ๐
Thats my standard quality arma terrain.
Its a Prototype/Testterrain, so i don't give a fkn damn ๐
Yeah.. uiSleep continues running when tabbed out without -noPause. I think. diag_tickTime is using systemTime btw
told ya ยฏ_(ใ)_/ยฏ
ScrollMenu?
ingameUIEventhandlerthingy
inGameUISetEventHandler ["Action", "systemchat str _this"]; <--
prev next
or so
not my prob, you just asked for beeing opened ยฏ_(ใ)_/ยฏ
๐
@tough abyss As in the actual scroll menu? With switch weapon, etc, and not just a single action.
that overly outdated piece of OperationFlashpoint
"familiar" - like in "Oh god, our alcoholic, debile and incontinent uncle comes to my birthday party - and i am 14"
_hintData = missionnamespace getvariable ["BIS_fnc_advHint_hint",[localize "STR_A3_CFGMPGAMETYPES_UNKNOWN_SHORTCUT_0"]];
_hintClass = _hintData select 0;
["Hint '%3' is too long (%1, shouldn't exceed %2)",_height,_heightLimit,_hintClass] call bis_fnc_error;
};``` good to know they implented a hint too long feature ๐
@tough abyss This is what that variable returns _text = str(uinamespace getVariable "igui_displays"); http://prnt.sc/ete1lc
How can I troubleshoot this error -- https://puu.sh/vbXAG/06ab830ef0.png
I notice that there is no button to click ok to ignore??
the error means the config entry is missing
what config entry?
needs configFile >> RscMainDisplay >> controls >> TitleSinglePlayer >> TextureNoShortcut to = a string
humm, let me dig around more then....
It doesn't mean at all that a string is missing. I think the error simply is wrong inheritance.
Updating base class ....
doesn't mean a string is missing specifically, but means that value doesn't exist
and in this case textureNoShortcut should be a string
could be inheritance or just left out
If you just say "there is a string value missing" then that implies a way to resolve the problem and I don't think that implied way is any good in the long term.
"Couldn't find the value". That sounds better.
yeah true.. something like the error means the config entry is missing ๐
If you say so. Manually adding one still is a bad idea.
Didn't mean to. ๐ฆ
https://manuals.bisimulations.com/vbs2/2-00/manuals/Content/Editor_Manual/SM_ScriptDebugger.htm So much on "A SQF Debugger in Arma doesn't exist"
Well there also IS that thing that checks the init boxes in the editor, but it's pretty limited in what it does.
@still forum Isn't there an editor which does that that is still in developpement ?
Arma.Studio is in alpha now yes.
But Dwarden told me before that a script Debugger doesn't exist. But it indeed does ๐. And the Interface for that is what my Debugger is using
It doesn ot in Arma itself
it does
It does. The Interface is there in Arma. I'm using it for my Debugger. It's probably the same Interface that's used for the VBS debugger
You mean Arma Studio is using it ?
yes. Arma.Studio is using my Debugger and that is using the Existing script debugger Interface in Arma
been using Visual Studio Code with SQF Language + SQFLint lately
Stop capitalizing the nouns, dedmen.
very good so far
First they tell me to capitalize the nouns and now they tell me not to. I don't know what to do know ๐
but i wouldn't call it a debugger (even though it displays log errors, etc)
Also tried the IntelliJ plugin but these are bugged af
needs breakpoints to be a debugger imo
We have a working Debugger with breakpoints. We actually have two
which??
Arma.Studio see #production_releases and "ARMA STUDIO" which is unreleased
@still forum So is Arma studio actually usable and suitable for developpement ? I use Sublime Text rn and I don''t want to loose the functionnalities
It's useful for Debugging. But not for writing code yet. It's still very much alpha.
Okay
Arma.Studio and ARMA STUDIO are 2 different projects?
yes. You can see that from the different Names. Obviously
yeh, my bad
๐ Not really your fault ^^ These Names are kinda similear if you don't pay attention to it ^^
@still forum Well, I think I'll still with the hacky and crapy methods for now like everyone. I use enigma's tool for a second syntax check
Arma.Studio also has live syntax checking. advertising
He has good ideas, maybe you guys should work together instead of creating xxxx tools
My debugger is open-source. Anyone can use and implement it into their tools. But till now no one seemed to care.
i have a suggestion
change the name
the saddest part is when you google arma studio, neither of them are in the top 5
Well.. One tool has been teased for over a year only on some youtube videos. The other was only released as early alpha a few weeks ago. So I wouldn't expect many search results
But for me Arma.Studio is third result on google
I have one question, THE QUESTION : Is there a Dark Theme ?
๐ Not yet ^^ I'm also waiting for that.
ok then => ๐
Currently doing a big rewrite. When that's done you can choose any colors you want
Dark material theme http://i0.kym-cdn.com/entries/icons/original/000/006/077/so_good.png
how do breakpoints work? with a dll or something?
yeah
nice
I suppose it does not work with Battleye
true. Will also try my best to keep it that way
Why would you use battle eye while debugging?
It's an anti cheat tool?
Even a lightweight version
Debugging requires a lot of cheating
Because you would be able to stop/manipulate any script running on any Battleye enabled Server. And Battleye aims to prevent exactly that
Cheating requires a lot of debugging *
Why do you know?
i like this VS Code one because it's adding the language to a good text editor
Suspicious...
seems too much to make a good text editor AND put the language in
I knew it.
Any good Arma dev knows approximately how battleye works
Tell me you never went on cheating forums
They are gold mines
I never went on a cheating forum.
For infos
I know @vapid frigate ^^ We have most of the language part done. But creating an actually good text editor is the harder part.
You should you can learn a lot
Like what?
Like how everything is working ? Like how do ppl cheat ?
If commy needs to learn something he'll just ask me. And you don't need to know how people cheat. Except you are a Server owner or something like that
All my learning is from asking the game engine by testing stuff.
Everything I was told and learned from others turned out to be a lie.
@still forum seems like it'd be easier to make it a VS or VS code plugin
Btw, you know you can freeze the process and read in the memory without being Battleye'd ?
- u could put it in the extension browser so ppl don't have to google it ๐
Already talked to the guy that made the VS Code plugin. He is free to add my Debugger into his stuff.
If I play it's on a closed server, so the only one cheating is me (the only one that would know how to).
Battleye don't care if you are on a private server
I lost an account trying on mine
My point is that there is no battle eye, because it's a resource hog and you don't need any of that in Arma.
Why would you use BE in a closed community?
Why would you trust everyone ?
I don't. It's a closed community.
You don't need BE to make sure no one does bad.
You don't need Rcon in a closed community. And Battleye creats more Problems than it solves in that scenario
depends how big the community is
Most of the servers need Battleye
They are not rare. Just not as big and well known as Public ones are. Which makes sense. Considering most of their servers are password protected
Yes. Indeed ^^
Stop editing your posts, dedmen. It's hard to keep track of what you write.
Just make a new response.
lel
This is not a forum, this is a chatroom.
Usually I complain about the other way round.
i smell mimimi
We are like 4 ppl talking it's not that hard to track
And Harm, stop writing like a 4chan reject.
@little eagle Please, you can do better, 9gag reject
๐ฅ ๐
๐ฟ
Are you a not funny version of @jade abyss ?
I should visit a "cheating forum" so I can learn about scripting.
Reading what harm says is always ๐ฟ time
Please. I try to be entertaining too.
Not always the best thing to be entertaining ๐ค
You assumed that I always have the best intentions.
yeh that's from VS 2017 vanilla
^
unfortunately not aware of arma plugins
Oh ok, i'll stick with Jetbrain then
VS code has some
I'll take a look thanks
looks like @willow basin made one of the ones i use.. creatively named 'SQF Language'
the other one is 'SQFLint'
to show more of the typos
at least they're uniquely named though ๐
shots fired
;D it was free so I took the chance to claim "sqf". But especially SQFLint will give you some hints. Mine is more to make SQF look more beautiful in VSCode ๐ atleast for now.
and it does.. no issues that i've seen in SQF Language yet. a few minor issues with SQFLint (discussed https://github.com/SkaceKamen/sqflint/issues/6 ), but recommending it to anyone who will listen already
so easy to tell devs 'get vs code, click the bottom icon, install SQF Language and SQF Lint, click play under the debug icon'
and just right click > 'open folder in code' to open an existing mod
It is important to know that even the engine of BI needs some () brackets around these statements (like the array after format []).
wat
format %1 try catch ๐ค
Catch returns something according to wiki. Probably return value from catch code
I am wondering:
I have 2 scripts here. Both are generating a marker on a map and then update the location continuously. They are launched through the init of an object.
In case A i continuously generate and delete the marker, in case B i create the marker first and then just continously update its position.
I used local markers first, which works in case A, but in case B, that does not work. The marker then only exists on the server.
why deleting it?
Now, If lauch through an objects init, that script is executed once on mission start, or will it run on every client that connects later, too?
Because, if it is run for every client, then i dont understand why local marker does not show up on the client
In case B
What kind of Obj? MapObj? Placed? If placed -> only when created.
Some rock, placed by editor
"
In case A i continuously generate and delete the marker, in case B i create the marker first and then just continously update its position."
Why deleting it
Its attached to an objective that might get destroyed
again: Why deleting it?
Because otherwise the marker persists after the object is destroyed
add a killed-EH to the Obj, that deletes the marker, when its dead oO
Does that throw errors for objects that cant be killed? Because i want to use it on all sorts of things
Still thats not the point, im aware that there are other ways to do that. But that script works and has no issues
Im wondering why local markers dont show on clients in tge second script
Where i also could do it differently and a normal marker does the job, but still i wonder
local = local to the machine where created oO
Does that throw errors for objects that cant be killed? Because i want to use it on all sorts of things
Wut?
In principle that part only would need to run on the server anyway, but it should also work with local markers in my understanding
What do you want exactly. I have no clue atm
killed only triggers on the machine where the dead object was local, but then you might as well just switch to global markers.
there is script A) for things that should be used as objectives. all sorts of vehicles, people, and whatever kind of objects in principle. all the script does is generate a marker on the position of those objects, and objects get this function, so they can be picked up
script B) only generates a marker on an object, and checks whether any objects tagged through script A) are within the area
i use local marker for script A) because i thought that, if launched through init, the thing is executed on servers and client and then there could be shitloads of markers on the map in the end
uhm.
and i was considering some functions depending on conditions that depend on the individual players
ive skipped all that already, and yes, now both scripts could do if only run on server, but my question is the same: why does the second case not work with local markers. because i seem to understand something wrong about what happens when something is called through an init of an object
I think this might be all too vague for a chat.
Also, define "init of an object".
Editor Init box?
yes
the code looks shitty right now, i dont want to post it ^^
but its very basic stuff really
in one case i generate and delete a local marker in a while look
The code inside the init box is executed on every client after the object was created on mission start. Note that "mission start" is a "local" concept. The mission start happens for a JIP when it joins which might be 2 hours into the mission.
in the other i generate the marker first and then only update the position in the loop
There is one huge trap with marker locality which might be your problem.
Even if you create a local marker with createMarkerLocal
As soon as you use one of the global setter command, e.g. setMarkerText instead of setMarkerTextLocal
The marker will turn into a global one and is broadcast to all clients.
โ
no i used all the local commands. im wondering why the marker is not generated on the clients at all when i create it outside the loop. it looks to me that only the while loop is running on theclients
Maybe the marker name is already taken.
so as if its lauched in the beginning, where only the server is there. but if a client connects then it just keeps running there too but the initial part is not executed again.... its weird
ahhhhhh
Marker name or marker id has to be unique. Note that marker name != marker text, which is the one shown on the map.
that could be... although that marker name would only be already taken on the server
not on the client that connects....
๐
You should try to debug your specific issue with as simple code as possible.
And if it still happens, then you can post that here so anyone here can try to repro or find the problem in the thinking.
let me just clean this up a bit
hm actually now i see that i have no indication of that script runnin on the client at all
i recall that i once noticed that a simple object would not show an action that was attached to it
could it have something to do with simple object??
diag_log "geddon homezone registering";
_center = _this select 0;
_side = _this select 1;
if (isnil "fez_CTFgeddon_homezones") then {
fez_CTFgeddon_homezones = [];
};
_array = fez_CTFgeddon_homezones;
_number = count _array;
_rd = random 1000;
_zonename = format ["fez_CTFgeddon_homezone_%2_%1_%3",_side,_number,_rd];
_zone = createMarkerlocal [_zonename, (getpos _center)];
_zone setMarkerSizelocal [75, 75];
_zone setMarkerTextlocal format ["AREA %1",_number];
diag_log format ["geddon zone marker created for %1",_zonename];
_array pushbackunique _zone;
fez_CTFgeddon_homezones = _array;
while {true} do {
diag_log "geddon homezone update loop is running";
_zone setMarkerPoslocal getpos _center;
_zone setMarkerColorlocal "ColorBlack";
_zone setMarkerShapelocal "ELLIPSE";
_zone setMarkerAlphalocal 0.5;
if (!isnil "fez_CTFgeddon_Objects") then {
diag_log "geddon zone found geddon objects";
{
diag_log format ["check location of geddon objective %1",_x];
if (_x inArea _zone) then {
diag_log format ["objective /n %1 is in area %2",_x,_zone];
};
} foreach fez_CTFgeddon_Objects;
};
sleep 30;
};
so this works with normal marker but not with local marker when called through an objects init box
i added _rd = random 1000; to the name of the marker, to exclude the thing with double names
@proven crystal that sounds unreliable
also there is a counter in the name
so there shouldnt be that option in the first place
but just to check i added that too
still: i found that the entire code is not executed on the client now in the first place, even though this is executed through an objects init box
while {true} do { <- checking each frame? Put a uisleep of min. 0.5s in it
so all that doesnt matter
Dscha is blind.
ow i wonder if that has to do with the fact that this is attached to a siple object?
fk that {-oneliner...
i also have a sleep 30 there
Dscha... Ckean your glasses
screw it, unreadable bs
๐ ๐
๐ฉ
no rly... whats the point of not putting { in a new line, to cleary see where something starts... -.- i hate humanity
Because some people like more compact code
and some People know that the { starts at the same line (People like me :3)
Compact code is a relative term
I don't like a line of code that only has one char on it. It's a wasted line. And there are only that many lines that fit on my screen
readability > CompactCode (unless it affects performance)
^
If you got stuff like sqf if(_abc)then{_abc = false;}; one liner
instead of:
if(_abc)then
{
_abc = false;
};```
if (_abc) then {
_abc = false;
};
But noooooooooooooooooo, there are sadists that like to write it like that:
if(_abc)then {
_abc = false;
};```
As i said -> Sadists
no sense it makes
^^
well yea, but there is going to be more code in those brackets obviously. because the point of it wont be a diag log
I don't need the bracket to see what's going on. The Indentation is already telling me that
wtf is happening here
I like it like in Dscha's second example
(btw.: A Sidenote for those who might not get it: My "raging" is just a joke)
xD
Anybody know where the button is?
๐
What if _abc is nil? D:
if (_abc != false) then {
_abc = true};
Then I also fixed an error, German
falling in Brennessel
See how efficient I am?
if !(_abc isEqualTo false) then
{
_abc = !_abc
};
Normal folk praise the sun. I praise commy for having the efficency of a german :D
Commy is a MacroUser... pff... never.
_abc = [false, true] select _abc;
How do I teach someone to stop using if (var == true) instead of if(var)? It's important
you show them it doesnt work at all
You don't need to
if(true == false)then{};
ยฏ_(ใ)_/ยฏ
It just doesn't work. No need to teach something ^^
Who puts == or isEqualTo in if's when the var in question is a bool?
Enough
BOOL is not an allowed type for == either way
if (_abc) then {
if (_abc == true) then { // REALLY make sure
_abc = false;
};
};
There are also ppl who claim that Trigger don't affect the game.
Check the channel description, nick.
isEqualTo won't throw an error as is checks the var type no ?
(if var is not a bool)
i quote:
IF (script == true) THEN {chat here};```
You use == to return true or false, if you already have a var with true or false = wasted time typing it
๐ Dwarden messed it up
isEqualTo won't throw an error, because it doesn't check the variable type.
Well that's what I meant but you got it
so what about my ugly code now? why doesnt it run on the client?
no matter how it looks r whats in it
Channel Description wrong since:
10/19/2015
again the question - can it have to do with te fact that it is a simple object?
because i also once added an arsenal to a simple object and that also wouldnt work
you cant use addaction with simple objects
you can cheat by having a hidden gamelogic or whatever which you do attach the action to or something
The if bool == true thing a friend of mine is doing is in C# actually. I'll try to teach him not to do so using the lego on the floor method
Why would you have the month before the day and then the year? Were ppl drunk back then? ^
Just let him do that. But tell him the more code he writes the slower he is coding. If he wants to be slow then that's how it is. Doesn't really hurt
Because smaert
Real languages will optimize that stuff out but in sqf it's probably bad to have lots of them in a PFH or something
Lol
-noLogs and while {true}...
And always use spawn
for everything
@willow basin its the default format for the USA. YYYY/MM/DD is much better to use on a computer. Looks nicer. Im just confused because I still cant tell if dscha is german for using german or american for having time and date formats popular in the US :x
better spawn {isNil {...}} Unscheduled but still scheduled
Make sure to put it in isNil or an eventhandler :D
^
@still forum wait what?
I got Discord (and almost everything else) in English, so it sets it like that.
Lol
proper localization is almost as hard as timezones
Timezones are worse
language, dates, decimal/thousand seperator, currency...
Especially when some countries have a summer and a winter time but others not
YYYYMMDD is perfect for sorting and stuff. It's MM/DD/YYYY that makes no sense to me xD if you have 01/02/2017 or if someone messes up with the delimiter you have an issue ๐
Yeah YYYY/MM/DD in filenames for example
so just for info, the simple object thing was the issue
Sort by name = sort by date
guys guys guys #offtopic_arma
seems that the script then still executes on the server, but not on client
add some diag_logs
addAction is ignored on dedicated server
Well if the script doesn't execute on the clients, then it's no wonder the local markers aren't updated.
exacty
wait, where is addAction beeing added?
no addaction. just marker
Now you need to figure out why the script isn't executed on the clients.
And it's probably nothing inside the script, but something in the way it's executed.
just because its in a simple object. just removed the simple object tag and now it works
So you're saying that the init box doesn't work on clients for simple objects?
same object, same code all good.. if simple object is on, it only executes on server
i now execute the same code in 2 objects. same objects but one simple one not simpel.
I'll try to debug that, but I could imagine this being caused by the server deleting the original object and replacing it with a simple one or something like that.
cant use addAction with simpleObjects
so its pretty obviously the thng
or at least according to the wiki
im not using addaction
nvm then
im just generating markers
lol what's up with people bringing up addAction again and again.
it came up somewhere /shrug
anyway solved ^^
But addAction
diag_log [this]
and checking "simple object"
should lead to no logging on the client and logging on the server
If this bug exists. Will try later, maybe ...
in my case now the effect seems to be pretty much the same that i would get if i added if (!isserver) exitwith {}; on top
Yeah. The 3den attribute literally deletes the map placed object and replaces it with a simple object. And that is maybe why the init box expression is ignored on clients.
I've made wiki page about new command available in dev branch https://community.bistudio.com/wiki/diag_resetShapes ๐
can i use these RGBA codes instead of colorRED etc?
don't do modeling but that seems quite useful
No you can't. There only are a handful of predefined marker colors.
Well with an addon you can.
/*
author: @Aebian
description: Entrance script
returns: nothing
// _null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab, this];
*/
params["_state","_caller"];
if (rank _caller isEqualTo "SERGEANT" && _state isEqualTo "toLab") then
{
_caller setPosASL [10622.9,7409.4,2.28408];
GateBunker animate ["TurnDoor",1];
sleep 3;
GateBunker animate ["MoveDoor",1];
};
if (rank _caller isEqualTo "SERGEANT" && _state isEqualTo "toBase") then
{
_caller setPos [7541.05,7392.53,0.43043];
};``` I think this is easy but it seems that I can't see the forest because of trees... My goal is to get the actual user that executed the script ported but Its not working. Whats wrong?
can't really see what _caller is based on that
_null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab, this];```
thats the call
_caller = toLab
what's 'this' lol
okay ^^
good then every player gets ported gg
that's the unit for the client the script is running on
hmm well it will be running on the server side
in an addaction, it's just the 1 client
okay
/*
author: @Aebian
description: Entrance script
returns: nothing
// _null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab];
*/
params["_state"];
if (rank player isEqualTo "SERGEANT" && _state isEqualTo "toLab") then
{
player setPosASL [10622.9,7409.4,2.28408];
GateBunker animate ["TurnDoor",1];
sleep 3;
GateBunker animate ["MoveDoor",1];
};
if (rank player isEqualTo "SERGEANT" && _state isEqualTo "toBase") then
{
player setPos [7541.05,7392.53,0.43043];
};``` well my debug console tells me that I executed addAction Area69 but I still don't get ported
biki tells sqf object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection]
thats why I put toLab behind the script
object addAction ["MyText",MyTag_fnc_MyFunction, [MyArg1 , MyArg2 ], 0, false, false, "", "", 5];```
looks like the syntax he used should work
SQF file example:
_act = player addAction ["Exec the file", "somescript.sqf"]```
but _null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab, this]; is passing 'toLab' as the params
and your script is expecting [_state]
params["_state"]; is the parameter 0 so toLab will be _state
maybe you meant like this _null = this addAction ["Area 69","itsAebian\lab_gate.sqf",[toLab, this]]
with (_this select 3) params ["_lab","_object"] ?
why? the addaction sqf _null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab];
is completly fine. I just don't get teleported
the args from addaction go into _this select 3
/*
author: @Aebian
description: Entrance script
returns: nothing
// _null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab];
*/
params["_state"];
if (rank player isEqualTo "SERGEANT" && _state isEqualTo "toLab") then
{
player setPosASL [10622.9,7409.4,2.28408];
GateBunker animate ["TurnDoor",1];
sleep 3;
GateBunker animate ["MoveDoor",1];
};
if (rank player isEqualTo "SERGEANT" && _state isEqualTo "toBase") then
{
player setPos [7541.05,7392.53,0.43043];
};```
No Lecks oO Only ",[toLab, this]" would be transported to the script. lol
as _this select 3, yeah
Now it could work, Aebian
Your first three params are for reversed values
arguments (Optional): Anything - Arguments to pass to the script (will be _this select 3 inside the script). If Array is used as an argument for example, its 1st element reference would be _this select 3 select 0. Default value: nil
You'd need
_null = this addAction ["Area 69",{[toLab] call preProcess "itsAebian\lab_gate.sqf"}];
For that
Ah! Missunderstood.
ah okay thanks @dusk sage
make a function of that .sqf
_act = player addAction ["Exec the file", "somescript.sqf"]``` is valid according to biki
Just use
_this select 3
or
params ["", "", "", "_yourstuffhere"];
btw preProcessFile ^^
or
_args params ["_toLab", "_yourOtherArgs"];
๐
with the addAction you initially posted though @hollow lantern, ```SQF
params ["_target", "_caller", "_id", "_toLab"];
because you put toLab outside of an array in the args, so it's the 4th param directly
_caller will always == player afaik
yey ๐
@jade abyss [missionNamespace,["varname",varvalue]] remoteExec ["setVariable",target] works
although I havent tested if there are any sideeffects
GateBun>
12:05:42 Error Undefined variable in expression: _state
12:05:42 File C:\Users\Aebian\Documents\Arma 3\missions\[A]_Cuda.Woodland_ACR\itsAebian\lab_gate.sqf, line 10
12:07:23 Error in expression <if (rank player isEqualTo "SERGEANT" && _state isEqualTo "toLab") then``` but ```sqf
params ["_target", "_caller", "_id", "_state"];```
and the line 10 is ```sqf
if (rank _caller isEqualTo "SERGEANT" && _state isEqualTo "toLab") then {}``` shouldn't that work?
is it faster that missionNamespace setVariable ["varname",varvalue,true] ?
_state isEqualTo "toLab"
_null = this addAction ["Area 69","itsAebian\lab_gate.sqf",toLab];
tolab isn't equal to "toLab"
"toLab" is a string, toLab is a variable
its not about being faster
@vague hull Shouldn't. It's like executing that command on that Client. So... i don't think there are any Probs.
and setting with public true, will share it with all clients
Yep
ah ok, you want to share it with only some?
and Server
or one
@vapid frigate yup works now
format ["%1", switch (false) do {case true: {1}; default {0}}];
works fine
No idea what https://github.com/SkaceKamen/sqflint/issues/6 is on about.
anyone know how to get AI to spawn with custom loadouts with EOS?
@little eagle
obviously nonsense code.. but valid
well.. same if _c = true;.. then it wouldn't error
what version are you using?
what you pasted doesn't work for me either
http://imgur.com/XCGEcYh works fine with my
Idk about SQFlint, but
It is important to know that even the engine of BI needs some () brackets around these statements (like the array after format []).
is what irritates me.
The command precedence is pretty clear and that is true for control structures too.
since when Oo
SQF is actually the one thing they did not fucked up
Yeah. Exactly
yeh idk about that sry
i tend to use brackets alot because i dont trust sqf to work it out
you tested ingame? maybe we are wrong @little eagle ๐
its usually right but not worth re-launching arma when it's wrong
use a proper linter and it will not happen
only moment when things happen like that is when you fucked up the precedence
However the usage of more brackets usally makes the code more readable so it is in gereral a good idea to use them ๐
However the usage of more brackets usally makes the code more readable so it is in gereral a good idea to use them :upside_down:
(if ((_this > (_other)) && false) then ({ foo = (bar);};)```
Yeah you can always fuck things up but if you do it a little thoughtfull my statement applies xD
But even in this extreme I'd say it's easier to read in some cases than when not using brackets at all
in C i would've written if (_this > _other && false).. in SQF i wouldve written if ((_this > _other) && false)
so still SQF is the only thing they did not fucked up
both would probly work in SQF but i cbf restarting arma to find out
because in SQF it seems to occasionally not be what you expect
just because SQF as language is fucked up
Once you know the rules you can predict how it's going to evaluate ๐
not because it is not working as intended
if (_this > _other && false)
works fine in SQF. No idea why you trust it in C, but not SQF
because of this most likely @little eagle sqf _arr select 1 + 2
- has higher precedence than other binary commands
i know
So it's basically select 3
you do not have to tell me
No. There is a table where you can find out.
so i just put in the brackets
SQF lacks a proper array access op
which is kinda bad and leads to confusion which leads to those ()crap
works fine in SQF. No idea why you trust it in C, but not SQF
๐
I think I'd trust anything in C more than SQF from an offset
would like to see the table/understand the full logic.. but until then.. when in doubt ()
C has weird logic too in places.
@vapid frigate https://foxhound.international/precedence-arma-3-sqf.html
yeh im sure it does.. i would chuck in extra brackets there unless i was sure too
the SQF BNF there btw. has some mistakes in it
nice, thanks
The precedence in SQF is as far as I can tell exactly the same as it is in C.
Obvious additions are the binary commands and the odd one else
yeh i guess just the syntax doesn't allow for as many mistakes
e.g. or lower than and
The most annoying thing is that isEqualTo doesn't have the same priority as ==.
And min max being the same as + and - which threw me off twice already.
personally i find the most annoying things select 2 instead of [2] and a getVariable "b" instead of a.b
Well that is not a problem of precedence, but having those syntaxes sure would make it easier to write.
Thats what rly fkd me up, when i touched c#/c++ for the first time, after doing nothing but .sqf before!
BUT: I rly rly missed the creation/handling of the Arrays in c#/++
yeah i came from C#/c++ (and a little SQL) before SQF... so confusing
especially with the little bit of SQL knowledge
and yeah, the ability to throw arrays around like you can in sqf is why _array[2] could conflict/get confusing
but still don't see what's wrong with a.b
it could be either
as no structures are existing, . is simply not needed
not to mention the problem this would cause in the engine
effectifly, your dot operator would look like this: sqf missionNamespace."foobar"
which is even worse then the GetVariable as that is essentially a sqf command in SQF common syntax whilst the . simply looks bollocks and makes no god damn sense
i mean without the quotes. obviously the command doesn't currently work in sqf
want it even more bad? use the set syntax: sqf missionNamespace.["foobar", value]
impossible
it's just a dream
unless: with receives a "tiny" version supporting only the next command
which again is impossible in SQF
set syntax would be missionnamespace.fooBar = value;
i don't see how either conflict
How can you say it's impossible though? I can see this being implemented rather easily and with full bwc.
enlighten me then
it could almost be done with a macro
i do not see in which way this could be solved unless you rewrite a hell lot of crap
How do you know what you have to rewrite? I'd argue that way more effort went into x64 than would go into implementing these syntaxes.
You say "hell lot of crap", but maybe it's just one file.
Who knows. I don't see how it could be that hard.
adding new commands is not hard
what this would require would be changing the parser
I never said anything about adding new commands.
And why you think amending the parser is such a impossibly huge task?
Uhm. That doesn't mean anything. They don't add x64 every patch either.
ye ... i will stay with what i said ...
You always do.
implementing that will never happen unless they rework how SQF works
because it simply is not possible in SQF right now
implementing that will never happen unless they rework how SQF works
By definition, yes.
because it simply is not possible in SQF right now
Right now, sure.
yeah, i'm just dreaming.. saying it COULD work without breaking anything
not by definition ... i showed how this could be solved with a new command
it would look ugly, but it would work
any change to the actual parser is bad
ever read the reasonings for compilers not doing something?
or why some stuff got dropped?
or why a tiny feature takes ages to implement?
No and I don't care.
it would break aRmA?sTudiO
nope
linting is fairly simple
would cost me a few days
but my work hours are non-paid anyway
BI could easilly make missionNamespace . "myVariable" work ^^. Though.. doesn't _var&&_var2 work already? without spaces?
I think so.
Then just adding . operator to where && and || is should be easy
yeah. it's still not the same, but at least it's not as verbose
I don't mind the long version tbh.
true. It doesn't fit current SQF style..
Depends how far they went with it. If it only did one thing then sure, but it seemed like an OO approach was wanted (with other commands avaliable?)
Getting with to work with objects / locations would be a massive leap imo.
Does anyone have a way to return a units current weapon object and not the name of it as a string?
I don't think so. What are you trying to do?
I'm trying to use the animChanged event handler to detect when a unit is reloading
but it doesn't seem to trigger for reloads
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/Reloaded This is probably too late then
yes unfortunately
I want to tie it into my AI system so it triggers my cover function when they are reloading
Looking around it seems like the weapon anims need to be setup in the config to be able to be used by animChanged? Can anyone confirm, I have very little expirience with configs compared to everything else
actually let me double check when reloaded fires
if it fires early enough it may work for me
No unfortunately that doesn't fire until the reload is complete
For now I'll just run a loop to check for ammo count in the current magazine I suppose since currentMagazineDetail seems to be quite lightweight
weapons use gestures for reloading and not full blown animations that trigger eventhandlers and can be read with the script commands
Ah so there's no way to do it then with an EH?
no
Alright, thanks for the info as usual.
Also I was curious if anyone had any optimization techniques/quirky sqf things that aren't listed here https://community.bistudio.com/wiki/Code_Optimisation
I'm about to do a big optimization pass on a lot of my older code and I feel it's always worth knowing the little quirks when writing new code to make it as quick as possible
I think everything is on that Page. Anyone can add to it so..
Right, was just curious because I noticed it hasn't been updated in a while and they've added quite a few new commands in the last few updates that may have replaced older slower methods I wasn't aware of
isEqualTo is faster than ==
that might not be on there.
It also doesn't say that if (true) then [{true},{false}] is faster than if (true) then {true} else {false}
i didnt even know thast worked... [{true},{false}]
if (true) then [{}, {}] is the faster of the two
{true} else {false} just makes an array out of the two and returns that. then expects code or array
also [1,2] select true is even faster (I think. Didn't actually test) if you just need to decide between 2 values
Yep
It also doesn't say that if (true) then [{true},{false}] is faster than if (true) then {true} else {false}
@still forum The page argues against you, it is on there
Kind of leaves it at 'no difference': https://community.bistudio.com/wiki/Code_Optimisation#If_Else_If_Else_If_Else_...
Is there a way to tell if anyone has put a speech mark (double quote) when they enter an rscedit? Because you can't just do```SQF
if (""" in _str)...
Hmm, you could purely loop through the string
Far from ideal though
Does
if ('"' in _str)...
work?
should work with ' instead of "
๐คข
Removing script calls always improves performance. Even if that site says no difference
๐
Just because it's on the wiki doesn't mean it's true.
Yeah, I would think that @little eagle @jade abyss But I just need to check if there is a singular one by itself... doing ```SQF
"'"
Ye, I just realised the sommand won't even get passed through though because it has incorrect format
idk it's being weird af
Xd
in STRING, not in ARRAY, Dscha
then he has to make an array, i don't care
xD
Does in STRING even exist? lmao
Problem solved, make an array, next one.
count (_str splitString """") >= 2
find should be used with String iirc
ye
Yep, FIND is for Strings
idk, I don't even know how it wrong a thing to my DB anyway.... because it shouldn't have been able to pass through anyway because of it's stupid quotations
('"' find """") = 0
('"' find "AA") = -1 (not found)
('"' find ""AAA"") = ERROR
So... more or less useless to search for ", since it fks it up earlier
Whatcha mean? In the last one you're not escaping
From my experience in cannot search substrings?
True. That's why Dscha said that. And it's not only your expirience. Wiki says in doesn't work for strings
I always wondered why they didn't expand in support substrings?
@still forum I can't believe this even running 24 AI is killing my FPS...
Tanoa specifically.
Too much work for the renderer to do along with the AI calculations running in the main-thread?
Wonder if I can force the renderer off core 0
You can force the main Thread to another core. But renderer and AI calculations are still main thread
What can I do? I mean my core 0 is hitting 100%
can't even play scenarios on Tanoa now.
get profiling build and check what's causing that. Or just remove Core 0 from the cpu affinity in task-manager
Could it be cause I'm allocating 16GB of RAM?
It's the main thread
The main-thread is hammering core 0
One sec.
Need to open the first level. I can't see anything there besides "game is running"
Largest Tanoa town. 12 vs 12 AI
okay. I'll run some new captures
This is an empty Zeus mission.
Which frame number should I capture?
1st 30th or 60th ?
doesn't really make a difference
k
Sufficient?
The game is running Ultra with View distance set to 2000M
I was conducting a tiny battle between Opfor and Blufor within the city
@still forum Any of this make sense? That has also been limited to 4 cores.
I'll take one without limiting it next.
Is there a command to make the player get in a vehicle? (like player enterVehicle _vehicle if there was something to do that) I want to run it through my interaction menu\
you what
moveIn
nvm I forgot.
Yeah MoveIn or MoveInCargo
depends where you want the player to be.
@cerulean whale Do you want him in the driver?
or other position?
Ah, I was trying to look for one with Get or Enter. Either is good. Thanks @tough abyss
is there a way to get max passengers seats in a vehicle without using configClasses?
Yes
why not just use the config file, like you're meant to?
I did write a small script a while ago.
but heres the command
@cerulean whale https://community.bistudio.com/wiki/emptyPositions
I used that command to enumerate all the positions in a vehicle and fill the vehicle with AI
that's the answer to a different question though
E.g a rebel truck.
not the "max passengers"
@tough abyss Thanks, @rancid ruin Less code is key lol xD, and it still solves my problem, I can just manipulate it
you can do it with cfg in a one liner, surely
and all the vehicles you know of have the count.
using emptypositions would need more
Array would probably be faster if you were to know the values first.
You can eliminate processing by simply keeping the data in an array
So what you can do is simply create the vehicle, scan all the postions pump it into an array.
e.g
Why do you always delete the images you upload? Was just playing a bit of Metro and now the image is deleted
getAllVehiclePositionsSize = {
params ["_vehicle","_listOfPositions","_positionTypesCount"];
_listOfPositions = [];
{
_positionTypesCount = _vehicle emptyPositions _x;
_listOfPositions pushBack [_x,_positionTypesCount];
} forEach ["Commander", "Driver", "Gunner","Cargo"];
_listOfPositions;
}:
@cerulean whale If that goes according to plan it will generate a list of positions containing a single nested array for each index
[["Commander",1],["Driver",1],["Gunner",2],["Cargo 5"]]; etc
@still forum Check #perf_prof_branch
getAllVehiclePositionsSize = {
params ["_vehicle","_listOfPositions","_positionTypesCount"];
(_listOfPositions + ["Commander", "Driver", "Gunner","Cargo"] apply {[_x, _vehicle emptyPositions _x]})
}:
I don't know why you have that _positionTypes count argument there. Or that _listOfPositions argument you are passing in
It's all there.
just use cfg like a normal person
Ah, yeah you have apply as well
Which is faster.
I used similar code when I was re-writting I&A for populating vehicles
before I was aware of apply.
Question to be asked though @rancid ruin Is the config faster?
than the function?
i expect so yes
config is generally slow. If the function does what you need then function is definetly faster
and less code
how's it less code? you could get # of positions for x vehicle in one line
So. "Clean"code - http://prntscr.com/ettp91
rather than that 15 line function or whatever
The function is 2 lines..
Indent better Dylan
You need to make it clear where one block begins and where one ends
Im aware @tough abyss - It needs some cleaning lol
Indentation, params > select. Why do you have 4x if with the same condition?
You could also check if the first block
If they are player and exitWith otherwise
Instead of running 5 checks everytime
Different vehicle placements. As you cant move a player into the co-pilot without using: _target moveInTurret [_vehicle, [0]]; - But I could probably fit that into one single if.
Could also move a lot of those operations into a function on their own
Smaller functions == faster code generally
also far more modular code too.
Seen patrol ops?
All tiny functions a lot of the time.
Yeah I need to clean the entire SQF that is in. I wrote it without thinking very much about cleanliness.
smaller functions == faster code. Yeah. But also more function calls == slower code
^
Fine balancing act.
Wait? Is that the case if the function is called in scheduled?
vs unscheduled?
it's the same
Hmmmm. Now I know why some of my code was slower.
I had a lot of function calls
How many function calls does it take the cripple a mission?
thousands
I used select in one of my pieces of code to replace a switch
Worked well
Just called the function with the select within it
used the indexes of the array as the results of the condition
Could probably do: _positions = ["Commander", "Gunner", "Cargo", "Driver"]; { if((_vehicle emptyPositions _x) > 0) exitWith { [_player, _x] call dy_fnc_findSeat; }; } forEach _positions;
Ah true
Didnt see that till now
How would you handle moving the player into the seat though. Switch, if statements?
select you mean?
switch is slower
Nested if-then is faster most of the time.
ยฏ_(ใ)_/ยฏ
Arma logic.
lol
Whats the point in using Switch then other then looking nicer?
^
Debatable.
Documenting your functions
Does.
With descriptive documentation
Not //Get this plug that into function _someName
Define exactly what you were doing
@tough abyss You ever find a way to do that action thing?
Scroll.
Right.
Ever used the endgames addaction?
yes
I wrote using your code an vehicle airdrop script
for squad leaders in I&A
Given their squad had > 6 players
It was adapted from your helicopter drop code
Yeah no one really got to see the Squad supports system I'd written
You couldn't request anything OP either.
Either ammo or a prowler / hunter
And only every 5 minutes
Old battlefield 2 style
As in? the networking or?
the cleanup?
Used arma 3's built in clean up system.
addToRemainsCollector
Perfectly good garbage collector. But initially for another community I created a vehicle destroy'd EH
Listening on the radiotower for cleanup
then adapted your cleanup script for use with it.
Was definitely lightning fast.
Then discovered I could use that destroyed handler for any kind of destroy able objective.
Key note, "Before" an object is deleted ๐
Is there a way to actually draw polygons on the map in arma... where it fills the polygon? D:
Filling is a very good question
However... where is the fill option?
LOL
i just implemented that for thsi WIP thing... then i realized it doesn't fill
Probably always filled. If you want unfilled polygon you could just draw lines
obviously also still no line thickness on these sorta commands, because why would you ever want easy polygon / line drawing with more than 1px with?
No filling
Well... Feature request and waiting for months to get any response on it time.
it'll probably be closed by judge dredd
judge, jury, executioner, and closer of arma 3 feedback tickets
Someone wanted to get the Weapon object of a Player instead of just the classname. See comment on https://community.bistudio.com/wiki/cursorObject Not that helpful but.. You can probably replicate that with lineIntersect or something
Does anyone know if you can use multiple typeNames in the nearObjects command like you can with nearestObjects?
I don't think so
Damn, must be a side effect of it's age compared to nearestObjects
Best way to get objects placed in eden and filter though them with a blacklist array?
I'm sure there's a better way but anything placed in Eden should come up in near/nearestObjects
as far as filtering through them probably apply?
and in
Hm
_blacklist = ["mapobj1", "mapobj2", "mapobj3"]; if (objs in _blacklist) then {do something};
Basically what I want to do
(on mission start)
yea and objs can just be objs = nearestObjects [syntax here]
don't remember exactly the order of params
nearObjects would be better if you don't need the sorting of nearest
and invert it if you wanna do something to the objects not in the blacklist
so _blacklist = ["mapobj1", "mapobj2", "mapobj3"]; if !(objs in _blacklist) then {do something};
if possible though I would look for a better command to get the Ed3n objects if it exists
isn't there a missionObjects or something?
I'm not able to check at the moment
Nah
ah
https://community.bistudio.com/wiki/all3DENEntities But that's in editor. But you were talking about eden so I suppose that's what you want
there you go, I'm sure that's faster
Hm
Items in the blacklist are buildings I place in the map. So I don't want them to be touched, meanwhile I want others that aren't those to be. tl;dr
actually looking at it, I'm not so sure
I would test the 3 options to check for speed
I guess that one would depend heavily on your mission as well
If you have a a lot of triggers and stuff it could be slower than just returning the mission objects
Make sure you don't run nearestObjects on each iteration of the loop though
you are doing it only once at mission start. so speed is not that important
yes
oh shit, sorry missed that part
Takes a minute, but works.
yea speed is obviously irrelevant then, carry on
lol
_blacklist = ["mapobj1", "mapobj2", "mapobj3"]; if (_x in _blacklist) then {do something};
use that inside a forEach allMissionObjects. But these mapobj strings have to be variables of the blacklisted buildings instead of strings
was about to type psudocode with _x in _blacklist lol
You beat me
ty
I'll test now
I think it worked
YES!
Thanks guys
I derped out and forgot in was a keyword omg
keep in mind it's case sensitive "lol" in ["Lol", "LOL", "loL"]; //false
Yeah
Question
So say I have a whitelist and blackist of objects
I only want to mess with objects in an area that's in the whitelist using nearestObjects, but if they're in my blacklist don't do anything. wut do
just use nearestObjects instead of allMissionObjects
That's what I'm using
trees pushBack _x;
};```
How could I implement that into a whitelist array?
nearestobjects accepts an array of types
If you are looking for trees I would rather use nearestTerrainObjects
ie nearestObjects [player, _whitelist - _blacklist, 200];
not trees lol
So basically I want to mess with objects that are in the whitelist, but if it's in the blacklist (variable name set in eden) then leave it alone.
There is no regex in the whitelist array afaik
You use object name to know if they are blacklisted ?
Whitelist would be names of objects I set in the editor..
ah ok
(When you click attributes in the editor on an object you set the name)
I would use variables instead
_allowedObjects = (nearestObjects [player, ["All"], 200]) select {_x in _whitelist && !(_x in _blacklist)};
I was using str _x find "objname" > -1, but it looks like crap. lol
Hm
I'll try that sec
sry had extra quotes on player