#arma3_scripting

1 messages ยท Page 279 of 1

jade abyss
#

Depends on what?

dusk sage
#

It isn't close to C in syntax, or C++

#

Unless you're talking very specifically

tough abyss
#

They could completely do away with if (condition) then {}

#

amd replace it with if (condition) { }

indigo snow
#

they cant, thats not how sqf works

jade abyss
#

but then you don't have exitWith {}

tough abyss
#

Ahhh right.

jade abyss
#

and again:
"Does it matter?"

dusk sage
#

Of course it does, because JS and PHP and shitty

tough abyss
#

Only the syntax of select matters, other than that no.

jade abyss
#

It's its own language, sooo.

dusk sage
#

๐Ÿ”ฅ

tough abyss
#

SQF ?

#

Status Quo Function

still forum
#

๐Ÿคณ

tough abyss
#

Screwy ass name.

jade abyss
#

and?

#

I still don't get, where the point of that Convo is^^

#

scratching head and b*********

tough abyss
#

It was in relation to the verbosity of _array select _something

still forum
#

who uses select anymore? param ftw

tough abyss
#

and the speed reduction it probably introduces

jade abyss
#

@still forum Why using param when you know whats in there?

tough abyss
#

I said why not a more sensible _array[index]

#

system

jade abyss
#

Or if you want the first entry

still forum
#

cuz... I wanna be anti?

jade abyss
#

okayyyyyyyyy

tough abyss
#

Atleast we got slices sort of

#

_myArray select [beginingindex,endingindex];

#

And I guess we should be grateful for SQF

#

rather than SQS (Status Quo Script)

#

Which results in some seriously bad spaghetti code

dusk sage
#

You shouldn't be questioning why we don't have array[index], more why something like select has so much overhead

little eagle
#

I already answered this. Input validation. And it twice as bad for select since it's a binary command.

tough abyss
#

How much overhead does it have... ?

little eagle
#

Not much more than any other binary command

tough abyss
#

hmmm

#

I thought try catch and throw was best for input validation?

#

I mean params can provide valid types.

#

But it can't break out of the code if an "illegal" expression is found.

#

Ironically try catch and throw got updated

#

To now accept parameters

#

e.g

dusk sage
#

I already answered this. Input validation. And it twice as bad for select since it's a binary command.
Yeh, but like I said yesterday or whenever, that is to a much larger extent than needed

#

I thought try catch and throw was best for input validation?
In SQF ๐Ÿ˜„ ?

tough abyss
#
player try { 
   if (player != (vehicle player)) then {
       throw "Not a vehicle"
       }; 
} catch { 
   if (_exception isEqualTo "Not a vehicle") then {
   //do some exception stuff //
   };
};
dusk sage
#

Doesn't help with anything internal though

#

It's just some sugar over what we all do anyway

tough abyss
#

Yeah but can't you replace exitWiths ?

#

with that?

dusk sage
#

If you like

tough abyss
#

And allows you to catch the error immediately without running all the exitWiths?

#

Hmmm wonder how many exitWiths it takes to make the same overhead as the try catch and throw

dusk sage
#

You're still running through more code than needed

#

If you wanted to exit with a hint for example

tough abyss
#

So why implement try catch and throw at all?

dusk sage
#
if (something) exitWith {hint something};
#

Instead you're throwing that, then checking what the error is, then hinting

#

I guess it could be handy

tough abyss
#

eg?

dusk sage
#

Certainly neater when you're quite far nested in scopes

tough abyss
#

Hmmm

dusk sage
#

Because exitWith won't exit the parent scope. Then again, breakOut is there

tough abyss
#

Yeah but the way I use breakOut

#

is I make the scopeName ahead

dusk sage
#

I've never tried nesting try catch in SQF, but if it works as you'd expect it to, then it could help

tough abyss
#

not before so it doesn't result in a goto like expression.

dusk sage
#

You could start trying to replicate an exception type system you'd expect of a normal language

tough abyss
#

I might search through all the BI-functions

#

see where they use it.

dusk sage
#
scopeName "main";
...
......
......... many scopes in, breakOut "main";
tough abyss
#

Yeah I normally put the scope name after the breakout.

#

Or below it.

#

So it follows some normal order of execution.

dusk sage
#

Why?

tough abyss
#
{
    if (_x isEqualTo condition) then { breakOut "main" }; 
}
forEach _listOfItems; 
scopeName "main"; 
dusk sage
#

Does that even work?

tough abyss
#

I think it does.

#

double checks

dusk sage
#

I don't think it does

#

I think it'll exit the forEach

#

Then continue execution, as your scope isn't defined

#
{
    if (_x isEqualTo condition) then { breakOut "main" }; 
}
forEach _listOfItems; 
systemChat "I'm executing!";
scopeName "main"; 
#

etc

tough abyss
#

see if it works

#

If it doesn't thats kind of silly

dusk sage
#

Why?

tough abyss
#

May as well replace BreakOut with goto

dusk sage
#

How does it know what to breakOut?

little eagle
#

Pretty sure scopeName needs to be executed before breakTo/Out

tough abyss
#

Thats why people don't use it.

#

It's basically a goto.

dusk sage
#

breakOut is nothing like a goto

#

breakTo is however

little eagle
#

breakOut is like a retarded return

tough abyss
#

xD

dusk sage
#

But a handy one

tough abyss
#

Yeah but the fact it bounces the code from the bottom to the top

#

It retarded

dusk sage
#

hm?

#

I don't understand what you mean

little eagle
#

Sure, but this style of code is pure spagethi

dusk sage
#

Well using purely breakOut as a mean to return, isn't spaghetti

#

It's as you'd expect a normal return to work

little eagle
#

breakTo isn't exactly goto either

dusk sage
#

Indeed, because it jumps forward in execution

#

But it's the nearest you're getting ๐Ÿ˜„

little eagle
#

You only can skip between scopes and not random points in the code like with goto

#

goto only exists in SQS

dusk sage
#

But that is good

little eagle
#

The lack of goto? Sure.

dusk sage
#

Because I've never really seen a proper use case for goto, where something more elegant couldn't be used

little eagle
#

There are probably some...

dusk sage
#

But in SQF?

#

๐Ÿคฃ

little eagle
#

No one can agree to what proper SQF looks like in the first place

#

No point in thinking about hypothetical new commands

dusk sage
#

It depends on what the language offers you though. I see many people use goto in C#, because it doesn't implement switch fall through very well

tough abyss
#

Okay found 8 entries in BI functions to scopeName

#

fn_findSafePos uses it

#

Interesting

#

Instead of a lot of exitWiths

dusk sage
#

what are params

#

๐Ÿ˜„

tough abyss
#

the breakTo looks neater

#

Look at the top

dusk sage
#

yes

#

the breakTo breaks to main after the scope, it's confusing

#

But hey

#

Spaghetti

little eagle
#

breakTo is pretty shitty, but I can see use in breakOut's new return value supporting syntax as a pseudo return

#

I probably even used that once or twice already in this discord.

dusk sage
#

Breaking out the most parent scope, like a return, is really handy if you're nested in some loops or logic

#

I use it for quite a few things

tough abyss
#

Ironic that BIS stores all their location data in configs

#

Instead of SQF scanning them all

dusk sage
#
_pos = _this select 0;
_minDist = _this select 1;
_maxDist = _this select 2;
_objDist = _this select 3;
_waterMode = _this select 4;
_maxGradient = _this select 5;
_shoreMode = _this select 6;
#

hehe

little eagle
#

