Jump to content
Sign in to follow this  
clydefrog

BIS_fnc_MP isPersistent param is broken

Recommended Posts

The isPersistant JIP parameter of BIS_fnc_MP has stopped working for me (stable version not dev). I have actions added using this function in 2 missions and no longer can JIP players see these actions when before you could disconnect or switch teams/roles in the lobby, come back in and still see them. Can anybody else confirm this?

Edited by clydefrog

Share this post


Link to post
Share on other sites

Nobody? This is a fairly big problem that will affect a lot of peoples missions, and since I've had it happen in 2 missions that I know it worked properly in before the update last week, I don't think this is a problem only I am having. Has anybody else here experienced the problem or have any mission they have made that they can check for it on?

Edited by clydefrog

Share this post


Link to post
Share on other sites

Are you absolutely sure that it is broken? Like have you tested in a local / private environment away from public players joining, the reason why I ask is because cheaters can overwrite things on the object that stores the information for JIP players. So it is always best to pinpoint the problem as best as possible and do initial tests on a dedicated server that has a password and kept away from the public.

Share this post


Link to post
Share on other sites
Are you absolutely sure that it is broken? Like have you tested in a local / private environment away from public players joining, the reason why I ask is because cheaters can overwrite things on the object that stores the information for JIP players. So it is always best to pinpoint the problem as best as possible and do initial tests on a dedicated server that has a password and kept away from the public.

Tested on a private dedicated server with one other person on helping me test. They joined after the start and didn't get the action, then we tried again by restarting the mission and him going back to the lobby after the start and also disconnecting, he didn't get the action. Then I lauched my own dedicated server and tried a mission we ran a few weeks ago that it worked fine on, I disconnected and reconnected and didn't get an action that previously was there for JIP players.

Edited by clydefrog

Share this post


Link to post
Share on other sites
So it is always best to pinpoint the problem as best as possible and do initial testsalways play ArmA on a dedicated server that has a password and kept away from the public.

Fixed. ;)

Share this post


Link to post
Share on other sites

Ok, well it still may not be broken per say.

How are you calling these functions to be persistent? Are they custom wrote functions or are you using things by BIS to execute the code i.e BIS_fnc_spawn

One thing i've always ran into problems is if I'm calling my own functions if the function isn't initialized before the client starts the JIP process it won't execute because the function doesn't exist.

Fixed. ;)

Har Har xD

Share this post


Link to post
Share on other sites
Ok, well it still may not be broken per say.

How are you calling these functions to be persistent? Are they custom wrote functions or are you using things by BIS to execute the code i.e BIS_fnc_spawn

One thing i've always ran into problems is if I'm calling my own functions if the function isn't initialized before the client starts the JIP process it won't execute because the function doesn't exist.

Har Har xD

The function is run at the beginning of the script (which is called from the init.sqf at the start) on all machines and is given time to initialise before the function is called with BIS_fnc_MP

Here's my function:



CF_addactionMP =

           		{

          		 private["_object","_screenMsg","_scriptToCall","_showActionVar"];
           		_object = _this select 0;
           		_screenMsg = _this select 1;
           		_scriptToCall = _this select 2;
		_showActionVar = _this select 3;

           		if(isNull _object) exitWith {};

       	_object addaction [("<t color=""#58FA58"">" + (_screenMsg) + "</t>"),_scriptToCall,[],1,false,true,"",_showActionVar];

       	}; 

and here is the code later in the script to use it

		[[transformer,"Place Charge","sabotage.sqf","showAction1"],"CF_addactionMP",true,true] call BIS_fnc_MP;

and also as I said, this function worked fine for JIP before the update last week.

Share this post


Link to post
Share on other sites

Ah so it is a custom function, first to make sure it's initialized in time before the JIP goes through its process scan through the RPT and check to make sure there isn't any errors going 'Function CF_addactionMP doesn't exist' or anything relating to it. It could be that BIS made the initialization time of fn_initMultiplayer.sqf before init.sqf (mission).

