Jump to content
HazJ

Custom loading screen (startLoadingScreen)

Recommended Posts

Hi all.

disableSerialization;

// _display = uiNamespace getVariable "disp_loadingScreen";
_display = findDisplay 97531;
// _display = findDisplay 0;
// copyToClipboard str allDisplays;

introQuotes =
[
	"\a3\missions_f_epa\video\a_hub_quotation.ogv",
	"\a3\missions_f_epa\video\a_in_quotation.ogv",
	"\a3\missions_f_epa\video\a_m01_quotation.ogv",
	"\a3\missions_f_epa\video\a_m02_quotation.ogv",
	"\a3\missions_f_epa\video\a_m03_quotation.ogv",
	"\a3\missions_f_epa\video\a_m04_quotation.ogv",
	"\a3\missions_f_epa\video\a_m05_quotation.ogv",
	"\a3\missions_f_epa\video\a_out_quotation.ogv",
	"\a3\missions_f_epa\video\b_hub01_quotation.ogv",
	"\a3\missions_f_epa\video\b_m01_quotation.ogv",
	"\a3\missions_f_epa\video\b_m02_quotation.ogv",
	"\a3\missions_f_epa\video\b_m03_quotation.ogv",
	"\a3\missions_f_epa\video\b_m06_quotation.ogv",
	"\a3\missions_f_epa\video\b_out2_quotation.ogv",
	"\a3\missions_f_epa\video\c_ea_quotation.ogv",
	"\a3\missions_f_epa\video\c_eb_quotation.ogv",
	"\a3\missions_f_epa\video\c_in1_quotation.ogv",
	"\a3\missions_f_epa\video\c_in2_quotation.ogv",
	"\a3\missions_f_epa\video\c_m01_quotation.ogv",
	"\a3\missions_f_epa\video\c_m02_quotation.ogv",
	"\a3\missions_f_epa\video\c_out1_quotation.ogv",
	"\a3\missions_f_epa\video\a_in2_quotation.ogv",
	"\a3\missions_f_epa\video\b_m05_quotation.ogv",
	"\a3\missions_f_epa\video\b_m02_1_quotation.ogv"
];

(_display displayCtrl 3575) ctrlAddEventHandler ["VideoStopped",
{
	params ["_control"];
	diag_log format ["Is this working?"];
	_quote = selectRandom introQuotes;
	diag_log format ["Quote :: %1", _quote];
	ctrlSetText [_control, _quote]; // returns correct video quote
}];
class rsc_loadingScreen
{
	idd = -1; // tried 97531 before - makes no difference
	movingEnable = 0;
	duration = 1e011;
	fadeIn = 0;
	fadeOut = 0;
	class controlsBackground
	{
		class videoOverlay : RscVideo
		{
			idc = 3575;
			x = safezoneX;
			y = safezoneY;
			w = safezoneW;
			h = safezoneH;
			loops = 1;
			video = __EVAL(selectRandom ["\a3\missions_f_epa\video\a_hub_quotation.ogv", "\a3\missions_f_epa\video\a_in_quotation.ogv", "\a3\missions_f_epa\video\a_m01_quotation.ogv", "\a3\missions_f_epa\video\a_m02_quotation.ogv", "\a3\missions_f_epa\video\a_m03_quotation.ogv", "\a3\missions_f_epa\video\a_m04_quotation.ogv", "\a3\missions_f_epa\video\a_m05_quotation.ogv", "\a3\missions_f_epa\video\a_out_quotation.ogv", "\a3\missions_f_epa\video\b_hub01_quotation.ogv", "\a3\missions_f_epa\video\b_m01_quotation.ogv", "\a3\missions_f_epa\video\b_m02_quotation.ogv", "\a3\missions_f_epa\video\b_m03_quotation.ogv", "\a3\missions_f_epa\video\b_m06_quotation.ogv", "\a3\missions_f_epa\video\b_out2_quotation.ogv", "\a3\missions_f_epa\video\c_ea_quotation.ogv", "\a3\missions_f_epa\video\c_eb_quotation.ogv", "\a3\missions_f_epa\video\c_in1_quotation.ogv", "\a3\missions_f_epa\video\c_in2_quotation.ogv", "\a3\missions_f_epa\video\c_m01_quotation.ogv", "\a3\missions_f_epa\video\c_m02_quotation.ogv", "\a3\missions_f_epa\video\c_out1_quotation.ogv", "\a3\missions_f_epa\video\a_in2_quotation.ogv", "\a3\missions_f_epa\video\b_m05_quotation.ogv", "\a3\missions_f_epa\video\b_m02_1_quotation.ogv"]);
			text = __EVAL(selectRandom ["\a3\missions_f_epa\video\a_hub_quotation.ogv", "\a3\missions_f_epa\video\a_in_quotation.ogv", "\a3\missions_f_epa\video\a_m01_quotation.ogv", "\a3\missions_f_epa\video\a_m02_quotation.ogv", "\a3\missions_f_epa\video\a_m03_quotation.ogv", "\a3\missions_f_epa\video\a_m04_quotation.ogv", "\a3\missions_f_epa\video\a_m05_quotation.ogv", "\a3\missions_f_epa\video\a_out_quotation.ogv", "\a3\missions_f_epa\video\b_hub01_quotation.ogv", "\a3\missions_f_epa\video\b_m01_quotation.ogv", "\a3\missions_f_epa\video\b_m02_quotation.ogv", "\a3\missions_f_epa\video\b_m03_quotation.ogv", "\a3\missions_f_epa\video\b_m06_quotation.ogv", "\a3\missions_f_epa\video\b_out2_quotation.ogv", "\a3\missions_f_epa\video\c_ea_quotation.ogv", "\a3\missions_f_epa\video\c_eb_quotation.ogv", "\a3\missions_f_epa\video\c_in1_quotation.ogv", "\a3\missions_f_epa\video\c_in2_quotation.ogv", "\a3\missions_f_epa\video\c_m01_quotation.ogv", "\a3\missions_f_epa\video\c_m02_quotation.ogv", "\a3\missions_f_epa\video\c_out1_quotation.ogv", "\a3\missions_f_epa\video\a_in2_quotation.ogv", "\a3\missions_f_epa\video\b_m05_quotation.ogv", "\a3\missions_f_epa\video\b_m02_1_quotation.ogv"]);
			onVideoStopped = "diag_log format [""CONTROL :: %1"", param [0]]; ctrlSetText [param [0], (selectRandom introQuotes)]; diag_log format [""New quote? :: %1"", ctrlText param [0]];";
		};
	};
	class controls {};
};
startLoadingScreen ["Authority mission is setting up. Please wait...", "rsc_loadingScreen"];
waitUntil {initserverfinished};
endLoadingScreen;