It's not something you need when you're new to SQF. It's really niche. A tad bit more useful than try-throw-catch which is just a bad joke.

tough abyss
#

yeah I know

#

It would be really easy to change

#

I've had to do this to a few BIS functions

#

over-write them with params builtin

crimson adder
#

(Bit off topic, sorry.) Anyone here have experience with the OO implementation in BIS?

dusk sage
#

aaaaaah

tough abyss
#

Nope.

#

There is however several functions that reference them.

dusk sage
#

I'm doubtful anyone here has played with the functions, and from what I hear, it was a somewhat disaster, may be wrong though.

crimson adder
#

Shoot. Was hoping they'd finally made a proper implementation

dusk sage
#

commy has a deep bond with SQF, might be worth asking him ๐Ÿ˜‰

little eagle
#

I don't have a deep bond with what a proper OO implementation would look like though.

dusk sage
#

Not a bunch of BIS functions ๐Ÿ˜›

tough abyss
#

This is the only one I've seen

crimson adder
#

Was reading some old posts by DnA. Apparently there is some overhead since it's handled with scripting

dusk sage
#

Indeed, yeh

tough abyss
#

And this.

dusk sage
#

I think, the C# thing that was posted on here before, might get you a step closer

#

But I can't remember its name

tough abyss
dusk sage
#

Or really what it did

tough abyss
#

Thats the only OOP system I've seen

crimson adder
#

Hm... I mean, their internal functions make total sense, just haven't tested what performance impact there would be

tough abyss
#

I'd be more worried about what you might over-write

