#arma3_scripting

1 messages ยท Page 429 of 1

still forum
#

Complicated stuff

compact galleon
#

If the array length isn't exactly 2, it'll error

queen cargo
#

but are those actual errors? or does script execution continues?

compact galleon
#

2 expected, X provided

still forum
#

If the array doesn't have 2 elements it will return Nil.
If first element is not a string it will return nil.

#

For objects!

little eagle
#

The function will not be compiled, X39. Nothing of the script will be executed.

still forum
#

Groups, Namespaces, others can be different

little eagle
#

No line before, no line after.

queen cargo
#

not compiled? wut?

#

no ... do not say the behavior is different for objects and namespaces and...

#

what have i gotten myself into ...

still forum
#

Okey... It's creepy now

#

It throws an error. Aborting the script. AND returns Nil

compact galleon
#

missionNamespace getVariable []; or any other incorrect argument will error and return Nothing

queen cargo
#

i rly need a new HDD ... ever since my old one broke, i have no room for frking arma

#

if it aborts the script, that is enough for me @still forum
i won't return nil for the lulz ๐Ÿ˜„

compact galleon
#

or maybe nil. they're reported the same, haven't checked

still forum
#

Many different types have different getVariable functions

#

so how much do you trust BI that they do the same thing in each of them?

compact galleon
#
_a = missionNamespace getVariable ["foo"]; // Error 1 elements provided, 2 expected
isNil "_a"```
`true`
queen cargo
#

... uhm ...... ye .......... not a single bit @still forum

compact galleon
#
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10]; // Error 11 elements provided, 2 expected
isNil "_a"```
`true`
still forum
#
missionNamespace setVariable ["foo"]; //Arraysize != throws "expected 2..." error
missionNamespace setVariable "foo"; //That command doesn't exist.
missionNamespace setVariable []; //Arraysize != throws "expected 2..." error
missionNamespace setVariable [1, "foo"]; // type is not string. throws type error
little eagle
#

DISPLAY getVariable [varname, default]
used to return nil even though a default was provided if the variable was defined previously and then set to nil later.

queen cargo
#

wait ... it is an actual size != 2 check @compact galleon ?

still forum
#

set variable always says "expected 3, got X" even though it could work with 2.

compact galleon
#

@queen cargo Must be exactly 2

#

No more, no less

little eagle
#

It should work with 3 if the third one is true though.

queen cargo
#

and they always abort script execution?

compact galleon
#

getVariable doesn't

little eagle
#

Oh, ok. Sorry.

still forum
#

setVariable (object. Others are subject to BI's consistency)
if arraysize== 3 and array[2] not a bool then throw type error and return nil.
if arraysize!=2 throw "expected 3, got x" error and return nil
If array[0] not a string then throw type error and return nil

getVariable (object again)
if arraysize!=2 throw "expected 2, got x" error and return nil
if array[0] not a string then throw type error and return nil

queen cargo
#

all aborting errors i guess?

still forum
#

errors are errors. I guess they abort yeah

queen cargo
#

non-aborting errors are warnings for me

still forum
#

I think every error aborts the script aka skips to just past the last instruction and then returns

#

Or.. It aborts the whole script instance

queen cargo
#

nah, there are also some commands where script execution continues

still forum
#

example?

queen cargo
#

is the first that comes in my mind

#

but there was some other too

#

think it was private ... but not sure right now

still forum
#

That set's an error just like the others. So it should behave the same

queen cargo
#

It does not interrupt the script execution.

little eagle
#

Test scheduled vs. unscheduled.

queen cargo
#

now, the same for object

#

no

#

no!

#

there is no difference between scheduled vs unscheduled

#

!!!

#

please no

little eagle
#

Well, there are plenty already without this specifically.

still forum
#

Just checked. Error's stop the script instance.

#

If they are not handled overwise

little eagle
#
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10]; // Error 11 elements provided, 2 expected
isNil "_a"

But this reported true.

queen cargo
#

๐Ÿ™ˆ

#

so > 2 elements works on namespace

#

is that now correct? or not?

little eagle
#

No, error, but it continues and makes the command report nil.

queen cargo
#

wut?

#

what in the name of the lord

little eagle
#
0 spawn {
    _a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10];
    isNil {
        systemChat str [_a];
    };
};

I wonder if this prints [any] or not though (besides the error).

queen cargo
#

i do not understand anything now anymore

little eagle
#

SQF
Don't expect EnScript to be any better though. ยฏ_(ใƒ„)_/ยฏ

queen cargo
#

i do expect a lot from enscript

#

and i still do not understand now ...
is getVariable with > 2 elementsi n the array now returning the correct item or nil?

little eagle
#

nil, always.

#

And triggers the error.

queen cargo
#

and does not continues

little eagle
#

Apparently it does continue, at least in unscheduled.

queen cargo
#

๐Ÿ‘ฟ

little eagle
#
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10]; // Error 11 elements provided, 2 expected
isNil "_a"
compact galleon
#

^ That continues no matter the context

little eagle
#

This will write true.

queen cargo
#

does all errors are ignored in scheduled?

#

because that would be what i expect now

little eagle
#

No error is ignored in scheduled.

#
0 spawn {
    _a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10];
    isNil {
        systemChat str [_a];
    };
};

@compact galleon Tried this?

still forum
#

OMG this is a mess.
If there is a command exception waiting while you throw in a try/catch block or if you use breakTo/breakOut then it will kill the script instance.
Otherwise the error is just shown and doesn't kill anything

queen cargo
#

?????

still forum
#

Exactly my thoughts

queen cargo
#

no, i do not understand what you mean by that

#

errors cannot be catched by try catch when they come from SQF itself and not from throw

still forum
#

The error message itself generally doesn't kill or stop the script at all

#

exactly

#

command exception != SQF throw command

compact galleon
#

@little eagle true

queen cargo
#

that is why i said there is warning and error

little eagle
#

Thanks, Mulle.

compact galleon
#

systemChat str [_a]; prints <null>

still forum
#

but if there is a unhandled exception while you execute a throw/breakTo/breakOut it will kill the entire script instance

little eagle
#

Well, [<null>]

queen cargo
#

that is known @still forum

compact galleon
#

right

little eagle
#

With brackets.

#
0 spawn {
    _a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10];
    _a;
    systemChat "works";
};
#

I wonder if maybe using undefined variables in scheduled environment ends the script prematurely.

compact galleon
#

Well, errors alone don't end them at least

little eagle
#

Yep. But this is a special kind of error.

compact galleon
#

Eh

little eagle
#

Because without the spawn, this would work fine. Aside from the error in L1 of course.

compact galleon
#

Works both with and without spawn

little eagle
#

Should print "error undefined variable in expression" though with spawn.

still forum
#

But you don't use the variable

little eagle
#

And?

still forum
#

Ah yeah. forget that

#

Thought it would be so intelligent not to notice if you don't use the variable at all

little eagle
#

It would be great it it were valid syntax.

compact galleon
#

Doesn't print undefined with or without spawn, because the "expected 2" error overshadows it

#

It only prints the first errors, the rest are not displayed

little eagle
#

Oh, interesting.

still forum
#

Nil variables don't actually kill the scheduled script?

little eagle
#

Apparently not.

compact galleon
#

Nothing terminates a script

#

But the effects may make it seem like it

queen cargo
#

terminate

still forum
#

Always thought it kills them

little eagle
#

Same.

still forum
#

Well an unhandled exception in a throw/breakOut/breakTo terminates a script.

little eagle
#

Although I usually just fix the error and not bother testing further.

compact galleon
#

Scripts probably just seem to terminate because only the first error is printed, and the rest of the commands are executed and do nothing because they also have errors due to the first error

#

Eg. sqf _special = missionNamespace getVariable ["special", "NONE", 1337]; _vehicle = createVehicle ["B_LSV_01_unarmed_F", getPos player, [], 0, _special];

#

Will errror on getVariable, and then createVehicle will error because _special is nil and won't create the vehicle. But won't show an error because of the first error

little eagle
#

Agreed, seems likely.

compact galleon
#

Append

