#arma3_scripting

1 messages ยท Page 232 of 1

austere granite
#

No

sacred fox
#

oh ok

little eagle
#

looks good to me

austere granite
#

[cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false]; right?

little eagle
#

or that

#

try both

sacred fox
#

ah a missing bracket.. yeah will do

little eagle
#

This is a good time to rant at addBackpack vs addVest and addUniform
Why does addBackpack require a local unit, but addVest and addUniform don't ?

sacred fox
#

its still says
'(_this select0) |#|setHit (_this select 1)'
Error setHit: Type Number, expected array

little eagle
#

Same with addWeapon and addHeadgear

sacred fox
#

[cursorobject,0] remoteexec ['setfuel',cursorobject,false];
[cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];

little eagle
#

Should work

#

don't restart the mission. always go back to editor

sacred fox
#

hm, doesnt the number off arrays match up on both sides?

#

yes

#

i do that

little eagle
#

if you restart your display event will be caried over

#

and you end up with the previous one extra

#

because display 46 isn't destroyed if you restart

sacred fox
#

ah now it works

little eagle
#

ha! knowledge is the key

sacred fox
#

maybe i just hit restart that particular time xD

#

i usally dont

little eagle
#

true

sacred fox
#

ok, atleast i got the active script working now, so now i just need to add that postinit

#

btw, at the moment this script will still reside inside init.sqf, should it still be like that?

little eagle
#

I get worked up at "this shouldn't even work wtf" issues ๐Ÿ˜›

#

chrish, you probably want to test in a new mission without init.sqf

#

You can test your CfgFunctions settup in a descrition.ext mission

#

And transfer it to config.cpp when it works

sacred fox
#

so i should just put this in the config.cpp now?

or description.ext

class CfgFunctions
{
class ImmobilizerTag
{
class CustomWeapons
{
class Immobilizer
{
postInit = 1;
};
};
};
};

little eagle
#

Just keep in mind to load the mission ingame when you add files

sacred fox
#

im not using init.sqf at the moment.. so far im still in the config.cpp, i havent really divided it yet :S

little eagle
#

i can't remember CfgFunctions at all, because I usually use a different frame work

austere granite
#

Great.... so apparently somehow in eden description doesn't get reloaded if you reopen the same mission without first switching to another mission

little eagle
#

You can check the ingame functions viewer if your function is defined

austere granite
#

10/10 30 mins trying to figure out why the fuck this function doesn't work

sacred fox
#

but yeah, there is only one link for me know.. where should i really put this script?, inside the CfgFunction beside the postinit = 1;?

#

one link missing*

#

or in a separate sqf and call it from somewhere?

little eagle
#

the script has to be in the mission when you use description.ext and inside the folder of the addon if you make a mod

sacred fox
#

so i need to add the script into the mpmission.sqm on the actual server?

little eagle
#

CfgFunctions should have the path under file = "";

sacred fox
#

this is purely a mod

#

i rather not want to have to deal with the missionfiles

#

so i just add it to descriptions.ext then, and find that file argument you mentioned? ๐Ÿ˜›

#

ext = ".fsm"; // Set file type, can be ".sqf" or ".fsm" (meaning scripted FSM). Default is ".sqf".

#

i wonder if this works

class CfgFunctions
{
class ImmobilizerTag
{
class CustomWeapons
{
class Immobilizer
{
postInit = 1;
ext = "/immobilizer/immobilizer.sqf"
};
};
};
};

austere granite
#

No, only 2 tags

#

class CfgFunctions
{
class ImmobilizerTag
{
class Immobilizer
{
postInit = 1;
file= "/immobilizer/immobilizer.sqf"
};
};
};

#

Or better

#

actually wait

#

nvm my bad

sacred fox
#

haha ok, so the last one you posteD?

austere granite
#
class CfgFunctions {
    class ImmobilizerTag {
        class CustomWeapons {
            file = "immobilizer";
            class Immobilizer {
                postInit = 1;
                description = "";
            };
        };

    };
};
#

Basically it's Tag > Category > Function

sacred fox
#

ok, it doesnt say file on bis wiki :S

class CfgFunctions
{
class myTag
{
class myCategory
{
class myFunction
{
preInit = 1; // (formerly known as "forced") 1 to call the function upon mission start, before objects are initialized. Passed arguments are ["preInit"]
postInit = 1; // 1 to call the function upon mission start, after objects are initialized. Passed arguments are ["postInit"]
preStart = 1; // 1 to call the function upon game start, before title screen, but after all addons are loaded.
recompile = 1; // 1 to recompile the function upon mission start
ext = ".fsm"; // Set file type, can be ".sqf" or ".fsm" (meaning scripted FSM). Default is ".sqf".
headerType = -1; // Set function header type: -1 - no header; 0 - default header; 1 - system header.
};
};
};
};

austere granite
#

If you set the folder for category, it retrieves the Function based on fn_function.sqf filename

sacred fox
#

so i cant use filepath?

austere granite
#

You can, but if you got more functions then you don't have to type the full file path out 20 times

#

Look at the functions example on BIKI, it explains this stuff

#

Your way works, but that example is what I'd use if I were you

sacred fox
#

ok, i usally end up finding outdated biki stuff -.-

#

guess i got bad references

little eagle
#

this is one of the pages that isn't outdated

lone glade
austere granite
#