little eagle
#
        //Automatically call parameter validation whenever a method is called
        private ["_compileString"];
        _compileString = _methodVar + " = compile ('";
        _compileString = _compileString + "if (!([""" + _className + """, """ + _methodName + """, _this] call BIS_fnc_validateParametersOO)) exitWith {" + _returnValue + "}; ";
        _compileString = _compileString + (preprocessFileLineNumbers _methodScript);
        _compileString = _compileString + "')";
        
        call (compile _compileString);
#

this part

#

I have to puke

tough abyss
#

Not very secure yeah.

dusk sage
#

That looks like that format thing I sent you ages ago

tough abyss
#

needs format.

dusk sage
#

๐Ÿ˜„

crimson adder
#

Oh god

tough abyss
#

cfgOOP

crimson adder
#

(Sorry, takes a second for me to read through on my phone.)

tough abyss
#

I need to find this config

crimson adder
#

Not finding much else on it

little eagle
#

It's rubbish.

#

Forget about it.

crimson adder
#

Looks like a side project ๐Ÿ˜‚

dusk sage
#

The idea is nice, if it was an actual 'language' implementation

crimson adder
#

I'd love to see it properly added

#

Might clean up a TON of code for people

tough abyss
#

cfgOO doesn't exist.

#

O_o

dusk sage
#

Because you make it

crimson adder
#

^

tough abyss
#

configFile >> "CfgOO"

#

Ohhhhh.

#

Right.

crimson adder
#

It's a special config

tough abyss
#

If you want real OOP

crimson adder
#

Just defined in desc

tough abyss
#

I found someone who made a neat macros library

crimson adder
#

Oh?

halcyon crypt
#

have fun reloading the game with every change ๐Ÿ˜

dusk sage
#

neat macros library

dusk sage
#

OOP? ๐Ÿคฃ

crimson adder
#

Reloading the game?

dusk sage
#

oh a naught creation, here we go

tough abyss
#

Thats the only one I know of.

dusk sage
#

I mean, again, neat idea

#

But really painful to look at

crimson adder
#

Hm... I'll have to see more on my laptop

dusk sage
#

And something you can easily achieve w/o

crimson adder
#

^

tough abyss
#

Agreed

halcyon crypt
#

ALiVE uses a semi OO style-ish code based around modules and/or CBA hashes

tough abyss
#

ALiVE is no offense a performance hog.

crimson adder
#

been meaning to tear apart ALiVE

tough abyss
#

On base configuration.

#

Just download the github Montel

crimson adder
#

Oh crap. Forgot they had one

tough abyss
halcyon crypt
#

performance isn't too bad to be honest

tough abyss
#

If you use the default 144 groups

halcyon crypt
#

for what it does

tough abyss
#

It will kill everyones FPS

halcyon crypt
#

no it doesn't

crimson adder
#

Depends if theyre doing it right

tough abyss
#

144 groups?

#

Thats a lot of AI

crimson adder
#

Dynamic sim?

#

Unless that is global

halcyon crypt
#

you'll never run in to 144 active groups

crimson adder
#

^

tough abyss
#

Well as our community approached 100 AI

#

everyone clients FPS took a massive dump

halcyon crypt
#

yes, if you're spreading around the map like crazy than sure

tough abyss
#

Even when the HC offloader was active.

#

Exactly Marceldev89

#

This was a noob mission makers mission

#

I brought the problem up with him several times.

#

Now the community I used to be apart of.

#

uses MCC...

#

facedesk ** -,..,- **

little eagle
#

My unpopular opinion: I don't need OO in SQF.

tough abyss
#

^

crimson adder
#

Reason?

tough abyss
#

It's not fast enough to use OOP

#

Plain and simple

crimson adder
#

(Just curious. If there was a proper implementation)

halcyon crypt
#

since when is OO something about performance?

little eagle
#

No. I don't need it. I can do everything without it and I would see no point in using it.

tough abyss
#

OO isn't the performance improvement

#

It's the way the languages that have it work

crimson adder
#

Not looking for perf improvement

tough abyss
#

SQF is even a bytecode translated language

#

nor compiled

#

most of those OO languages use some kind of bytecode or compiled code.

#

Excluding. Lua.

#

Python, C++, C, Java bytecode. or compiled.

crimson adder
#

Ah, I am forgetting about this backend. Sorry, I come from a background of C,C++,Java,.NET on embedded systems

tough abyss
#

Yeah no SQF is C, PHP, JavaScript had a baby and it was ugly.

crimson adder
#

Oh god it is

#

SQF makes me want to stab things

#

And yet I keep working with it ๐Ÿ˜‚

tough abyss
#

Especially when you get errors that make no sense.

#

For example I tried to use a C implementation for looping through a multidimensioal array

#

using nested for loops

#

NOPE

#

SQF doesn't like that one bit.

little eagle
#

That's just your bad script though.

crimson adder
#

My face when I found out switch statements were slower than ifs ๐Ÿค”

little eagle
#

: P

tough abyss
#

"Bad script"

#

Completely valid in C

little eagle
#

This isn't C though

crimson adder
#

Their logic handling it beyond me as well

tough abyss
#

ASk @still forum if you want to know more specifics.

#

But he said SQF's script executer is Single-threaded

#

Unlike C# or C++'s compiler being multi-threaded along with supporting multi-threaded libraries by default.

crimson adder
#

I can certainly see the challenges with multi threading that

#

I'd love to see some more "knobs" and functions I could use to maybe implement my own version

#

That'll never happen though lol

tough abyss
#

Best you can do is use an external extension

#

Only issue is the calls to the extensions are single-threaded as well

#

callExtension etc.

crimson adder
#

Been looking into that for a little while now. And the issue of only string transfer

#

Has its own set of crappy problems with its implementation

tough abyss
#

Why because you need a parser to interpret the data coming from the string?

little eagle
#

The problem is that you worked with C++ and now you want to have a games scripting language work the same way.

crimson adder
#

Eh, I go back and forth on the string thing tbh. I see both sides of the argument on it

tough abyss
#

callExtensions also unscheduled. It is limited in how many loops it can do. 10,000 iterations I think it was, before the extension will be stopped

crimson adder
#

Very true @little eagle . I need to keep things in perspective

little eagle
#

Just forget about everything and start over fresh.

#

And keep in mind that, at least I consider it to be, 90% of the code snippets you find out there are shitcode.

halcyon crypt
crimson adder
#

I mean, I've been learning the SQF backwards methodology for 3 years now. It's not foreign lol

tough abyss
#

I've mostly stopped SQF

#

Gone to Python. Got walked on by too many communities.

little eagle
#

3 years ago I didn't know anything about any language that is not Java if you count one semester working with it knowing it.

tough abyss
#

SQF isn't really "useful"

#

Unless you work on VBS 3.0

crimson adder
#

Never figured it would be. Just a fun hobby

little eagle
#

VBS uses a different library.

tough abyss
#

It's still SQF

little eagle
#

It's so much different from Arma now.

tough abyss
#

All of it.

#

But VBS has a whole bunch of tools

#

like an external debug console

#

That complains about bad scripts

#

and is intelligent enough to say this is a crappy script

#

fix it.

#

You can even change the way the scheduler handles the scripts

#

telling it to complete in a single frame or etc.

crimson adder
#

Hm...

#

Haven't looked into VBS yet. Been meaning to

#

Too much to do though ๐Ÿ˜‚

little eagle
#

Why? No one uses it.

crimson adder
#

Just cruious

little eagle
#

It's probably all broken and shitty.

jade abyss
#

Its not "the yellow from the egg"

little eagle
#

People get too excited by features described on wiki articles, video demonstrations and pretty screenshots.

crimson adder
#

Very true

tough abyss
#

It has proceedural, environment generator...

#

That can be programmed.

crimson adder
#

@little eagle playing the other side of the coin and keeping it grounded

tough abyss
#

Take 1 blank map

#

Generate all the trees, terrain, roads etc.

little eagle
#

Yeah, that's my job.

#

I'm the downer.

tough abyss
#

Based on a set of conditions.

crimson adder
#

Hah

little eagle
#

Too bad no one ever listens. So many tragedies could've been avoided.

tough abyss
#

O_o

#

Elaborate/

#

?

little eagle
#

What is there to elaborate? It's a joke.

tough abyss
#

Okay

#

Give me this in arma 3

snow pecan
#

@tough abyss ALiVE is a tool, of course your fps is going to tank if you have too many AI clusterfucked in a small area. Just don't abuse it and your performance will be fine.

tough abyss
#

I know

#

People abuse it.

#

Often.

#

Just like Zeus

#

I said in my community DONT spam AI

#

what did they do?

#

Spammed AI...

#

-,...,-

halcyon crypt
#

seems like you need to find better people ๐Ÿ˜›

tough abyss
#

was a MEU

#

I protested against MCC

#

They took the advice of an asshole that had run Life communities, and effectively gave him the keys to the kingdom even though I had been there for 2 - 3 months, I'm glad I didn't deploy my mission framework.

#

What did you think of the biotopes @little eagle

little eagle
#

looks like they just spawn a bunch of trees and rocks alongside the road or on the ground

#

ยฏ_(ใƒ„)_/ยฏ

#

You could do that with SQF too

tough abyss
#

Then why doesn't BI just give us the ability to use a blank map

#

to proceedurally generate trees on?

little eagle
#

Because please buy Tanoa

#

Idk.

tough abyss
#

facedesk

little eagle
#

Looks more like a gimmick to me.

#

I mean sure.

#

Nice to have I guess.

tough abyss
#

Yeah, really nice, take Takistan change it, take Chernarus change it.

little eagle
#

But I'd rather be able to manipulate the attachments of weapons inside ammo boxes already.

halcyon crypt
#

we're not playing minecraft ^^

tough abyss
#

On the fly too.

#

In that in relation to me or commy marcel?

halcyon crypt
#

to the biomes

tough abyss
#

Ah.

#

I'd like the ability to lock containers.

#

But no.

halcyon crypt
#

not sure how that's in scope of what BI is making tbh

#

it's still a military sim

tough abyss
#

Then stop supporting life servers dies

halcyon crypt
#

how are they "supporting" life servers?

tough abyss
#

"Monotization"

dusk sage
#

I'd like the ability to lock containers.

#

Then lock them ๐Ÿค” ?

tough abyss
#

tried it

#

lock doesn't work...

#

Not sure how I could remove the interaction item.

#

without using removeAllActions.

#

Which removes everything.

dusk sage
#

Just stop people opening them?

tough abyss
#

You can't...

dusk sage
#

Of course you can

tough abyss
#

How?

dusk sage
#

๐Ÿ˜‰

tough abyss
#

Oh.

#

Right.

#

Forgot about the Container open handler

#

I just wanted a simple system to lock and unlock the container...

dusk sage
#
if (container getVariable ["locked", false]) exitWith {true};
tough abyss
#

Okay it's that easy?

little eagle
#

exitWith might not work in the eventhandlers main scope

dusk sage
#

It should, not like OEF

#

IIRC

#

Yes it's that easy, one variable ๐Ÿ˜‰

little eagle
#

It doesn't work in handleDamage

halcyon crypt
#

EH's don't have any scope to exit do they?

#

as in it's at the top of the "call stack", kind of

dusk sage
#

I'm assuming you're hooking a function into it though

#

Forgot that bit

little eagle
#

everything encapsulated with curly brackets is a scope

#

player addEventHandler ["InventoryOpened", {<this is a scope>}];

halcyon crypt
#

mhm but is there a scope above the current scope once it fires?

#

I'd imagine that exitWith doesn't work in init.sqf either in that case

little eagle
#

Define work

#

If you call exitWith in the main scope of init.sqf

#

nothing below the exitWith will be executed

#

There is no return value that is expected by init.sqf

#

unlike InventoryOpened

#

so I really don't see the similarities.

halcyon crypt
#

they both don't have a parent scope to exit to?

#

that's why I could imagine it not working in init.sqf as it doesn't with the HandleDamage EH as you pointed out

little eagle
#

Neither have a parent scope to exit to

jade abyss
#

init(or any other).sqf:

abc = true;
if(abc)exitWith{};
systemchat str abc

Systemchat won't be executed.

#

As easy as it is oO There is no witchcraft in exitWith

halcyon crypt
#

then why does it not work with HandleDamage EH for example?

jade abyss
#

Cause HandleDamage EH is executed as its own

#

Nothing below it

little eagle
#
player addEventHandler ["handleDamage", {
    if (true) exitWith {0};
}];
#

^ this does not work

jade abyss
#

because -> Arma

halcyon crypt
#

wait, init.sqf is scheduled, isn't it? That probably explains the difference

little eagle
#

Nah, because the main scope of handleDamage expects a return value, but you leave the scope with exitWith

jade abyss
#

iirc its for each and every EH.

little eagle
#

I mean sure Arma, but that is how it works with everything

#

Except waitUntil for god knows why ....

#

Literally everything that is not waitUntil

jade abyss
#

afaik init.sqf is the same as every other *.sqf file. It just gets loaded by the engine automaticly. Marcel

little eagle
#

Yeah.

#

And it has nothing to do with scheduled either. My while loop was scheduled to avoid the 10k iteration limit

#

It's just waitUntil being weird

jade abyss
#

waitUntil is like a Loop on its own, in its own NameSpace. No chance for ExitWith (iirc)

halcyon crypt
#

@jade abyss I get that but exitWith not working for EH's is just weirding me out I guess. Always assumed that exitWith kind of meant return _var

little eagle
#

Dunno, Dscha

#

Maybe experimenting with breakTo can leave it

dusk sage
#

It's handled specially due to the rate at which it executes IIRC, it's brought out of context

jade abyss
#

prolly

little eagle
#

But can you breakTo to a deeper scope?

jade abyss
#

I mean... lets see it the logical way:

A script that has waitUntil in it gets executed once, then reaching waitUntil Part, then checking constantly each whatever* s, looping its {XYZ} part

halcyon crypt
#

@little eagle what about this?

player addEventHandler ["handleDamage", {
    0;
    if (true) exitWith {};
}];
#

not that it makes sense due to the condition

jade abyss
#

Prolly the mainscript gets "cached"/removed from the mainSchedule and only the waitUntil Part is still loaded.

#

@halcyon crypt Try this: add diag_log "blaaaa" to the EH or define a globalVar in it.

little eagle
#
0 spawn {
    scopeName "main";

    call {
        waitUntil {
            breakTo "main";
            false
        };
    };

    systemChat "is this ever reached or not?";
};
jade abyss
#

logically, it should

little eagle
#

Well, exitWith didn't reach it

jade abyss
#

Since you say to that darn thing -> Exit here at this point (breakTo)

#

So waitUntil should be done

#

i get headache

little eagle
#

Yup

jade abyss
#

maybe worse headache, cause i haven't touched that stuff for > 6 Months ^^

#

back to Tentacle Pr... movie... less headache

halcyon crypt
#

my guess would be that the engine implementation of waitUntil prevents breakTo or anything else to work guess not ๐Ÿ˜„

jade abyss
#

Or its just a bug/broken.

halcyon crypt
#

don't know, it seems somewhat logical to me but my logic seems a bit off judging by the stuff above ๐Ÿ˜›

little eagle
#

it does print and end the script

jade abyss
#

Does NOT print? Okay

little eagle
#

it does

jade abyss
#

Its too late, my bad

little eagle
#

now testing:

#
0 spawn {
    scopeName "main";

    waitUntil {
        breakTo "main";
        false
    };

    systemChat "is this ever reached or not?";
};
jade abyss
#

wait, you tested what before?

little eagle
#

with another call inbetween

#

this prints too

jade abyss
#

kk

#

Try this:

#
0 spawn {
    scopeName "main";

    waitUntil {
        systemChat "1";
        breakTo "main";
        systemChat "2";
        false;
        systemChat "3";
    };

    systemChat "is this ever reached or not?";
};```
little eagle
#

I'll be testing this first:

#
0 spawn {
    waitUntil {
        scopeName "main";
        false breakOut "main";
        false
    };

    systemChat "is this ever reached or not?";
};
#

This is basically exitWith

#

right?

jade abyss
#

I vote for banana.

#

(no clue)

little eagle
#

this loops forever

#

just like exitWith

#

ยฏ_(ใƒ„)_/ยฏ

jade abyss
#

Can you test that one from me? Don't wanna search A3 in my SteamLibrary ๐Ÿ˜„

little eagle
#

yours says

#

1

#

is this ever reached or not?

jade abyss
#

hmmm, okay

#

At least, it exits. But without result sending over.

#

screw it, i move my rotten body to the couch.

little eagle
#

My best explanation is that the code block of waitUntil is being called inside another virtual code block and the return value of the virtual code block is used

#

waitUntil {<blah>};

#

is basically

#

waitUnit {call {<blah>}};

jade abyss
#

e.g.:

_Time = (diag_TickTime + 40);
waitUntil {sleep 1; diag_TickTime >= _Time};```
#

So yeah, seems to be your last example

#

No stop, not call

little eagle
#

why not?

jade abyss
#

waitUntil spawn{<blah>} <-- ?? ^^

little eagle
#

You can suspend in call if the call was executed in scheduled environment

jade abyss
#

And waitUntil is already, yeah.

#

as i said, its late.

little eagle
#

Yeah, waitUntil has to be

#

It suspends for a frame

#

that is it's sole gimmick

#

And it has only one code block so it's not as much of a drag compared to while performance wise

jade abyss
#

+you can still use (ui)sleep to suspend it

little eagle
#

Yeah.

#

A sleepFrame 1; command would've been more useful

jade abyss
#

Depends on what you wait

#

I mostly used it Changes of Areas

waitUntil{sleep 10; SomethingNotSoImportantButStillNeeded};
little eagle
#

I meant instead of waitUntil

#

while {sleepFrame 1; checksomething} do {}

#

of course also patch while so you don't need a do block

jade abyss
#

And i meant: Not checking every frame/second. Just check it every X Seconds.

#

Also possible with it.

little eagle
#

yeah, you can already do that with while

#

Or could

#

The do block

jade abyss
#

Was while able to use suspend? like
while{sleep 3; Var}do

#

can't remember

#

but still... nah, that makes no sense to let a while{true}do doing that

little eagle
#

You can use suspension everywhere in scheduled environment

crimson adder
#

^

little eagle
#

Except isNil CODE, because that is no longer scheduled environment for god knows why

dusk sage
#

My best explanation is that the code block of waitUntil is being called inside another virtual code block and the return value of the virtual code block is used

little eagle
#

or the string-code block in configClasses and configPropeties

dusk sage
#

Can you exitWith {breakOut ""};?

little eagle
#

haha, I'll try something

#

gimme a minute

jade abyss
#

thought something similar @dusk sage

little eagle
#
0 spawn {
    waitUntil {
        if (true) exitWith {
            scopeName "main";
            false breakOut "main";
        };
        false
    };

    systemChat "is this ever reached or not?";
};
#

this, right?

dusk sage
#

nono just breakOut ""

jade abyss
#
0 spawn {
    waitUntil {
        if (true) exitWith {
             breakOut "";
        };
        false
    };

    systemChat "is this ever reached or not?";
};```
โ˜ ?
little eagle
#

I'll test mine first

dusk sage
#

equivalent I think

little eagle
#

mine loops forever

#

breakOut "";

#

is just another breakTo, it will work

#

wait

#

uhm no

#

it loops forever

#

Idk man

#

ยฏ_(ใƒ„)_/ยฏ

jade abyss
#

i guess: Since no targetscope :/

dusk sage
#

Like someone said before

#

waitUntil is a spinlock

little eagle
#

Oh right

#

""

dusk sage
#

Chances are its taken totally out of context

little eagle
#

^ this doesn't work

#

"" doesn't work guys

#
0 spawn {
    waitUntil {
        if (true) exitWith {
             breakOut "undefined";
        };
        false
    };

    systemChat "is this ever reached or not?";
};
#

"" is just ignored by the command

#

Yup

#

With "undefined" it prints the chat message

jade abyss
#

btw.:
Why is exitWith in waitUntil even needed?

little eagle
#

It's not, but you can use it as return

dusk sage
#

hoooray

#

it's broken!

jade abyss
#

^^

#

Its Arma'd \o/

little eagle
#

It's a really confusing syntax as I said

#

Because it works nowhere else

#

Never use this

still forum
#

@tough abyss

callExtensions also unscheduled. It is limited in how many loops it can do. 10,000 iterations I think it was, before the extension will be stopped

What? No!... Arma doesn't care about what happens inside the extension and it can't stop it either. there is a limit on loops yeah.. but totally nothing todo with Extensions

#

I can't sleep right now so... back to that thingy about _array[index] and if (true) {do this}

#

SQF is a very easy language. It has variables, arrays, code blocks and 3 types of commands. Commands without arguments.. Commands with one argument and commands with 2 arguments.. Thats It. Thats all of SQF.
_a = 1 Is this a variable assignment? NO! It's a function call. It's calling the function = with the arguments _a and 1.
Same for if.... then stuff... if is a command taking one argument and returning an intermediary "condition object". then and exitWith are commands that take 2 arguments. One "condition object" and a codeblock.
SQF's core principle is that everything is a function call.
So by doing if (true) {code}, which looks like CONDITION CODE to the engine, You are trying to violate the core principle of SQF.. Well actually.. They could just make a whitespace function that takes a "condition object" and a code block... But thats Nuts...
Same for _array[index] how should it know that ARRAY ARRAY should do anything? ARRAY FUNCTION ARRAY is very obvious what it should do.. It's a function call taking 2 arguments. You just can't change the core principle of the language. So all these Ideas about making the language nicer will stay exactly that.. Ideas.
I hope i can sleep now instead of thinking about this the whole time

queen cargo
#

_a = 1 Is this a variable assignment? NO! It's a function call. It's calling the function = with the arguments _a and 1.
uhm ... nope
it is a variable assignment

= is a special case in SQF

#

So by doing if (true) {code}, which looks like CONDITION CODE to the engine also false
for the engine it is ( IF(BOOL) )THEN( CODE )
important difference is the IF(BOOL) as the bool after the if gets flagged specially somehow
then REQUIRES an if
even though ... IF does not require then (and just returns the bool itself)
--> _cond = if(true); _cond then {1} else {0} is valid
true then {1} else {0} is not

woeful void
#

@still forum SQF is a very easy language. Sorry, I would have to disagree, because I'm fluent in at least 6 differrent true programing and scripting languages (C#, C++, Javascript, XML/XSL, VB, PERL, LISP, Forth, assembly), conversant in quite a few others.... and the syntax of SQF only very, very loosely matches the syntax of any that I've seen which makes it hard for someone who already knows one of those other languages, because the change up in syntax is pretty extreme.

However, it is the one we are stuck with for ARMA 3 so that's why I'm trying to learn it.

tough abyss
#

in my opinion it matches C based languages making it fairly easy

ionic orchid
#

SQF reminds of me the scripting language at work, grown and patched on to over 15 years into a frankenstein's monster of quirky behaviour and edgecases

dusk sage
#

@woeful void When you consider that everything is 'well' documented on the wiki, SQF really isn't a hard 'language' at all

ionic orchid
#

and probably with 15 years of content that uses it that no-one wants to change in order to overhaul it

thin pine
#

Gotta love the backward compatibility though hehe

ionic orchid
#

anyhoo, my arma3server keeps crashing when I start it up...anyone ever get this error?

#

arma3server.exe - Bad Image

F:\Games\Arma3\A3Master\BattlEye\BEServer.dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.

thin pine
#

I find sqf to be pretty easy to understand and learn though. Especially in 2016/17

ionic orchid
#

I killed the server process while it was booting to fix a script and it hasn't worked since

#

it just fails init'ing BE

thin pine
#

Restart be service

ionic orchid
#

my bad, sorry

#

didn't work, but I'll figure it out tomorrow, this is definitely not a 2am probably I want to have

#

cheers

wispy patio
#

Hey fellas, any clue as to whether there is a getCargoIndex but for commander seats? Thanks.

thin pine
#

I don't think so but there's a lot of workarounds for whatever it is you re trying to achieve

wispy patio
#

Hm, basically I want an animation to happen if someone switches into a particular commander seat.

#

Basically need a custom eventhandler on entering a specific turret position.

thick lintel
#

Specific vehicle? or any vehicle commander position?

#

GetIn or GetInMan EH

#

seatSwitched or seatSwitchedMan

#

then commander vehicle player isEqualTo player

#

or assignedCommander vehicle player isEqualTo player

thick lintel
#

@X39#2180 important difference is the IF(BOOL) as the bool after the if gets flagged specially somehow IF is both a command and a type in sqf. typename if (true) is of type 'IF' which is expected for the left hand operator of 'then'. supportInfo "*:if" ["t:IF"] a type. supportInfo "*:if*"["u:if BOOL"] a command. supportInfo "*:then*" ["b:IF then CODE","b:IF then ARRAY"]

woeful void
#

@dusk sage The reason I call it hard is because it flys in the face of all the other programming habits one picks up when they do programming professionally. What I am pointing out is that knowing other languages can make SQF harder, not easier to understand.

dusk sage
#

I would argue despite the awkwardness of SQF, knowing other languages has made learning SQF simpler. But when I refer to difficulty, it takes little to no time to become 'proficient' in SQF

woeful void
#

Would you be a casual or a professional programmer? Just trying to get an idea as to skill level here, no offense intended.

#

Actually.. that question isn't relevant to the channel as a whole so I'll withdraw it. Nevermind me.

dusk sage
#

I program in my degree, and have jobs lined up as a programmer post grad @woeful void

cerulean whale
#

Is there a way to restrict the contents of a 'RscEdit' to numerical characters?

tough abyss
#

@woeful void Not only that. There is quirks of the language that... are related to stupid things.

#

E.g unscheduled code in, EH's show 0 errors

cerulean whale
#

How would I delete every element AFTER a certain one in an array? deleteAt will delete the one I want but not all after it.... I could write an algorithm but there may be a command anyway

cerulean whale
#

deleteAt doesn't like strings either

#

damn

indigo snow
#

Just select from 0 to the one you want and copy them. _array = _array select [0,_index+1]

cerulean whale
#

It can vary where it will occur... It could be select 3, 4, 5, 6, etc. That's why I just wanted to see if there was a command for it

indigo snow
#

You only want to remove element from the end I understand? I forgot about resize which even modifies the original like deleteAt

#

Simply resize to the index of the last element you want to keep + 1

cerulean whale
#

@indigo snow It's slightly different to that, I just wrote an algorithm for it though, thanks for the help though. I kindof wish they had a command for that but w/e xD.

meager granite
#

@tough abyss

if(isNil "oef_block") then {
    oef_block = addMissionEventHandler ["EachFrame", {
        whatever;
        removeMissionEventHandler ["EachFrame", oef_block];
        oef_block = nil;
    }];
};
still forum
#

I meant SQF is very easy from the engine programmers perspective. everything is made up of function calls that makes the backend relativly easy to program.
and @queen cargo i don't understand anything about what you are saying about the if then stuff besides the last 2 lines.

little eagle
#

What I am pointing out is that knowing other languages can make SQF harder, not easier to understand.
I would argue despite the awkwardness of SQF, knowing other languages has made learning SQF simpler.

#

Opinions. ยฏ_(ใƒ„)_/ยฏ

#

But when I refer to difficulty, it takes little to no time to become 'proficient' in SQF
Yes, but how long does it take to master SQF?

#

@tough abyss
@meager granite

addMissionEventHandler ["EachFrame", {
    // do magic

    removeMissionEventHandler ["EachFrame", _thisEventHandler];
}];
#

Since Arma 3 v.1.63.137807 the EH handle is also stored in _thisEventHandler variable and is available during EH code execution.

#

if (so) then {sweet};

halcyon crypt
#
ERROR Generic error in expression
little eagle
#

(entities [[], [], true, true]) returns duplicates of units in vehicles when called at postInit

#

You had one job, BI

#

You know what?

#

I'm not even surprised.

meager granite
#

Oh _thisEventHandler is already implemented, forgot about its existence

#

Though he still needs outside handle if I got his question right

dusk sage
#

Yes, but how long does it take to master SQF?

#

Depends how far you're willing to sell your soul

#

๐Ÿคฃ

#

The SQF god is not kind

#

He will destroy everything you believe in

little eagle
#

Souls are not real.

#

Neither are SQF gods.

dusk sage
#

Then what is it empowering us to write the most abusive and dirty code? ๐Ÿ˜Ÿ

shadow sapphire
#

Okay. I need help. Anyone game this morning? Here's what I need:

#

I need a script that either can make autoturrets fire blanks, a script that will make autoturrets fire at assigned targets based on a trigger, or I need an invisible wall that will stop bullets.

Anyone know of any of these??

little eagle
#

blanks

#

fired eh and delete the projectile

shadow sapphire
#

HAha, okay, but how do I do that? I am TERRIBLE.

little eagle
#
  • add fired eh
#
  • delete the projectile
#

???

shadow sapphire
#

I'm always in over my head. Will it work on autoturrets?

little eagle
#

Idk, why not? Probably, try it

shadow sapphire
#

Will try it if I can get the syntax right!

little eagle
#

What do you have atm?

shadow sapphire
#

Diving in now. I'll report back soon.

Nothing. I have nothing yet, because I didn't know which way I would go about it. I thought invisible walls would be easiest, but that didn't work at all.

shadow sapphire
#

Do you think this would be best placed in the turret's init?

little eagle
#

Is this for a mission?

#

params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];

shadow sapphire
#

Sorta. It's for a training environment. I want autoturrets to fire at people when they are visible, so that they will get to cover.

#

But I don't want to kill the people, because on our server, death is a pretty big deal.

little eagle
#

I posted everything you need. Just 3 legos you have to put together

shadow sapphire
#

Thanks a ton!

little eagle
#

If it's for a mission, then I'd use the init box

shadow sapphire
#

Init box of the turret?

little eagle
#

Yeah

shadow sapphire
#

Thanks a ton! I'll let you know if I get it working.

little eagle
#

Remember to use a local check, because the fired eh triggers everywhere and deleting a projectile is global and at machine gun speed, you don't want to do unneeded network traffic and red chain the server

shadow sapphire
#

A local check?

little eagle
#

local _unit

shadow sapphire
#

I don't understand the context, unfortunately..

little eagle
#

only delete the projectile on the machine guns machine

#

instead of everywhere

shadow sapphire
#

Oh. Okay! The MG will be on a dedicated server, if that matters.

little eagle
#

No, it doesn't. Ideally you make your scripts work regardless of who owns the object or who is the server, but that is not the trend these days.

shadow sapphire
#

Haha, okay, roger.

little eagle
#

and yes i even tag private vars
madness

#

it would be a sad little number forever

#

it would be a sad little number forever

#

And adding new ehs starts over at index 0

#

which is the worst part

#

Just make the event handler self removing

#

it's OEF, so set a last frame no

#

And add a new one if that diverges to far

#

if you're worried about cheaters removing it

shadow sapphire
#

Okay, what else do I need to know?

 
this addEventHandler ["Fired", deleteVehicle _projectile];```

I get expected nothing.
#

Invalid number in expression.

#

I'm trying to fake blank firing autoturrets for a training environment.

#

Or just make them fire high.

#

When I pasted your script into the turrets, I get invalid number in expression error. Not sure of exact context.

#

Worked perfectly locally! Now I just need to test it on dedicated. Thanks so much!

#

@tough abyss and @little eagle, thanks a ton! Script is working locally. Will test on dedicated soon. If this works, the applications for my group will be expansive!

peak plover
#

What are the pros and cons to having 1 while loop that runs every second that I add different functions and checks to or having a seperate loop for every function and check? Does the engine handle this on it's own? Would the end result being the same in both cases?

#

Enjoying is different than having good performance ๐Ÿ˜„

#

Squeeze performance out of EVERYTHING

#

I don't think the quality of life can decrease any further. Would having a loop for caching groups of units rather than spawn a script for every group separately be worth it?

#

Can't figure out anything better to do...

halcyon crypt
#

custom events ๐Ÿ˜›

#

then you'll only need a loop to fire the events

peak plover
#

Don't custom events run on every frame?

#

aah

#

Oops

#

I used {}, 5 ] call CBA_fnc_addPerFrameHandler;

#

Does the 5 still cause performance loss?

#

Better to use while { } do {}

#

?

nocturne bluff
#

No lol

peak plover
#

Well, I don't want it to constantly run. Just every 5 seconds

halcyon crypt
#

depends on the condition that you're testing but while { true } do {} probably could use a sleep ๐Ÿ˜›

peak plover
#

And in theory, the last run must be complete before a new one is started

#

^ this is scheduled?

#

It'll not run a new one before the last one is done

little eagle
#

this PFH only runs every 5 seconds, QS

#

The same is true for using the scheduler

peak plover
#

What does sleep actually do?

little eagle
#

And scripting in the scheduler has overhead for every command used

#

they check runtime after each command to manage the scheduler

#

you're still making up in the end

peak plover
#

Isn't the myth that using sleep in scripts lags out the engine true?

little eagle
#

Idk what that means

#

sleep ends the execution of the current pseudo thread and puts it on the end of the stack of all the other pseudo threads

peak plover
#

For some reason, whenever I use sleep in a script. I feel like it's taking something away. And the more of those I use, the more I feel like something is taken from me.

little eagle
#

So the scheduler can continue with the next item

#

The real problem here is, that you broadcast a variable every 5 seconds

#

Idk, but that doesn't sound very optimal

peak plover
#

Doesn't the thread get cluttered with throwing the pseudo threads into the end all the time?

#

Only 1 variable is broadcasted along the net

little eagle
#

The more threads you have, the longer it will take for them all to complete

peak plover
#

Thanks. That actually makes it a lot easier to read.
Well having less threads is what I'm trying to achieve here

little eagle
#

And if you're machine is busy and the stack is huge, e.g. from spawning fish, then a sleep 5 can take 15 seconds to resume

#

It's put on the stack with a timer and the game checks every frame if the time has passed

#

each thread has a timestamp which when it's expected to resume

peak plover
#

So. Having sleep sounds so bad, because it's checked every frame

little eagle
#

Dunno if the scheduler sets times by itself when it thinks a script is slow or if it's reserved for sleep/uisleep

#

Of course it is checked every frame. The difference is that it's done in C++ land, but the PFH logic that does this similarly is pretty lightweight

#

I'm just telling the truth.

#

You do that.

#

You're the red one, I'm the blue one

#

Perfect antagonsts

#

We make a show for the others to enjoy.

peak plover
#

He's just presenting knowledge based on information he's got on the subject. No one is really never wrong or correct. Just misinformed.

little eagle
#

Dunno why people think a sleep command isn't checked every frame either. I mean, it's not magic, someone has to poll it.

#

So 2?

#

Idk how to read this

#

[spawn-ed, execVM-ed, exec-ed, execFSM-ed]

#

as if the first two make any difference

#

flares

#

?

#

There are some hard coded ones

#

I mean, the game intro for example is made with SQS

peak plover
#

Ok, a small thought. I don't want my script to run FAST. I want it to cause less stress on the machine running the script in total. Wouldn't running as many things as possible using spawn instead of everything running in one loop be better?

little eagle
#
~1
1 cutRsc ["SplashBohemia", "PLAIN"];
0 cutRsc ["SplashNoise","PLAIN"];
~4
if (isClass (configfile >> "CfgPatches" >> "A3_Map_Tanoabuka")) then {1 cutRsc ["SplashArma3Apex", "PLAIN"];} else {1 cutRsc ["SplashArma3", "PLAIN"];};
~4
1 cutRsc ["SplashCopyright", "PLAIN"];
~3
titleText ["", "PLAIN"];
exit
#

startupScript.sqs

peak plover
#

Scheduler gets cluttered. So it's not better

#

Exactly my point

little eagle
#

Dunno what you mean by "fast". Fast means less stress.

peak plover
#

I don't want the script in hand to be executed in the span of 5 seconds. If it would cause less strees, I wouldn't mind running it on 6 seconds instead

little eagle
#

He doesn't want it all in one frame, but using fast commands means exactly the same as less stress

peak plover
#

Yes. The least stressful way is what I am in search of

#

In theory. If I run everything As Fast As Possible, it's gonna cause a small hickup. This does not currently happen (atleast with [hashtag]montior 0.1).

little eagle
#

Measure it, nigel.

#

If you can't tell the difference, then it doesn't matter evidently.

peak plover
#

But I don't understand the concept of measuring script performance. I tried a few times. Never managed to get it to work

little eagle
#

You put your code into the debug console and press the code performance button. You have to use unscheduled environment for that though

peak plover
#

I want to build on this and add more functionality. Currently it does not have a huge problem even with 144 groups. But I need to add more features and ideas keep popping up.

little eagle
#

Yeah, don't do too much in one frame

#

The PFH thing is not a replacement for huge loops.

peak plover
#

For huge loops use _____ .

little eagle
#

Let's say you have a gigantic loop

#

Which is stupid, but whatever

peak plover
#

๐Ÿ˜ฆ

little eagle
#

The PFH would ensure that it runs every X seconds

#

But that frame

#

where it runs

#

everything runs

#

And that could end up being a slow frame

#

And don't make gigantic loops to begin with.

peak plover
#

@little eagle For caching 100 groups of units. Would it be better to have 100 loops or 1 loop ? I think for this gigantic loop is better

little eagle
#

Well I'd say use event handlers

#

Or check one group, then the next time the other

#

etc. etc.

#

have a variable that ensures that you check only one group every time

#

and increment that

#

if you end at the last group, set it back to 0

peak plover
#

And run that on every frame?

little eagle
#

That means that your code works the same with 1000 groups as it does with 1

#

Or every 0.1 seconds idk

#

depends on what you do and how large your array becomes

peak plover
#

That would mean for 100 groups it takes 100 frames.

#

That's a good idea

#

Cannot have above 144 groups per side

little eagle
#

They liftet it

peak plover
#

WHEN

little eagle
#

or soon they will

peak plover
#

aah, this makes more sense

little eagle
#

dev?

peak plover
#

Ok. the miricle of 64 bit is surely a great one

little eagle
#

Anyway, baers state machine implementation works like that

#

only check one item of a potentially huge list

#

Basically your own super simple scheduler

#

except less retarded already

peak plover
#

haha, yes ๐Ÿ˜„

#

You also pointed out eventhandelers ?

#

How often do eventhandelers usually check themselevs?

little eagle
#

Never

#

if you kill a unit, the logic that kills the unit calls all the event functions

#

otherwise they just rest in memory

#

You could make your own event handlers that use polling of very simple states

peak plover
#

How is this possible?

little eagle
#

I mean

peak plover
#

The creation of event handlers?

little eagle
#

It's easier with an example I think

jade abyss
#

@peak plover Prepare yourself for a 50 Pages .pdf File.

little eagle
#

pdf

peak plover
#

I'd really love one. My last 50 pages .pdf was DAC documentation. Best book I've read on a computer to date.

jade abyss
#

DAC?

little eagle
#

Dscha, you would read my SQF book too if I wasn't too lazy and the whole thing too unprofitable. Admit it.

jade abyss
#

Nah, i would watch at my own files and think: "Oh boy, why did i even started learning SQF."

peak plover
jade abyss
#

ah, kk

little eagle
#

I don't think you're doing it right when you use SQF like how it was intended.

jade abyss
#

You mean, i should arma it?

peak plover
#

I think using a custom simple scheduler with PFH would benefit ai modifications like VCOM a lot.

#

"fn_animalBehaviour_mainLoop","A3\functions_f\ambient\fn_animalBehaviour.sqf".Tried out the diag_activeSQFScripts.

little eagle
#

a few messages per second

#

light spam

#

Fix your error. Not only the logging slows down the game, but also the error itself.

#

Writing to a huge file on hdd will slow down the server

#

How much? Idk

#

Depends on the machine I guess

jade abyss
#

And yeah: .rpt Spam can slowdown your Server.

little eagle
#

problems as AI spawn in midmission

#

Do you have CBA?

#

wait

#

solution incoming

#

Incompatible classes are listed at game start

#

game

#
["CAManBase", "init", {
    params ["_unit"];

    _unit spawn {
        _this setSpeaker "NoVoice";
    };
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
#

replace you allUnits loop with this and it will handle spawned in units

#

setSpeaker does not work in the frame you spawn the unit

#

What?

#

pretty much the only way

#

Who knows.

cerulean whale
#

Hey, is it possible to do a linebreak in the text of an RscButton

little eagle
#

try

#

/n

#

or

#

\n

#

or

#

<br\>

#

or however that's supposed to look like

#

If those don't work, then the answer is "no".

#

Btw.

#

I found another reason why select sucks so much.

#

It does all these needles out of bounds checks too

#

Like complain if you select +2 out of bounds or minus one

#

So those are more reasons why it's slower than expected

#

Not that that changes much.

#

But it essentially also reads the array size like count does.

#

Otherwise the error trap wouldn't work obviously.

ionic orchid
#

am I right that SQF positions are [x,y,z] but the sqm positions are [x,z,y] ?

rancid ruin
#

sounds like an easy thing to test

ionic orchid
#

yeah, just confirming

rancid ruin
#

did you confirm it to be true or false?

ionic orchid
#

not yet

rancid ruin
#

there's no way to read a terrain which isn't the current world right? e.g find out every type of building classname on Stratis while worldName = Altis

peak plover
#

@little eagle Select is bad? What's a better alternative?

still forum
#

param is the better alternative @peak plover

wispy patio
#

I'm trying to make an animation happen on the turning out of the commander, for which I put this in the subclass class Eventhandler of my vehicle class.

#

TurnOut = "if ((_this select 1) == commander (_this select 0;) then {(_this select 0) setdamage 1;};";

#

You can ignore the setdamage part, it's just for testing. Pretend it runs a script :p

#

But it doesn't seem to work.

broken mural
#

I have a script that on key press skips time back and forth and hints the current mission time and all works fine in MP local host, but I need to move it to a dedicated server. The working script was in initplayerlocal.sqf. Where does it need to be for all players to get the script for keybinds and see the hints?

broken mural
#

I'm executing skiptime via remoteexec as well as hint.

#

found the problem; syntax.

warm lintel
#

Does anyone know if there's a way to simultaneously apply a scripted event or state to all instances of an object type? I've made a helo training mission for a few guys in my team & have a pattern of the portable helipad lights marking out LZs they can try & land in. I'd like to make them blink in a pattern rather than just all at once, I was thinking I'd disable simulation on the outer ring of lights then reenable it by script after a half a second from mission start or something. Is there a command vaguely like "enablesimulation false for each {CLASSNAME}" or something along those lines?

little eagle
#

@wispy patio You cannot use a semi-colon inside parenthesis. Syntax error.here: (_this select 0;) Check the RPT and use -showScriptErrors

#

@broken mural initPlayerLocal.sqf ...

#

@warm lintel It is not, except if you use CBA which then it totally is.

young current
#

Does anyone have experience on UI element pip camera view? I've got a thermal view of a camera but for some reason when the script initializes white is all bright and fine but in a second or two it dims down to light grey.

wispy patio
little eagle
#

hmm. We ironie implemented a config based turnOut EH on our Eagle IV today and it totally worked.

#

Are you using an actual hatch?

#

Try without the subclass maybe

wispy patio
#

Already did, doesn't do anything

jade abyss
#

How do you call it?

wispy patio
#

I'm using the commander hatch.

jade abyss
#

And you are sure, that you open up the right hatch?

little eagle
#
        class EventHandlers: EventHandlers {
            init = "if (local (_this select 0)) then {[(_this select 0), """", [], false] call bis_fnc_initVehicle;};";
            // Noch nicht in CBA darum hier!
            TurnIn = "if((_this select 2) isEqualTo [0] ) then {(_this select 0) animate ['open_hatch', 0]};";
            TurnOut = "if((_this select 2) isEqualTo [0] ) then {(_this select 0) animate ['open_hatch', 1]};";
        };
