#arma3_scripting
1 messages ยท Page 328 of 1
@queen cargo do i need to consider anything when playing on BE servers after install? like unhook something?
@little eagle ๐ one sec
nope
only do not start ArmA.Studio in MP and you should be fine (nobody is sure if BE already added the DLL to the explicit blacklist for auto whitelisting as it is/was whitelisted)
ok thanks!
could you remove MP functionallity from the exe to protect users from accidently using it in MP?
there is no "functionallity" in there
it is the debugger DLL actually that gets auto-loaded by arma
BE should reject it
you wont get banned though
as the DLL wont do anything on its own
and should not be loaded by BE anymore
@little eagle same error as above
copy paste it?
20:21:31 Error in expression <[B Alpha 1-1:1 (Lappihuan),"TEST","TEST1",0>
20:21:31 Error position: <Alpha 1-1:1 (Lappihuan),"TEST","TEST1",0>
20:21:31 Error Missing ]
So it's not the same error
It's the same line, which means at least we found the faulty line.
well yea the TEST thing is new ๐
Can you copy paste WW_fnc_isPlayer too?
private "_unit";
_unit = _this getVariable ["bis_fnc_moduleremotecontrol_owner", _this];
(isPlayer _unit);```
i'm gonna look at missionEventHandler stuff and see if that works
That one won't let you pass arguments
fek
["blah", onEachFrame", {}, [player, "TEST"]] call BIS_fnc_addStackedEventHandler;
potential repro for the error?
Since you're using a hard coded ID ("WW_pfh_boltAction") for your EachFrame handler, you might as well use a global variable to pass the arguments to the addMissionEventHandler one
So not really a problem
20:29:34 Error in expression <["blah", onEachFrame", {}, [player, "TEST"]] call BIS_fnc_addStackedEventHand>
20:29:34 Error position: <TEST"]] call BIS_fnc_addStackedEventHand>
20:29:34 Error Missing ]
something seems to be weird with pasing arguments into BIS_fnc_addStackedEventHandler
Yeah, no error without the typo
oh ๐
i do get the error without the typo btw
are you on devbranch aswell?
20:38:12 Error in expression <[B Alpha 1-1:1 (Lappihuan),"TEST"] call {}>
20:38:12 Error position: <Alpha 1-1:1 (Lappihuan),"TEST"] call {}>
20:38:12 Error Missing ]
No, stable
The data of the whole game were repacked. Please report any related issues (missing textures and icons, pop-up errors, etc.) to the Feedback Tracker. Thanks!
But that looks like what I was looking for. Basically the same pattern.
that was in the last devbranch update
Well there you go.
Just to make sure
["blah", "onEachFrame", {systemChat str _this}, [player, "TEST"]] call BIS_fnc_addStackedEventHandler;
I used this in stable without error
If you're on dev and this errors, then it's a bug on dev
To confirm you could try again without mods.
20:44:43 Error in expression <[B Alpha 1-1:1 (Lappihuan),"TEST"] call {sy>
20:44:43 Error position: <Alpha 1-1:1 (Lappihuan),"TEST"] call {sy>
20:44:43 Error Missing ]
Yup, same as the initial error
They b0rked it
And because I'm an asshole: Arma.Studio wouldn't have found this in a million years.
just confirmed without any mods, same error as above
thanks for the help! @little eagle
yw
ArmA.Studio can look easily in those functions and check the various contents of variables at runtime when you glance it
it would have found it faster then you stupid
than*
commy is the active dude in this chat
https://feedback.bistudio.com/T126078
ticket for the issue before, if someone wants to follow it
that's some crazy shit... what is their implementation like this? ```SQF
_init = "";
{
if (count _init > 0) then
{ _init = _init + ","; };
_init = _init + str _x;
} foreach _args;
_eh = compile format ["[%1] call %2", _init, _code];```
Is that actual code or did you made that yourself?
judging by the words it's made up
Because your loop is a convoluted way of writing:
_init = str _args;
I wouldn't be surprised if it's something dumb like that.
+it makes no real sense, tbh
Why not _init = []
then pushback everything? ยฏ_(ใ)_/ยฏ
Because that only works with an array already made out of strings.
No it works I am pretty sure
@little eagle
["[%1] call %2", _init, _code];
["1",2,text "3"] joinString ""; // "123"
Because that only works with an array already made out of strings. - Not correct
See my two comments above
I don't know why, just pointed out that it's inneccessary to count/foreach to add string to string instead of just using joinString ๐
Or, str in this case
@jade abyss That results in one pair of brackets too much
I quoted from the Code above
_eh = compile format ["[%1] call %2", _init, _code];```
Removing the [] in that above + doing it with pushback in the array -> Makes more sense to me.
The whole thing can be reduced to:
_eh = compile format ["%1 call %2", _args, _code];
unless you want all _args stringed (hell knows why)
That was the point of the loop.
And it wasn't to achieve anything. It was to explain a specific error on dev branch.
_init is a string You cannot use pushBack on a string
Because that is just as pointless, because the whole code is a one liner as I've shown.
Not rly, but okay.
w/e. it's okay.
Admission of defeat.
Not rly, just not in the mood
Then I declare victory and demand land and reparations.
take it, leaving world anyway
*startingRocket*
๐ ๐ ๐
๐ -> ๐
that whole block of code could be replaced with [_args] call _code ?
don't need to convert it into a string and then compile it
err nvm.. thought it was 'call compile'
Awwwww cabbage patch kids
There isn't a generic CfgNotification that accepts parameterized everything :<
Am writing a plugin that I was hoping would simply be (drop into mission folder, add init.sqf reference) and go
IntelAdded is the closest, if I'm not mistaken ๐ฆ
Hey. I'm trying to get a random one of three sounds to play in a trigger, but I'm having trouble. Note, I'll be of limited help since the majority of this is donated, borrowed or otherwise cobbled together. Here's my description.ext: class CfgSFX { class Ion { sound0[] = {"\music\ion1.ogg", db-0, 1.0, 1000, 0.2, 0, 15, 30}; sound1[] = {"\music\ion2.ogg", db-0, 1.0, 1000, 0.2, 0, 15, 30}; sound2[] = {"\music\ion3.ogg", db-0, 1.0, 1000, 0.2, 0, 15, 30}; sounds[] = {sound0, sound1, sound2}; empty[] = {"", 0, 0, 0, 0, 0, 0, 0}; }; class stormloop { name = "Ion Storm Loop"; sound[] = {\music\stormloop.ogg, db+4, 1.0}; }; };
and the trigger:
private _pos = while {true} do {
private _pos = [_this] call BIS_fnc_randomPosTrigger;
if (count (_pos nearEntities [["Man"],200]) == 0) exitWith {_pos};
};
_bolt = createvehicle ["LightningBolt",_pos,[],0,"can collide"];
_bolt setposatl _pos;
_bolt setdamage 1;
private _light = "#lightpoint" createvehiclelocal _pos;
_light setposatl [_pos select 0,_pos select 1,(_pos select 2) + 10];
_light setLightDayLight true;
_light setLightBrightness 95;
_light setLightAmbient [0.6, 0.6, 0.1];
_light setlightcolor [1, 0.95, 0.3];
sleep 0.1;
_light setLightBrightness 0;
sleep 0.1;
private _class = selectRandom ["lightning1_F","lightning2_F"];
_lightning = _class createvehiclelocal [100,100,100];
_lightning setpos _pos; _duration = random 2;
for "_i" from 0 to _duration do {
_time = time + 0.1;
_light setLightBrightness (100 + random 100);
[_lightning,"Ion",500] call CBA_fnc_globalSay3d;
waituntil {time > _time};
};
deletevehicle _lightning;
deletevehicle _light;
};```
Main issue i'm having right now is it doesn't seemto recognise "ion"
If I create a trigger to just play the sound, I get something along the lines of "no entry description.ext/sfx/ion1.empty"
ion1 isn't refrenced anywhere there
you got something else trying to play ion1? or the error is different than what you said?
I was trying something different when I got that error
I'll try having it play one of the specific sounds, gimme a sec
Just gives me "Sound ion1 not found"
dunno sorry, guess it's saying it can't find the .ogg file
i thought that would in yourmission\music\ion1.ogg
yeah, that's where I got it
maybe try taking out the \ at the start
the error is kinda odd.. thought it would say can't find \music\ion1.ogg, not just ion1
checked your RPT for any hints?
6:25:21 Warning Message: Sound ion1 not found is the only relevant thing as far as I can see
i guess to confirm that is the problem, you could try changing ion1 to somethingelse1
i'm not sure about that CBA function, but say3D says it's for CfgSounds
not CfgSFX
Ooooh
that might be it
hmm
desc.ext
{
class Strike
{
sound0[] = {"music\strike1.ogg", db-0, 1.0, 1000, 0.2, 0, 15, 30};
sound1[] = {"music\strike2.ogg", db-0, 1.0, 1000, 0.2, 0, 15, 30};
sound2[] = {"music\strike3.ogg", db-0, 1.0, 1000, 0.2, 0, 15, 30};
sounds[] = {sound0, sound1, sound2};
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};
};```
not sure if cfgsounds is the same format
Yeah, I was wondering the same
doesn't seem to have random options available, so you might need to just make 3 cfgsounds and play a random one in the script
Now i'm getting "No entry [...]description.ext/cfgsounds/strike1.title"
{
sounds[] = {};
class strike1
{
name = "strike1";
// start path to sound file in AddOn with @
sound[] = {{\music\strike1.ogg};
titles[] = {0,""};
};
class strike2
{
name = "strike2";
// start path to sound file in AddOn with @
sound[] = {{\music\strike2.ogg};
titles[] = {0,""};
};
class strike3
{
name = "strike3";
// start path to sound file in AddOn with @
sound[] = {{\music\strike3.ogg};
titles[] = {0,""};
};```
yeh not sure why it's looking for that.. could try throwing in title = "";, but it's not in the docs
not that that necessarily means anything
your brackets are messed up there
and missing the numbers in the sound array
{
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, 100};
titles[] = {0,""};
};
};```
Yeah, I corrected the brackets, don't know what the numbers are on about
{
sounds[] = {};
class strike1
{
name = "strike1";
// start path to sound file in AddOn with @
sound[] = {"\music\strike3.ogg, 1, 1, 300};
titles[] = {0,"Ion Strike"};
};
class strike2
{
name = "strike2";
// start path to sound file in AddOn with @
sound[] = {"\music\strike3.ogg, 1, 1, 300};
titles[] = {0,"Ion Strike 2"};
};
class strike3
{
name = "strike3";
// start path to sound file in AddOn with @
sound[] = {"\music\strike3.ogg, 1, 1, 300};
titles[] = {0,"Ion Strike 3"};
};```
looking good?
yeah, you probably want blank titles though (but shouldn't hurt). that's subtitles
missing a quote too
after the .oggs
the error about strike1.title ?
{
sounds[] = {};
class strike1
{
name = "strike1";
// start path to sound file in AddOn with @
sound[] = {"\music\strike3.ogg", 1, 1, 300};
titles[] = {0,"Ion Strike"};
};
class strike2
{
name = "strike2";
// start path to sound file in AddOn with @
sound[] = {"\music\strike3.ogg", 1, 1, 300};
titles[] = {0,"Ion Strike 2"};
};
class strike3
{
name = "strike3";
// start path to sound file in AddOn with @
sound[] = {"\music\strike3.ogg", 1, 1, 300};
titles[] = {0,"Ion Strike 3"};
};
class stormloop
{
name = "Ion Storm Loop";
sound[] = {\music\stormloop.ogg, db+4, 1.0};
};
};```
Yep
i guess try adding it: class strike1 { name = "strike1"; // start path to sound file in AddOn with @ sound[] = {"\music\strike3.ogg", 1, 1, 300}; titles[] = {0,"Ion Strike"}; title = ""; };
that's what the error is saying it's expecting
it won't be saying No entry [...]description.ext/cfgsounds/strike1.title with that
nah, it's still the same, but it's strike1.titles
you definitely saving the right file and stuff? it would come up that error if cfgsounds wasn't in description.ext at all
{
sounds[] = {};
class strike1
{
name = "strike1";
// start path to sound file in AddOn with @
sound[] = {"\music\strike1.ogg", 1, 1, 300};
titles[] = {0,"Ion Strike"};
title = "";
};
};```
filename strike1.ogg
and reloading the mission to make sure it picks it up
oh, in the editor?
Sure
I'll try that lol
the trigger as it currently is for posterity nul = thisTrigger spawn { private _pos = while {true} do { private _pos = [_this] call BIS_fnc_randomPosTrigger; if (count (_pos nearEntities [["Man"],200]) == 0) exitWith {_pos}; }; _bolt = createvehicle ["LightningBolt",_pos,[],0,"can collide"]; _bolt setposatl _pos; _bolt setdamage 1; private _light = "#lightpoint" createvehiclelocal _pos; _light setposatl [_pos select 0,_pos select 1,(_pos select 2) + 10]; _light setLightDayLight true; _light setLightBrightness 95; _light setLightAmbient [0.6, 0.6, 0.1]; _light setlightcolor [1, 0.95, 0.3]; sleep 0.1; _light setLightBrightness 0; sleep 0.1; private _class = selectRandom ["lightning1_F","lightning2_F"]; _lightning = _class createvehiclelocal [100,100,100]; _lightning setpos _pos; _duration = random 2; for "_i" from 0 to _duration do { _time = time + 0.1; _light setLightBrightness (100 + random 100); [_lightning,"strike1",500] call CBA_fnc_globalSay3d; waituntil {time > _time}; }; deletevehicle _lightning; deletevehicle _light; };
don't really need to paste all that.. only relevent line is [_lightning,"strike1",500] call CBA_fnc_globalSay3d;
Fairs
good news and bad news though
the error's gone
but I don't hear the sound
hah
Can volume go over 1?
you close enough? (within 300m)
yeah pretty sure volume can be greater than 1
Yeah, it is occuring at the same time as a loud explosion
okay, interesting
I upped the volume to 100 cause why not
I do hear the sound, but it seems it only plays until _lightning is deleted, which is more or less instant
This is where it goes beyond my comprehension
So globalSay3d needs the position for the duration of the sound to play it for its entire length
it says that will happen here https://community.bistudio.com/wiki/say3D
I think it goes without saying I haven't read too far into this
How do I use a parameter value in my Description.ext?
I'm trying to make respawn time a parameter
I guess I could create a "null" vehicle with the script, and delete that later that _lightning, but I wouldn't know how to go about that
@outer scarab just create a Logic (or maybe it's Logic_F.. check config viewer)
getting a "generic error in expression"
private _pos = while {true} do {
private _pos = [_this] call BIS_fnc_randomPosTrigger;
if (count (_pos nearEntities [["Man"],200]) == 0) exitWith {_pos};
};
_bolt = createvehicle ["LightningBolt",_pos,[],0,"can collide"];
_bolt setposatl _pos;
_bolt setdamage 1;
_snd = createvehicle ["Logic",_pos];
_snd setposat1 _pos;
private _light = "#lightpoint" createvehiclelocal _pos;
_light setposatl [_pos select 0,_pos select 1,(_pos select 2) + 10];
_light setLightDayLight true;
_light setLightBrightness 95;
_light setLightAmbient [0.6, 0.6, 0.1];
_light setlightcolor [1, 0.95, 0.3];
sleep 0.1;
_light setLightBrightness 0;
sleep 0.1;
private _class = selectRandom ["lightning1_F","lightning2_F"];
_lightning = _class createvehiclelocal [100,100,100];
_lightning setpos _pos; _duration = random 2;
for "_i" from 0 to _duration do {
_time = time + 0.1;
_light setLightBrightness (100 + random 100);
[_lightning,"strike1",500] call CBA_fnc_globalSay3d;
waituntil {time > _time};
};
deletevehicle _lightning;
deletevehicle _light;
sleep 5;
deletevehicle _snd
};```
oh, i see it
or not
I managed to fix it within the script
don't know exactly what I did
apparently a missing ; or 2, one of which was at the bottom
problem I'm having now is whether " _snd = createvehicle ["Logic",_pos]; " is legit
Yeah, I'm not the one who made this in the first place, I'm just trying to cobble together a way to play a sound
It works for all intents and purposes, except that
[_lightning,"strike1",500] call CBA_fnc_globalSay3d; works, but the sound stops when _lightning is deleted
This here: random 2, seems silly, for your for loop
so I'm trying to create a logic to get the position to play the sound from
Yeah, I appreciate pointing out the stuff that's wrong - but like I said, I didn't make the original version of this script
I'm not sure what CBA_fnc_globalSay3d is
But if it's what I imagine it to be, I doubt you should use it
remoteExec with say3D would be better
And yes, say3D will cancel when the object is deleted
You need to delay that deletion if you want it to continue
I'm specifically looking for what I'm doing wrong here: _snd = createvehicle ["Logic",_pos,[],0,"can collide"]; _snd setposatl _pos;
``` [_snd,"strike1",500] call CBA_fnc_globalSay3d; ```
};```
can collide
And I don't think you can create a logic with createVehicle
As of Arma2, this command cannot be used to create game logics (source). Use createUnit instead.
Ahah
@valid dew you can use missionConfigFile
same was as configFile for normal configs
so with this in your description.ext:foo = bar; class foobar { bar = foo; }; you could get the first one with missionConfigFile >> 'foo', or for the second, missionConfigFile >> 'foobar' >> 'bar'
(with getText before them to get the text if it's a string; or getNumber, getArray, etc)
Performance warning: SimpleSerialization::Write 'params' is using type of ',TEXT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types What does this mean exactly? I cant seem to find where its arising from
Okay, I tried something different:
private _pos = while {true} do {
private _pos = [_this] call BIS_fnc_randomPosTrigger;
if (count (_pos nearEntities [["Man"],200]) == 0) exitWith {_pos};
};
_bolt = createvehicle ["LightningBolt",_pos,[],0,"can_collide"];
_bolt setposatl _pos;
_bolt setdamage 1;
_A = getPosASL _bolt;
private _light = "#lightpoint" createvehiclelocal _pos;
_light setposatl [_pos select 0,_pos select 1,(_pos select 2) + 10];
_light setLightDayLight true;
_light setLightBrightness 95;
_light setLightAmbient [0.6, 0.6, 0.1];
_light setlightcolor [1, 0.95, 0.3];
sleep 0.1;
_light setLightBrightness 0;
sleep 0.1;
private _class = selectRandom ["lightning1_F","lightning2_F"];
_lightning = _class createvehiclelocal [100,100,100];
_lightning setpos _pos; _duration = random 2;
for "_i" from 0 to _duration do {
_time = time + 0.1;
_light setLightBrightness (100 + random 100);
playSound3D ["strike1.ogg", _pos, false, _A, 100, 1, 1000];
waituntil {time > _time};
};
deletevehicle _lightning;
deletevehicle _light;
};```
Ooh
Nah, doesn't work
Tried putting _A = getPosASL _bolt; before _bolt setdamage 1; no dice
Can you elaborate more on "doesn't work"?
And as before, I'd recommend remoteExec with say3D
I think I've figured it out anyway
playSound3D ["strike1.ogg", _pos, false, (getPosASL _Lightning), 100, 1, 1000];
Buuut now, 8:21:22 Sound: Error: File: strike1.ogg not found !!!
{
sounds[] = {};
class strike1
{
name = "strike1";
// start path to sound file in AddOn with @
sound[] = {"\music\strike2.ogg", 100, 1, 3000};
titles[] = {0,""};
title = "";
};```
Was working fine when I was using CBA_fnc_globalSay3d
All that's changed now is the function I'm using in the trigger
also tried playSound3D ["strike1", _pos, false, (getPosASL _Lightning), 100, 1, 1000];
And as before, I'd recommend remoteExec with say3D
And you should read the wiki page: https://community.bistudio.com/wiki/playSound3D
wasn't your sound in a music folder @outer scarab ?
Yeah
I just tried music\strike2.ogg
since the example on the wiki page gives a full file-path
read the comments on the wiki too
basically it's painful with a sound in a mission to use playSound3D
This just got 10x more complicated, if you're referring to this comment: You need to get the correct path for custom mission sounds. Use missionConfigFile with BIS_fnc_trimString (to trim off "description.ext"), then add your mission's sound directory and sound file: _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\some_sound_file.ogg"; playSound3D [_soundToPlay, _sourceObject, false, getPos _sourceObject, 10, 1, 50]; //Volume db+10, volume drops off to 0 at 50 meters from _sourceObject
yeah, exactly
hence BoGuu: And as before, I'd recommend remoteExec with say3D
you almost had it right before, but you had "can collide" instead of "CAN_COLLIDE"
err nvm missed boguus thing about not using createvehicle
Well the trouble I had with createvehicle logic is as BoGuu pointed out, you gotta use create - yeah
create a softdrink can instead
I kinda gave up on that, then someone recommended I just use playsound3d
Hmm, I could
Would it have any performance impact? These lightning strikes are probably going to be happening quicker than 1/second
(or use createUnit)
a strike every second? ๐
Yeah man
i would guess less overhead than 'createunit', but not certain
~ambience~
(make sure you delete it afterwards)
I wouldn't advise to spam create lightning and sounds every second
Won't it piss people off aswell ๐คฃ ?
That's kinda the idea
I mean we tested it before I got to implementing sounds, apparently it wasn't perceptibly worse than any other mission
In terms of performance I mean
but a soda can is double the objects
I don't know, it's worth a try anyhow
It's always a bad idea to piss your players off.
Question: Does playSound3D delay the sound by distance as with others? As far as I can tell, the CBA function doesn't
Someone said yesterday no
Couldn't you reuse the same dummy object?
I.. don't know about that
This is pretty much my first attempt at scripting anything
That'd probably be better
And the lightest simulation type
The soda can thing was for barriers, because AI reacts to them.
iirc
No reason to do that for say3D
In this instance I'm not using say3D, but CBA's globalSay3d
But that function is just a wrapper for
remoteExecCall ["say3D"];
....oh
So you're still using the same thing and you don't consider the speed of sounds either.
Yeah, I'm guessing getting speed of sound involved if even possible would take me the rest of the day to figure out
you'll probly get a random amount of delay anyway just from lag
Network delay, yeah
I mean it'd be nice to have, because the lightning strike also creates an explosion at the point of impact
and that does take speed of sound into account
jokoho is currently doing speed of sound delays for the cookoff stuff in ACE
But it's a bit... advanced?
sleep (_obj distance player) / 340.29;
it won't be accurate with network lag though
you could make the whole script remote exec instead of just the say3d and do everything locally
then everything will be in sync on all clients.. but might not happen at the identical time for everyone
Well, that's not too much of an issue really
but I think we're getting ahead of ourselves, and way ahead of me ๐
Because, once again, I must've broke something
no script error, nothing in the .rpt, no sound
Oh, I think I know why actually
i have "CAN_COLLIDE" on the Building
And the lightning bolt is destroying it I'm guessing
I never asked for this
I think I've got it as close to working as I reasonably can
tried disabling simulation on _snd, not sure if it helped, but the sound only plays half the time
@little eagle look what got added to the devbranch changelog...
Tweaked: The BIS_fnc_addStackedEventHandler, BIS_fnc_removeStackedEventHandler and BIS_fnc_executeStackedEventHandler functions are no longer supported
It cannot pass arguments, so not necessarily.
Also some events cannot overwrite input, like clicking on the map when using the mission eventhandler version.
Quick question -- rearming an aircraft is easy enough when you're setting the magazineTurret's ammo... but how do we add chaff/flares back to the aircraft? Because they're not part of the PylonLoadout or the [-1] turret path.
Right but I need the turret path, and I don't see where I can find the turretPath for the chaff/flares. It's not the usual [-1] for the main pilot, which is where everything else is stored.
Does the chaff even use a turret path? I don't even know
I will try on that A10
so they discontinue support of a function and don't provide a alternative ๐
cameraOn magazinesTurret [-1]
["1000Rnd_Gatling_30mm_Plane_CAS_01_F","Laserbatteries","120Rnd_CMFlare_Chaff_Magazine","PylonRack_1Rnd_Missile_AA_04_F","PylonRack_7Rnd_Rocket_04_HE_F","PylonRack_3Rnd_Missile_AGM_02_F","PylonMissile_1Rnd_Bomb_04_F","PylonMissile_1Rnd_Bomb_04_F","PylonMissile_1Rnd_Bomb_04_F","PylonMissile_1Rnd_Bomb_04_F","PylonRack_3Rnd_Missile_AGM_02_F","PylonRack_7Rnd_Rocket_04_AP_F","PylonRack_1Rnd_Missile_AA_04_F"]
looks like it IS in turret [-1]
"120Rnd_CMFlare_Chaff_Magazine"
@modern sigil
cameraOn removeMagazinesTurret ["120Rnd_CMFlare_Chaff_Magazine", [-1]];
cameraOn addMagazineTurret ["120Rnd_CMFlare_Chaff_Magazine", [-1]];
This works perfectly fine for me
Really? [-1] is the turretPath for flares? I need to go back and see what I was doing wrong.
Thanks @little eagle. I'll give it a shot and report back in a bit.
@modern sigil -1 turret is the driver / pilot of the vehicle
_eh = compile format ["(%1) call %2", str _args, _code];``` there i revised my code from earlier... of course the whole the point wasn't some string manip, but rather embedding the context in code as literals, which is obviously horribly broken... the defect report showed the result of `str(<unit>)` being compiled as a literal
The str is superfluous and so are the parentheses, no?
You're not getting off the hook.
But yeah, I agree. That could explain the issue
superfluous eh? have a go without them then
I just wonder why they'd change it like that and then remove support for that function entirely one day later.
have a go without them then
Example code?
Because atm it does nothing
fine SQF [/*_args*/ "", /*_code*/ {systemchat str _this}] call setEventHandler
do you see the problem?
No, looks fine to me.
depends what _args is
" call {systemchat str _this}"```
whether it can be serialized back and forwards as text
do you see the problem now?
Can you give an actual example I can paste into the debug console and have an error when not using str that disappears when using str?
format ["%1 call {}", ""] -> " call {}"
format ["%1 call {}", str ""] -> """ call {}"```
surely _args can be anything
yeah, not in the first code i posted, but it can in the second one
Because we are talking about a specific example code that turns the array _args into a sting called _init
the one where you said the str was superfluous
str is superfluous under the condition that _args is an array as it was in the initial problem
sure sure, but my revised code snippet didn't impose such a requirement
So yes, str is superfluous, but you were talking about a different problem where it no longer is
But then you shifted the topic
i did also note that the string manip was never the point in the first place
do you really need to convert it to a string and back?
no, you must not
can't just store it as _eh = [_args, _code];
that was the point
Your result
"" call {}
makes no sense anyway, because it can no longer explain the issue this was all about
converting the callback context into literals is horribly broken, that was the point
If the argument were a string, then the code would error out differently.
sure, but then we're talking about a different error that doesn't exist
it can't work if, for example, _args was an object
exactly
Yes!
or if _args was an array...
And that's the problem this was all about
it only works for strings, bools, and scalars
i think... maybe something else but i don't think so
No, it also works for arrays!!!
would work for arrays of those things too
completely and utterly broken
Example:
call compile format ["%1 call %2", [0,1], {systemChat str _this}]
works fine
but it loses the array reference
making the context pointless
it can no longer modify the original array
yeah it creates a new array when you recompile it
You're again talking about an issue that did not happen.
And whether or not passed arguments to stacked eventhandlers should be passed by reference or not is an open question imo.
It shouldn't change suddently ideally for bwc
i don't care if someone did it or not, or if it happened or not, i was talking about the fact that converting a callback context to literals is broken, both for types like objects, and also for just simple arrays with scalars, strings, etc...
But it's not clear what the expected result should be unless specified.
Maybe the function already copies the input? Idk
and obviously a callback context should be passed by reference... otherwise it's pointless
How is it pointless when my code works just fine?
how do you expect to return from an asynchronous operation without the array reference?
I disagree that the arrays has to be passed by reference.
depends on the application, but in contextual callbacks they definitely should
Idk what asynchronous operation has to do with this. We are talking about eventhandlers that run unscheduled.
has something changed? i don't understand the problem
if you convert into a string then back to code, it's always gonna recreate arrays?
BIS_fnc_addStackedEventHandler is either broken or discontinued on dev branch
yes, that's the problem, it creates a new array
That is not the problem this is about, mate
you're trying to recreate it?
yeah, that may not be the defect that was reported and sparked the whole discussion, but it's still valid
yes, that's the problem, it creates a new array```
Erm, and?
Nope, I am trying to explain the shown error. No idea what untelo is about.
ยฏ_(ใ)_/ยฏ
and that's what's breaking it
Lecks, we don't know why it's broken, but that would explain the error message.
@jade abyss copying the array prevents you from modifying the original (obviously), which prevents you from returning the value of an asynchronous operation
uhm, what? oO
The goal was to create code sufficient to explain why a specific error messgae is shown.
And some people hijacked the conversation to "fix" the code that was never meant to be used
some are bored ยฏ_(ใ)_/ยฏ
And are off topic
The channel topic is scripting. The conversation topic is about scripting. But that does not mean that the conversation topic should be changed to a different one and that it's fine to do so just because it still complies with the channel topic.
Obviously there is no point in stringifying an array when you immediately recompile it.
But it can explain why an object without object name would error out exactly like what was found in an RPT file that happened on dev branch.
yes that was the point, and to back it up i gave two examples of why it's broken, 1) because not all types have literal representations and 2) because array references are lost
And how does that explain the error on dev branch?
the code i posted did explain it, converting the callback context into literals
How would I go about finding out how many lightpoints are in my mission, or making sure they're working? I've placed 34 with ```var = [] spawn {light = "#lightpoint" createvehicle getpos L7;
light setlightbrightness 5;
light setlightcolor [0.1,0.8,0.1];
light setlightambient [0,0.8,0];};````
in init.sqf, but for whatever reason none of them are showing up now.
the code i posted did explain it, converting the callback context into literals
So you don't even know what the error on dev branch is. K thx.
well i was talking about this one https://feedback.bistudio.com/T126078
it tries to compile SQF [B Alpha 1-1:1 (Lappihuan),"TEST"]
which looks like someone tried to convert the context into a literal, but it fails because objects don't have a literal representation
well, they do when you give them object names in the ediotr "vehicle var names"
So that is important when trying to repro the issue.
ok, let's say it worked for objects, my point was that even if it worked for objects, the whole idea is still broken for other reasons
Sure.
It's also pointless.
Yet my derived one liner code is identical to what was posted as explanation.
And the explanation had the same issue.
So if my one liner keeps all the issues of the original, it's even better suited as simplification
Because as I said, it's literally the same, but as a one liner...
i'm not sure what one liner code you're referring to here
Wait
original:
_init = "";
{
if (count _init > 0) then
{ _init = _init + ","; };
_init = _init + str _x;
} foreach _args;
_eh = compile format ["[%1] call %2", _init, _code];
simplification:
_eh = compile format ["%1 call %2", _args, _code];
i had a quick glance at the functions yesterday late night and they seem to store the arguments and the code in a missionNamespace array but i don't remember if they stringify them or not
On dev branch?
yes
var = [] spawn {light = "#lightpoint" createvehicle getpos L7;
light setlightbrightness 5;
light setlightcolor [0.1,0.8,0.1];
light setlightambient [0,0.8,0];};
`
in init.sqf, but for whatever reason none of them are showing up now.```
i can paste the functions on my lunchbreak
original and simplification are equivalent, unless you want to deliberately change the _init variable, which would be horrible design.
Wich one exactly @tough abyss ?
BIS_fnc_addStackedEventHandler
The BIS_fnc_addStackedEventHandler, BIS_fnc_removeStackedEventHandler and BIS_fnc_executeStackedEventHandler
exectue is the one that reads from missionNamespace and add is the one that saves it there
@little eagle what do you mean by deliberately changing _init?
Changing the value of a predefined variable _init
read from MissionNameSpace
Assuming the lack of privatewas intentional.
_init is magic?
Nope
i just named it that as short for initializer
because it was the array initializer without []
Think of both codes as a black box
or are you talking about local var corruption due to lack of local?
or private in A3 i guess...
@jade abyss could you paste the execute function aswell? ^^
@tough abyss The one i pasted is the one, how it seems. But i can't find that Codepart, that is reffered to in here oO
_init = 0;
ORIGINAL
typeName _init // STRING
_init = 0;
SIMPLIFICATION
typeName _init // NUMBER
or are you talking about local var corruption due to lack of local?
No
Paste = fn_addStackedEventHandler.sqf
BIS_fnc_executeStackedEventHandler
ok then i have no clue what you're talking about
few files below
fn_executeStackedEventHandler.sqf
/*
Author: Nelson Duarte
Description:
Deprecated
Returns:
BOOLEAN - FALSE
*/
false;```
๐
wait wat?
that wasn't the case yesterday evening 100%
ok then i have no clue what you're talking about
How so? The example is easy to understand.
and i'm 100% sure they didn't had that deprecated entry in the devbranch changelog...
@little eagle so you are talking about corrupting _init due to lack of local
or... private whatever...
@outer scarab
allMissionObjects "#lightpoint"
That reports an array with all light source objects.
Yes. Corrupting, or changing it deliberately and the simplification no longer doing that.
well obviously my code was just a silly example and was never intended to be valid for any purpose
Do you agree that my simplification is equivalent to your original aside from modifying potentially predefined variables in a different way?
Hmm, Commy I don't imagine there's a way to count only editor, well, init-placed lightpoints?
well no i don't, because it behaves differently when _args is string, but otherwise, yes of course
I don't think allMissionObjects lists anything else.
assuming _args is always array, it's equivalent and much better, of course
Untelo
_args is defined as array by the original
} foreach _args;
That doesn't work with strings.
i just had a brain fart about array to string, but once again the string manip was not important
ok i had no clue i might as well have called _args _floop and _code _blargh
So again: Where is that codepart from?
that's some crazy shit... what is their implementation like this? ```
```sqf
_init = "";
{
if (count _init > 0) then
{ _init = _init + ","; };
_init = _init + str _x;
} foreach _args;
_eh = compile format ["[%1] call %2", _init, _code];```
it was just meant to demonstrate turning the callback context into a code literal
So it was nonsense you posted/wrote?
ok i had no clue i might as well have called _args _floop and _code _blargh
Sure, but that doesn't change the fact that forEach makes the variable _floop to be an array if we assume that the code works.
SQF seems weird as hell
And I demand reparations
@tardy wagon Just forget everything you know about other languages (even your mothertounge)
jk, it was a fun and pointless discussion
@tardy wagon i see you're a connoisseur of the finest of programming languages known to man, thanks be to Bjarne
now... to keep the flame war going but with a new topic... how to get the return value when i call remote functions using remoteExec etc?
seems like a troll dickmove to drop support of a function and in the same time just break it intentionally by doing a return false;
now... to keep the flame war going but with a new topic... how to get the return value when i call remote functions using remoteExec etc?
Another remoteExec I guess.
Yeah, Lappi. No idea what's going on.
but how do i associate it with the original caller?
clientOwner I guess. Hoping that the code is not meant to work in local hosted MP
_blah = [_code, _args] call some_remoteExec_wrapper_that_has_the_ability_to_return_values```
how do i derive the return value from _blah
well the way i would do it is by returning a future
now... how would you implement futures
What? remotexec that returns a value? Do you want a value from another client?
i want to call a function on a remote machine, and get back the value from the function
what the remote machine is or what the function is are irrelevant
what is relevant is how to approach returning values from asychronous operations
such as a remote call
RemoteExec it back?
call a func on the Target, that returns the data. Can't think of anything else
run script_a on machine_1 >> remotexec script_B on remote machine_2 >> script_B remoteExecs script_C on machine_1
some_remoteExec_wrapper_that_has_the_ability_to_return_values = {
params ["_code", "_args"];
My_RE_Return = nil;
[[_code, _args, 0], {
params ["_code", "_args"];
private _return = _args call _code;
[_return, { My_RE_Return = _this; }] remoteExec ["BIS_fnc_call"];
}] remoteExec ["BIS_fnc_call"];
waitUntil {!isNil "My_RE_Return"};
My_RE_Return
};
Something like this?
Or let it change a setVar Pub. no clue
well i can think of publicvariables, which is what i actually do because i live in A2 land
yes this is all very obvious... what i'm getting at though is that using any more global state than absolutely necessary is very bad
which is why, as i said, i would personally implement this using futures and promises
now... implementing futures and promises without global state is possible using array references
call a func on the Target, that returns the data.```
some_remoteExec_wrapper_that_has_the_ability_to_return_values = {
params ["_code", "_args"];
My_RE_Return = nil;
[[_code, _args, clientOwner], {
params ["_code", "_args", "_owner"];
private _return = _args call _code;
[_return, { My_RE_Return = _this; }] remoteExec ["BIS_fnc_call", _owner];
}] remoteExec ["BIS_fnc_call"];
waitUntil {!isNil "My_RE_Return"};
My_RE_Return
};
forgot the owner part
and this gets us to my point about why callback contexts should never copy arrays
BIS_fnc_call? Wouldn't a simple "call" be enough?
remoteExec ["call"] would execute the code in unscheduled environment
Ohh yeah, if it's more than 1 targets, then yeah. You would have to do some kind of a wait OR you could save the amount of targets you've sent out to on the original machine and then everytime the return function runs, check if it has got information from all the target machines yet
_Vargs RemoteExecCall ["call"]
things i did for debug stuff:
[_Veh,{player moveInDriver _this}] remoteExecCall ["call",_Player];```
remoteExec ["call"] // unscheduled
remoteExecCall ["call"] // unscheduled
remoteExec ["BIS_fnc_call"] // scheduled
remoteExecCall ["BIS_fnc_call"] // unscheduled
mind blown
That is how it is.
don't get stuck on the implementation details for remoteExec
Can that be added to the biki?
instead let's change the problem from remoteExec to a remote database load via extension on a server
I'm really stuck on the details
Scripted function - scheduled environment (suspension is allowed, i.e. spawn, execVM).
Script command - unscheduled environment (suspension is NOT allowed).
So much for having the finishing touches of my mission done within an hour or two
I've been at this since 4am
call is a "Script command"
var = [] spawn {light = "#lightpoint" createvehicle getpos L34;
light setlightbrightness 5;
light setlightcolor [0.1,0.8,0.1];
light setlightambient [0,0.8,0];};
where L# is a trigger with the corresponding variablename
[11:05 AM] Morbo: All I remember having done between them working and when I noticed they weren't was 1: change the "Lightning" weather condition, and 2 started/reloaded the mission a hundred times messing with a script, that as far as I can tell shouldn't interface(edited)```
So
remoteExec ["call"] -> unscheduled
Commy should start reading.
Reading what?
[_Veh,{player moveInDriver _this}] remoteExecCall ["call",_Player];```
remoteExec ["call"] would execute the code in unscheduled environment```
Yeah. You can replace remoteExecCall with remoteExec here and it makes no diff
Are you drunk?
No
So where did you mentioned that it's unscheduled? (fk, i hate that word)
BIS_fnc_call? Wouldn't a simple "call" be enough?
It's not enough, because
{hint str canSuspend} remoteExec ["call"];
-> false
{hint str canSuspend} remoteExec ["BIS_fnc_call"];
-> true
That is why it wouldn't be enough to use it. My code uses waitUntil therefore only works in scheduled environment
I think it's a good idea to keep that even when continuing on another machine
( i wonder why waitUntil anyway, but okay)
Because that is the only way to do the initial task
to wait for the var to be set
Send it back via rec -> Done O.O
_blah = [_code, _args] call some_remoteExec_wrapper_that_has_the_ability_to_return_values
This was the initial task
And you have to use waitUntil to get this to work afaik
Wich is imho pretty nonsense ยฏ_(ใ)_/ยฏ
No need to waste stuff in a waitUntil ยฏ_(ใ)_/ยฏ
Well, that is kinda how the new remote debug console in CBA works, so it's not "nonsense"
you absolutely DO NOT have to use waituntil
Not waitUntil, but it's a similar idea
you can do it without the scheduled environment
Doesn't make it better. Split it up to 2 Funcs -> Done.
you absolutely DO NOT have to use waituntil
Then show me code that would make:
_blah = [_code, _args] call some_remoteExec_wrapper_that_has_the_ability_to_return_values
working without waitUntil
ok
_future = [_code, _args, _client] call my_remoteExec;
[_future, _code2, _ctx] call my_future_then;```
untelo, I expected some_remoteExec_wrapper_that_has_the_ability_to_return_values to be something
Not to change the question
renamed to my_remoteExec in version 2
Ok, then solve
_blah = [_code, _args] call my_remoteExec;
how does my_future_ten work without waituntil?
^
it attaches a callback to the future
which is executed when the future becomes ready
wut? no
The right way to go about this is, that this cannot be solved without waitUntil and THEREFORE it's better to split it into two functions.
so u 'wait until' it becomes ready?
Can someone help me here, please?
no
lol
Since when does it wait? oO
you need something that loops until whatever is doing something is done, period
Yep
โ x2
when the client receives a response via some mechanism such as remoteExec, it sets the value on the promise, which executes all callbacks attached to the future
there is no need for any waituntil or sleep looping etc
that would be horrible
show the functions?
Is this wishthinking or currently possible?
it's absolutely possible
_blah = [_code, _args] call my_remoteExec;
Just so it doesn't get lost. I claim that this cannot work without my_remoteExec using waitUntil or sleep
cause i can't imagine, that it works.
i've implemented it already as a single class Task, but redoing it right now to separate into Promise and Future to make things easier
it could if my_future_then uses sleep/waituntil
have you done this on a Dedi machine?
but 1 of them has to
Yeah, Lecks
func pls.
โ
I rly doubt, that RE(C) returns values. I would be pretty surprised if.
It doesn't. The JIP version reports a ticket for the JIP stack
i'll have to finish this future/promise implementation first
REC
Anything - Nil in case of error. String otherwise. If JIP is not requested this is an empty string, if JIP is requested, it is the JIP ID. See the topic Function for more information.```
i'll give you the code when it's presentable ok
Nah, just a showcase is enough
ok give me a minute....
Poor @outer scarab is ignored ๐ฆ
Haven't you answered him already?
Morbo - heute um 12:23 Uhr
Can someone help me here, please?
Untelo - heute um 12:23 Uhr
no
Morbo - heute um 12:23 Uhr
lol
We need #arma3_scripting and #arma3_scripting-questions with the Topic if(_Question == true)then{systemchat ask};
what no
he asked his question earlier
Check the current topic
i know, but it needs correction
No shit sherlock
lol
== reports false when both sides are null (except for configNull, because)
That could be a reason to use == over isEqualTo
local _channel = (if (_topic call my_topic_isQuestion) then { "scripting-questions" } else { "scripting" }) call my_getChannel;
[_channel, (_topic call my_getMessage)] call my_channel_post;```
But...but it's slightly slightly slower...
It isn't anymore when you have to add isNull checks.
+Now with remoteExec func.
@outer scarab try to figure out if that bit of code is running at all with hint or diag_log
Notepad++ > Find and replace in files > == to isEqualTo > huge fps gain
Yes
yes
no ๐
no
but we don't have ternary op so
Contrarians.
ยฏ_(ใ)_/ยฏ
poor man's ternary expression
Don't worry, I got it sorted @Marcel @little eagle
๐ฅ
had this too far up in my init // ======================================= // Ambient Sounds //enableEnvironment false; while {true} do { [player, "stormloop",500] call CBA_fnc_globalSay3d; sleep 15; //"0" represents what length the track is, so replace the 0 with your soundtrack's length };
yeah if we could use _var = x ? true : false; i would
put it at the bottom, boom
haha, it never get's past the loop ๐
I am still waiting for the remoteExec return ยฏ_(ใ)_/ยฏ
@vapid frigate: it wouldn't work, it would have to be SQF cond ? { true } : { false }
I would give it to you if I had my computer at the moment @jade abyss
yeh probably
@tough abyss You working with Untelo?
@jade abyss you can read https://en.wikipedia.org/wiki/Futures_and_promises while you wait :D
and you can implement futures and promises in sqf
local _channel = (if (_topic call my_topic_isQuestion) then { "scripting-questions" } else { "scripting" }) call my_getChannel;
local _channel = (["scripting", "scripting-questions"] select (_topic call my_topic_isQuestion)) call my_getChannel;
Where is your god now?
i think i would make the array static
only... the performance implications of having thousands of static arrays for shit like this worries me
local is same as private?
because global vars are not statically linked
You do know that else also creates an array?
local is private in A2
{ "scripting-questions" } else { "scripting" }
->
[{ "scripting-questions" }, { "scripting" }]
*StillWaitsForRemoteExecExampleForReturnValues*
still prefer the if/then
So no, there are no performance implications aside from it gets faster
Lecks, that is called irrationality, but Ok
man i'm implementing this future/promise right now... my old shittier implementation didn't support callbacks
I call it CommyNism
although it fairly easily could have...
You calling me irrational, Dscha?
calling you a CommyNist
@jade abyss https://pastebin.com/raw/VQJV7P8m https://pastebin.com/raw/pjVih0kQ for the future/promise, it's got some missing dependencies but they're pretty self-explanatory, e.g. delegate is just code + context. also it's just an untested first version so might have typos or even design flaws, but it shows you the basic idea
I can already tell that Dscha will like this.
I do, i rly do. (sarcasm)
I see 0 remoteExecs
Still searching for RemoteExec
that's obviously separate from the future/promise, which is just an abstraction for the result of an asynchronous operation
no
๐ฟ
For me, it's just macroGibberish and i still can't see the return of (a) RemoteExec
_future = [...] call my_remoteExec;
_handler = { diag_log format ["ctx: %1 args: %2", Delegate_Context, Delegate_Args]; };
Future_Then(_future, Delegate_New(_handler, "hello"))```
like i said, future/promise is an abstraction. next i'm writing the remoteExec code
https://www.youtube.com/watch?v=BpT6MkCeP7Y
Arma3 would be beyond words if they just slapped in a near-photoreal raytrace engine
Has nothing to do with Scripting.
vaguely
not even close lol
next i'm writing the remoteExec code
Haven't you said, it was already working?
@pliant stream are you currently somewhere in the academic world either as student or something else?
I'm intrigued
@jade abyss it was working, but it didn't use the future/promise that i just wrote. also i've since redone the server backend (implemented in C++) so the SQF side is now incompatible, which is why i have to redo it anyway, and i decided to return futures instead of a future-like RPC object which i was returning previously
@halcyon crypt why do you ask?
I like simple answers to simple questions.
you know what's simple to write? waitUntil on a global variable
you know what it isn't though? scalable... maintainable...
^ that's why I asked ๐
_blah = [_code, _args] call my_remoteExec;
How fancy can you get solving this ^
?
i can get very fancy, and i will
And I doubt that you're still working on something we would accept as solution to the given question.
_requests = [];
for "_i" from 1 to 1000 do
{
_requests pushBack ([_code, _i] call my_remoteExec);
};```
this is a bit harder to do with just global vars and wait until isn't it
Mostly because of: remoteExec just doesn't return anything else, then Nil/JIP-ID or empty String
I still don't see a way around something looping somewhere ๐ค
ยฏ_(ใ)_/ยฏ
There is none.
It might work in another Language, but in sqf.... I doubt it.
of course remoteExec doesn't return, and it can't, but it's possible to wrap around it an API which can
Proof it.
Wich has some kind of suspension in it
^
yeah, like commy did earlier
no there is still no need for scheduled environment :D
but not without waiting/polling/looping somewhere
yes there is suspension, in the same way that coroutines have suspension
but there is no need for the scheduled environment
suspension outside the scheduled environment. ๐ค
do you know what a coroutine is
๐ฟ
do you know what a coroutine is
No.
Once again: It might work in another Language, but in sqf.... I doubt it.
sqf is turing complete isn't it
Idk what that means either.
ok
well soon as i've got my remoteExec code working i'll be sure to showcase it to you
Did I mention that I like simple answers for simple questions?
it doesn't need macros, macros are just faster since we don't have a compiler that can inline
Don't wanna waste x minutes just to switch around and see what macro does what.
Q: "How to get this code working?"
A?: "Do you know what 'Turing complete' is?"
from the Unity docs:
A coroutine is like a function that has the ability to pause execution and return control to Unity but then to continue where it left off on the following frame.
So it's basically just the scheduled environment in Arma ..... ๐คฆ
Oh for fucks sake.
as for the macros, i just prefer to define public APIs using macros, it could just as well be functions
as if the underlying threading system matters at all for the implementation
like Future_GetValue(_future) -> _future call my_future_getValue
same thing
just written differently
arma sqf scheduler is a threading implementation
https://community.bistudio.com/wiki/Code_Optimisation#Make_it_work.
"Excessive cleverness is doing something in a really clever way when actually you could have done it in a much more straightforward but slightly less optimal manner. You've probably seen examples of people who construct amazing chains of macros (in C) or bizarre overloading patterns (in C++) which work fine but which you look at an go "wtf"? EC is a variation of premature-optimisation. It's also an act of hubris - programmers doing things because they want to show how clever they are rather than getting the job done." - sbsmac```
I meant the implementation of whatever you're trying to proof here
My Fav is the "wtf"-part.
brb implemented templated metaprogramming lambda thread schizz foo
This is what i see, at about 95% of all Macros i've seen so far.
I think I'm laughing.
alright, then in those terms i shall prove that returning from remoteExec is possible using only one thread
without sleep/waituntil/similar stuff.
If you like threads just write some compute shaders
pls do
_blah = [_code, _args] call my_remoteExec;
Reminder ^
lol
for your insane programming benders
Yep. And pls remember: There were > 4 ppl who knows their shit in here, telling you: Not possible.
But if it works -> Kudos.
@little eagle i upgraded that to 1000 concurrent remoteExecs
That was not the question.
1 will do
fine
(and is bad anyway)
using PVEHs is cheating btw
you don't need globals
Well, I don't see how using PVEH could solve the issue that is:
_blah = [_code, _args] call my_remoteExec;
So it's not cheating, but unlikely to be the solution.
@halcyon crypt It still has to "wait" until the Var is set, wich can be delayed ๐
๐
PVEH could be used as alternative to remoteExec, but that doesn't get around the need for suspension and therefore scheduled environment
A2 doesn't have remoteExec so i have to emulate it using PVs anyway...
I know that, what I meant with cheating was that PVEHs still rely on looping/polling/suspending etc behind the scenes
But it makes no difference
if he proves us wrong then I think he deserves a place in the veterans group ๐
you know, as a price
Lol
or in biminions group
Whats the biminions group for btw
employees
Slaves
Ok i thought so
if you lose though, you get X39's old group ๐
lmao, thats mean
Whats that
Don't ask.
Ok
๐
Stop chatting, Untelo and post your code.
*CollectingSomePitchforks*
I'm walking my dog. I'll continue coding when i get back. Have some patience
You will NOT get away with this.
you don't need to waitUntil you get back
badumm tss
can do it at the same time.. that's the whole point
I have attached a continuation to the asynchronous dog walking operation
So, a new Thread.
No the dog walking executes on the same thread. The continuation gets synchronized to it using a dispatcher.
_blah = [_code, _args] call my_remoteExec;
@pliant stream so you create a proper async system for arma?
How would you realize the "reattach" to the previous scope? Unscheduled could break your neck here when you use a await function
At least with the method that would come in my mind right now
simple future/promise with continuations
of course coroutines would require compiler support
But how you want to solve that?
similar to C# Task<T> if you're more familiar with that than e.g. C++ std::future, std::promise
future/promise, or coroutines?
Coroutines
Still waiting for the code.
oh i don't intend to, like i said that would require compiler support
in essence parsing something like await ( [...] call my_remoteExec ) and transforming the function into a coroutine
stackless coroutines, obviously
the locals would have to be extracted into a dynamic coroutine frame
So... You did not found the holy grale of sqf?
if you mean pretty coroutines, then no. said i said that would require compiler support
Y
Not sure if I regret reading the last few hours of chat or not
looking at std::future and std::promise it still needs to suspend/block using std::future::wait. In Arma that would either mean blocking the engine in unscheduled or using some kind of polling in scheduled ๐
TIL commy says 'mate' when getting triggered That is not the problem this is about, mate
you can however do ugly coroutines like i showed above, i.e. SQF Future_Then([...] call my_remoteExec, DelegateNew({ /*continuation*/ }, /*context*/));
oh i don't intend to
๐
Was I being bullshited all along?
@halcyon crypt look instead at std::experimental::future, or boost::future
std::future::then is a C++17 feature
Finally too
Extremely ugly
Due to macro usage that also should be problematic for anything using newlines or commas
TIL commy says 'mate' when getting triggered That is not the problem this is about, mate
Yo, mate
@little eagle did you misunderstood? in _blah = ... _blah was never the result, it was a future which will at some indeterminate time provide the result
Ugly in the sense of: you loose your current scope completely
๐คฃ
there's no way around that without stackful coroutines, which would require SQF support and that's obviously not happening
Leave him in his little world untelo
wtf
and stackful coroutines aren't desirable anyway
actually i guess it wouldn't matter in sqf since it has a variable sized stack afaik
ยฏ_(ใ)_/ยฏ
Extension could do it
yeah, but it would be unstable
not unstable in that it would crash necessarily, but it would be broken by binary patches to the game
i think if you wanted pretty coroutines, the best way would be to just transform the extended sqf into valid ugly sqf with explicit continuations
but that requires tooling that doesn't exist
So, Untelo, you're not gonna post a solution to:
_blah = [_code, _args] call my_remoteExec;
that does not require scheduled environment?
yes, but it's not my fault if you misunderstood what _blah is
_blah is a local variable
containing the return value of _code called with _args on a different machine
it is a future object that will at some indeterminate point provide the result of (_args call _code) executed on the server
The good old, at some point this may, or may not, have completed
that one
but all boilerplate is abstracted away, making it easier and safer to work with
I promise something might happen ๐
You abuse the reference "problem" of arrays?
wtf is the point of the "future object" when you still have to suspend your code to read it's value?
Still on mobile and did not want to trigger commy2
I don't agree with your proposed solution to @little eagle's problem
@little eagle yes you have to suspend, but not by sleeping or using waitUntil
Then how
you simply return, and then when the value is returned the continuation will execute
how
don't think you can, but if you could i'm pretty sure the game would freeze
You can't, which was my point.
the client executes an eventhandler when the value is returned via PV or RE, the eventhandler finds the relevant promise and fulfills it, executing the continuation
yes it suspends, but it does not sleep or waitUntil
there is no polling
or any shit like that
how does it suspend then?
it's completely event based
_blah = [_code, _args] call my_remoteExec;
But it does not allow for this ^ then.
event systems still use polling at some point
@little eagle yes it does, but you misunderstand what _blah is
No, _blah is the return value of _args call _code on a remote machine.
it is not. what you describe is impossible without freezing the client for an indeterminate amount of time
_blah is a future
_blah is a reference to the value that will be returned
It is not yet available but in a future point it will be
Yes it is:
some_remoteExec_wrapper_that_has_the_ability_to_return_values = {
params ["_code", "_args"];
My_RE_Return = nil;
[[_code, _args, clientOwner], {
params ["_code", "_args", "_owner"];
private _return = _args call _code;
[_return, { My_RE_Return = _this; }] remoteExec ["BIS_fnc_call", _owner];
}] remoteExec ["BIS_fnc_call"];
waitUntil {!isNil "My_RE_Return"};
My_RE_Return
};
See?
You said this can be done in scheduled / without waitUntil
right, now you use waitUntil
And no you can't.
You can get the actual value by using a yield function
Shut up X39
like i said, if you want pretty coroutines you need compiler support
it's that simple
but you can have ugly coroutines without it
like i posted above
/*continuation*/
}, /*context*/));```
I think we should try bargain for something better than SQF first
@little eagle by compiler support i don't mean changing SQF, the SQF "compiler" is essentially f(x) = x
The question was what some_remoteExec_wrapper_that_has_the_ability_to_return_values should be to get the return value of a function called on another machine with given arguments.
I said this can only be done with waitUntil / in scheduled environment
And you said it can be done in unscheduled.
And you're wrong, because you still have not demonstrated that it can be.