hint format ["Vehicle: %1", _vehicle];```
#

And it'll print Vehicle: <NULL-object>

#

All is executed

little eagle
#

I wonder if in scheduled environment, another error will be shown if the first one disappeared. Like when you use a long sleep.

still forum
#

I think errors are printed if you suspend

little eagle
#
0 spawn {
    missionNamespace getVariable ["special", "NONE", 1337];
    sleep 20;
    missionNamespace getVariable ["special", "NONE", 1337];
    systemChat "end";
};

Like if this shows both errors, because the first one already faded.

still forum
#

Or maybe on scope end? I guess I'm too tired for this

compact galleon
#

It doesn't even print any subsequent errors to the RPT

#
14:25:27 Error in expression <0 spawn{
_special = missionNamespace getVariable ["special", "NONE", 1337]; 
>
14:25:27   Error position: <getVariable ["special", "NONE", 1337]; 
>
14:25:27   Error 3 elements provided, 2 expected```
#

That's all

little eagle
#

"end" in chat?

compact galleon
#

end of scope

little eagle
#

Is that a yes or no?

compact galleon
#

@little eagle No, he's talking about when scopes end

#

@still forum Yup, it's 1 error per scope

#
14:28:15   Error position: <getVariable ["special", "NONE", 1337]; 
>
14:28:15   Error 3 elements provided, 2 expected
14:28:15 Error in expression <SV_01_unarmed_F", getPos player, [], 0, _lol]; 
hint format ["Vehicle: %1", _veh>
14:28:15   Error position: <_lol]; 
hint format ["Vehicle: %1", _veh>
14:28:15   Error Undefined variable in expression: _lol
#
0 spawn
{
_lol = call
{
    _special = missionNamespace getVariable ["special", "NONE", 1337];
    _special;
};

_vehicle = createVehicle ["B_LSV_01_unarmed_F", getPos player, [], 0, _lol];
hint format ["Vehicle: %1", _vehicle];
}```
little eagle
#

Well, you have your work cut out for you, X39.

queen cargo
#

wondering right now, https://community.bistudio.com/wiki/exitWith Exits current scope {...} it is executed from if condition evaluates true, creates new scope {...code...} and executes the given code in it.
so ... ```sqf
private _foo = "bar";
if true exitWith { isNil "_foo"; };

would this return `true` now? according to wiki, it should
#

cannot remember as i barely used exitWith

little eagle
#

It'd exit with false.

compact galleon
#

No, it would return false

#

And it does

still forum
#

It executes the code in a sub-scope meaning _foo carries over. And then returns whatever value is on the stack when the exitWith code is over

little eagle
#

cannot remember as i barely used exitWith
You've been scripting for this game for at least 5 years.

queen cargo
#

and when i use exitWith i literally use it with empty {}

#

to ... well ... exit the scope

#

and is arma 3 rly already 5 years out? man ... i get old

little eagle
#

2013

compact galleon
#

Last I looked at the wiki page for exitWith it had a note saying using it in a script had undefined behaviour

#

As in, the initial scope in a script

#

But it never had any ill-effects for me

#

And the notice is gone

little eagle
#

Well, if you use it in handleDamage for example, the return value is ignored.

#

Unless you wrap it in a call. I guess that is what is meant.

cedar kindle
#

flashbacks to arma2 when all scripts you downloaded ended with if (true) exitWith {};

queen cargo
#

@little eagle wut?
but that would remove the effect of the exitWith

compact galleon
#

xD

#

wait

#

o.O

#

Maybe I need my caffaine

#

But

#
hint call { if true exitWith {"LOL"} }```
#

I'd expect that to print LOL ?

queen cargo
#

nope

#

gimme a sec

compact galleon
#

So exitWith doesn't return it's value?

queen cargo
#

it does

compact galleon
#

'cause it returns nil

little eagle
#

It should print "LOL".

queen cargo
#

no

#

binary call

#

or

#

no ...

#

wait

#

wtf

compact galleon
#

what?

little eagle
#

This is a unary call.

queen cargo
#

also noticed ...

#

now

#

call { if true exitWith {"LOL"} }

compact galleon
#

Oh, do'h, lawl

#

I DO need my caffaine

queen cargo
#

what does this output?

compact galleon
#

.<

#

I was doing hint call { if true exitWith {"LOL"}; }

queen cargo
#

i need alcohol to compensate this

compact galleon
#

And expected it to output "LOL"

#

Obviously that'd PRINT "LOL", but output nothing

#

lol

queen cargo
#

ohh ...

#

yes ... you need some caffaine

compact galleon
#

Phew.. My faith in reality restored

little eagle
#

As expected.

queen cargo
#
SQF;0;41;hint call { if true exitWith {"LOL"}; }


        UNARYEXPRESSION;0;39;
                UNARYOP;0;4;hint
                UNARYEXPRESSION;5;34;
                        UNARYOP;5;4;call
                        CODE;10;29;
                                BINARYEXPRESSION;12;0;
                                        UNARYEXPRESSION;12;7;
                                                UNARYOP;12;2;if
                                                NULAROP;15;4;true
                                        BINARYOP;20;8;exitWith
                                        CODE;29;7;
                                                STRING;30;5;"LOL"
-------------------------------
[HINT]  LOL
[WORK]  <NOTHING>       nil```
little eagle
#

WORK is the return value?

queen cargo
#

that is whatever is left on the varstack

#

thus, yes

#
SQF;0;3;1


        NUMBER;0;1;1
-------------------------------
[WORK]  <SCALAR>        1.000000```
strange urchin
#

Hm? What tool is that from?

queen cargo
#

sqf-vm

#

this specific from the cpp-branch debug build

strange urchin
#

Oh, where can I get my hands on that?

queen cargo
#

there is a bot in there

#

that is still on the c branch

#

but that will change soon to the cpp branch

#

has no sqf-AST printing though ... that is special to the cpp branch right now

#

in case you are just interested in the AST generation, i can provide you a special build doing just that

compact galleon
#

@queen cargo If you think you've got your work cut out for you with the error checking

#

hint str damage player;

#

Shows the damage of the locally controlled player unit converted to a string in a hint.

#

I might have to rethink this tool, lol

queen cargo
#

not sure what you mean by that

#

should work fine and print whatever dmg the player has rightnow

compact galleon
#

@queen cargo I mean, that's what my tool does

#

Explains the code

queen cargo
#

ahh

compact galleon
#

And it's probably too much work in the end xD

queen cargo
#

explaining all code? yes

still forum
#

Can it automatically generate comments that comment each line of code and explain what it does? ๐Ÿ˜„

queen cargo
#

hint (if true then { "foo" }) @compact galleon

compact galleon
#

@still forum sqf if (alive player) then { hint ("You're alive! Your damage is " + str damage player); } else { hint "You're not alive!"; };

#
    1: Shows (the damage of the locally controlled player unit converted to a string concatenated to the text "You're alive! Your damage is ") in a hint.
If NOT the locally controlled player unit is alive, executes the following code block:
    1: Shows the text "You're not alive!" in a hint.```
queen cargo
little eagle
#

@compact galleon

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

How does it try to explain this one?

queen cargo
#

BOOOOOOOM

little eagle
#

It's assignedTeam _unit, except that it doesn't break when the unit is inside a group with AI as leader.

#

Pardon, assignedVehicleRole, not team.

compact galleon
#

@little eagle I haven't updated it in a long while

#

It doesn't even know fullCrew is an operator

#

And it doesn't really "explain" as much as it converts to english

#

@queen cargo hint (if true then { "foo" })

    1: The text "foo".
) in a hint.```ยด
queen cargo
#

acceptible
not good, but acceptible

little eagle
#

I justed wanted a long and convulted sentence.

compact galleon
#

hint str str str str str str str str str str str str 1337;

#

1: Shows the number 1337 converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string in a hint.

#
hint str (1+2+3+4+5*2);```
`1: Shows (the number 5 multiplied by the number 2 added to the number 4 added to the number 3 added to the number 2 added to the number 1) converted to a string in a hint.`
little eagle
#

That's not really convoluted. Just long and repetetive.

spark phoenix
#

@queen cargo does sqf vm handle array locality in the same way that arma does?

queen cargo
#

mhh?

spark phoenix
#

In arma, arrays are storied in their own location in memory, this location doesn't change as they are passed to and from threads and methods. Only with _arr = +array; is a new location mapped and all the values cloned.

queen cargo
#
_arr = [0];
_arr2 = _arr;
_arr2 pushBack 1;
diag_log [_arr, _arr2] //[[0.000000, 1.000000], [0.000000, 1.000000]]``` you mean this?
spark phoenix
#

Let me get example 2 seconds

queen cargo
#

if you could make that example a lot simpler so i do not have to read through lines of code in a pic, that would be nice

#

but i guess my example also covers what you were talking about if i understood your comment correctly

#

C branch does the same

compact galleon
#