jade abyss
#

Or using the right slot etc

little eagle
#

this works for me

wispy patio
#

I've tried them all as a matter of fact.

broken mural
#

okie dokie looks like I'm stuck on a silly problem; trying to skiptime for the entire dedicated server. I got the keydown issue resolved but it's not actually skipping time.

This is what I have;

-1 remoteExec ["skipTime", 2, true]; //back 1 hour
wispy patio
#

But it should fire on all 'normal ones' right?

little eagle
#

"normal ones"?

wispy patio
#

Yeah like the commander hatch.

#

Driver/commander/gunner

little eagle
#

Kot, remove that JIP param, or you break it for JIP actually

wispy patio
#

Does it matter I didn't inherit from the base eventhandler class?

broken mural
#

@little eagle alright I changed that, but would that cause skiptime not to actually fire for currently connected players?

little eagle
#

You should, because you delete the other eventhandlers otherwise

#

It still would. JIP is just to retroactively execute the command on JIP clients

wispy patio
#

I never touched event handlers before alright, so bear with me even if I sound very silly. ๐Ÿ˜‰

little eagle
#

but they get their start time from the server anyway

#

So all you'd do is move them another hour into the past

broken mural
#

Ah I see.

little eagle
#

and that for every execution, because your JIP stack grows each time you use that command