What I actually do to be sure that I never have the issue is I just make the functions I want in a .sqf and call it via BIS_fnc_execVM and I've never generally had a problem, although I do flush variables stored on bis_functions_mainscope over periods of time but I haven't noticed any issues with the JIP param not working.

Share this post


Link to post
Share on other sites
Ah so it is a custom function, first to make sure it's initialized in time before the JIP goes through its process scan through the RPT and check to make sure there isn't any errors going 'Function CF_addactionMP doesn't exist' or anything relating to it. It could be that BIS made the initialization time of fn_initMultiplayer.sqf before init.sqf (mission).

What I actually do to be sure that I never have the issue is I just make the functions I want in a .sqf and call it via BIS_fnc_execVM and I've never generally had a problem, although I do flush variables stored on bis_functions_mainscope over periods of time but I haven't noticed any issues with the JIP param not working.

I just checked my .rpts and there is no reference to that function name anywhere. So how do you do this thing with BIS_fnc_execVM? Do you run the script for all machines and JIP e.g.

[[[],"functions.sqf"],"BIS_fnc_execVM",true,true] call BIS_fnc_MP;

in the init.sqf?

Still I don't understand why this worked a couple of weeks ago but now since that update last week it doesn't unless something in the update has changed it.

Edited by clydefrog

Share this post


Link to post
Share on other sites

You don't need to use that because the init.sqf runs for everyone who connects to the game. So it is persistent in it's own way.

Share this post


Link to post
Share on other sites
I just checked my .rpts and there is no reference to that function name anywhere. So how do you do this thing with BIS_fnc_execVM? Do you run the script for all machines and JIP e.g.

[[[],"functions.sqf"],"BIS_fnc_execVM",true,true] call BIS_fnc_MP;

in the init.sqf?

Still I don't understand why this worked a couple of weeks ago but now since that update last week it doesn't unless something in the update has changed it.

I'm not entirely sure but last time I worked with BIS_fnc_MP I found out that it does not generate script errors. So either your function is not initialized by the time it's called or the script is generating an error which it is not outputting.

Also are you sure this line isn't hit: if(isNull _object) exitWith {};

I would start with putting diag_log inside your custom function and see if it even runs on the client.

---------- Post added at 09:13 ---------- Previous post was at 09:02 ----------

After some digging I found the script they use to do the delayed script loading:

From fn_initMultiplayer.sqf:

		waituntil {!isnil "bis_functions_mainscope"};
		_queue = bis_functions_mainscope getvariable ["BIS_fnc_MP_queue",[]];
		{
			//--- Do not declare persistent call again to avoid infinite loop
			_varValue = +_x;
			_mode = 	[_varValue,0,[0]] call bis_fnc_paramin;
			_params = 	[_varValue,1,[]] call bis_fnc_paramin;
			_functionName =	[_varValue,2,"",[""]] call bis_fnc_paramin;
			_target =	[_varValue,3,-1,[objnull,true,0,[],sideUnknown,grpnull]] call bis_fnc_paramin;
			_isPersistent =	[_varValue,4,false,[false]] call bis_fnc_paramin;
			_isCall =	[_varValue,5,false,[false]] call bis_fnc_paramin;

			switch (typename _target) do {
				case (typename objnull): {
					if (local _target) then {
						["BIS_fnc_MP_packet",[_mode,_params,_functionName,_target,false,_isCall]] call BIS_fnc_MPexec; //--- Local execution
					};
				};
				case (typename true): {
					if (_target) then {
						["BIS_fnc_MP_packet",[_mode,_params,_functionName,_target,false,_isCall]] call BIS_fnc_MPexec; //--- Local execution
					} else {
						[_params,_functionName,_target,false,_isCall] call BIS_fnc_MP; //--- Global execution
					};
				};
				case (typename grpnull);
				case (typename sideUnknown): {
					["BIS_fnc_MP_packet",[_mode,_params,_functionName,_target,false,_isCall]] call BIS_fnc_MPexec; //--- Local execution
				};
				case (typename 0): {
					//--- Disabled
				};
			};
		} foreach _queue;
		["BIS_fnc_initMultiplayer"] call bis_fnc_endLoadingScreen;