In what you linked (because file path isn't mentioned itll look for a file)

"functions\ImmobilizerTag\CustomWeapons\fn_immobilizer.sqf";

lone glade
#

O RLY ?

austere granite
#

Yeah so in Alganthe's screenshot it'll; use a file on the location "functions\misc\fn_VA_filter.sqf"

#

The former these days I think

lone glade
#

KK is a BI dev now

#

there's also an other new dev

sacred fox
#

class CfgFunctions {
class ImmobilizerTag {
class CustomWeapons {
file = "/immobilizer/immobilizer.sqf";
class Immobilizer {
postInit = 1;
description = "";
};
};

};

};

#

im getting confused again.. maybe we should start with how they work. what a tag is etc ๐Ÿ˜›

austere granite
#

A tag is just so you don't get overlap with other peoples functoins

lone glade
#

okay, the first class (under CfgFunctions) is going to be the first word of your function

austere granite
#

So if I have a mod with a function called Immobilizer and you have one.. that they don't fuck up

lone glade
#

so BI tag is BIS_

sacred fox
#

ah ok

#

thats why bis called is BIS_fnc?

#

and CBA_fnc for cba etc?

lone glade
#

if I want my function callled herp to be derp_fnc_herp derp is going to be the first class

little eagle
#

and CBA_fnc for cba etc?
exactly

lone glade
#

second class is there for sorting files, third class is the name of your function.

#

fnc is added automagically.

sacred fox
#

oh ok

lone glade
#

so in my case if herp is in functions\misc\ I'll have

sacred fox
#

chr_immobilizer how would that then be?

jade abyss
#
class CfgFunctions
{
    class c2017
    {
        class vehicle
        {
            file = "YourPathToTheSQF";
            class MyFunction {};
        };
    };
};

Result:
c2017_fnc_MyFunction

little eagle
#

You don't even need to know your final functions name in this case, because it's postInit = 1 only anyway

sacred fox
#

chr the first class?

#

ah thanks Dscha

jade abyss
#

Name of the File: FN_MyFunction.sqf

#

class vehicle = Subclass for sorting

lone glade
#
class CfgFunctions
{
    class tag {
        class stuff {
            file = "YourPathToTheSQF";
            class MyFunction {};
        };
    };
};
jade abyss
#

test

#

"" tag_fnc_MyFunction "" (in this case)

austere granite
#
{
    class Chrish88 {
        tag = "c88";
        class stuff {
            file = "YourPathToTheSQFFOLDER!!!";
            class MyFunction {}; // points to "fn_MyFunction.sqf in above folder
        };
    };
};```
#

๐Ÿ˜„

sacred fox
#

so

class CfgFunctions
{
class IBZ
{
class Immobilizer
{
file = "immobilizer/immobilizer.sqf";
class Immobilize {};
};
};
};

would be IBZ_fnc_Immobilize?

jade abyss
#

Yep

austere granite
#

No

jade abyss
#

No

sacred fox
#

ah not the file

little eagle
#

that's wrong

jade abyss
#

file = "immobilizer/immobilizer.sqf"; == Folder

#

file = "immobilizer";

little eagle
#

^

jade abyss
#

Filename: "fn_immobilizer.sqf"

sacred fox
#

class CfgFunctions
{
class IBZ
{
class Immobilizer
{
file = "immobilizer/";
class Immobilizer {};
};
};
};

so this would point to the immobilizer.sqf?

jade abyss
#

without /

little eagle
#

remove the /

lone glade
#

nope, still missing the fn_

little eagle
#

alganthe, you troll

lone glade
#

the name of your function under that path need to be fn_immobilizer.sqf

little eagle
#

oh, right

sacred fox
#

really?

jade abyss
#

Filename.

austere granite
#

Yes

lone glade
#

yes.

austere granite
#

Filename of your file is going to be fn_{CLASSNAME}.sqf

sacred fox
#

ah ok

#

but where do i specify the path if say it resides in a scripts folder for example [mod]/scripts/fn_immobilizer.sqf?

jade abyss
#
class CfgFunctions
{
    class MyFNC
    {
        class vehicle
        {
            file = "YourPathToTheSQF"; //e.g. (from Addon) "\YourAddonPBO"
            class MyFunction {};  //e.g. "YourAddonPBO\fn_MyFunction.sqf"
        };
    };
};

Result:
MyFNC_fnc_MyFunction

little eagle
#

the path is set in the file = entry

sacred fox
#

so mod/scripts

austere granite
#

mod\scripts

little eagle
#

Its called file,because usti hlavne

austere granite
#

lel

sacred fox
#

haha, i have seen those weird words everywhere ๐Ÿ˜›

jade abyss
#

because stary svetlo @little eagle

austere granite
#

That's the turret hitpoint right? ๐Ÿ˜ƒ

little eagle
#

doplonvani mate

jade abyss
#

psht

lone glade
#

call medevac they're ded

jade abyss
#

Take that: Kolgujev!

austere granite
#

Do arma modding for a while and you end up speaking fluent Czech

jade abyss
#

hehe

lone glade
#

HELP THE GERMANS ARE ATTACKING US AGAIN (france)

little eagle
#

"fluent"

#

setDammage

jade abyss
#

Ruhรค! Still gestanden! @lone glade

little eagle
#

he is french

jade abyss
#

Don't care if he likes Baguette

lone glade
#

I eat 1 a day

#

like every frenchmen should.

jade abyss
#

+You also drive backwards all the time? ๐Ÿ˜„

lone glade
#

T.T

sacred fox
#

so this should work?

class CfgFunctions
{
class IBZ
{
class Immobilizer
{
file = "immobilizer/";
class Immobilizer {};
};
};
};

and would be IBZ_fnc_immobilizer?

jade abyss
#

XD

sacred fox
#

oh bracket

#

slash i mean

#

class CfgFunctions
{
class IBZ
{
class Immobilizer
{
file = "mod\immobilizer";
class Immobilizer {};
};
};
};

lone glade
#

๐Ÿ‘

jade abyss
#

@sacred fox If its in an Addon file: "" file = \immobla"; "" || If missionfile: "file = "Immobla";

#

"" \ "" <-- Important!

sacred fox
#

if its called fn_immobilzer and reside in mod\mobillizer?

#

ah ok

#

why is backslash important for paths?

jade abyss
#

Missionfile or Addon file (.pbo)?

#

Because Arma, thats why

little eagle
#

that how they distignuish between addon and mission paths

sacred fox
#

ah ok, nice to know

#

class CfgFunctions
{
class IBZ
{
class Immobilizer
{
file = "\mod\immobilizer";
class Immobilizer {};
};
};
};

#

?

little eagle
#

sometimes they even lead with @

jade abyss
#

Filename is?

#

With @?? oO

sacred fox
#

fn_immobilizer.sqf

little eagle
#

yes

jade abyss
#

Should work @sacred fox

#

strange, never seen it anywhere @little eagle

sacred fox
#

would this be IBZ_fnc_Immobilizer then?

little eagle
#

searching for it

#

...

jade abyss
#

ffs... so many commy2 ... ... ...

#

10x Commy2 | 1x Commy22

#

wth did you do there?

lone glade
#

he didn't wanted to sign up

#

which he ended up doing :^)

jade abyss
#

oh boy

austere granite
#

Does anyone know a good way to check whether you're previewing mission these days? The old way doesn't work anymore

((uinamespace getvariable ["gui_displays",[]]) find (finddisplay 26) == 1);
``` that used to return true in editor preview
lone glade
#

eeerm, why do you need to check for preview ?

sacred fox
#

so commy, now when i have the CfgFunction set up and, the script itself, should it just work now, aslong as the conditions in the script are met?

austere granite
#

Because I want some extra debug mission editing formatting while i'm previewing in editor

#

Just a couple little things that you want to see while you're designing the mission

jade abyss
#

Just test it @sacred fox || Add a simple: " hint "i am working"; " then do a "" [] spawn Tag_fnc_MyFnc ""

lone glade
#

just check if you have access to the debug console, isn't that faster ?

jade abyss
#

In the editor

sacred fox
#

ok

jade abyss
#

OR " hint str Tag_fnc_MyFncName "

#

this should show you the fnc in the hint box

austere granite
#

algantha, rather have editor preview in this case

little eagle
#

foudn it

#
class CfgSounds
{
    sounds[] = {};
    class addonsound1
    {
        name = "sound from addon";
        // start path to sound file in AddOn with @
        sound[] = {"@a3\Ui_F_Curator\Data\Sound\CfgSound\visionMode", 0.8, 1};
        titles[] = {0,""};
    };
};
jade abyss
#

foudn!

jade abyss
#

oh wow oO

lone glade
#

BI = Bohemia's Inconsistency

#

even better.

little eagle
#

It was shoehorned in later

sacred fox
#

i got a bunch of if statements when i did it Dscha ๐Ÿ˜›

jade abyss
#

Thats the _fnc

sacred fox
#

ah so this is correct? ๐Ÿ˜ƒ

jade abyss
#

[] spawn FNC Name

austere granite
#

hes

#

yes

little eagle
#

[] spawn FNC Name
nah. it's postInit . He doesn't even need that

jade abyss
#

In Debug console

sacred fox
#

oh forgot the postinit

lone glade
#

just drop a diag_log in there and check the rpt

sacred fox
#

yh.. well nothing happened

#

and the script doesnt seem to work O.o

#

it didnt throw an error though

lone glade
#

commy go

sacred fox
#

the function itself is

//fn_immobilizer.sqf

if (hasInterface) then {
0 spawn {
waitUntil {
(!isNull (findDisplay 46))
};
(findDisplay 46) displayAddEventHandler ["MouseButtonDown",
{ if (currentWeapon vehicle player == "fakeWeapon") then {
[cursorobject,0] remoteexec ['setfuel',cursorobject,false];
[cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];
hint 'Vehicle immobilized!';
};
}];
};
};

little eagle
#

restart the game and try again

#

is this still description.ext?

#

woa red colour

sacred fox
#

i run this, and expect the script to work..

[] spawn IBZ_fnc_Immobilizer;

#

no its fn_immobilizer.sqf

#

and the CfgFunction class resides in config.cpp

little eagle
#

check the functions viewer if it's there

#

keep in mind that you have to start a new mission for these functions to be defined

sacred fox
#

yeah it is.. but its blank and i know why lol xD

#

file = "\mod\immobilizer"; i forgot to change to the actual modname xD

little eagle
#

it should complain if it can't find the file

sacred fox
#

im trying again now

#

is it any point in downloading the discord app for computer btw? ๐Ÿ˜ƒ

jade abyss
#

Start your game with "ShowScriptErrors"

sacred fox
#

and also alganthe what editor are you using? ๐Ÿ˜ƒ

#

too late :P, i will do that, after this test if it doesnt work ๐Ÿ˜›

jade abyss
#

ALWAYS start the game with it ๐Ÿ˜‰

lone glade
#

@chris88 it's atom

sacred fox
#

ah ok

#

hang on find another typo

#

found*

austere granite
#

To answer my questoin: Editor preview >>

((alldisplays find (finddisplay 26) in [0,1]) || (alldisplays find (finddisplay 313) in [0,1]))
little eagle
#

oh god

austere granite
#

That's from Debug console code โค :p

lone glade
#

atom
themes:

  • atom-material-UI
  • atom-material-syntax

Packages:

  • highlight-selected
  • keyboard-localization
  • language-arma-atom
  • linter-mixed-indent
sacred fox
#

btw where is show script errors? ๐Ÿ˜›

little eagle
#

I wouldnt rely on the order of alldisplays

jade abyss
#

Arma Launcher?

austere granite
#

Meh, it's not a very critical function, just a bit helpful and this is ripped from BIS stuff so obviously it's absolutely perfect way to do it

sacred fox
#

ah under author

little eagle
#

this is ripped from BIS stuff so obviously it's absolutely perfect way to do it
even worse

austere granite
#

/s

lone glade
#

BI funcs spook me.

little eagle
#

BIS_fnc_weaponComponents is the worst

sacred fox
#

ok, now it shows up in the function viewer.. but it doesnt seem to work:S

lone glade
#

it's funtime now, DEBUG TIME

sacred fox
#

but if i take the same code as in the script i put it in debug window it works ofcrouse ๐Ÿ˜›

little eagle
#

"arifle_mx_black_f" call BIS_fnc_weaponComponents
["arifle_mx_f"]

"laserdesignator_02" call BIS_fnc_weaponComponents
["laserdesignator"]

sacred fox
#

got any idea? afaik it should work, as the script itself works, and the function is there also showing the script.. but when only spawning the function, or not spawning the function du to postinit =1; it doesnt work :S

jade abyss
#

Once again: Try with a simple " hint "I am working" "

#

Then [] spawn FNCName

#

Just try that. If that works -> Add the normal code

sacred fox
#

it says Iam working

#

so does that mean that the function is working? even though it isnt? ๐Ÿ˜›

#

actually nevermind ^^

#

potinit is the probably cause.. these fucking typos xD

little eagle
#

potinit ๐Ÿ˜„

sacred fox
#

sometimes you stare yourself blind on the punctuations :S

#

wtf, i still have to spawn it to use it,, it wont "postinit" ๐Ÿ˜›

jade abyss
#

... ShowScriptErrors, check the .rpt, cmon, we helped you alot. Now you can do it on your own ๐Ÿ˜‰

sacred fox
#

yh sorry.. is there .rpt even for editor?

#

im really thankful, i have learnt alot from, you now! thanks a bunch! ๐Ÿ˜„

lone glade
#

RPTs start when you start your game and end when you close your game.

#

unless you use -noLogs then you won't have any.

sacred fox
#

ok, thanks ๐Ÿ˜ƒ

#

well it doesnt load in the postinit thats for sure.. and i hate to bother you guys again, but i tried to google some, but couldnt find any answer why my postinit, doesnt seem to work :S

21:14:59 [18727,71.091,0,"XEH: PostInit started."]
21:14:59 [18727,71.116,0,"CBA_VERSIONING: cba=2.3.0.160217, "]
21:14:59 [18727,71.126,0,"XEH: PostInit finished."]

only CBA appears to load

fallen locust
#

theres your first issue ๐Ÿ˜› hue hue hue its a joke

sacred fox
#

haha ๐Ÿ˜›

#

i mean spawning my function works.. just not the postinit -.-

little eagle
#

strange

#

copy your config in the chat?

sacred fox
#

class CfgFunctions
{
class IBZ
{
class Immobilizer
{
file = "\airpatrol\immobilizer";
class Immobilizer {};
postinit = 1;
};
};
};

#

and the function works

little eagle
#

do this:

#

open debug console

jade abyss
#

wait a sec

#

does this even work?

little eagle
#

and in one of the four lines with watch enter thiss:

jade abyss
#

class Immobilizer { postinit = 1;};

#

Shouldnt it be like that?

little eagle
#

nvm found the issue

sacred fox
#

ah

#

i feel so stupid -.-

little eagle
#

class Immobilizer {};
postinit = 1;
shoudl be
class Immobilizer {postinit = 1;};

sacred fox
#

๐Ÿ˜›

jade abyss
#

toooo slow ๐Ÿ˜›

little eagle
#

ahh, the scrolling didn't work

#

but that should fix it

jade abyss
#

๐Ÿ˜ƒ

sacred fox
#

i need to take a break im staring myself blind.. if i actual check the BIS reference for CfgFunctions, its that structure..i just feel stupid ๐Ÿ˜›

little eagle
#

at least you din't ask how to binarize a pbo

sacred fox
#

works like a charm! ๐Ÿ˜ƒ

#

well that i know ^^

little eagle
#

now here is a prolem with your script

sacred fox
#

and there is alot of things there that can pevent it ๐Ÿ˜›

little eagle
#

it will not work in a save game

#

try it. save the mission and load the save game

sacred fox
#

okk, ill try

#

i dont want to sound stupid but how the fuck do i load a saved game?, i mean if i run the editor mission, and then saves it ingame, i cant find it to load anywhere in the editor either.. this makes me feel veeery stupido xD

little eagle
#

you have to export it as single player mission and then go main menu -> scenario

sacred fox
#

aha

#

then play it, and then save it?, and then load it again?

little eagle
#

exactly

#

loading is called "resume"

sacred fox
#

got it, k

little eagle
#

"restart" starts it over

sacred fox
#

yeah you're right it doesnt init

#

the second time

#

but would this be a problem when it should load when the server spawns the vehicle?

#

or adds the addon

little eagle
#

only if you resume a game in MP

#

same behaviour

#

most scripts and addons have this issue

#

even CBA and ACE

sacred fox
#

hm ok

little eagle
#

and that's what I'm working on since 3 weeks

sacred fox
#

so this wont work multiplayer then?

#

ah

little eagle
#

it will, but not resumed MP game

sacred fox
#

what counts as a resumed game then.. if the mission is ran on a dedicated server, and you just rejoin?

#

or do the mission need to be reloaded?

#

so for example server restarts?

#

this script will be run on a public EXILE server. not in its current state though, but yeah, thats the point

little eagle
#

when you resume it's a loaded save game

#

Dunno if EXILE supports that.

#

Apparently it's hard.

#

rejoining will work. That's called JIP and is different from resuming

#

There is another minor issue. if you restart the mission from inside the mission. Or use #restart on the server, you will have multiple mouse handler scripts

#

Doesn't make a difference in your case, except double the network traffic and execution time. Pretty minor

lone glade
#

if one thing is optimized in arma it's network traffic

little eagle
#

oh red text again

austere granite
#

I highly recommend saving all handles in an array, saving to uiNamespace and going forEach delete in that on missions startup to fix what commy said. ๐Ÿ˜„

#

What's the most effecient way to add small dialog / rscTitle elements to the map? I'd rather not do a loop with checking shownMap and hate doing stuff on keybinds like that. Is there some way I can hook into BIS display scripts to extend functionality or something else?

#

It would be great if BIS added a scripted EH for pretty much all their dialog opening/closing

lone glade
#

check addons enabled in the server RPT

blazing zodiac
#

Is there a simple way to check if a buildingPos is occupied?

lone glade
#

nearestObjects with man as argument with a super small radius

#

could also retrieve worldPos of those units and compare them to buildingPos

blazing zodiac
#

I like the nearestObjects way, should work for what I need it for. Thanks for the tip.

lone glade
#

also, BI added a new use to buildingPos in 1.56, it can now return all positions using -1 as index

blazing zodiac
#

Yes, I'm already using that. Cleans up quite a bit.

blazing zodiac
#

Yes, also thanks again alganthe. Your nearestObjects method worked fine for my purposes.

agile pumice
#

what was that site where the ace people hang out?

snow pecan
#

Probably thinking of slack

agile pumice
#

thanks

sacred fox
#

would this argument work?

waitUntil{isNil CursorObject} or how would i go to check if its defined or not?

zealous solstice
#

no

#

isNull is there the right point

sacred fox
#

ah ok.. so thhe value "<NULL-object>" you get from watchfield in the debug console is that isNull? ๐Ÿ˜ƒ

zealous solstice
#

and isNil requise code or string

sacred fox
#

ah ok

#

would this work.. the logic thinking is really giving me a headache now, with all the operators and boolean values XD

if (hasInterface) then
{
0 spawn
{
waitUntil
{
(!isNull (findDisplay 46))
};

(findDisplay 46) displayAddEventHandler ["MouseButtonDown",
{
  targetHit = True;
  []spawn 
    {
    waitUntil{isNull CursorObject}
    targetHit = False;
    };
    sleep 12;
  if (targetHit && currentWeapon vehicle player == "fakeWeapon") then
      {
        [cursorobject,0] remoteexec ['setfuel',cursorobject,false];
        [cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];
        hint 'Vehicle immobilized!';
      }
       else 
        {      
        targetHit = false;
        hint 'Immobilization failed!'
        };
}];

}

};

#

shoule work.. but there is something wrong.. and i cant find it, if its a punctuation or something

#

oh, i need to modifiy the else statement otherwise it would trigger always when im not aiming at the vehicle i guess

zealous solstice
#

@sacred fox add 3 ` befor and after your code and its better readable

#

just as small tip

sacred fox
#

3 ' what? ๐Ÿ˜›

zealous solstice
#

no `

#

or better befor and after your code hier in discord ```

sacred fox
#

just need to find that sign haha ๐Ÿ˜›

#

found it

#
if (hasInterface) then
{
  0 spawn
  {
    waitUntil
      {
        (!isNull (findDisplay 46))
      };

    (findDisplay 46) displayAddEventHandler ["MouseButtonDown",
    {
      targetHit = True;
      []spawn 
        {
        waitUntil{isNull CursorObject}
        targetHit = False;
        };
        sleep 12;
      if (targetHit && currentWeapon vehicle player == "fakeWeapon") then
          {
            [cursorobject,0] remoteexec ['setfuel',cursorobject,false];
            [cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];
            hint 'Vehicle immobilized!';
          }
           else if (!targetHit && !currentWeapon vehicle player == "fakeweapon") then 
            {      
            targetHit = false;
            hint 'Immobilization failed!'
            };
    }];
  }
  
};
#

oh!

#
else if (!targetHit) then 
            {      
            targetHit = false;
            hint 'Immobilization failed!'
            };
#

maybe thats better as a elseif statement

zealous solstice
#

if else not exist in SQF

sacred fox
#

haha lol ok xD

#

well then i need to rethink xD

zealous solstice
#

you only can do if () then {} else {if () then {} else{]} and so on

sacred fox
#

will the waintuntil spawn work in that way ?

#

ah ok

#

as it is now

#
waitUntil{isNull CursorObject}
zealous solstice
#

a sleep need scheduled enviroment too

sacred fox
#

hm ok.. well what i want is the script only to trigger if the cursor is still at the object after 12secs, so i thought a spawned waituntil would do the trick.. apparently not ๐Ÿ˜›

#

shouldnt the if statement and the script triggers after the sleeptime?, and then check if the variable targethit is true or false?, in my eyes this code looks right, but yeah iguess its not that simple

#
if (hasInterface) then
{
  0 spawn
  {
    waitUntil
      {
        (!isNull (findDisplay 46))
      };

    (findDisplay 46) displayAddEventHandler ["MouseButtonDown",
    {
      targetHit = True;
      []spawn 
        {
        waitUntil{isNull CursorObject}
        targetHit = False;
        };
        sleep 12;
      if (targetHit && currentWeapon vehicle player == "fakeWeapon") then
          {
            [cursorobject,0] remoteexec ['setfuel',cursorobject,false];
            [cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];
            hint 'Vehicle immobilized!';
          }
           
    }];
  }
  
};

zealous solstice
#

if you use a sleep in a unscheduled enviroment it only throw a RPT issue and contiune without waiting

#
if (hasInterface) then {
    0 spawn {
        waitUntil {(!isNull (findDisplay 46))};

        (findDisplay 46) displayAddEventHandler ["MouseButtonDown", {
            [] spawn {
                TAG_targetHit = True;
                waitUntil{!isNull CursorObject}
                TAG_targetHit = False;
                sleep 12;
                if (TAG_targetHit && currentWeapon vehicle player == "fakeWeapon") then {
                    [cursorobject,0] remoteexec ['setfuel',cursorobject,false];
                    [cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];
                    hint 'Vehicle immobilized!';
                } else {
                    if (!TAG_targetHit && !currentWeapon vehicle player == "fakeweapon") then {
                        TAG_targetHit = false;
                        hint 'Immobilization failed!'
                    };
                };
            };
        }];
    };
};
sacred fox
#

oh, so what is a scheduled environment then?

#

cant seem to find anything about that on the biki

lone glade
#

unscheduled cannot be halted, and waitUntil / while {} do run 10 000 only

zealous solstice
#

and that stop the frame

#

what means there is not ingame time changes

lone glade
#

scheduled is anything passing through the scheduler, so FSM, spawned code and some commands.

#

in scheduled code has a 3ms runtime for each script and can be halted.

sacred fox
#

so if i spawn the timer?

lone glade
#

was just answering the question, didn't looked at what you wrote above ๐Ÿ˜„

sacred fox
#

the sleep command is inside a spawn.. shouldnt this work?

zealous solstice
#

a sleep only work in a spawn

lone glade
#

oh and also sleep isn't precise.

sacred fox
#

-.- BIS giving me more and more headache ๐Ÿ˜›

lone glade
#

That doesn't change your case but it's knowledge you need to have.

sacred fox
#

yh

#

what about this then?

if (hasInterface) then
{
  0 spawn
  {
    waitUntil
      {
        (!isNull (findDisplay 46))
      };

    (findDisplay 46) displayAddEventHandler ["MouseButtonDown",
    {
      targetHit = True;
      []spawn 
        {
        waitUntil{isNull CursorObject}
        targetHit = False;
        sleep 12;
      if (targetHit && currentWeapon vehicle player == "fakeWeapon") then
          {
            [cursorobject,0] remoteexec ['setfuel',cursorobject,false];
            [cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];
            hint 'Vehicle immobilized!';
          };
        };
           
    }];
  };
  
};

#

now the sleep is inside a spawn, with the active script aswell

zealous solstice
#

@sacred fox add a tag to your vars to be sure that you dont collide with other scripts/functions

sacred fox
#

oh ok

zealous solstice
#

if you use a global variable

sacred fox
#

si just customize my varname

#

for example IBZ_targethit

zealous solstice
#

how ever you want to call your vars

sacred fox
#

yh, just wanted to makesure i got you right ๐Ÿ˜ƒ

zealous solstice
#

yes

#

i forexample have my vars like this JK_[module]_Name

sacred fox
#

something is still wwong withthe code thought, trying to run it in debug console, and it says ; missing, but i cant seem to find it, have been staring at this same code for a while now!

#

๐Ÿ˜›

#

ok

zealous solstice
#

and functions yes in the secound waitUntil is a ; missing

#

waitUntil{isNull CursorObject};

sacred fox
#

so it should be like this?
waitUntil{(isNull (CursorObject)}

zealous solstice
#

no there is a simicolon missing

sacred fox
#

oh right

#

frustrating when you cant find them, when you overlook them all the time -.-

#

how do i hint boolean values? :S

#

this doesnt seem to work

IBZ_targetHit = True;
   []spawn              
   {                 
     waitUntil{isNull CursorObject};
     IBZ_targetHit = False;
     sleep 3;       
     hint IBZ_targetHit;     };
#

im just testing stuff in the debugconsole

#

and im always having trouble hinting variables, or get hit forexample that reports the right value in the watchfield, but a long string in a hint

zealous solstice
#

str true

sacred fox
#

k

austere granite
#

Chris don't know if you're learning now or trying to get stuff to work, but if you're learning read up on types. Bool vs string vs scalar, etc.

queen cargo
#

not 100% true with the "if else does not exists in SQF" :)
it is just a little bit different as usual

    case (<ExpressionGoesHere>):{};
    case (<ExpressionGoesHere>):{};
    default{};
};```
will work
only thing im not sure about is how it will handle 2 trues
austere granite
#

It'll take the first

zealous solstice
#

nop that is not the same behavior as a if else

#

and is slower too

queen cargo
#

not true actually

zealous solstice
#

of cause

queen cargo
#

performance of switch has improved

#

it highly differs on the specific case what is faster in the end

zealous solstice
#
test1 = true;
test2 = true;

switch {true} do {
    case test1: {
        
    };
    case test2: {
        
    };
};
#

there switch case fail ๐Ÿ˜„

queen cargo
#

as i already said

#

not sure how it would behave with duplicated values

zealous solstice
#

it execute both

austere granite
#

Are you sure? I always thought it only executed first

queen cargo
#

think nobodies sure on this topic

#

switch is barely used anyway

austere granite
#

I use it a lot ๐Ÿ˜„

queen cargo
#

then why you do not know that?

austere granite
#

I haven't used it where multiple could be true in quite some time and can't remember on the other

queen cargo
#

go ahead and check it

#

still at work so no arma around ๐Ÿ˜ƒ

austere granite
#

anyone got game running

test1 = true;
test2 = true;

switch {true} do {
    case test1: {
        systemchat 'test1'
    };
    case test2: {
        systemchat 'test2'
    };
};

pls

queen cargo
#

ohh and as little promotion :)