broken mural
#

well I dont want that lol

little eagle
#

I thought so, that's why I told you

#

lol

broken mural
#

Alright testing again, I may have missed a ; after returning _handled bool

little eagle
#

The game should complain about that if you have script errors enabled

broken mural
#

I do, and it didn't.

#

sqflint in visual code is bitching about it though

little eagle
#

who?

broken mural
#

plugin for visual code. linting is a tool for languages that gives you feedback on code before you compile and execute.

#

such as missing a ;

little eagle
#

A trained eye, my friend.

#

Trained by the suffering of having to reload the mission a hundred times.

broken mural
#

Tools > trained eye in blocks of 300 lines of code haha

#

fuck. that.

#

literally.

#

lol

little eagle
#

I try to not write 300 lines though

broken mural
#

true, in all fairness the code should be broken up a lot more

#

but in var declarations for giant missions :S

#

alrighty.. trying again.

little eagle
#

fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1

#

only one liners

#

What a language. C++ can't compete with this beauty.

#

/s

broken mural
#

Cool, it worked well.

warm lintel
#

Hmm, I'll have a look at the functions in CBA, thanks @little eagle

little eagle
#

wait

#

^ this one

#

@wispy patio Maybe it's just borked for commanders. Wouldn't be the first time something new doesn't work in the patch it is introduced.

