Jump to content

Recommended Posts

new missionEventHandler "PreloadFinished"

Does this help with network optimization of complex missions? Any particular examples? I'm sure many would love to hear more ;)

Share this post


Link to post
Share on other sites

Does this help with network optimization of complex missions? Any particular examples? I'm sure many would love to hear more ;)

 

"PreloadFinished" is a stackable version of onPreloadFinished {} EH/command. Not sure if this would help with network, but it sure will make modding a bit of a lesser pain ;) There are more stackable alternatives to be added, currently WIP.

Share this post


Link to post
Share on other sites

Hey KK,

stacked means that previouly EHs are not overwritten when creating a new EH of the same type, right?

Share this post


Link to post
Share on other sites

Hey KK,

stacked means that previouly EHs are not overwritten when creating a new EH of the same type, right?

 

Correct

Share this post


Link to post
Share on other sites

Hey KK,

stacked means that previouly EHs are not overwritten when creating a new EH of the same type, right?

 

a long time ago i looked at the stacked event handler system.

 

looked like it was storing the code to a missionnamespace variable and then executing all the linked variables inside a single onX event expression. So there isn't actually multiple onX events, just one which executes an array of variables(functions).

 

basic outline:

 

the core event function:

tag_fnc_eventOnEachFrame = {
     {
          call _x;
     } forEach array_of_stackedEventExpressions;
};

the event:

onEachFrame (missionNamespace getVariable ['tag_fnc_eventOnEachFrame',{}]);

adding another event to the stack:

array_of_stackedEventExpressions pushBack my_stacked_event;

Share this post


Link to post
Share on other sites

"PreloadFinished" is a stackable version of onPreloadFinished {} EH/command. Not sure if this would help with network, but it sure will make modding a bit of a lesser pain ;) There are more stackable alternatives to be added, currently WIP.

 

awhile back I read about some network events, these real?

 

onplayernetworkconnected

onplayernetworkdisconnected

Share this post


Link to post
Share on other sites

awhile back I read about some network events, these real?

 

onplayernetworkconnected

onplayernetworkdisconnected

 

I'm not aware of those EHs, but there are stackable versions for onPlayerConnected and onPlayerDisconnected:

 

addMissionEventHandler ["PlayerConnected", {diag_log _this}];

addMissionEventHandler ["PlayerDisconnected", {diag_log _this}];

Share this post


Link to post
Share on other sites

That means onPlayerConnected and onPlayerDisconnected were not getting restored when game was loaded from save , which got fixed

Share this post


Link to post
Share on other sites

Can we get case insensitive variants for "in" and "find" please? The configs are all over the place with the capitalization of magazines and attachments, even on the vanilla weapons.

  • Like 2

Share this post


Link to post
Share on other sites

Can we get case insensitive variants for "in" and "find" please? The configs are all over the place with the capitalization of magazines and attachments, even on the vanilla weapons.

 

they are case sensitive? can provide a repro?

Share this post


Link to post
Share on other sites

(toLower "wHatEVeRstRinG") find "what" is not an option?

 

Edit:

they are case sensitive?

Yes, try the above without toLower..

Share this post


Link to post
Share on other sites

Can we get case insensitive variants for "in" and "find" please? The configs are all over the place with the capitalization of magazines and attachments, even on the vanilla weapons.

 

(toLower "wHatEVeRstRinG") find "what" is not an option?

I would say the option above is sufficient and easy enough in order to justify there is no need for new variants of these commands.

Share this post


Link to post
Share on other sites

I would say the option above is sufficient and easy enough in order to justify there is no need for new variants of these commands.

 

It is not, because it's completely missing the point! I'm talking about <ARRAY> find <STRING> and <STRING> in <ARRAY>.

 

Just spawn yourself as "B_officer_F" and enter this in debug console:

(primaryWeaponItems player select 2) in getArray (configFile >> "CfgWeapons" >> primaryWeapon player >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems")
-> false // !

primaryWeaponItems player select 2
-> "optic_Aco"

getArray (configFile >> "CfgWeapons" >> primaryWeapon player >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems")
-> [..., "optic_aco", ...] 

 

The class is named "optic_Aco" in CfgWeapons, but in "compatibleItems" of almost all weapons it's called "optic_aco". The CSAT variant on the other hand is named "optic_ACO_grn" everywhere it seems. At least in the stock equippment.

There is a 30 ~ 40 items long list of weapons where the magazine has a different capitalizaion too. It's on the feedback tracker, so unfortunately inaccessible currently.

 

  • Like 2

Share this post


Link to post
Share on other sites

It would probably be way more efficient to have single commands to do that though than having to command stacking (with 'in' it gets way more cumbersome when dealing with an array of strings)..

EDIT: ninja'd

 

Why strings are case-sensitive in the first place? I don't recall them being so in OFP, it started to happen in A1 and the most annoying thing is/was that at least back then only some of the strings were case-sensitive and some were not which could cause massive shedding of gray hair after which I have always used toLower/Upper because it seems even the game can't decide when to be sensitive or not..

 

 

Oh, and on the topic of new commands, are there any plans to add toolbox (the dialog control type, not object :P ) related commands because currently you can't fiddle with them via sripting, I think only lbCurSel and lbClear work with toolboxes so you can't add stuff or manipulate them in any way.. You guys have added a lot of completely undocumented lb* and lbn* commands used all over 3DEN but none for toolboxes.. Unless I'm missing something very obvious..

Share this post


Link to post
Share on other sites

My suggestion would be adding unary alternative syntaxes to the usually binary commands "in" and "find". Those would be case insensitve.

 

Example:

find ["a", ["A", player, "123"]]
-> 0

in ["a", ["A", player, "123"]]
-> true

Making unary variants of binary commands has been done before. E.g.: https://community.bistudio.com/wiki/createVehicle

  • Like 1

Share this post


Link to post
Share on other sites

Plenty of commands to find ways around the problem.

_playerWeaponOptic = toLower ( primaryWeaponItems player select 2 );
_compatItems = getArray (configFile >> "CfgWeapons" >> primaryWeapon player >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems") apply { toLower _x };

_isCompat = _playerWeaponOptic in _compatItems;
_isCompat = _compatItems find _playerWeaponOptic > -1;

Share this post


Link to post
Share on other sites

That's true. But even your example would error with the arguments I provided, because you would have to check the type of _x before using to lower. It also looks god awful compared to a dedicated command for such a basic functionality. With your method the game would have to iterate through the array twice!

  • Like 1

Share this post


Link to post
Share on other sites

There is a bug with the "diag_codePerformance" command, which causes it to be unusable in the debug console.

 

If you enter:

systemChat str diag_codePerformance [{systemChat "test"}, nil, 1000];

and press "local exec", nothing happens. No chat messages are displayed.

 

You have to modify the code to:

0 spawn {
    systemChat str diag_codePerformance [{systemChat "test"}, nil, 1000];
};

for it to display anything.

 

I thought that maybe the command is not supposed to work in unscheduled environment, but it does seem to work without issues in the four watch fields. This can't be the reason, because those show:

canSuspend
-> false

After testing I found out that you can't stack two diag_codePerformance inside each other:

0 spawn {
    diag_codePerformance [{
        systemChat str diag_codePerformance [{systemChat "test"}, nil, 1000];
        systemChat "test test";
    }, nil, 1];
};

as this only displays "test test" in the chat, but no result of the inner diag_codePerformance command or the "test" s from inside that.

 

Seems like the upper field in the debug console uses diag_codePerformance internally - or at least something similar - and this bug prevents it from showing anything.

 

Version: 1.58.135276 (RC)

Share this post


Link to post
Share on other sites

That is correct, you cannot execute diag_codePerformance inside diag_codePerformance. Besides why would you need to run it inside debug console if there is such a nice code performance button for convinience?

Share this post


Link to post
Share on other sites

Hey KK, could you take a look at this thread, please and clarify whether that is intended or not?

  • Like 1

Share this post


Link to post
Share on other sites

Hey KK, could you take a look at this thread, please and clarify whether that is intended or not?

There might be some issues with using remoteExec in Eden. Could you please prepare repro steps for me?

Share this post


Link to post
Share on other sites

I did some more testing and found out that it's not execute if JIP is set to true and target is the server.

[s1,['test_var',true]] remoteExec ['setVariable',2] //works
[s1,['test_var',true]] remoteExec ['setVariable',0] //works
[s1,['test_var',true]] remoteExec ['setVariable',2,true]//doesn't work
[s1,['test_var',true]] remoteExec ['setVariable',0,true] //works

Both tested in 3DEN and 2D editor in single player.

Share this post


Link to post
Share on other sites

That is correct, you cannot execute diag_codePerformance inside diag_codePerformance. Besides why would you need to run it inside debug console if there is such a nice code performance button for convinience?

The diag_codePerformance command allows you to specify how many loops should be tested I guess.

This behaviour should probably be documented. Ideally the command should also show an error message instead of just failing silently.

I know it's just a debug command, but silently failing commands is probably one of the worst things about SQF.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×