else if (true) {...}```
works in OOS โค
sacred fox
#

why doesnt this work? :S

      if (IBZ_targetHit && currentWeapon vehicle player == "fakeWeapon") then
          {
            [cursorobject,0] remoteexec ['setfuel',cursorobject,false];
            [cursorobject,["motor",1]] remoteexec ['sethit',cursorobject,false];
            hint 'Vehicle Immobilized!';
            } else {if(!IBZ_targetHit) then {
            hint 'Immobilization Failed!';
            };
          };
#

it returns Vehicle Immobilized in both cases :S

#

this is the code prior to that

IBZ_targetHit = True;
      hint 'Keep on target!';
      []spawn 
        {
        if (isNull CursorObject) then {
        IBZ_targetHit = False;
        };
        sleep 3;
zealous solstice
#

@queen cargo OOS sucks and is slow as Fuck

queen cargo
#

bullshit

#

OOS is as fast as SQF is

#

darling ๐Ÿ˜ƒ

zealous solstice
#

in my test i have over 90% speed lose with OOS vs SQF Pure

queen cargo
#

would love to see that test

zealous solstice
#

its get horrible translated

queen cargo
#

lemme repeat: would love to see that test

#

as it would mean i got room where i have to improve

#

unless that, its just your word vs mine

#

still, there is room to improve
but 90% is definitly not the case!
eg. foreach of OOS currently requires another variable assignment for simplicity (but that wont cause a 90% drop as you described it)

simmilar things going to happen when you want to compare the for loops
OOS currently is not printing the for "_var" from 0 to 10 do {...} syntax as it is kinda complicated to detect and would consume too much time from other parts which need attention

#

so lemme ask again kindly:
would love to see those tests as you seem to have created quite solid tests to say im 90% slower then SQF

meager granite
#

@austere granite {true} and not (true) ?

austere granite
#

Just wondering whether switch exists on the first true result

#

or if it'll execute both cases

meager granite
#

it will not execute any as there is no cases for {true}

queen cargo
#

its a typo @meager granite ... hell not even i am doing that fucking nitpicking

austere granite
#

i just copied, you're right :p

#

Not my fault :3

meager granite
#

fuck

#

how do you do code tags here again?

queen cargo
#

`