One option you could try is to put something like this in the init:

waituntil {!isnil "bis_functions_mainscope"};
_queue = bis_functions_mainscope getvariable ["BIS_fnc_MP_queue",[]];
diag_log _queue;
};

You would at least know for sure whether the client has is supposed to exec it.

Share this post


Link to post
Share on other sites
You don't need to use that because the init.sqf runs for everyone who connects to the game. So it is persistent in it's own way.

Yeah I shouldn't have to use that.

.

The action is run on all clients because any player who is there from the start and doesn't jip sees the action.

Yeah, if(isNull _object) exitWith {}; does not show up in the rpt either.

Thanks for the suggestions but really I don't see why I should need to do anything special to get this to work again, again it worked fine until that update last week. There must be a simple way of giving the function more time to initialise if that's what it is, still if that's the problem why does it run it on all clients but not for JIP? I see currently it is given 2 seconds from the function being created to it being called, and in the other script/mission using it it's more like 7 seconds between it being created and being called, surely that is enough time?

How about putting my functions into one script with a sleep of say 5 seconds at the end of it, that is called from the init.sqf at the start of it. Should that make sure they are all initialised before anything else is done?

Edited by clydefrog

Share this post


Link to post
Share on other sites
Thanks for the suggestions but really I don't see why I should need to do anything special to get this to work again, again it worked fine until that update last week.

You can debate till the end of life and tell everyone "it used to work" but unless you debug and come up with some hard evidence that the function is actually broken no-one from this forum or Bohemia will take time to verify this.

Just follow my advice and test these couple of things to verify what is wrong.

Put this at the first line of your client's init:

[] spawn{
waituntil {!isnil "bis_functions_mainscope"}; 

_queue = bis_functions_mainscope getvariable ["BIS_fnc_MP_queue",[]]; 
diag_log format["MP call que:%1",_queue]; 
};

Also use some diag_log's inside your made script to see how far it comes.

CF_addactionMP =
{
private["_object","_screenMsg","_scriptToCall","_showActionVar"];
_object = _this select 0;
_screenMsg = _this select 1;
_scriptToCall = _this select 2;
_showActionVar = _this select 3;

diag_log format["Called CF_addactionMP with vars: %1.", _this];
if(isNull _object) exitWith {};

diag_log format ["Adding action to object: %1.", _object];
_object addaction [("<t color=""#58FA58"">" + (_screenMsg) + "</t>"),_scriptToCall,[],1,false,true,"",_showActionVar];
diag_log "Action added to object.";
};

;

If you do these 2 things and your JIP clien't actually has the line "Action added to object." in his RPT but the addaction is not showing switch to DEV branch and test is there.

Also confirm the params outputted in the first diag_log are actually correct. If for example _screenMsg is empty your action will not display.

Edit:

Run the mission dedicated and set persistent=1. Connect once to "fire up the mission". leave and re-join and you should be a JIP player. This way you can test it out yourself.

Share this post


Link to post
Share on other sites

Ok this is from the server rpt after starting the mission:

2013/08/05, 15:07:22 "Called CF_addactionMP with vars: [23bef040# 166252: dp_transformer_f.p3d,"Place Charge","sabotage.sqf","showAction1"]."

2013/08/05, 15:07:22 "Adding action to object: 23bef040# 166252: dp_transformer_f.p3d."

2013/08/05, 15:07:22 "Action added to object."

this is from the normal rpt:

"Called CF_addactionMP with vars: [46d5b040# 164041: dp_transformer_f.p3d REMOTE,"Place Charge","sabotage.sqf","showAction1"]."

"Adding action to object: 46d5b040# 164041: dp_transformer_f.p3d REMOTE."

"Action added to object."

I'll post after JIP in a min

---------- Post added at 15:16 ---------- Previous post was at 15:10 ----------

After JIP all I see extra in the rpts related to the action is this line:

"MP call que:[[1,[37a550c0# 164036: dp_transformer_f.p3d REMOTE,"Place Charge","sabotage.sqf","showAction1"],"CF_addactionMP",true,true,false]]"