@little eagle sqf hint ("Vehicle: " + str createVehicle ["B_LSV_01_unarmed_F", getPos player, [], 0, "NONE"]);

queen cargo
#

all variables are handled as reference
thus, the answer is yes

compact galleon
#

1: Shows (a new vehicle of type "B_LSV_01_unarmed_F", spawned at the position of the locally controlled player unit converted to a string concatenated to the text "Vehicle: ") in a hint.

still forum
#

Every datatype has their own pool allocator and thus stored in different locations.
You mean that arrays are passed by reference instead of copied

#

And all other variables are also passed as reference

#

You just can't really edit something inside them as in an array

spark phoenix
#

@still forum Thanks & @queen cargo sweet, I'll check it out later today then, seems very useful

still forum
#

Could theoretically do the same with every other datatype. But people would just be even more confused if you could edit numbers by reference

queen cargo
#

will now implement the mess that switch do case default : is

compact galleon
#

well, you can edit numbers "by reference"

#

_var = [5];

queen cargo
#

you do not edit the number itself

still forum
#

you are not editing the number itself though

queen cargo
#

as no command is editing existing numbers

#

unlike commands for arrays

#

god forbid that pushBack would create and return a new array each time

compact galleon
#

Sure, but the effect is the same

#

Granted you keep certain constraints

still forum
#

I never tried to make a increment/decrement command because I always thought I'd need the variable name. But if I edit the number by reference then I don't need the varname.

queen cargo
#

could somebody check what happens if only case 123 is executed outside of a switch?
iirc should return nil and not error

#

++_i

still forum
#

Uhm...

#

That could be interesting

queen cargo
#

the inc command?

still forum
#

I thought it might error if ___switch is undefined. But it doesn't even check that

queen cargo
#

or the case thing

#

that is the question
how it handled the missing var

still forum
#

It statically casts the pointer of the data in the game value to a switch data. And then reads from the pointer

#

without even checking if it's a nullptr

compact galleon
#

It'd need the name, or need to be a special construct like =

queen cargo
#

also not sure what exactly case 123 is returning

compact galleon
#

it returns SwitchType

still forum
#

case returns the value inside the ___switch variable

#

then used as left argument to :

#

default checks if ___switch is nil and returns Nil if so.

#

But : and case don't even check for nil and grab the raw pointer

compact galleon
#

Foreign Error well, that's new

#

Error Foreign error: Unable to evaluate switch block

#

:D

still forum
#

Atleast no crash...

queen cargo
#

@compact galleon i remember that

#

spoiler there is more where that came from in the switch construct

compact galleon
#

Probably

#

Haven't checked how the whole thing works entirely yet

#

Except changing ___switch

#
switch 0
{
    ___switch = switch 20;
    case 20:
    {
        hint "LOL";
    };
};```
#

Not sure how they handle fall-through cases yet, though

queen cargo
#

there are non iirc?

#

crap ...

#

i see

#

there are

#

how default was handled is more funny though

compact galleon
#

That's what I was expecting. Just wasn't sure where it stored the flag

#

woah

#

I crashed it

#

great

queen cargo
#

with?`

compact galleon
#
switch 0 do
{
    case 0;
    ___switch2 = ___switch;
};

switch 0 do
{
    ___switch = ___switch2;
    case 45:
    {
        hint "LOL";
    };
};```
#

oh

#

shit

#

forgot to define ___switch2 outside the switch

still forum
#

You've set ___switch to nil

compact galleon
#

I thought they fixed them not checking for nil`?

#

I know

still forum
#

but why does it crash in your example. But not if you execute case 45 by itself where ___switch is also nil

compact galleon
#

what?

still forum
#

when you got that Foreign error. You just executed a case right?

compact galleon
#

case 45 will refuse to work outside the scope created by switch do

still forum
#

Yeah. I'd have thought it checks if ___switch is undefined and errors based on that

compact galleon
#

One of the changelogs says that it does

still forum
#

It errors and doesn't crash.
In your example ___switch is also undefined. But in your example it crashes instead of just erroring

compact galleon
#

Fixed: CTD when ___switch is nil

#

Dec 8, 2015

#

There. Now it prints LOL ```sqf
___switch2 = nil;
switch 0 do
{
case 0;
___switch2 = ___switch;
};

switch 0 do
{
___switch = ___switch2;
case 45:
{
hint "LOL";
};
};```

queen cargo
#

i would guess that ___switch is not set to nil but rather deleted completly at the end

#

thus making the ___switch2 not a nil but rather a dead pointer

compact galleon
#

Well, yeah, normally. It's stored in the scope created by do

queen cargo
#

which leads in access violation

still forum
#

All types are refcounted though. You'd have to really really want it to do such a thing

queen cargo
#

probably a mistake done in some ancient time

#

legacy code

still forum
#

Can't find any deliberate deletion of that. It just goes out of scope and get's left to refcounting

queen cargo
#
switch 1 do {
    default {1};
    default {2};
};``` what about this?
compact galleon
#

What about it?

queen cargo
#

what happens here

compact galleon
#

do returns 1

#

: and default breaks out of the scope after executing the codeblock

queen cargo
#
switch 1 do {
    default {1};
    case 1 : {"will execute"}
};```
compact galleon
#

I see

#

Judging from the wiki, default doesn't do anything but store the code block passed to it somewhere, and do will execute that if no case has matched

queen cargo
#

yup

#

at the very end if the flag in the swtich type is not set

compact galleon
#

Judging by The default block will be executed only if no case matches, no matter at which position inside the switch it is. It is not a case, and will never be entered by fallthrough.

queen cargo
#

question was more related to will a second default override the last one

compact galleon
#

yes

#

it will

queen cargo
#

you tested?

compact galleon
#

yes

#

switch 1 do { default {2}; default {1}; }; returns 1

#

switch 1 do { default {1}; default {2}; }; returns 2

queen cargo
#

kk

#

i think i have the switch now perfectly covered in the c++ branch

#

now to test those idiotic cases

#

yup

#

got it covered fully

still forum
compact galleon
#

Now dedmen just needs to get some good writing skills.

#

Including punctuation

#

:D

#

Just before the sorting a Timer was started doesn't read well

still forum
#

I'm used to arguing with people in here using short text messages

#

Yeah. I wanted to write the timer before that.

compact galleon
#

Just before the sorting, a Timer was started **

still forum
#

I tried to put everything into chronological order as the engine does it. But I only thought about the timer after I wrote the first paragraph

compact galleon
#

@still forum Also, its, not it's

#

The scheduler will end it's cycle

still forum
#

Really? ๐Ÿคฆ Well. I did that wrong my entire life except when I was too lazy to use '

lone glade
#

it's not its

cedar kindle
#

timer/time classes or something?

lone glade
#

its does not exist.

cedar kindle
#

why capitalized

lone glade
#

i'll do a full review @still forum

compact galleon
#

@lone glade Are you trolling, or just ignorant?

#

It's is a contraction of it is

#

Its is possessive

still forum
#

Wait with the review like.. 10 minutes atleast till I fixed up parts

compact galleon
lone glade
#

that's why you use the apostrophe

compact galleon
#

No, if you use apostrophe it becomes it is

shadow sapphire
#

@compact galleon... maybe go back and read?

lone glade
#

... dude

#

it's contraction of it is
its doesn't exist

compact galleon
#

its DOES exist

still forum
#

In that case its is correct.
scheduler ends its cycle it ends its cycle and not it ends it is cycle
it is not a cycle. It ends the cycle it possesses

cedar kindle
#

its doesnโ€™t exist? ๐Ÿค”

lone glade
#

oh fuck... my brain

#

I just woke up....

shadow sapphire
#

Its does exist, @cedar kindle.

still forum
#

And I'm ready to go sleep again

lone glade
#

I completely forgot about possession...

compact galleon
#

...

shadow sapphire
#

Its is possessive.

cedar kindle
#

i know lol

lone glade
#

indeed, mybad ๐Ÿ˜„

still forum
#

timeing ๐Ÿ™„

compact galleon
#

Yea, I was looking at that xD

#

time'ing

still forum
#

timing

compact galleon
#

Yea, no shit

still forum
#

Updated it. There is still no real layout in there. And it ended up shorter than I expected.. Turns out the scheduler is easy ๐Ÿ˜„

#

I missed my bus... ๐Ÿ˜

compact galleon
#

@still forum Also ofcause xD

#

of course, in case you're in doubt

still forum
#

I'll get a grammar / spell check plugin...

halcyon crypt
#

isn't the organisation name somewhat not a good thing?

still forum
#

True.

#