meager granite
#

can't google it either for whatever reason

zealous solstice
#

3x

meager granite
#
switch {true} do {
    case true: {systemChat "nope"};
    case {true}: {systemChat "yep"};
};
#
switch (true) do {
    case true: {systemChat "yep"};
    case {true}: {systemChat "nope"};
};
queen cargo
#

the code was a typo

#

question is

#

two times true

#

expression true

#

what will get executed

meager granite
#

why is it red? ^

queen cargo
#

red is not sent

austere granite
#
    case true: {systemChat "yep"};
    case true: {systemChat "??"};
};```
meager granite
#

it will execute only the first case

austere granite
#

okay, so figured it would and i feel like i've used that, just couldn't check and made me unsure

zealous solstice
#

that is interessting in 1.54 i use it

deft zealot
#
call {
    if (_a == 1) exitWith {
        systemChat "First case";
    };
    if (_a == 2) exitWith {
        systemChat "Second case";
    };
};```
lone glade
#

that's a single code block, that's normal that the second if is going to be evaluated.

deft zealot
#

an alternative to switch

lone glade
#

switches are used to keep the code readable.

deft zealot
#

well its a control structure so its primary use is to control execution flow not readability

lone glade
#

switch is slower than a bunch of If's

deft zealot
#

depends

lone glade
#