Share this post


Link to post
Share on other sites

Well this confirms that the JIP call queue is working correctly. Did the JIP log also have the "Action added part" (after the call queue output)?

Share this post


Link to post
Share on other sites
Well this confirms that the JIP call queue is working correctly. Did the JIP log also have the "Action added part" (after the call queue output)?

no it didn't

Share this post


Link to post
Share on other sites

Hmm after re-evaluating your script I noticed something weird.

 _object addaction [("<t color=""#58FA58"">" + (_screenMsg) + "</t>"),_scriptToCall,[],1,false,true,"",_showActionVar];

Where "_showActionVar" is "_this select 3".

And accoring to this line:

  [[transformer,"Place Charge","sabotage.sqf","showAction1"],"CF_addactionMP",true,true] call BIS_fnc_MP; 

this means _showActionVar = "showAction1".

This would mean that the unit should have a local var named showAction1 which should be true in order to be able to see the action.

Is this var also synced to JIP players?

---------- Post added at 16:34 ---------- Previous post was at 16:32 ----------

no it didn't

Did it show the "diag_log format["Called CF_addactionMP with vars: %1.", _this];" part?

Please be a little more specific. I'm trying to help you and your replies are beginning to irritate me...

Share this post


Link to post
Share on other sites

showAction1 is a global variable that is set true and publicVariable'd before the action is added, and is used as a condition to show the action, once the action is used that variable is set false to hide the action. So becasue it's publicVariabled it should make it show for JIP too right?

Did it show the "diag_log format["Called CF_addactionMP with vars: %1.", _this];" part?

Please be a little more specific. I'm trying to help you and your replies are beginning to irritate me...

no, it only showed the line I quoted, here is the line with the line before and after it

Speaker Male01_F not found in CfgVoiceTypes

"MP call que:[[1,[37a550c0# 164036: dp_transformer_f.p3d REMOTE,"Place Charge","sabotage.sqf","showAction1"],"CF_addactionMP",true,true,false]]"

String STR_A3_at_mine_cluster_0 not found

and I'm not trying to irritate you, I'm trying to answer everything you ask and appreciate the help a lot.

---------- Post added at 15:49 ---------- Previous post was at 15:34 ----------