This all works fine after a lot of time messing with it but the issue is that onVideoStopped doesn't. Originally I did this in an external file (see above) but that didn't work as the specified idd appears to be ignored. Not sure why as it is custom display, even when I changed -1/97531 to something else. I even tried uiNamespace setVariable too. I want to play another video upon the previous ending and stop it when loading is complete.

How to change the video?

- ctrlSetText doesn't work (although it returns correct quote)

- BIS_fnc_playVideo function doesn't work (not for control method)

@Larrow

 

  • Like 3

Share this post


Link to post
Share on other sites

if you want the video to play on the display you still have to call bis fnc_playVideo after settext
 

030590 cutRsc ["MRHPip", "PLAIN"];
disableSerialization;
_display = uiNamespace getVariable "MRHPip";
_ctrlPICHG = (_display displayCtrl 1200);
_ctrlPICBD = (_display displayCtrl 1201) ctrlShow false;

_video1 = "media\video\video1.ogv";
_ctrlPICHG ctrlsettext _video1;
_videoplaying = [_video1, [10, 10]] call BIS_fnc_playVideo;
//_ctrlSIZE = (_display displayCtrl 1203)ctrlShow false;
//sleep 10;
_ctrlPICHG = (_display displayCtrl 1200) ctrlShow false;

_ctrlPICBD = (_display displayCtrl 1201) ctrlShow true;
_ctrlPICBD = (_display displayCtrl 1201);
_video2 = "media\video\video2.ogv";
_ctrlPICBD ctrlsettext _video2;
_videoplaying = [_video2, [10, 10]] call BIS_fnc_playVideo;
sleep 9;

_display closedisplay 2;

I had this that worked in a mission but not used with startLoadingScreen it states in the wiki that you can't use sleep with startLoadingScreen but uisleep instead, maybe this will help, I'm not sure.

  • Like 2

Share this post


Link to post
Share on other sites

I shall try it this evening when home. Thanks.

  • Like 1

Share this post


Link to post
Share on other sites
On 11/12/2018 at 11:03 AM, Mr H. said:

if you want the video to play on the display you still have to call bis fnc_playVideo after settext
 