nah, always the case I did some tests.

deft zealot
#

if you check the most common case first it might be faster

deft zealot
#

0.0161s vs 0.0149s

little eagle
#

looks like 10k loops. also ms.

#

depends on how many switches you use.

#

death loops?

deft zealot
#

i dont use while true

#

neither infinite for loops

#

nope

#

infinite loops are evil - thats what they tought me

little eagle
#

polling should be avoided, but some things can't be done otherwise

deft zealot
#

events are the replacement for polling

#

you re the programmer - you create the world ๐Ÿ˜„

#

vote for a drowned event handler

little eagle
#

idk, I don't touch medical if it can be avoided

#

allowdamage false doesn't work underwater, because the game outright kills you with oxygenRemaining 0

#

underwater is indeed totally broken

#

no one fights in water anyway

gaunt patio
#

TMW createUnitLocal is only available on VBS and not ArmA. RIP... guess I gotta hide the unit on every client

little eagle
#

most useless feature in A3

#

you are better off ignoring it imo. Especially if it means you need polling loops, because you can't change addon files

#

I just want to let the game run as smooth as possible, while having as much cool features as possible

gaunt patio
#

So it seems like hideObject on an AI unit doesn't disable it's collisions to anything other than bullets.

#

That's mildly annoying

lone glade
#

the ONLY while {true} do loop that I use is ```
derp_mission1Locations = ["missionMarker_Athira","missionMarker_Frini","missionMarker_Abdera","missionMarker_Galati","missionMarker_Syrta","missionMarker_Oreokastro","missionMarker_Kore","missionMarker_Negades","missionMarker_Aggelochori","missionMarker_Neri","missionMarker_Panochori","missionMarker_Agios_Dionysios","missionMarker_Zaros","missionMarker_Therisa","missionMarker_Poliakko","missionMarker_Alikampos","missionMarker_Neochori","missionMarker_Rodopoli","missionMarker_Paros","missionMarker_Kalochori","missionMarker_Charkia","missionMarker_Sofia","missionMarker_Molos","missionMarker_Pyrgos","missionMarker_Dorida","missionMarker_Chalkeia","missionMarker_Panagia","missionMarker_Feres","missionMarker_Selakano"];

while {true} do {
_selectedLocation = selectRandom derp_mission1Locations;

_isAOempty = count ((getMarkerPos _selectedLocation) nearEntities ["Man",PARAM_AOSize]);
if (_isAOempty == 0) exitWith {
    false
};
#

and i'm leaving it like this just for the lulz :^)

little eagle
#

why would you use the tag "derp" ?

lone glade
#

why not ? :^)

tough abyss
#

Is stringtable.xml limited to the languages in which a3 was released?

gaunt patio
#

The languages usable are listed at the bottom of that wiki page

tough abyss
#

Thanks

tough abyss
#

Can you access definitions made in Description.ext in SQF?

#

I'm looking for a way to have global definitions among all scripts

#

With #define, preferably not as variables

indigo snow
#

#defines only remain in current file

#

youd have to #include a file with all the defines in each file that needs em

tough abyss
#

Ok, thanks

austere granite
#

Dont know if anyone uses game updater tool here, but i so: How are you supposed to unfuck your steam after having used it?

#

It seems like the only way to log in again is by exitting steam completely and logging in

queen cargo
#

kidn of #offtopic_arma ... still relates to coding and somehow i do not expect much audience there ... but not SQF ... so ... anybody here has experience with WPF?
got some quite serious problem with it which i cannot solve

sacred fox
#

Im trying to get the Fired eventhandler to work, but it doesnt seem to trigger when fired from vehicle gunner?

#
if (hasInterface) then
{
  0 spawn
  {
    waitUntil
      {
        (!isNull (findDisplay 46))
      };

    (findDisplay 46) displayAddEventHandler ["Fired",      {hint "FIRE!";}];
#

it doesnt even trigger in debug console, when i fire with a rifle :S

#

ok, got it to work with just ```
player addeventhandler ["Fired", {hint "FIRE!";}];

#

nvm, got it ๐Ÿ˜ƒ

lone glade
#

Add the EH to vehicles too

lunar mountain
#

Greetings, can I access the action menu with scripts? I mean... does it have any IDC/IDD path , or is it completely engine side and it cannot be accessed?

queen cargo
#

better question @lunar mountain why would you want to do such a thing

lunar mountain
#

because you have no access at all to the engine actions. Does it really matter why?

#

correction: you have, but not how they appear

tender fossil
#

@lavish ocean any ETA on the scheduled/non-blocking callExtension?

#

Or is it just Enfusion stuff?

queen cargo
#

when was a non-blocking callExtension announced?

#

also ...

#

why you even bother about it dude

#

you can simply start the thread yourself

tender fossil
#

Dwarden said some months ago to me that they're working on non-blocking callExtension

#

Yes, but AFAIK, even if it runs in a thread, it blocks the whole engine (as stupid as it is)

#

That's what I've been told

queen cargo
#

no, it does not Ezcoo

tender fossil
#

It does block only the thread? o.O

queen cargo
#

...
lemme quickly write something for you together ...

lone glade
#

why the hell would you want scheduled callExtension ?

tender fossil
#

Database intensive mission

lone glade
#

if you can avoid the scheduler do it.

#

even more reasons to avoid the scheduler

tender fossil
#

Imagine what it would do to server performance if it used blocking callExtension all the time

#

Performance is critical, minimal response time is not

queen cargo
#

ahhh
now its more clear what you want ezcoo

#

you want a call extension where you can get the value later

lone glade
#

he want intercept.

queen cargo
#

no he does not alganthe

tender fossil
#

It's possible to wait, IF it's non-blocking.

queen cargo
#

pff ...

tender fossil
#

IF it blocks the execution, then we want to get the value later.

queen cargo
#

simply do what you always do on such things dude ...

#

start a worker thread

#

and just check with the extension if the value is available

#

instead of running the actual job in the callExtension

#

the worker thread is doing it

tender fossil
#

That's what we're considering already

queen cargo
#

"considering" ... it is the only correct way to do it

tender fossil
#

But why would we need to use such solution if callExtension blocks only the thread it's running in?

queen cargo
#

im sorry to ask but ... are you dump?
so ... lemme explain you what to do:

  • Create a new extension with two commands, namely:
    -- StartThread <-- Starts Thread if not yet started which does the heavy work
    -- IsFinished <-- checks if thread is done and returns result if it is, if not it simply will return empty

in StartThread you will create a new thread and detach it from your current stack
by doing so, you can return safely from the current function
After that you just poll "IsFinished" until it IS finished

there is your non-blocking whateverHeavyWorkYouMightDo callExtension
properly implemented

#

tipp: do not touch callExtension if you do not know what you are doing

#

that is the planar basic of how to properly work with callExtension

tough abyss
#

lol, someone is on her period

lunar mountain
#

he's always like this

queen cargo
#

im just nice as usual @tough abyss

lone glade
#

but he's right.

queen cargo
#

and thats why i still can be like that @lone glade ๐Ÿ˜ƒ

lone glade
#

I mean, if he was wrong or was doing it in pure spite ok, but this time he's right.

#

:^)

tough abyss
#

seems like it could work

#

but what @tender fossil probably means is that no such hacks would have to be developed

#

if you could do callExtension in an SQF thread

#

and it only blocks that specific SQF script

queen cargo
#

it is no "hack" @tough abyss
the problem is the invalid expectation that it should work like so

#

callExtension is calling from within a c/c++ context another function

#

due to the nature of non-virtualized stuff

#

(which C/C++ is)

#

it simply will not return out of there to the VM unless you return out of the function or tell the VM explicitly it can pause now

#

thus you always have to exit callExtension ASAP to give control back to the VM

#

callExtension is not something every scripter can catch up

#

you need serious knowledge about programming itself to actually do something with it

#

so to quickly conclude this garbage that just came out of my hands:
callExtension is blocking and should remain so! making it "non-blocking" would require at least three new script commands and a lot of background code