Commy didn't want me to just write "Arma 3" because that could make it look official.

#

So I just turned it into something unofficial looking

compact galleon
#

Organization name?

halcyon crypt
#

at first I thought BI started something on github ^^

still forum
#

arma3 name was used by some exile guy that never did anything but register and fork a exile repo. So I asked github to delete his account and free up the name

tough abyss
#

Those commas

still forum
#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

lone glade
#

you mean there's none? huehuehue

compact galleon
#

Also sometimes you use the Oxford comma and other times you don't.

still forum
#

Just spam me with comments on that PR ๐Ÿ˜„
It's my first blog post. I'll learn. But I have to catch my bus in 4 minutes and I'll make sure not to miss it again

lone glade
#

nevermind found them, yep.

still forum
#

Oxford comma?

compact galleon
#

Oxford comma: 1, 2, 3**,** and 4

#

No Oxford comma: 1, 2, 3 and 4

lone glade
#

I prefer the oxford comma

#

but this:

A SQS script will execute until it, is done, suspends, or after it executed for a total of 3ms. If the 3ms limit is reached it will be forced to suspend.

still forum
#

Oh.. If I used oxford it was a mistake

compact galleon
#

lol

#

until it, is done

lone glade
#

I had a brain aneurysm reading this

compact galleon
#

Shouldn't be one there

tough abyss
#

Yeah @lone glade thatโ€™s what I was about to paste

still forum
#

But if you prefer then I'll keep that. In German it's usually left out

tough abyss
#

Also spell check

still forum
#

I should probably stay with ranting at random people in chat rather than writing blog posts ๐Ÿ˜„

tough abyss
#

Ofcause

still forum
#

Yeah I got myself a spell check extension

#

now

#

But I need something that checks commas too

lone glade
#

I'd prefer a list instead of enumerating them like that

compact galleon
#

Well, without the Oxford comma you might end up conveying the wrong thing

still forum
#

yeah.. Might be 1 && (2 && 3) instead of 1 && 2 && 3

#

bad example

compact galleon
#

We invited the strippers, JFK, and Stalin. << You're inviting strippers, and jfk and stalin

#

We invited the strippers, JFK and Stalin. << you're inviting two strippers named JFK and Stalin

lone glade
#

I love oxford comma examples, they're just glorious

cedar kindle
#

oxford commas are the truth
canโ€™t believe school taught me the wrong way

compact galleon
#

If you're stupid, say 'phone'

cedar kindle
#

phone

compact galleon
#

:D

cedar kindle
#

;0

compact galleon
#

The highlights of his global tour include encounters with Nelson Mandela, an 800-year-old demigod and a dildo collector. << haha, the lack of Oxford comma makes Nelson Mandela a dildo collector

#

Personally, I actually hate the Oxford comma. I write my sentences to not be ambiguous instead

shadow sapphire
#

If I was writing a script to climb onto or over things, would cursorObject or another command be better to start with? I'm looking for one that would find the height of the object a player was looking at?

cedar kindle
#

e.g canClimb

shadow sapphire
#

@cedar kindle, thanks! Will give it a look.

winter dune
#

does someone know how to make a listbox scrolling horizontally?

#

not in the original way up down

winter dune
#

found here

#

if someone needs

compact galleon
#

@still forum Hahaha

#

ofcause of cause is ofcause wrong

#

of cause is also wrong

#

it's of course

still forum
#

lol

#

๐Ÿคฆ

#

I'll take care of that tomorrow

compact galleon
#

xD

winter rose
#

it must of bin an exhaustion error, rather then incorrect grammer

#

incoming flaming in 3, 2, โ€ฆ

meager heart
#

๐Ÿ˜€

tough abyss
#

is it possible to determine server side whether a player is outside a certain distance from a marker, as player is null for the server?

cosmic kettle
#

@tough abyss search for units near the marker position.

tough abyss
#

hmm AllUnits then?

cosmic kettle
#

AllUnits, allPlayers , playableUnits, ... depends on what you need. for MP playableUnits should do.

tough abyss
#
( if(_x distance2D _base > 1500) then { exitWith{ null = call tag_fnc_some_nifty_function; }; }; ) forEach playableUnits;``` would only call the function *once* when it finds its first victim and then skips the rest right?
cosmic kettle
#

iirc it does.

tough abyss
#

great, thanks!

cosmic kettle
#

np o7

#

@tough abyss

{
 if (_x distance2D _base > 1500) exitWith {[] call tag_fnc_some_nifty_function}; 
} forEach playableUnits;
#

i didn't read correctly lol

ruby breach
#

Yeah, no need to do if()then{exitWith{};};.

cosmic kettle
#

also () forEach won't work ^^

tough abyss
#

yea you're right, point was the exitWith ๐Ÿ˜›

native siren
#

Any reason why disableUserInput false; works when in same if as disableUserInput true; but not if outside? I'm 100% that this block of code with it is firing.

meager heart
#

@shadow sapphire

Something that takes places like Feres and Oreokastro and makes it look not like a ghost towns, but for the whole map.
Warning: test it for small map like Stratis! ๐Ÿ˜€

0 spawn { 
    (nearestObjects [getArray (configfile >> "CfgWorlds" >> worldName >> "safePositionAnchor"),["House","Building"], worldSize]) apply {_x setDamage 1}; 
};
shadow sapphire
#

@meager heart, that would be much easier than the way I'm doing it, but I don't think that will work. I will certainly try it. Does that go into like a game logic or something?

meager heart
#

put it in debug console... just don't try it for Altis... it will ruin your fps

shadow sapphire
#
_object = nearestObjects [player, ["house","ruins","walls"], 800];

{

    switch (typeof _x) do {

        case "Land_u_House_Big_01_V1_F": {

            _dir = getdir _x;
            HideObjectGlobal _x;
            _h = createvehicle [(selectRandom ["Land_i_House_Big_01_b_blue_F","Land_i_House_Big_01_b_brown_F"]), position _x, [], 0, "NONE"];
            _h attachto [_x,[0,0,0]];
            detach _h;
            _h setdir _dir;
            deletevehicle _x;

        };

        case "Land_u_House_Big_02_V1_F": {

            _dir = getdir _x;
            HideObjectGlobal _x;
            _h = createvehicle ["Land_i_House_Big_02_b_white_F", position _x, [], 0, "NONE"];
            _h attachto [_x,[0,0,0]];
            detach _h;
            _h setdir _dir;
            deletevehicle _x;

        };

    };

} foreach _object;

Etc... is what I'm trying currently...

ruby breach
#

@native siren disableUserInput works on a standalone basis for both true and false. Are you sure that your re-enable command is being executed after your disable command? (Also worth noting that you have to do the thing on the biki page for cases where user input starts automatically when you re-enable input)

shadow sapphire
#

@meager heart, shouldn't your code have setdamage 0 rather than setdamage 1?

meager heart
#
(nearestObjects [player, ["house","ruins","walls"], 800]) apply {_x setDamage 1}; //--- destroyed
 (nearestObjects [player, ["house","ruins","walls"], 800]) apply {_x setDamage 0}; //--- not destroyed
shadow sapphire
#

Right... I'm trying to make them not destroyed. Anyway, thanks! That does something for sure, but it's not what I'm looking to do. I've tried something like that before, and I tried your version just now. The problem is that even at full health, the buildings look abandoned, broken, and destroyed.

meager heart
#

also when you hide building and spawn new on that position, it makes your fps go down ๐Ÿ˜€

shadow sapphire
#

Only for a moment. But this will be done on server init, before players join the game. Eventually the script will be modified so that each of these buildings is dynamically simulated.

#

@meager heart, if you check out the screenshots channel, you'll see what I'm doing.

meager heart
#

yep saw that

rose delta
#

arma 4 confirmed

shadow sapphire
#

Okay. So, the ruins are their own model. They aren't damaged versions of the buildings. IDK WHY BIS makes certain choices...

tough abyss
#

its possible to have multiple damage parts for a building etc

shadow sapphire
#

Well, I mean the map objects are just weird. Like, there is Land_i_House_Small_01_b_F or something like that but then the damaged version of it on the map doesn't have the same object name, it's called Land_u_House_Small_01_V1_F.

weary pivot
#

hey Im new to mission making and have a few questions. BTW i know the basics of where to put the scripts. first im trying to make an ai unit salute when i get close how do i do that.

native siren
#

@ruby breach So I get system message "Unblocked" but I still cannot do anything.

#
if (var_block) then {
    disableUserInput false;
    systemChat "unblocked";
};```
#