030590 cutRsc ["MRHPip", "PLAIN"];
disableSerialization;
_display = uiNamespace getVariable "MRHPip";
_ctrlPICHG = (_display displayCtrl 1200);
_ctrlPICBD = (_display displayCtrl 1201) ctrlShow false;

_video1 = "media\video\video1.ogv";
_ctrlPICHG ctrlsettext _video1;
_videoplaying = [_video1, [10, 10]] call BIS_fnc_playVideo;
//_ctrlSIZE = (_display displayCtrl 1203)ctrlShow false;
//sleep 10;
_ctrlPICHG = (_display displayCtrl 1200) ctrlShow false;

_ctrlPICBD = (_display displayCtrl 1201) ctrlShow true;
_ctrlPICBD = (_display displayCtrl 1201);
_video2 = "media\video\video2.ogv";
_ctrlPICBD ctrlsettext _video2;
_videoplaying = [_video2, [10, 10]] call BIS_fnc_playVideo;
sleep 9;

_display closedisplay 2;

I had this that worked in a mission but not used with startLoadingScreen it states in the wiki that you can't use sleep with startLoadingScreen but uisleep instead, maybe this will help, I'm not sure.

Doesn't work. This is what happens, adapting your code above.

Share this post


Link to post
Share on other sites

maybe spawn the BIS_fnc_playVideo function and use waitUntil & scriptdone
from the wiki : https://community.bistudio.com/wiki/BIS_fnc_playVideo

Quote

Plays in-game video with a range of options. The function can be called or spawned. If spawned, scriptDone command can be used to see if video is stopped or finished. If called in scheduled environment, the next line of code will not process until the video is stopped or finished.

The function also calls "BIS_fnc_playVideo_started" and "BIS_fnc_playVideo_stopped" Scripted Event Handlers in missionNamespace (see BIS_fnc_addScriptedEventHandler)

hope this might help

Share this post


Link to post
Share on other sites