the reason why callExtension is blocking is because the VM gives the current context to another function which is expected to return ASAP
normally it would do so (all SQF commands you issue work that way btw. they block the VM for a short periode of time fully but exit fast enough) but when you simply stay inside of the function, the VM cannot further process, the engine cannot do too and thus you block all

its like "that guy" who drives with 10 over a highway with a single road thus blocking all other ppl behind him

fallen locust
#

callExtension -> parseParamas -> push that to a seperate dll thread -> return job ID or some indentifier -> arma does its thing -> callExtension (is that job done -> dll returns

#

only proper way of doing it

#

aka what @queen cargo said probablly TLDR :p

queen cargo
#

yup
just without the "return job id" as i did not wanted to also provide guidance for that ^^

fallen locust
#

blah easy ๐Ÿ˜›

queen cargo
#

technically @fallen locust you have to use mutexes etc. for that

#

not that simple

fallen locust
#

no you dont

queen cargo
#

but one of the more simple tasks

fallen locust
#

per thread buffers ๐Ÿ˜‰

#

with single job per thread

#

stupid but no need for mutex ๐Ÿ˜›

lone glade
#

/thread

queen cargo
little eagle
#

I think it's ironic to say "pro tip: don't touch if you don't know what you are doing"

deft zealot
#

talk less - code more

thick oar
#

waitUntil{itHurts}

little eagle
#

laughed

lone glade
#

for "_feels" from 0 to 10 do {halp}

austere granite
#

There's still no way to get rid of the connections / connected messages is there?

little eagle
#

with mod there is

#

RscDisplayChat, add a onLoad script and setPosition it to [0,0,0,0]

#

text background has no idc / -1, so proably have to change that too

#

You won't be able to read server commands though. maybe some additional ifs

austere granite
#

Plus it means i gotta create my own chat system I take it

little eagle
#

proably. maybe one can do some text parsing, before hiding the contols

#

extremly hackish

#

also have to use the string tables, cause the messages are different

#

but it would work

#

RscDisplayChat is the actual window were you enter the chat, it's a different one...

austere granite
#

Meh don't worry about it for now, was just wondering about it

deft zealot
#

@austere granite call clearRadio on each frame

#

but small side effect, it removes all messages ๐Ÿ˜‰

little eagle
#

oh, nvm that was the debug console

#

nope. I think it's hard coded, unfortunately

tribal crane
#

You can make callExtension non-blocking for scheduled code. ARMA would just suspend the script context until the DLL call that is marshalled to another thread/process completes and then return the value.

queen cargo
#

did today already @deft zealot :)
OOS got updated to 0.7.4-alpha

#

@tribal crane you cant
ArmA is not rly threading SQF
it is actually running in sequence which means --> [] spawn {"blocking" callExtension "";}will block your game just like non-scheduled would

tribal crane
#

ARMA can suspend a scheduled SQF script for any reason; e.g. when you do a "waitUntil" the waitUntil command suspends for an arbitrary condition.

#

There's no reason ARMA couldn't internally suspend your SQF script until the callExtension "work" off in some other thread finishes.

tough abyss
#

Lets be honest callExtension will be blocking for the entire Arma3 Lifetime, its highly unlikely they will change how the scripting engine works when it calls an extension

#

Personnally i am still waiting on a new str command that escapes quotations properly, so i can parse nested arrays containing strings (without having to worry about user input).
Its like a 10 minute job tops coding wise
Or an engine command to list loaded callExtensions & checksums on a client. Way to easy to get a random extension whitelisted

queen cargo
#

@tribal crane omgfg ... do you even read the shit i write?!
hell why i even make the work to write down any shit!?

#

arma CANNOT suspend if callExtension is not returning

tribal crane
#

How does waitUntil work then?

queen cargo
#

...

#

sometimes

#

sometimes i rly have no fucking clue how to be more bad

#

waitUntil is like call

#

just that it calls following function until it returns true

#

every command cannot be suspended

#

thus every operation (eg. player) is atomic

#

however

#

SQF can suspend inbetween those commands

#

thus

#

if you do not return callExtension ASAP

#

SQF cannot suspend

#

as youre still in your function

tribal crane
#

Every operation isn't atomic.

queen cargo
#

lemme ask again
do you even read what i write?

tough abyss
#

If arma loaded the callExtension calls in a seperate thread, they could try implement a callBack feature into the scripting engine.

tribal crane
#

Take:

{ sleep 10; } forEach [1, 2, 3];

queen cargo
#

cool

tough abyss
#

But BIS won't bother todo this, its to much work for them and they risk breaking abit ๐Ÿ˜›

queen cargo
#

2 atomic operations

#

good example ian ( sleep 10 and the actual forEach which however works a little bit different )

tribal crane
#

Actually they might, so they can run .dll's out of process, Torndeco.

tough abyss
#

But they dont ๐Ÿ˜›

tribal crane
#

BattlEye wouldn't have to worry about whitelisting DLL's, then.

#

X39: You can see SQF commands being non-atomic by looking at savegame dumps.

queen cargo
#

non-blocking call extension is also complete bullshit

#

dont talk trash shit

#

but dont worry @tribal crane i will write something together when my event is over

#

and explain it

#

AGAIN

tribal crane
#

X39: Don't go to the trouble just for my benefit. What's your event?

queen cargo
#

Friday ArmA mission

#

its not only for you ... there are multiple problems in understanding as it looks like ...

lone glade
#

getCargoIndex works fine for this

#

0 is driver the rest turrets / cargo seats.

lone glade
#

erf confused it with turretIndex (returned by getIn), getCargoIndex indeed only return cargo positions.

little eagle
#

assignedvehiclerole might return completely wrong roles when you have an AI group leader

#

something like this:
fullCrew cameraOn select {_x select 0 == player} select 0 select 1

#

"driver", "commander", "gunner", "turret", "cargo"

daring zinc
#

@queen cargo how often do you get punched in the face?

lone glade
#

too often, he's the salt god after all.

little eagle
#

it begins

lone glade
#

popcorn will be spilled.

still forum
#

dont see the problem with non blocking callExtension... instead of

CallExtension -> callFunc -> Return

just change it to

CallExtension 
-> CreateThread(in thread: _x=0;callFunc;_x=1) 
-> (waituntil {_x == 1};) 
-> return

wont work in non-sheduled because you cant waitUntil.. but i think that does the job doesnt it?

lone glade
#

you can waitUntil, just use the PFH variant available in ACE3 :^)

little eagle
still forum
#

dont mean waitUntil really.. its just symbolic for an engine side implementation

lone glade
#

oh btw, any idea why mines can't be added to zeus ?

little eagle
#

CfgAmmo

#

never implemented

lone glade
#

I'm using createMine :/

little eagle
#

still CfgAmmo

lone glade
#

T.T

still forum
#

so all of that is engine side.. in the current implementation callFunc runs in mainThread and stops whole game.. my implementation only stops its own thread and that single scheduled script

little eagle
#

Won't that eat up all the scheduler time?

#

those 3ms

still forum
#

no

#

waitUntil just checks the condition.. and if it doesnt match it just jumps to the next scheduled script.. it has some processing to do.. but very little

little eagle
#

so your callExtension just returns "pls wait" until it's done

still forum
#

yeah... basically what we have in script currently with just polling the extension and asking if its done... just in the engine compressed into one script command

little eagle
#

I see no problem with that.

still forum
#

i also dont... @queen cargo says thats impossible... dont know why... Seems very easy to me

little eagle
#

He was probably thinking of something else

queen cargo
#

still in mid-mission thats why you do not get any results
@daring zinc never
@still forum callExtension is always blocking until you return
that was the question
how to make it pseudo-non-blocking (by spawning a thread etc.) was something i already have described earlier

little eagle
#

So you both agree after all.

queen cargo
#

never said something else

#

still, callExtension is a blocking call

little eagle
#

true. pretty sure Dedmen knows that. He proposed polling.

queen cargo
#

never was in an argument with Dedmen

daring zinc
#

that's a surprise @queen cargo, considering how you behave in this channel

still forum
#

yeah i think i didnt think enough about what i read... i just saw people suggesting a new non-blocking callExtension.. and you stating its not possible because callExtension has to block

queen cargo
#

i am always right is the problem @daring zinc

#

you just got the feeling but your inner knows i am right

little eagle
#

oh boy

daring zinc
#

"my inner" knows your whois record is public

#

woops

queen cargo
#

yup

#

it is

#

#dontCare ๐Ÿ˜ƒ

#

come around

#

prepare to drink

#

((so better do not come with a car))

daring zinc
#

yeah, that would be "dump", right?

queen cargo
#

exactly

little eagle
#

Oh The Party, The Party is always right
And comrade, may it ever be so;
For who fights for the right
He is always right

daring zinc
#

glory to arstozka

lone glade
#

I think I made my longest If condtion, ever.

#
if (!(typeOf _vehicle in _casHelos) && {!(typeof _vehicle in _secondCopilotHelos) && {0 in _turretIndex}} || {typeof _vehicle in _secondCopilotHelos && {0 in _turretIndex || {1 in _turretIndex}}}) then {
            moveOut _unit;
            ["What are you doing?","You are not in a pilot slot!"] remoteExecCall ["derp_fnc_hintC",_unit];
        };