if I remove if it works

unborn ether
#

@native siren disableUserInput result might stack for some reasons, so currently its useful to check userInputDisabled before disabling or enabling.

native siren
#

yeah I was thinking if that wasn't an issue in my case

#

thank you

unborn ether
#

Is there actually anything in secondaryWeaponItems besdies the secondaryWeapon magazine? What accessories can actually exist for launcher-like weapons, cant remind any.

meager heart
#

scopes

#

also with addons (RHS has it) with SMAW, you will have spotting rifle magazines

#

also x2 if anyone will create bipod for rpg 7...it will be there (yes bipod for rpg 7 exist!) ๐Ÿ˜€

unborn ether
#

Wow

tough abyss
#

Wondering if anyone would like to be a hired dev for an A3L server, simple shit just need someone to do it so im offerring $$ for motivation

subtle ore
#

(Discord: ๐Ÿ–• )

meager heart
#

๐Ÿ˜”

#

discord op

subtle ore
#

It's been a problem since day one,
and uh...well..

sinful sky
#

ok I've been trying this for hours now. time to ask. I'm trying to find a place able position inside a building close to a marker and move an object there.

#

ive tried using this _allBuildings = (nearestObjects [cache_1, ["house"], 40] select {!(_x buildingPos -1 isEqualTo [])});
_rndBuilding = selectRandom _allBuildings;
_rndPos1 = selectRandom (_rndBuilding buildingPos -1);

#

nevermind, ive gotten so lost with what ive tried I don't know where to start now

little eagle
#

nearestObjects only picks up objects in the internal mission-objects list. But buildings are terrain-objects. One exist depending on the terrain/map, the others are placed in the editor or created on the fly during the mission.

#

You have to use:

nearestTerrainObjects [cache_1, [], 40]

instead of nearestObjects.
Please note that both commands are different in that second argument array. nearestObjects takes classnames and nearestTerrainObjects takes a generic object type, NOT classnames. Best to leave it empty and let the select / buildingPos -1 block filter out all non-buildings.

#

@sinful sky ^

sinful sky
#

ok, I think this is closer to what you mean.

#

_allBuildings = nearestTerrainObjects [cache_1, house, 80,0,0, true];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;

little eagle
#

Syntax of nearestTerrainObjects is wrong.

sinful sky
#

ive no idea that that means

#

ive been trying to lean what the ASP pos means but

#

I'm getting more lost atm

little eagle
#

The parameters are: [position, types, radius, sort, 2Dmode], where sort and 2Dmode are optional.
Your second argument is house, which is not an ARRAY, but an undefined variable.

sinful sky
#

I got it like this

#

_allBuildings = nearestTerrainObjects [_pos, _types, _radius, false, true];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;

little eagle
sinful sky
#

i think so, tbh ive real ALOT in the past few hours a lot has just confused me

#

leme look

#

ok so that looks for map stuff not objects

little eagle
#

And do not just copy paste the examples. Read carefully what _types is, otherwise your script will miss a lot of Building`s.

#

ok so that looks for map stuff not objects
You didn't even read what I posted in this chat 5 minutes ago...

sinful sky
#

this is the first time ive tried to make things spawn in buildings

#

what?

#

look

little eagle
#

Yep, you ignored what I wrote 5 minutes ago.

sinful sky
#

lol

#

you don't get it

#

i don't understand what it said

#

not that i didn't read it

little eagle
#

Okay, I repeat it.

#

nearestObjects only picks up objects in the internal mission-objects list. But buildings are terrain-objects. One exist depending on the terrain/map, the others are placed in the editor or created on the fly during the mission.

sinful sky
#

that's what i said isn't it?

little eagle
#

No.

#

It's the opposite.

sinful sky
#

so it looks for things placed?

little eagle
#

nearestObjects yes

#

nearestTerrainObjects no

sinful sky
#

no

#

i mean the other one

#

so i was right

#

ebfore

#

before*

#

nearestTerrainObjects looks for building and rocks and trees

#

and mre

little eagle
#

ok so that looks for map stuff not objects
This sentence makes no sense. Map stuff are objects. This can't be right.

sinful sky
#

I'm just trying to get this straight in my head

little eagle
#

Both are objects. Some are mission-objects, the others are terrain-objects.

inner swallow
#

i'm assuming by objects they mean editor placed objects

sinful sky
#

well that obv to youy mabye but not too me

#

yea thats what i mean

little eagle
#

Good. Now you can write your script so it picks up terrain-objects like buildings belonging to the map.

sinful sky
#

ok so this

#

_allBuildings = nearestTerrainObjects [_pos, _types, _radius, false, true];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;

#

should work if i get the syntax correct

#

?

little eagle
#

Well, as long as the variables are defined it should work as far as I can tell.

sinful sky
#

so pos is the maker.

#

type is "houses" ?

little eagle
#

Though, this does not filter out buildings that have no building positions.

sinful sky
#

well that would be ok as im looking for it to be random some inside soje out

little eagle
#

type is an ARRAY, "houses" is a string.

#

Seriously.

sinful sky
#

YES, i dont what an array is a string,

little eagle
#

I think the script would error further down, because _spawnPos would be undefined for buildings without positions.

#

Enter "array" or "string" into the searchbar of the wiki.

#

You will not be able to write any scripts without knowing what an array is. Sorry.

sinful sky
#

ok so it would just have no possition for some of them

#

well ive done ok so far with simple stuff over the years

little eagle
#

ok so it would just have no possition for some of them
Yes, and depending on how the rest of your script looks like, it might cause a script error and stop working

#

well ive done ok so far with simple stuff over the years
You were working on this simple thing for hours...

sinful sky
#

lol wana be more codecending?

little eagle
sinful sky
#

ok

little eagle
#

Read those.

sinful sky
#

well i thaught an array was a 0,0,0

little eagle
#

I'm not condecending. Everyone here will agree that you have to at least know the very basic things.

#

Just trying to help you.

sinful sky
#

yes i understand

#

but not everybody starts with the same things

little eagle
#

well i thaught an array was a 0,0,0
That's not correct. It's close, but wrong.

sinful sky
#

lol see im close

little eagle
#

The game won't care if you were close. The game needs the correct input or you'll stare at it for an hour and nothing will happen.

sinful sky
#

yes i know that

#

code dont bend for no man

#

soo, i neen the first line to be
nearestTerrainObjects [marker1, ["House"], 100];

#

well after pos=

#

nope

#

says 0 elements provided 3 needed

#

well thanks but, hasnt helped. i dont get what im missing

inner swallow
#

@sinful sky markers aren't considered objects

#

or positions

#

they're markers

#

so your first thing should be getMarkerPos "marker1"

sinful sky
#

ok

#

so far i have this

#

housepos = getpos "cache_1";
_allBuildings = nearestTerrainObjects [housepos, "House", 100];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;

inner swallow
#

types: Array - list of types of the objects to search for.

#

"house" there is not an array

sinful sky
#

what is?

inner swallow
#

["house"] like you had before

sinful sky
#

o ok

#

i keep changeing things a get messed up

#

cos im not sure where the prob is

inner swallow
#

change one thing at a time ๐Ÿ˜„

sinful sky
#

i try lol, ive got a map full if triggers atm

#

wait do i have to getmarkerpos ?

#

ok first line is ok, still getting the array thing

#

_allBuildings = nearestTerrainObjects [housepos, ["House"], 100];

#

thats almost exactly whats on the BI wiki

#

nearestTerrainObjects [player, ["House"], 200];

#

thast the wiki example

#

nope i still dont get what is wrong with this

#

_allBuildings = nearestTerrainObjects [housepos, ["House"], 100];

#

surely thats an array

#

?

#

you guys given up on me?

#

i cant learn whats correct buy being told whats wrong.

#

im just guessing by this stage. and i read through the pages ive been sent but it doesnt mean enought to see what im doing wrong

#

even the example doesnt work

inner swallow
#

can you paste the exact error?

#

Also it's 10AM on a weekday in Europe, replies will be slow at this time of day ๐Ÿ˜„

sinful sky
#

thanks for the help, i know im a noob

#

is there a way to copy error

inner swallow
#

look in %localappdata%\Arma 3

#

there will be files that end in .rpt

#

open the most recent one with notepad

#

your error should be somewhere there

#

and put the link here

sinful sky
#

its saying error 0 elements provided, 3 expected

inner swallow
#

that's fine, but show me the exact error in the RPT file as described above.

sinful sky
#

ok was going to ask waht file you wanted

inner swallow
#

i just wrote that above...

sinful sky
#

errm

#

all the chat just dissapeared

#

hello>?

meager heart
#

๐Ÿ™„

sinful sky
#

ok its back

#

suiside ive been reading a lot for the past 6 hours, sorry if I miss things

elder slate
#

@meager heart ๐Ÿ˜Ž

sinful sky
#

errm the RPT file its thousand of lines long

#

ah at th bottom duur

#

lol well ive no idea how to use this paste bin

peak plover
#

<100mb is no othhing

sinful sky
#

can anybody tell me whats wrong with this line
_allBuildings = nearestTerrainObjects [housepos, ["House"], 100];

#

error is 9:02:17 Error position: <nearestTerrainObjects [housepos, ["House>
9:02:17 Error 0 elements provided, 3 expected

split coral
#

maybe housepos isn't an object or a valid position?

queen cargo
#

could somebody check if this here works:

100 call {
    for "_i" from _this to _this + 100 do {
        systemChat _i;
    };
};

i do assume that this should work perfectly fine ... but ... well ... just do it please

sinful sky
#

hmm i set the house pos from
housepos = getmarpos "marker1"

#

*getmarkerpos

#

How are people putting it in boxes in the chat?

#

hmm well that may be the problem i chaged it to
getpos player

peak plover
#

There is no getmarkwrpos

#

Its just markerposition

sinful sky
#

ah THANKYOU

#

that would explain it i guess

#

nody pointed that out yet ๐Ÿ˜ƒ

#

nobody

#

is that markerpos?

#

ok

#

so

peak plover
#

Check biking, I think it is markerposition

sinful sky
#

housepos = markerpos "cachepos_1";
_allBuildings = nearestTerrainObjects [housepos, ["House"],100];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;

compact galleon
#

@queen cargo Didn't try it, but I'm pretty sure that wouldn't work

sinful sky
#

this is what ive got

compact galleon
#

As far as I know no overload of + takes a ForType on the left side

queen cargo
#

need to know for sure

#
  • has higher predecense
#

thus it should work theoretically

#

but my sqf ast tree breaks on it

compact galleon
#

It does?

queen cargo
#

thus i need the answer

#
6 +
4 to```
compact galleon
#