So does the lack of that line mean something is going wrong somewhere? By the way if it helps, when I used this function in another mission it was altered and used the standard addaction (I didn't use the show/hide action variable, I just removed the action after it had been used), but the function also doesn't work in that mission for JIP now either (actions are not added for them).

Edited by clydefrog

Share this post


Link to post
Share on other sites

So your function reaches the call queue but it won't get executed. This code actually makes sure it should:

	private ["_canExecute"];
_canExecute = switch (typename _target) do {
	case (typename grpnull): {player in units _target};
	case (typename sideUnknown): {playerside == _target;};
	default {true};
};

if (_canExecute) then {
	_function = missionnamespace getvariable _functionName;
	if (!isnil "_function") then {
		if (_isCall) then {
			_params call _function;
		} else {
			_params spawn _function;
		};
		true
	} else {
		["Function '%1' does not exist",_functionName] call bis_fnc_error;
		false
	};
};

The _canExecute should be true because _target = true and therefore the default case is triggered.

The next part actually checks if your function is initialized. If not it displays an error. Since it's not displaying "Function does not exist" we it's fair to assume the code doesn't reach that part.

_iscall is false and your function should be spawned.

Weird. I walked through fn_initMultiplayer.sqf with your diag_log output of the _queue. It should, 100% sure call BIS_fnc_MPExec (e.g. fn_MPexec.sqf) which should then spawn your function.

2 more things left:

1: Switch to dev mode and test again.

2: Set up a clean proof of concept with these scripts

//Server

[["testvar1", true, "testvar2"],"CF_addactionMP",true,true] call BIS_fnc_MP;

CF_addactionMP

CF_addactionMP =
{
diag_log "Adding action";
diag_log _this;
};

If the dev mode doesn't work test with the 2nd set of scripts. If those don't work in JIP it's a bug and you should use the bugtracker to report it as a bug.

I will also test this scenario tonight when I get home (4-5 hours from now) and post my results here.

Share this post


Link to post
Share on other sites
So your function reaches the call queue but it won't get executed. This code actually makes sure it should:

	private ["_canExecute"];
_canExecute = switch (typename _target) do {
	case (typename grpnull): {player in units _target};
	case (typename sideUnknown): {playerside == _target;};
	default {true};
};

if (_canExecute) then {
	_function = missionnamespace getvariable _functionName;
	if (!isnil "_function") then {
		if (_isCall) then {
			_params call _function;
		} else {
			_params spawn _function;
		};
		true
	} else {
		["Function '%1' does not exist",_functionName] call bis_fnc_error;
		false
	};
};

The _canExecute should be true because _target = true and therefore the default case is triggered.

The next part actually checks if your function is initialized. If not it displays an error. Since it's not displaying "Function does not exist" we it's fair to assume the code doesn't reach that part.

_iscall is false and your function should be spawned.

Weird. I walked through fn_initMultiplayer.sqf with your diag_log output of the _queue. It should, 100% sure call BIS_fnc_MPExec (e.g. fn_MPexec.sqf) which should then spawn your function.

2 more things left:

1: Switch to dev mode and test again.

2: Set up a clean proof of concept with these scripts

//Server

[["testvar1", true, "testvar2"],"CF_addactionMP",true,true] call BIS_fnc_MP;

CF_addactionMP

CF_addactionMP =
{
diag_log "Adding action";
diag_log _this;
};

If the dev mode doesn't work test with the 2nd set of scripts. If those don't work in JIP it's a bug and you should use the bugtracker to report it as a bug.

I will also test this scenario tonight when I get home (4-5 hours from now) and post my results here.

Ok thanks a lot, I'll download the dev branch and see what happens then try that as well.

---------- Post added at 16:30 ---------- Previous post was at 16:04 ----------

Ok I'm having a strange problem with dev branch, when I click on a mission to load it on the dedicated server, the screen just flashes to the map of stratis loading screen then back to the mission selection. I'll go back to the normal one for now just to test your second thing as I can't load anything on the server with dev branch.

---------- Post added at 16:53 ---------- Previous post was at 16:30 ----------

Here are the rpt logs from running those 2 scripts in the stable branch:

On Mission start:

in the server rpt:

2013/08/05, 16:40:44 "Adding action"

2013/08/05, 16:40:44 ["testvar1",true,"testvar2"]

in the normal rpt:

"Adding action"

["testvar1",true,"testvar2"]

and after JIP

in the server rpt:

nothing else added

in the normal rpt:

"Adding action"

["testvar1",true,"testvar2"]

Here's a link to the mission file I used to test it

http://www.mediafire.com/?grxqvwgbn3c6vwm

Edited by clydefrog

Share this post


Link to post
Share on other sites

The latest test confirms it that JIP functions do actually work. Would you be willing to share your originally mission, the broken one so I could investigate it myself?

If you don't want to make it public you could pm it.

Share this post


Link to post
Share on other sites

Sure I'll pack it up for you and pm you a link. By the way, any idea why I was unable to load any missions up on the dedicated server with the DEV branch?

---------- Post added at 18:41 ---------- Previous post was at 18:19 ----------

Ok the PM's sent with some instructions of what to do to test the problem.

Share this post


Link to post
Share on other sites

Well I was just looking at the spotrep for the new patch and saw this:

Fix: After JIP, persistent functions were sometimes executed before mission objects were created

related to my problem, perhaps? I'm going to see if it is now fixed after this update.

edit: no, still not fixed.

Edited by clydefrog

Share this post


Link to post
Share on other sites

So has anybody else had this problem since then? I have just been bringing two older missions up to date and the problem still exists where an action won't show to JIP players.

Share this post


Link to post
Share on other sites

Yes I am having this same issue. I'm not sure if it's every JIP player or just occasional ones. I need to do some logging like was done earlier in this thread and investigate it further.

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
Sign in to follow this  

×