Jump to content
Sign in to follow this  
freakjoe

Dialogs using HTML?

Recommended Posts

I think HTML files are a throwback to arma 2 days. Briefings used to be handled with html but that has changed now and they are no longer used. You can still format text with html tags though using commands like

parseText

and composeText.

Structured_Text

Share this post


Link to post
Share on other sites

Yes they can, I have a working dialog created for an up and coming project.

It actually pulls data from an external php webpage, and displays dynamic data on the dialog depending on what variables are contained in the url, of which are supplied by in game variables.

Share this post


Link to post
Share on other sites
Yes they can, I have a working dialog created for an up and coming project.

It actually pulls data from an external php webpage, and displays dynamic data on the dialog depending on what variables are contained in the url, of which are supplied by in game variables.

Please explain to us how, or at least point us in the right direction.

Thanks

Share this post


Link to post
Share on other sites

wow that sounds cool... can you give us an example please

Share this post


Link to post
Share on other sites

Ok so here goes

newsfeed_init.sqf of which is called, by whatever method you wish for example radio action.

This finds the dialog set with the idd value, in this case 981100.

In my example I am getting the current map, mission name and playername as variables and passing it into my url, to by used by php.

I have also included an offline url, of which is linked to a local html file, in case of no internet connection.

I then use the htmlload command to load the php file into the dialog with an idc of 10042.

private ["_display", "_map", "_mission", "_player", "_newsOnline", "_newsOffline", "_ctrlHTML", "_htmlLoaded"];

disableSerialization;

createDialog "newsfeed_dialog";

_display = (findDisplay 981100);

_map = worldname;
_mission  = missionName;
_player = name player;

_newsOnline = "http://www.yourdomain/phppage.php?map=" + _map + "&mission=" + _mission + "&player=" + _player;
_newsOffline = "news.html";


//Load the correct HTML into the control
_ctrlHTML = _display displayCtrl 10042;
_ctrlHTML htmlLoad _newsOnline;

In the hpp file I create the main dialog with idd 981100.

In the dialog I have a class of which uses the main RscHTML Class, of whcih refernces the different parts of the php page, for ecample the Headers (H1,H2,H3) and the paragraphs.

class newsfeed_dialog
{
idd = 981100; 
movingEnable = 1; 
enableSimulation = 1;
enableDisplay = 1; 

onLoad = ""; 


class controls 
{

	class NewsTitle: RscText
			{
				colorBackground[] = {0.69,0.75,0.5,0.8};
				idc = 10032;
				x = "0 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				y = "0 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
				w = "15 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				h = "1 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
			};
			class NewsBackgroundDate: RscText
			{
				idc = 10022;
				x = "0 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				y = "1.1 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
				w = "15 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				h = "1 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
				colorBackground[] = {0,0,0,0.4};
			};
			class NewsBackground: RscText
			{
				idc = 10052;
				x = "0 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				y = "2.2 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
				w = "15 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				h = "17.5 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
				colorBackground[] = {0,0,0,0.4};
			};
			class NewsText: RscHTML
			{	
				idc = 10042;
				shadow = 0;
				class H1
				{
					font = "PuristaMedium";
					fontBold = "PuristaLight";
					sizeEx = "(			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
				};
				class H2: H1
				{
					sizeEx = "(			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
					font = "PuristaLight";
				};
				class P: H1
				{
					sizeEx = "(			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
					fontBold = "PuristaLight";
				};
				colorBold[] = {0.6,0.6,0.6,1};
				colorLink[] = {0.69,0.75,0.5,1};
				colorLinkActive[] = {0.69,0.75,0.5,1};
				x = "0.5 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				y = "-0.1 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
				w = "14 * 			(			((safezoneW / safezoneH) min 1.2) / 40)";
				h = "19.5 * 			(			(			((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
			};	
};
};

I hope this is enough to get you started :o

Share this post


Link to post
Share on other sites

Is the website displayed like in a browser and everything is usable? :butbut:

Share this post


Link to post
Share on other sites

Um No! However if you have external links on the page, this will open a browser to the link.

Share this post


Link to post
Share on other sites

Ah, many thanks, Gunny1979, it's not exactly what I had been hoping for but at least something.

Edited by FreakJoe

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  

×