eh

#

Alright then

#

@queen cargo Don't you have the game yourself?

#

@queen cargo Doesn't work since systemChat doesn't take a number ๐Ÿ˜›

#

But the loop works

queen cargo
#

do have the game myself, but not installed

#

due to HDD death ...

#

and no monez for new one

peak plover
#

X39 codes on iPhone.

#

No Arma for iPhone yet

compact galleon
#

Glad I bought lots of space

#

$247

#

for 5TB

#

And that's with 25% VAT

queen cargo
#

but for SQF you do not need arma installed ... just to confirm stuff
and that now means that i have to fix whatever is wrong in my AST generator -.-

compact galleon
#

What is predecense?

#

:D

queen cargo
#

magic word that is completly misspelled

compact galleon
#

And I don't know C, only C++

queen cargo
#

also enough

#

C is required to understand the code
C++ bases on C
youre fine

#

in case you did not have been joking, PN me and i will further explain to you ๐Ÿ˜„

compact galleon
#

C is vastly different from C++

queen cargo
#

not in regards of what needs to be done there

#

basic understanding what the . operator does is required there with basic understanding of programming

#

no allocation or anything like that is done there outside of simple push operations that require locally allocated structures

#

thus even somebody with any other language could do it (as long as it is not something like SQF or eg. lua)

sinful sky
#

then why cant you?, not being rude but im confused looking at this convo

queen cargo
#

was coding the whole morning and simply got other stuff to do too

#

not like i can spend the full day just doing some random arma stuff that is fully non-compensated (the monez ya kno)

sinful sky
#

so its for sombody else?

#

i see

queen cargo
#

sqf-vm?
that is something i do for the community

#

to emulate SQF

#

outside of arma

#

did not was expecting anybody to actually provide a fix btw. just random chatting ...
would have been surprised if somebody said "ye i can do it"

compact galleon
#

did not was expecting >:D

sinful sky
#

well nobody could answer my question yet ether

queen cargo
#

i am half asleep @compact galleon
leave me be

sinful sky
#

lol

#

know the feeling

queen cargo
#

go fix my issue !!!! @compact galleon ๐Ÿ˜›

sinful sky
#

ive been trying to do one thing for hours in about 10 diffrent ways

#

still more confused than i started

#

i thinkl

queen cargo
#

```sqf
<yourcode>
```
@sinful sky

sinful sky
#

great way to confuse me more lol

queen cargo
#

that is to create those "boxes"

sinful sky
#

oh

queen cargo
#

the issue you have tells you that housepos is not having 3 elements

sinful sky
#

that wasnt the question o ment but thanks

#

yes

#

lol i know that

#

too well

#

what i dont know is what it wants

queen cargo
#

well ... a position?

sinful sky
#

but it has one

queen cargo
#

did you checked housePos?

sinful sky
#

housepos = markerpos cachepos_1;
_allBuildings = nearestTerrainObjects [housepos, ["House"], 900 ];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;

queen cargo
#

housepos <-- global var
check what it outputs

sinful sky
#

o so

#

thats a name i shouldnt use?

queen cargo
#

that is what you wrote up there

compact galleon
#

If cachepos_1 is the name of a marker you need to use markerPos "cachepos_1"

sinful sky
#

ah

#

wait that waht ive got

#

o no

#

i did

#

well

#

thats how i had it before

#

houseplace = markerpos "cachepos_1";
_allBuildings = nearestTerrainObjects [houseplace, ["House"], 900 ];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;

#

cache_1 setpos _spawnPos;

#

but the box doesnt move

#

now im not getting any error

#

well im pretty much where i stated, i can move a box to a marker

#

but ive dont that before lol

peak plover
#

Can I get fii in Arma ?

sinful sky
#

fit*?

peak plover
#

Fibonach constant. Fii

sinful sky
#

k, way over my head

#

guess its best to wait till later in the day to ask again

compact galleon
#

@sinful sky Your problem is that you're selecting random houses, and not all houses have random positions

#

So executing it just once won't necessarily find a position

#

You'll have to choose a house that has positions

sinful sky
#

well i found a script erlier that only found positions in houses with them

#

but ive been through so many i cant find it now

compact galleon
#

Might want to use select on the houses array

sinful sky
#

TBH untill i see ascrip that works most of this means nothing to mean

#

im really thinking about it but it doesnt help