wispy patio
#

Hmm I hope not.

#

You had it working with non-commander slots right?

#

Is there anything else I need to do except adding the event handler in the config?

#

Because the turnout event handler should also fire generally when turning out as driver or gunner right?

warm lintel
#

Thanks @little eagle, you're a champ

#

Hah, I've just noticed the author credit on that script so I'll assume you definitely know what you're talking about...

little eagle
#

I think so. It's a FFV cargo slot in the Eagle actually

#

Like on those offroaders

#

Where you can "turn out" and then use the rocket launcher weapons

#

Those are actually hatches

#

Well they aren't, but they trigger turn out and that is how we animate the hatch on the Eagle IV

wispy patio
#

I'd say maybe the hatches on my vehicle are broken, but I wouldn't know how and the animation works.

little eagle
#

Because using the logic of the tank would screw up sound attenuation

#

Yeah, Alias, I've rewritten that shit. The code from A2 times was unbearable.

#

The diff was hillarious

#

+1200 lines -4004 lines

#

And it does more now.

#

Summer well spend. Now it's cold and I regret it.

wispy patio
little eagle
#

Can you show the full thing?

wispy patio
#

The entire config?

little eagle
#

Only the vehicle I guess

#

We only have one vehicle per config

#

not counting the retextures or unarmed variants