#

yes the If is a single line.

little eagle
#

i have seen and made worse

lone glade
#

but it works !

little eagle
#

typeOf in is case sensitive

daring zinc
#

at least wrap that shit

lone glade
#

meeeeh.

little eagle
#

Is it possible to localize hints with RE ?

lone glade
#

might wanna check it, but I doubt it.

little eagle
#

Well I guess you use your own function

lone glade
#

it's a simple hintC without the second hint.

little eagle
#

moveOut works on remote units?

lone glade
#

yep.

#

because this is an event

little eagle
#

the hintC is remote execed

#

so this will happen on a different machine

lone glade
#

oh that's for gunners.

#

wait wrong function

little eagle
#

They claim moveOut is global on the wiki.

lone glade
#

moveOut is global and the hint is remote

#

I got myself tangled with my fired EH

#

this is a getIn EH added on the vehicles.

little eagle
#

getIn already fires for remote units

lone glade
#

are you trying to confuse me ?

little eagle
#

no the wiki is wrong

#

if bob1 enters you get a getIn event

lone glade
#

wait, getIn is global ?

little eagle
#

just a heads up

#

yes

lone glade
#

oh well, no biggie.

#

just someone should fix the wiki.

little eagle
#

well it's not a MP event that sends code over the net. it will only execute on the machine were it was added

#

but it does fire for remote units and vehicles

#

both are scheduled environment

lone glade
#

remoteExec is scheduled same for remoteExecCall

#

whoaaaa such perf drops, this is going to be ran once in a few hours and there's barely anything running clientside on my mission.

little eagle
#

Wha does that even mean?

#

sounds weird to me, but it might be true

lone glade
#

I want my hint to show today, not next week.

fallen locust
#

remoteExecCall is either for the sender and unscheduled for the reciver

lone glade
#

:^)

little eagle
#

both have a huge ass delay compared to PVEH

fallen locust
#

like do we need to have scheduled vs unscheduled thign again?

lone glade
#

just running cba as servermod, can't use them :/

fallen locust
#

only in certint scenarios...

#

mostly no

little eagle
#

Grim, knowing is half the battle. You should at least know what a command does

fallen locust
#

What?

lone glade
#

I wish we had in engine taskCreate for the new mission framework

fallen locust
#

remoteExecCall has nothing to do with envoiroment its executed in (scheduled/unscheduled)

#

same with remoteExec

#

only difrence is on reciving end

lone glade
#

already done

#

nope not in this case

#

well, simple, check if the helo is in my array of helos with 2 copilots

#

incoming block of code

#
/*
* Author: alganthe
* Check if the unit is authorized to enter the pilot / copilot slot of the vehicle, if not they are kicked out.
* This is called by the getIn eventhandler.
*
* Arguments:
* 0: vehicle the getIn action is used on <OBJECT>
* 1: position in which the unit is entering <driver, gunner or cargo>
* 2: unit doing the action <OBJECT>
* 3: turretIndex of the position < [] for driver and [0] to n number of seats>
*
* Return Value:
* Nothing
*
* Example:
*
* yourVehicle addEventHandler [""GetIn"",{_this call derp_fnc_pilotCheck}];
*/
params ["_vehicle", "_position", "_unit", "_turretIndex"];

_authorizedPilotUnits = ["B_pilot_F","B_Helipilot_F"];
_secondCopilotHelos = ["O_Heli_Transport_04_F", "O_Heli_Transport_04_ammo_F", "O_Heli_Transport_04_bench_F", "O_Heli_Transport_04_box_F", "O_Heli_Transport_04_covered_F", "O_Heli_Transport_04_fuel_F", "O_Heli_Transport_04_repair_F" , "O_Heli_Transport_04_medevac_F"];
_casHelos = ["B_Heli_Attack_01_F","O_Heli_Attack_02_F", "O_Heli_Attack_02_black_F"];

if !(typeOf _unit in _authorizedPilotUnits) then {

    if (_position == "driver") then {
        moveOut _unit;
        ["What are you doing?","You are not in a pilot slot!"] remoteExecCall ["derp_fnc_hintC",_unit];

    } else {

        if (!(typeOf _vehicle in _casHelos) && {!(typeof _vehicle in _secondCopilotHelos) && {0 in _turretIndex}} || {typeof _vehicle in _secondCopilotHelos && {0 in _turretIndex || {1 in _turretIndex}}}) then {
            moveOut _unit;
            ["What are you doing?", "You are not in a pilot slot!"] remoteExecCall ["derp_fnc_hintC", _unit];
        };
    };
};
#

yep.

little eagle
#
test = {
    systemChat str [_this, call CBA_fnc_isScheduled];
};

"call" call test;
"re" remoteExec ["test"];
"re call" remoteExecCall ["test"];
["call", false]
["re call", false]
["re", true]
lone glade
#

I could add a seatSwitched EH and allow for the loadmaster seat to be used but meh.

little eagle
#

holy intendations

#

hadouken

lone glade
#

dat indentations and variables

little eagle
#

If you are the group leader, yes

lone glade
#

just sayin' v u1 and u2 aren't very good to use as params.

little eagle
#

says the one that uses "derp" as tag

lone glade
#

:^)

#

if you have to ask...;

little eagle
#

not very readable.

lone glade
#

also, could be used by literally anything else.

#

you dropped this _

little eagle
#

OK. I tested RE vs RECall and my conclusion is that RECall is always executed in unscheduled env, while RE is always executed in scheduled env.

#

Which is different from my last test that was made when these were new

fallen locust
#

so wait

#

did by any chance REC execute scheduled ?

lone glade
#

hahahahahah.

little eagle
#

depends on what args you move over the net

fallen locust
#

if REC was executing scheduled that would explain so much wierd crap

little eagle
#

REC executes unscheduled

fallen locust
#

Yea it should

little eagle
#

on server and client no matter who send it

fallen locust
#

but is it possible that it was executing scheduled

little eagle
#

It didn't when they were new.

fallen locust
#

that just explaind so much wierd crap

lone glade
#

hahaha

fallen locust
#

@tough abyss no

#

bypassing battleye?

little eagle
#

scroll menu? ingameuiseteh was fixed

fallen locust
#

i think that still works in a2

little eagle
#

a2 is dead

#

ingameuiseteh can easily be solved in A2 by overwriting it with the mission

fallen locust
#

yup

little eagle
#

anything else in A3 beside "" ?

fallen locust
#

""?

little eagle
#

nothing ๐Ÿ˜‰

fallen locust
#

lol

#

God knows

#

Well its either startis or Altis or VR but who wants to play in VR ๐Ÿ˜›

#

Its not the size

#

its the flatness of it ๐Ÿ˜›

queen cargo
#

ALtis size is still not enough

fallen locust
#

and color palet

queen cargo
#

gimme larger maps

lone glade
#

yeah, no.

queen cargo
#

100x100km

lone glade
#

altis is 240 x 240

fallen locust
#

eeeh no it isnt ๐Ÿ˜›

lone glade
#

according to BI it is : ^)

#