compact galleon
#
houseplace = markerpos "cachepos_1";
_allBuildings = nearestTerrainObjects [houseplace, ["House"], 900 ]; 
_allBuildings = _allBuildings select { count (_x buildingPos -1) > 0 };
_building = selectRandom _allBuildings; 
_allBuildingPos = _building buildingPos -1; 
_spawnPos = selectRandom _allBuildingPos;```
#

That'll work ^

sinful sky
#

ok so you added a count bit

compact galleon
#

ARRAY select CODE returns an array of the elements in the specified array that matches the condition in the code block

sinful sky
#

brain just melted

#

i really need to get sombody to teach me the arrays string and still

#

*stuff

#

ive read through the wiki but its not making sence to me. its good to know what ive dne wrong.

#

leme try that anyway

compact galleon
#

arrays string ?

sinful sky
#

&

#

the basics i guess

compact galleon
#

@sinful sky Learning the basics is always a good idea

obtuse cosmos
#

Hi, anyone know a way around or if there is a way for object to show inside the LoW DLC (closed) van? I can see it when I stand outside but can't see the object when I sit in the back... I used attachTo command

sinful sky
#

the thing is knowing and applying are a bit diffrence too

little eagle
#

Nigel, you mean the golden ratio?

peak plover
#

Yes

little eagle
#

Just define the constant as a macro.

fading burrow
#

Hi, i got a lot of players being kicked by battleeye. Reason: PublicVariable Restriction #37

Anyone know what is wrong?

#

is there something wrong with my be filters or is this just normal?

ruby breach
#

Given that pubVar#37 could be well... anything. Thereโ€™s no way to know if thatโ€™s normal.

#

publicVariable.txt/.log would tell you what is causing the kicks. Whether you have that in your actual mission would tell you if itโ€™s intended behavior or not.

still forum
#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

queen cargo
#

โ”ฌโ”€โ”ฌ ใƒŽ( ใ‚œ-ใ‚œใƒŽ) chill

compact galleon
#

@still forum Still haven't fixed your wiki page

still forum
#

I just came home :U

compact galleon
#

@still forum Bad excuse

#

:D

still forum
#

Btw to A SQS script will execute until it, is done, suspends, or after it executed for a total of 3ms. If the 3ms limit is reached it will be forced to suspend.
it, is
I used that comma to show the start of the list

little eagle
#

Eh, what about:

A SQS script will execute until it: is done, suspends, or after it executed for a total of 3ms. If the 3ms limit is reached it will be forced to suspend.
still forum
#

Well... That seems kinda obvious... ๐Ÿคฆ

little eagle
#

Tbh, I'd also get rid of the Oxford's comma.

#
A SQS script will execute until it: is done, suspends or after it executed for a total of 3ms.
lone glade
#

USE BULLET POINTS

little eagle
#

I also think it's "an SQS script". "es-qu-es".

still forum
#

Already using bullet points on one level

lone glade
#
An SQS script will execute until it:
- Is done.
- Suspends.
- It executed for a total of 3ms.

.<

subtle ore
#

So, quick question here. Is it peformance friendly to be getting a variable value from missionnamespace every few seconds or are there better alternatives?

lone glade
#

wat

still forum
#

it's performancewise irrelevant

little eagle
#

I don't think there is an alternative. If that is what you have to do, then it's what you have to do.

subtle ore
#

Okay then, thanks for the feedback.

lone glade
#

in itself it's irrelevant like ded said, it's mostly why you're doing it that matters

little eagle
#

This doesn't need bulletin points, alganthe.

lone glade
#

well, it's more readable that way imho.

subtle ore
#

Well why: I want to be able to (during runtime) throw in extra code into a loop

still forum
#

That's basically... what call my_fnc_dostuff does

#

throw in extra code... Into some code

lone glade
#

literally what it does

still forum
#

You are very much overcomplicating what you want to do ๐Ÿ˜„

lone glade
#

true

subtle ore
#

Alrighty, i will try and less overcomplicate what i am trying to do

peak plover
#

In a loop call array

#

Add code to tht array

little eagle
#

less overcomplicate
"simplify"?

subtle ore
#

That's what i am already doing Nigel

#

Simplify works

lone glade
#

we can't really help you without context

#

because your explanations are pretty abstract right now

subtle ore
#

I have a function, it adds given code to array stored in mission namespace. Other fnc initializes array on missionnamespace and starts loop given that the variable has code and parameters inside stored as arrays inside arrays

#

so then in the loop, it itterrates through all of the array and calls the code with parameters

lone glade
#

simplified:
I call a function that stores code in a global variable, other func checks all vars in missionNamespace and starts a loop.

still forum
#

That's kinda how CBA eventhandlers work

peak plover
#

Cba pfg

#

Pfh

lone glade
#

that looks oddly like PFHs indeed

#

or at least it's a similar initial intent

hollow zephyr
#

Hey guys, me and my friends have started playing IFA3 recently and I started creating a new mission for it, but all of the enemies die way too fast and it isn't fun. I'm trying to make a script that makes it so that the enemies need to take double the damage they would normally take but I can't seem to get it to work for some reason

peak plover
#

Just use ace and 8ncrase enemy health in cba settings

winter dune
#

I'm not very practical with this thing but can someone give me an input on how should I modify whatever is inside the dialog and insert other different controls? This is the rsc I'm looking to use: RscDisplayWelcome

little eagle
#

What for?

winter dune
#

I'll like to create a welcome dialog

#

that displays different types of images

little eagle
#

Mission, addon, or what?

winter dune
#

mission

unborn ether
#

@winter dune Well dialog/display is a class where you can create (if not exists) a class called controls or controlsBackground. This example provides the minimum for display to exist:

class dialogName {
    name = "dialogName";
    idd = -1;
    movingEnable = false; 
    enableSimulation = true; 
    class controls {};
    class controlsBackground {};
};
little eagle
#
createDialog "RscDisplayWelcome";

private _display = uiNamespace getVariable "RscDisplayWelcome";
private _ctrlText1 = _display displayCtrl 1100;
private _ctrlText2 = _display displayCtrl 1102;
private _ctrlSpoilerText = _display displayCtrl 1101;
private _ctrlButtonSpoiler = _display displayCtrl 2400;

// compose text
private _line1 = parseText "<t align='center' size='10' shadow='0'>HELLO</t>";
private _line2 = parseText "Blah blah blah";

_ctrlText1 ctrlSetStructuredText composeText [
    _line1, lineBreak,
    _line2, lineBreak
];

// set position
private _position = ctrlPosition _ctrlText1;
_position params ["_x", "_y", "_width", "_height"];
_height = ctrlTextHeight _ctrlText1;

_ctrlText1 ctrlSetPosition [_x, _y, _width, _height];
_ctrlText1 ctrlCommit 0;

// disable and hide these
{
    _x ctrlSetFade 1;
    _x ctrlCommit 0;
    _x ctrlEnable false;
} forEach [_ctrlText2, _ctrlSpoilerText, _ctrlButtonSpoiler];
#

This is what I have lying around.

winter dune
#

ok, so the only thing is to modify the dialog with sqf, right?

#

i'll work on it, thanks

little eagle
#

I don't see how you'd do it otherwise without breaking everything that uses the dialog.

winter dune
#

๐Ÿ‘

little eagle
#

Edited line 2 to make it work more reliably...

finite jackal
#

Anyone have experience using bis_fnc_replaceWithSimpleObject?
biki says Use with caution as this technique is not very clean - should not be used for many objects and definitely not in MP games., Why exactly is it not clean and should be avoided?

little eagle
#

Because you have to create a full object first and this function then deletes it and creates a simple object copy.

#

May aswell create the simple object from the start.

unborn ether
#

^ and sometimes that fails to replicate the attributes, or fail in general if used many times.

#

sometimes dir/up is wrong, sometimes object just disappear for some reason.

finite jackal
#

Does it run locally on every client? This would be used once at the very beginning of a mission

little eagle
#

Server only.

unborn ether
#

@finite jackal Better do it in preInit then.

little eagle
#

There are no objects to replace at preInit.

#

The pre stands for before objects are created.

finite jackal
#

Currently have it in the Object: Init field of around 130 objects that are always there since mission start

unborn ether
#

@little eagle Well I still able to apply hideObjectGlobal to a map objects in preInit ยฏ_(ใƒ„)_/ยฏ

little eagle
#

Code?

#

... ?

weary pivot
#

How do i do a sequence of animations. do you just repeat this: player switchMove "YourAnimation";
sleep 2.00;

#

Then repeat?

unborn ether
#

@commy2 ๐Ÿ’ฉ#9913 Well you can simply launch preinit function from a server which does hideObjectGlobal on any map object - it will work.

meager heart
#

@weary pivot
playMove will add next anim to the queue, so you can do it like this

0 = player spawn { 
    _this playMove "amovppnemstpsraswrfldnon";  
    _this playMove "amovpknlmstpsraswrfldnon";  
    _this playMove "ainvpknlmstpsnonwnondnon_medic_1"; 
    _this playMove "amovppnemstpsraswrfldnon";  
    _this playMove "amovpknlmstpsraswrfldnon"; 
    _this playMove "ainvpknlmstpsnonwnondnon_medic_1"; 
};

or you can adjust timings with sleep

0 = player spawn {
    sleep 2; 
    _this playMove "amovppnemstpsraswrfldnon"; 
    sleep 2; 
    _this playMove "amovpknlmstpsraswrfldnon";  
    sleep 2;
    _this playMove "ainvpknlmstpsnonwnondnon_medic_1"; 
};

or you can check when animation is finished like this

0 = player spawn {
    private _animation = toLower "Acts_welcomeOnHUB01_PlayerWalk";
    _this switchMove _animation;

    waitUntil {
        hintSilent format [ "Animation state: \n%1", animationState _this];
        (animationState _this select [0, count _animation] != _animation)
    };
    hint "Animations finished";
};

or you can check it with https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#AnimDone

subtle ore
#

Why the toLower? ๐Ÿค”

unborn ether
#

@meager heart AnimDone is the best way, because unsheduled.

ruby breach
#

@subtle ore My guess would be habit in comparing strings and case sensitivity

#

animationState returns forced lowercase

#

(granted, != isn't case sensitive, which is why I say habit)

subtle ore
#

I see, I'm not sure I ever run into case sensitive classes or commands all that often

ruby breach
#

isEqualTo, in, switch do etc are all case sensitive for string comparisons

subtle ore
#

okay, good t o know

austere granite
#

== is not case sensitive for string comparison

#

#fakenews

#

isEqualTo is case sensitive, what would in other languages be ===

ruby breach
#

Sorry yeah, it's isEqualTo that's case sensitive

meager heart
#

why lowercase...

//"AmosffsfvPercMstpsfsfsSlowsffsfWrflDnon"
/*
    A mov    //ACTION move
    P erc    //POSITION erect
    M stp    //MOVE stopped
    D non    //DIRECTION none
    W rfl    //WEAPON rifle
    S low    //STATE lowered
*/

fix for isEqualTo yes which was replaced with == ๐Ÿ˜€

#

@subtle ore

subtle ore
#

I see now, always wondered the naming convention of all those lol.

meager heart
#

@unborn ether yes AnimDone is the best way i think

#

but maybe there is some better solutions idk

unborn ether
#

@meager heart AnimDone is handled by the engine internally, doesn't require spawn so stays unscheduled, easy to use. Nothing else can benefit the same.

unborn ether
#

Can anybody unearth a huge secret about how BIS adds additional controls such as text and progress bars to a RscListBox like its done in gear?

golden storm
#

Hi everyone, i'm using a script to spawn a group of units at a set position with the BIS_fnc_spawngroup function, but since i'm using an Area trigger and it being an P mission, when many people steps in ti executes for each client

#

Is it enough to set said trigger to execute "Server Only"?

#
for "_i" from 2 to 4 do {
_spawnPos = selectRandom [getMarkerPos "spawn2",getMarkerPos "spawn3"];

_UnsGroup = createGroup [east,true];

_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainriflesquadone"),(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainweaponsquadtwo")];
_UnsGroup = [_spawnPos, EAST, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = selectRandom [[2105.670,859.581],[2040.258,722.678]];
_UnsGroup addWaypoint [_ranWay,0];
}

Thats the script i'm using, would it be enough to add:

if (!isServer)  exitwith {}; 

At the beggining?

#

SAy, for example:

if (!isServer)  exitwith {
for "_i" from 2 to 4 do {
_spawnPos = selectRandom [getMarkerPos "spawn2",getMarkerPos "spawn3"];

_UnsGroup = createGroup [east,true];

_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainriflesquadone"),(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainweaponsquadtwo")];
_UnsGroup = [_spawnPos, EAST, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = selectRandom [[2105.670,859.581],[2040.258,722.678]];
_UnsGroup addWaypoint [_ranWay,0];
}
}
strange urchin
#

I feel like BIS just adds more controls to the same dialogue

warm gorge
#

Is it worth using a headless client to take load off the server from serverside scripts etc?

velvet merlin
#

how to optimize this best?

waitUntil {(_obj distance (_obj findNearestEnemy (position _obj))) < 40};```
#