But I think that your issue in the first video is that endLoadingScreen; is called before the loading is actually done and that's why you get the blue screen, maybe try to use
waitUntil {getClientState == "GAME LOADED"};
or
waitUntil {player == player};
before using endLoadingScreen;
(untested I'm not sure!)

Share this post


Link to post
Share on other sites

We already know how to play the video. The issue is that we are trying to play it to a control which we have done however we want to play another and so on so fourth once one ends. Thanks for trying though.

Share this post


Link to post
Share on other sites

Just guessing but loop = 1; in your rsc_loadingScreen may prevent the videostopped eventhandler from firing. Some other ideas:

 

The Biki implies that RscVideo uses BIS_fnc_playVideo for starting the video internally. So maybe the scripted eventhandler BIS_fnc_playVideo_stopped will work.

 

If the new video does not start AND you called BIS_fnc_playVideo you can try the removal of the videoOverlay control and addin a new one,  directly with the correct video.

Or you can just end the current loading screen and start a new one with a different video (make the video a parameter of the loadingscreen, so one loadingscreen can invoke a new one).

 

  • Like 1

Share this post


Link to post
Share on other sites

Back again... No luck.

@NeoArmageddon

startLoadingScreen ["Authority mission is setting up. Please wait...", "rsc_loadingScreen"];
[missionNamespace, "BIS_fnc_playVideo_stopped",
{
	diag_log ":::: Video stopped!"; // This isn't even being executed
}] call BIS_fnc_addScriptedEventHandler;
waitUntil {initserverfinished};
endLoadingScreen;

Just to clarify... I am not just showing the video in-game at any time. It is specific to loading screen. See startLoadingScreen command.

loops = 1;

This doesn't actually loop. It is more show X times.

class rsc_loadingScreen
{
	idd = 12345;
	duration = 10e10;
	fadein = 0;
	fadeout = 0;
	class controlsBackground
	{
		class videoOverlay : RscVideo
		{
			idc = 3575;
			x = safezoneX;
			y = safezoneY;
			w = safezoneW;
			h = safezoneH;
			loops = 1;
			video = __EVAL(selectRandom ["\a3\missions_f_epa\video\a_hub_quotation.ogv", "\a3\missions_f_epa\video\a_in_quotation.ogv", "\a3\missions_f_epa\video\a_m01_quotation.ogv", "\a3\missions_f_epa\video\a_m02_quotation.ogv", "\a3\missions_f_epa\video\a_m03_quotation.ogv", "\a3\missions_f_epa\video\a_m04_quotation.ogv", "\a3\missions_f_epa\video\a_m05_quotation.ogv", "\a3\missions_f_epa\video\a_out_quotation.ogv", "\a3\missions_f_epa\video\b_hub01_quotation.ogv", "\a3\missions_f_epa\video\b_m01_quotation.ogv", "\a3\missions_f_epa\video\b_m02_quotation.ogv", "\a3\missions_f_epa\video\b_m03_quotation.ogv", "\a3\missions_f_epa\video\b_m06_quotation.ogv", "\a3\missions_f_epa\video\b_out2_quotation.ogv", "\a3\missions_f_epa\video\c_ea_quotation.ogv", "\a3\missions_f_epa\video\c_eb_quotation.ogv", "\a3\missions_f_epa\video\c_in1_quotation.ogv", "\a3\missions_f_epa\video\c_in2_quotation.ogv", "\a3\missions_f_epa\video\c_m01_quotation.ogv", "\a3\missions_f_epa\video\c_m02_quotation.ogv", "\a3\missions_f_epa\video\c_out1_quotation.ogv", "\a3\missions_f_epa\video\a_in2_quotation.ogv", "\a3\missions_f_epa\video\b_m05_quotation.ogv", "\a3\missions_f_epa\video\b_m02_1_quotation.ogv"]);
			text = __EVAL(selectRandom ["\a3\missions_f_epa\video\a_hub_quotation.ogv", "\a3\missions_f_epa\video\a_in_quotation.ogv", "\a3\missions_f_epa\video\a_m01_quotation.ogv", "\a3\missions_f_epa\video\a_m02_quotation.ogv", "\a3\missions_f_epa\video\a_m03_quotation.ogv", "\a3\missions_f_epa\video\a_m04_quotation.ogv", "\a3\missions_f_epa\video\a_m05_quotation.ogv", "\a3\missions_f_epa\video\a_out_quotation.ogv", "\a3\missions_f_epa\video\b_hub01_quotation.ogv", "\a3\missions_f_epa\video\b_m01_quotation.ogv", "\a3\missions_f_epa\video\b_m02_quotation.ogv", "\a3\missions_f_epa\video\b_m03_quotation.ogv", "\a3\missions_f_epa\video\b_m06_quotation.ogv", "\a3\missions_f_epa\video\b_out2_quotation.ogv", "\a3\missions_f_epa\video\c_ea_quotation.ogv", "\a3\missions_f_epa\video\c_eb_quotation.ogv", "\a3\missions_f_epa\video\c_in1_quotation.ogv", "\a3\missions_f_epa\video\c_in2_quotation.ogv", "\a3\missions_f_epa\video\c_m01_quotation.ogv", "\a3\missions_f_epa\video\c_m02_quotation.ogv", "\a3\missions_f_epa\video\c_out1_quotation.ogv", "\a3\missions_f_epa\video\a_in2_quotation.ogv", "\a3\missions_f_epa\video\b_m05_quotation.ogv", "\a3\missions_f_epa\video\b_m02_1_quotation.ogv"]);
		};
	};
	class controls
	{
	};
};

- ctrlSetText has no affect

- BIS_fnc_playVideo doesn't affect the control itself and even then it doesn't work as intended (see video a few posts up)

- Tried creating the whole thing again using ctrlCreate with no joy either

 

EDIT: Looking over the Wiki again, I think I got the syntax mixed with BIS_fnc_addScriptedEventHandler and BIS_fnc_playVideo? I think:

missionNamespace 	"BIS_fnc_playVideo_started" 	[_video]
missionNamespace 	"BIS_fnc_playVideo_stopped" 	[_video]

Are specific to BIS_fnc_playVideo which isn't gonna help me either...

Share this post


Link to post
Share on other sites

Final result. Not what we was hoping for but it is the closest we'll get. Sadly too limited with SQF this time as it runs before actual real game init, etc...

Here is the code if anyone wants to bang their head against a brick wall... Mine is quite sore. :rofl:

class rsc_loadingScreen
{
	idd = 12345;
	duration = 10e10;
	fadein = 0;
	fadeout = 0;
	class controlsBackground
	{
		class backgroundOverlay : RscPicture
		{
			idc = 100;
			x = safezoneX;
			y = safezoneY;
			w = safezoneW;
			h = safezoneH;
			text = "#(argb,8,8,3)color(0,0,0,1)";
		};
		class videoOverlay : RscVideo
		{
			idc = 200;
			x = safezoneX;
			y = safezoneY;
			w = safezoneW;
			h = safezoneH;
			loops = 1;
			video = __EVAL(selectRandom ["\a3\missions_f_epa\video\a_hub_quotation.ogv", "\a3\missions_f_epa\video\a_in_quotation.ogv", "\a3\missions_f_epa\video\a_m01_quotation.ogv", "\a3\missions_f_epa\video\a_m02_quotation.ogv", "\a3\missions_f_epa\video\a_m03_quotation.ogv", "\a3\missions_f_epa\video\a_m04_quotation.ogv", "\a3\missions_f_epa\video\a_m05_quotation.ogv", "\a3\missions_f_epa\video\a_out_quotation.ogv", "\a3\missions_f_epa\video\b_hub01_quotation.ogv", "\a3\missions_f_epa\video\b_m01_quotation.ogv", "\a3\missions_f_epa\video\b_m02_quotation.ogv", "\a3\missions_f_epa\video\b_m03_quotation.ogv", "\a3\missions_f_epa\video\b_m06_quotation.ogv", "\a3\missions_f_epa\video\b_out2_quotation.ogv", "\a3\missions_f_epa\video\c_ea_quotation.ogv", "\a3\missions_f_epa\video\c_eb_quotation.ogv", "\a3\missions_f_epa\video\c_in1_quotation.ogv", "\a3\missions_f_epa\video\c_in2_quotation.ogv", "\a3\missions_f_epa\video\c_m01_quotation.ogv", "\a3\missions_f_epa\video\c_m02_quotation.ogv", "\a3\missions_f_epa\video\c_out1_quotation.ogv", "\a3\missions_f_epa\video\a_in2_quotation.ogv", "\a3\missions_f_epa\video\b_m05_quotation.ogv", "\a3\missions_f_epa\video\b_m02_1_quotation.ogv"]);
			text = __EVAL(selectRandom ["\a3\missions_f_epa\video\a_hub_quotation.ogv", "\a3\missions_f_epa\video\a_in_quotation.ogv", "\a3\missions_f_epa\video\a_m01_quotation.ogv", "\a3\missions_f_epa\video\a_m02_quotation.ogv", "\a3\missions_f_epa\video\a_m03_quotation.ogv", "\a3\missions_f_epa\video\a_m04_quotation.ogv", "\a3\missions_f_epa\video\a_m05_quotation.ogv", "\a3\missions_f_epa\video\a_out_quotation.ogv", "\a3\missions_f_epa\video\b_hub01_quotation.ogv", "\a3\missions_f_epa\video\b_m01_quotation.ogv", "\a3\missions_f_epa\video\b_m02_quotation.ogv", "\a3\missions_f_epa\video\b_m03_quotation.ogv", "\a3\missions_f_epa\video\b_m06_quotation.ogv", "\a3\missions_f_epa\video\b_out2_quotation.ogv", "\a3\missions_f_epa\video\c_ea_quotation.ogv", "\a3\missions_f_epa\video\c_eb_quotation.ogv", "\a3\missions_f_epa\video\c_in1_quotation.ogv", "\a3\missions_f_epa\video\c_in2_quotation.ogv", "\a3\missions_f_epa\video\c_m01_quotation.ogv", "\a3\missions_f_epa\video\c_m02_quotation.ogv", "\a3\missions_f_epa\video\c_out1_quotation.ogv", "\a3\missions_f_epa\video\a_in2_quotation.ogv", "\a3\missions_f_epa\video\b_m05_quotation.ogv", "\a3\missions_f_epa\video\b_m02_1_quotation.ogv"]);
		};
	};
	class controls
	{
		class loadingText : RscText
		{
			idc = 101;
			x = 0.01 * safezoneW + safezoneX;
			y = 0 * safezoneH + safezoneY;
			w = safezoneW;
			h = 0.06 * safezoneH;
			sizeEx = 0.06;
			text = "Loading mission... Please wait.";
			colorText[] = {1, 1, 1, 1};
		};
		/*
		class progressBar : RscProgress
		{
			idc = 1013;
			x = safezoneX;
			y = safezoneY;
			w = safezoneW;
			h = 0.02 * safezoneH;
			type = 8;
			style = 0;
			texture = "#(argb,8,8,3)color(1,1,1,1)";
		};
		class progressBar2 : RscProgress
		{
			idc = 104;
			x = safezoneX;
			y = safezoneY;
			w = safezoneW;
			h = 0.02 * safezoneH;
		};
		*/
	};
};
waitUntil {getClientState isEqualTo "BRIEFING READ"};
startLoadingScreen ["Authority mission is setting up. Please wait...", "rsc_loadingScreen"];
...
...
...
...
endLoadingScreen;

 

  • Like 1
  • Thanks 1

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

×