wispy patio
young current
wispy patio
young current
#

oh scratch that.. normal thermals do that too. Must be the VR map.

little eagle
#

I don't see the EventHandlers base class anywhere

wispy patio
#

class EventHandlers: EventHandlers {};

#

below the physx stuff

#

that's the 2nd pastebin btw

little eagle
#

change that to just

#

class EventHandlers;

#

and instead of this:

#
        class EventHandlers: EventHandlers
        {
            class UK_MBT
            {
                Turnout = "hint 'EH be working fam'";
            };
        };
#

try:

#
        class EventHandlers: EventHandlers
        {
            Turnout = "hint 'EH be working fam'";
        };
wispy patio
#

I tried that before. I added in the extended one to try and see if that would fix it.

little eagle
#

What version are you on?

wispy patio
#

Latest non-dev branch.

little eagle
#

1.66?

#

cameraOn addEventHandler ["TurnOut", {systemChat str _this}];

#

use this in the debug console when you're inside the vehicle

#

that has to work

wispy patio
#

Doesn't do anything for me, hm.

little eagle
#

Does it work for vanilla tanks though?

#

also

#

systemChat str (cameraOn addEventHandler ["TurnOut", {systemChat str _this}]);

#

if you do it like that, what does it print in chat?

wispy patio
#

It doesn't seem to do anything on vanilla tanks either.

little eagle
#

what does the second one print in chat?

#

systemChat str (cameraOn addEventHandler ["TurnOut", {systemChat str _this}]);

wispy patio
#

That prints 0.

little eagle
#

But it doesn't do anything if you open and close the hatch?

wispy patio
#

Negative.

#

What is it supposed to do?

little eagle
#

print more in chat

wispy patio
#

Printed 1 in a vanilla tank.

little eagle
#

And nothing if you turn out?

wispy patio
#

Prints 5 when turned out.

#

That's high, isn't it..

little eagle
#

yeah, the code increments by 1 every time

#

you execute it

#

but it should print an array without you opening the debug console again

#

just by turning out

#

[yourname, yourname, [0]]

#

or something like that

wispy patio
#

Yeah, that second little script seems to print one higher each time, whether turned out or not.