just a sleep (1 + random (1/_skillUnit))?

subtle wigeon
#

Anybody have or know where to get a template for scripting task in sqf. I need to make a 5 task mission. Each one linked to the next. Thanks.

#

The wiki isnโ€™t helpful

golden storm
#

@subtle wigeon rn its too late over here but first thing morning i log into Discord i'll give you an example

subtle ore
#

The wiki just fine, I think it's your lack of experience in SQF that isn't helpful

still forum
#

AnimDone is the best way, because unsheduled. @unborn ether
unscheduled* And no. It's the best way because it's a Eventhandler. Not because it's unscheduled.
@little eagle Map objects might exist at preInit. But not objects placed in the mission which is what you meant.
Can anybody unearth a huge secret about how BIS adds additional controls such as text and progress bars to a RscListBox like its done in gear?
They have unlimited possibilities in engine. Stuff that might not be exposed to scripts or config.

unborn ether
#

BOOM ๐Ÿ˜„

still forum
#

@velvet merlin You wont optimize something by making it slower :D
The engine already won't execute that code if it doesn't have enough free time. And if the engine has too much free time and wants to use it for something. Why not let it ^^
I have no idea what your usecase is so I don't know why you would random and what _skillUnit is

#

If you mean the inventory UI by gear Then that's mostly in engine. So they are most likely using stuff that isn't exposed

unborn ether
#

Yep that one that is RscDisplayInventory under idd=602

velvet merlin
#

ended up with this

_position = position _obj;
_skill = skill _obj;

waitUntil
{
    sleep (1 + random (1/_skill));
    (_obj distance (_obj findNearestEnemy _position)) < 40
    };```
#
  1. have it checked way less frequently
  2. natural delay as AI should have no inhuman speed
  3. skill modifier
still forum
#

What if position changes?

unborn ether
#

@velvet merlin ^ position should be private to waitUntil to keep it updated.

velvet merlin
#

sorry context was missing: the unit is inside a static weapon

meager heart
#

also maybe just sleep <number> ? ๐Ÿ˜€

velvet merlin
#

th escript is to make the crew eject if an enemy number gets nearby

#

@meager heart see 3.

meager heart
#

๐Ÿ˜ฎ

velvet merlin
#

it should not be the same all the time

meager heart
#

reveal after waitUntil ?

still forum
#

The unit already knows about the enemy. So why reveal?

velvet merlin
#

hm fair idea. however is it natural?

#

is awareness still fully group based?

still forum
#

According to wiki yes.

velvet merlin
#

didnt they change this a bit in A3 finally

still forum
#

Wiki says both though.
Returns a null object if the object's group does not know about any enemies. This command will return nearest object that is known to the unit and is considered enemy

meager heart
#

i thought task is to make ai react somehow, Dedmen

still forum
#

@meager heart Yes. It will leave/eject it's gun.

#

Reveal isn't needed though as the unit already knows about the enemy. So telling it again won't do much

meager heart
#

maybe you're right... but knowledge values can be low, but if you force it ๐Ÿค”

still forum
#

Maybe you should use https://community.bistudio.com/wiki/getHideFrom
Because the AI might know that some enemy is 100m away and findNearestEnemy will find them. And your script will trigger if that enemy is 40m away. Although the AI itself still thinks he is far away

velvet merlin
#

good find. ty

meager heart
#

also if enemy is player maybe setUnitTrait camouflageCoef ? ๐Ÿ˜ฌ

neon snow
#

Would there be a way to create if expression, that will check if "_var" variable is equal to any variable in array?

still forum
#

Yes...

#

Many ways infact

#

Easiest way if (_var in _array)

#

Checks if _var is in _array

neon snow
#

How would I do that with string?

#

Same?

still forum
#

Yeah

#

For strings that checks case-sensitive though

neon snow
#

Thank you very much ๐Ÿ˜ƒ

warm gorge
#

Are headless clients worth using to take load off the server from serverside scripts etc? Im working on a mission but not sure if it is worth implementing the use of one.

still forum
#

We can't tell you that

#

If your script is so heavy that it's worth it then it's probably worth it.
If it's not worth it then it's probably not worth it.

compact galleon
#

Why can't you log into the wiki anymore?

still forum
#

you mean can't register?

compact galleon
#

No, log in

#

Clicking "Log In" says you can't register

#

But I'm already registered

still forum
#

Exactly that's what I meant ๐Ÿ˜„

#

That should go into #community_wiki ;)
BI Account was merged into everything. So you have one BI account for BIF/Wiki/Store.
If you access Wiki for the first time it has to link your existing account to your BI account or it will register a new one

#

Maybe the name on your BI account isn't exactly the same as your biki account so it tries to create a new one. Which is currently disabled because Spambots found how easy it is to use a BI Account to spam the wiki

compact galleon
#

My BI account is MulleDK19. My Wiki account is MulleDK13

still forum
#

Ah yeah see...

#

I guess you could try to temporarly rename your BI account

#

then try to access wiki and rename back

compact galleon
#

I hope that doesn't work

#

Major security issue if you can just hijack people's accounts by changing your name

still forum
#

I guess it uses email and name

compact galleon
#

Doesn't work either

#

"This nickname is already taken."

#

When trying to change to MulleDK13

still forum
#

So someone else either took that name for some reason. Or it was auto generated ๐Ÿ˜„

#

New BI account stuff is certainly alot of fun

#

Also... The wiki's SSL cert is invalid for me ๐Ÿ˜„

#

Probably my companies fault.. I have no friggin Idea what's going on here. I can't push to github, half an hour ago google was unreachable and now that ssl cert is broken

compact galleon
#

Fantastic...

still forum
#

Wiki says MulleDK13 and MulleDK19 both don't exist ๐Ÿ˜„ Fun

compact galleon
still forum
#

Oh god lowercase

#

Wiki can't lowercase anymore because of other issues