(they don't tell you they count the water too)

little eagle
#

more like 24x24

fallen locust
#

its still not 240 XD

little eagle
#

What's the point of huge maps when every city looks the same? The assets make the map

cold quartz
#

anyone know if there's an outbound limit on the function string length for callExtension?

still forum
#

its passing the direct pointer from the arma string.. so... The limit is only arma string limit

cold quartz
#

Really? So there's no limit on the character length?

#

er, rather, do you know what the arma string length limit is?

still forum
#

was just looking that up but didnt find it ^^

cold quartz
#

No worries, thanks Ded

agile pumice
#

is it impossible to use setVectorDirAndUp on a groundweaponholder?

#

trying to attach a weapon to my character and it doesnt seem to do anything

snow pecan
#

Should be possible

agile pumice
#

im just gonna make a dummy weapon

#

thanks for the link though, ive actually seen this before

iron mist
#

not sure if this is the correct chan, can anyone point me in the correct direction for creating a flight model for a helicopter?

agile pumice
#

might wanna try config_editing

iron mist
#

will do

cold quartz
#

Extension question: if I reference additional DLL's from within the extension DLL, and then place them within the @mod folder, upon calling the extension DLL, arma3 crashes with a file_not_found. If I place the additional DLL's in the root arma3 folder, it runs happily. Any way to work around that?

fallen locust
#

@cold quartz Max output size is passed with the call itself as a param last time i checked

#
extern "C"
{
    __declspec(dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
};

void __stdcall RVExtension(char *output, int outputSize, const char *input)
fallen locust
#

and @cold quartz you can get your modules PWD and call it with that path... it should work

queen cargo
gaunt patio
#

So I'm trying to convert an array in string format, back to an array. I've done it before using this exact same method and it worked fine, but it's just not working in this case.

hint _data;
_data =  call compile _data;```

The hint returns: ['Default',ObjectName]

However, trying to use the _data variable after that compile returns undefined variable. Any ideas?
#

^ Object name is just placeholder btw... the object name is a passed parameter refering to a unit. I just threw in "objectName" above to save typing out the individual object ID

cold quartz
#

@fallen locust, I was under the impression that that was the limit on what the extension could return into arma?

fallen locust
#

Yes its passed from arma to the extension as 2nd param

cold quartz
#

Yea but I was wondering if there was a limit on what arma provided to the extension?

fallen locust
#

Not really as far as i can tell...

#

as ouput limit is due to preallocated output buffer

cold quartz
#

Dedman? said it was basically whatever the limit on string length is

fallen locust
#

and you have no issue like that on input

#

yes that is true. but max string size in arma is prity huge

cold quartz
#

yea, like 10k

fallen locust
#

i thing is more then that

cold quartz
#

No, no, you're right

#

Its 10m

#

wrong letter

still forum
#

@cold quartz im called dedmen without an a ;)
for the dll loading in your @mod folder you could use GetModuleFileName to get the full path of your extension and then call LoadLibrary manually with that path to grab your other dll

cold quartz
#

Sry bud. I'll get it right next time ๐Ÿ˜‰

lone glade
#

@lavish ocean cleaning pleeease :^)

agile pumice
#

I was about to post the same issue, igi lol

#

the new patch must have broken using call compuile to return vehicles from a string

#

The issue can be replicated by returning: call compile str player

agile pumice
#

also im trying to return a variable using missionNamespace getVariable that's been publically broadcasted but its returning as nil

#

_keys = missionNamespace getVariable format["%1_KEYS",getPlayerUID player]; hint str (isNil "_keys")

#

its set on the server like so:

missionNamespace setVariable[_keys,_arr];
publicVariable (missionNamespace getVariable _keys)```
agile pumice
#

I'm thinking this might be the proper code instead:

call compile format ['%1 = %2; publicVariable ""%1""',_keys,_arr];```
little eagle
#

its set on the server like so:
wrong syntax. It's:

keys = format["%1_KEYS",_uid];
missionNamespace setVariable[_keys,_arr];
publicVariable _keys

You have to pvar the variable name, not the value.
I think in 1.56 this also works:

keys = format["%1_KEYS",_uid];
missionNamespace setVariable[_keys,_arr, true];
#

Also this usage of call compile hurts my feelings.

#

call compile str player
this never worked, simply because str player will be a string that is not compileable to the object reference. The only things that can reliably be compile str'd are booleans, numbers*, strings and arrays of these. It never worked for objects, groups or anything else really.

Edit: numbers below a million that is
Edit2: compile on objects can work if the object has a vehicleVarName, as str will return the vehicle var name. Since this is only an edge case, I wouldn't use this.

lone glade
#

gee, use call compile only when you want your functions to be available only serverside.

little eagle
#
_data = _ctrl lbData _index;

If you have to use lbData, then instead of using str on the value, simply setVariable on the list box control and use that string as lbData:

_ctrl lbSetData [_index, "data01"];
_ctrl setVariable ["data01", _data];
....
_ctrl getVariable (_ctrl lbData _index);

That way you can store any data type in the control and you don't have to worry about compile.

agile pumice
#

thanks commy

#

and alganthe ๐Ÿ˜›

#

i didnt think the global param for the setvariable would do anything for the mission namespace

#

just a ltitle confused with your example

_ctrl setVariable ["data01", _data];```
#

in my case, what do I substitute data01 for?:

_units lbSetData [(lbSize _units)-1,str(_x)];
_units setVariable ["data01", str(_x)];```

_units is the control, to avoid confusion
little eagle
#

_x is a soldier object I guess?

_id = lbSize _units - 1;
_key = "data" + str _id;
_units lbSetData [_id, _key];
_units setVariable [_key, _x];
#

_key would be your unique string "key" for that list box entry

#

and the variable name on the control

#

edited it. This way you don't have to convert the object to a string, which is the huge benefit

agile pumice
#

thanks for clarifying

little eagle
#

You basically store a variable name as lbData. And the variable is stored on the control. Maybe they'll fix lbData to support any data type. Until then this is the best solution.

agile pumice
#

I think I understand

little eagle
#

Any command that returns magazine IDs from a vehicles cargo?

currentMagazineDetail
currentMagazineDetailTurret
magazinesDetail
magazinesDetailBackpack
magazinesDetailUniform
magazinesDetailVest
soldierMagazines
uniformMagazines
vestMagazines
backpackMagazines

^ None of these work.

vapid frigate
indigo snow
#

Does that return them by ID tho?

little eagle
#

nope,no ids
magazineCargo cameraOn
["BWA3_30Rnd_556x45_G36","BWA3_30Rnd_556x45_G36","BWA3_30Rnd_556x45_G36","BWA3_30Rnd_556x45_G36","BWA3_DM25","BWA3_DM25","BWA3_DM32_Orange","BWA3_DM32_Orange"]

#

I'm looking for smth like this:
currentMagazineDetail cameraOn
"MG5 7.62x51mm 120Rnd Belt Case(120/120)[id/cr:10000093/0]"

agile pumice
#

am I doing this wrong?
params ["_vcl", ["_l1","_l2","_l3","_n1","_n2","_n3"]];

getting an error:

  Error Type String, expected Array```
indigo snow
#

yes, look at the syntax on the wiki

agile pumice
#

im trying to make out the examples

#

settled on params ["_vcl"]; (_this select 1) params ["_l1","_l2","_l3","_n1","_n2","_n3"];

indigo snow
#

yea

bold comet
#

hey guys, long time no see

#

i have people suddenly reporting issues with HCs since v1.56, anyone knows anything about that ?

indigo snow
bold comet
#

thanks

#

" said: it's 100% broken atm, as @zealous solstice pointed out the inits are borked for HC and logics."

#

ok

#

they work on my end, somehow

#

with a mission created before eden

lone glade
#

nope, they appear to work, they don't

bold comet
#

they definitely do

lone glade
bold comet
#

they definitely create local units and manage them alright, i have diags showing that

#

but that's with a pre-eden mission

lone glade
#

wat.

bold comet
#

i suppose exporting the mission right now would bork it

#

the people who get issue are those who modified my mission recently and exported their own version

#

the last official version works perfectly fine on our server with 3 hcs

#

i can send you the link if you want to test stuff with it

lone glade
#

welp that's weird.

bold comet
#

ok

#

not sure about the infinite loading issue tho

#

we don't get this one at all in v1.56

#

i'll try to get hold of my server admin first and make sure i'm getting it alright

lone glade
#

I LOVE the changes they made to buildingPos, I never garrisoned units faster.

indigo snow
#

YES it's awesome

#

Together with select {code} as well

#

Mhmmm

lone glade
#

now if we could get a nearObjects command which takes multiple classnames as arguments (like nearestObjects but without the sorting) that would be niiiice.

bold comet
#

oh what did they change ?

lone glade
#

if you use -1 as index it returns all positions inside the building.

bold comet
#

so it returns what BIS_fnc_buildingPositions would have returned right

lone glade
#

but in engine and much better.

bold comet
#

ok

queen cargo
#

a great change indeed
finally no need anymore to go through all manually and doing some check ...

lone glade
#

my biggest issue with building positions atm is that setPosWorld doesn't work quite well with them :/

#

or that might be setPosWorld being too fast and my unit not spawning properly.

queen cargo
#

it could also be just some weird MP issue like i have ...

lone glade
#

ya

#

setPos works fine tho.

queen cargo
#

"MissionReady" never gets published

#

however ... the entire mission sets up correctly ...

bold comet
#

they could have updated bis_fnc_buildingPositions with the new buildingPos behaviour to have both the performance gain and compatibility

#

just checked the code and it's not done

lone glade
#

I prefer in engine solution imho

bold comet
#

of course

#

but since most of the old code will never get updated :p

#

they could modify the old functions to take advantage of the new stuff

#

they often do actually

lone glade
#

it's by dude ๐Ÿ˜„

little eagle
#

@queen cargo createCenter is deprecated in A3. It does nothing.

#

What is GVAR_GVARS_missionContext? a game logic?

queen cargo
#

yup

#

a planar and simple game logic

little eagle
#

How is it created?

#

game logics have to be created with createUnit or createVehicleLocal (for a local one). createVehicle fails for whatever reason

queen cargo
#
_logic = _grp createUnit ["Logic", [0, 0, 0], [], 0, "NONE"];
[_logic] join grpNull;
deleteGroup _grp;
_logic;```
little eagle
#

I think you can directly grpNull createUnit instead of the join

queen cargo
#

nop

#

that wont create a unit sadly ...

#

the logic is present

#

the mission stuff is present

#

just the stupid variable is not ๐Ÿ˜ƒ

little eagle
#

stupid. On the local machine it's set, just not on the other ones?

#

Maybe the object is not* transfered during preInit, but the object isn't put on the jip stack

#

Is this a 3den mission?

queen cargo
#

SP it works
MP it does not :)

converted it recently to 3den ... but not sure why that should cause trouble with a 100% scripted mission

#

ohhh ... wait ... think i did shit

#

if thats true what i think right now ...

#

then i am one of the dumpest idiots in this fucking world :facepalm:

#

yes ... i am a dump idiot

little eagle
#

What was the issue?