Jump to content

Recommended Posts

So I have a GUI I grabbed off Armaholic, but wanted to make some changes to it to fit better with some mission ideas I have. Essentially wanting to change the GUI from a dialog to a display.

In the process of doing so I obviously watched all the tutorial video's I could and read up on it as best I could.

After having no success I decided to grab one that did work and change it bit by bit to see where the issues were.

 

So using the video from H8ermaker, and scripts to go along with it, I began to change it:

 

Original working script.

class RscTitles
{
    class Default 
       {
       idd = -1;
       fadein = 0;
       fadeout = 0;
       duration = 0;
         };
    class H8erHUD
    {
        idd = 1000000;
        movingEnable =  0;
        enableSimulation = 1;
        enableDisplay = 1;
        duration     =  99999;
        fadein       =  0.1;
        fadeout      =  2;
        name = "H8erHUD";
        onLoad = "with uiNameSpace do { H8erHUD = _this select 0 }";
	class controls 
        {
            class structuredText
            {
                access = 0;
                type = 13;
                idc = 1001;
                style = ST_LEFT;
                x = 0.103165 * safezoneW + safezoneX;
                y = 0.757996 * safezoneH + safezoneY;
                w = 0.778208 * safezoneW;
                h = 0.0660106 * safezoneH;
                size = 0.03;
                colorBackground[] = {0,0,0,0};
                colorText[] = {1,1,1,1};
                text = "";
                font = "puristaMedium";
                    class Attributes{
                        font = "puristaMedium";
                        color = "#FFFFFF";
                        align = "CENTER";
                        valign = "top";
                        shadow = false;
                        shadowColor = "#000000";
                        underline = false;
                        size = "4";
                    }; 
            };
        };
    };
};

 

My ever so slightly changed script, which doesnt work.

class RscTitles
{
    class Default 
       {
       idd = -1;
       fadein = 0;
       fadeout = 0;
       duration = 0;
         };
    class H8erHUD
    {
        idd = 1000000;
        movingEnable =  0;
        enableSimulation = 1;
        enableDisplay = 1;
        duration     =  99999;
        fadein       =  0.1;
        fadeout      =  2;
        name = "H8erHUD";
        onLoad = "with uiNameSpace do { H8erHUD = _this select 0 }";
    class controls 
        {
            class structuredText
            {
                access = 0;
                type = CT_STATIC;
                idc = 1001;
                style = ST_LEFT;
                x = 0.103165 * safezoneW + safezoneX;
                y = 0.757996 * safezoneH + safezoneY;
                w = 0.778208 * safezoneW;
                h = 0.0660106 * safezoneH;
                sizeEx = 0.03;
                colorBackground[] = {0,0,0,0};
                colorText[] = {1,1,1,1};
                text = "";
                font = "puristaMedium";
                   class Attributes{
                        font = "puristaMedium";
                        color = "#FFFFFF";
                        align = "CENTER";
                        valign = "top";
                        shadow = false;
                        shadowColor = "#000000";
                        underline = false;
                        size = "4";
                     }; 
            };
        };
    };
};

As far as I can tell the issue is to do with the CT_STATIC (and sizeEx). I have no idea why or how to fix this though, if im honest im not sure what it even does. any help would be appreciated!

Share this post


Link to post
Share on other sites

1. What's the problem exactly?

2. Where are your defines? e.g: CT_STATIC etc.

Share this post


Link to post
Share on other sites

Ahh yes, sorry:

1. I want to be updating the text, but the text isn't updating.

Currently I have a sqf which is activated by a tigger, the sqf has the following in it:

 disableSerialization;

1 cutRsc ["H8erHUD","PLAIN"];

_name=name player;
_time=time;

waitUntil {!isNull (uiNameSpace getVariable "H8erHUD")};
	_display = uiNameSpace getVariable "H8erHUD";
		_setText = _display displayCtrl 1001;
			_setText ctrlSetStructuredText (parseText format ["Initializing..."]);
			
sleep 5;

			_setText ctrlSetStructuredText (parseText format ["Connecting..."]);

sleep 5;

			_setText ctrlSetStructuredText (parseText format ["Connected"]);

sleep 5;
		1 cutRsc ["default","PLAIN"];

 

2. The defines are in the defines.hpp

 

Share this post


Link to post
Share on other sites

I think you need to use ctrlCommit with ctrlSetStructuredText command.

https://community.bistudio.com/wiki/ctrlCommit

Example:

_setText ctrlSetStructuredText parseText format ["Connecting..."];
_setText ctrlCommit 0;

Edit: Actually, looking over your code again... I'm a bit confused. Take a look at my example below:

Dialog .hpp snippet:

class primaryTargetLocation : Haz_RscStructuredText
{
	idc = idc_primaryTargetLocation;
	x = 0.325 * safezoneW + safezoneX;
	y = 0.32 * safezoneH + safezoneY;
	w = 0.2375 * safezoneW;
	h = 0.04 * safezoneH;
	text = "Target Location:";
};

Defines.hpp snippet:

class Haz_RscStructuredText
{
	idc = -1;
	type = CT_STRUCTURED_TEXT;
	style = ST_LEFT;
	size = "0.02 / (getResolution select 5)";
	shadow = 1;
	colorText[] = {1, 1, 1, 1.000000};
	class Attributes
	{
		font = "RobotoCondensed";
		color = "#ffffff";
		colorLink = "#d09b43";
		shadow = 1;
		align = "left";
	};
};

Take note of:

class primaryTargetLocation : Haz_RscStructuredText

Another thing... The command is uiNamespace not uiNameSpace however, I'm not sure if commands are case sensitive or not.

Lastly, change:

waitUntil {!isNull (uiNameSpace getVariable "H8erHUD")};

To:

waitUntil {!isNil (uiNamespace getVariable "H8erHUD")};

 

  • Like 1

Share this post


Link to post
Share on other sites

Sorry, I made the changes you suggested above, but it didn't achieve what I am looking for. "Target Location:" popped up on screen but it didn't change.

 

In the grand scheme of things, I want to change this GUI from t-800a into a display. That is not have it freeze the player.

 

I have managed to get it to fully pop up as a display without freezing the player, BUT, now I want to get the script that drives the dialog to change the variables. That is where this exercise comes in.

 

I started with this bit of code:

Spoiler

	class  T8L_DDD_line01L
	{ 
		idc = 8001;
		moving = 1;
		type = CT_STATIC;
		style = ST_LEFT;
		font = "puristaMedium";
		text = "Initializing ..."; 
		sizeEx = 0.03; 
		colorText[] = { 1, 1, 1, 1 };
		colorBackground[] = { 0, 0, 0, 0 }; 		
		y = 0.53; x = 1; 
		w = 0.15; h = 0.03; 
	}; 

 

but I want to change the text from "Initializing..." to "Connecting..." then finally "Connected:".

I followed the video (as linked in the first post), making a single change at a time to slowly transform it into the above code, and ended up with the following code which would not change the string:

Spoiler

#define true 1
#define false 0
#define ST_LEFT 0x00
#define ST_RIGHT 0x01 
#define ST_CENTER 0x02
#define CT_STATIC 0

class RscTitles
{
    class Default 
       {
       idd = -1;
       fadein = 0;
       fadeout = 0;
       duration = 0;
         };
    class H8erHUD
    {
        idd = 1000000;
        movingEnable =  0;
        enableSimulation = 1;
        enableDisplay = 1;
        duration     =  99999;
        fadein       =  0.1;
        fadeout      =  2;
        name = "H8erHUD";
        onLoad = "with uiNamespace do { H8erHUD = _this select 0 }";
	class controls 
        {
		    class structuredText
            {
                access = 0;
                type = CT_STATIC;
                idc = 1001;
                style = ST_LEFT;
                x = 0.103165 * safezoneW + safezoneX;
                y = 0.757996 * safezoneH + safezoneY;
                w = 0.778208 * safezoneW;
                h = 0.0660106 * safezoneH;
                sizeEx = 0.03;
                colorBackground[] = {0,0,0,0};
                colorText[] = {1,1,1,1};
                text = "";
                font = "puristaMedium";
                    class Attributes{
                        font = "puristaMedium";
                        color = "#FFFFFF";
                        align = "CENTER";
                        valign = "top";
                        shadow = false;
                        shadowColor = "#000000";
                        underline = false;
                        size = "4";
                    }; 
            };
        };
    };
};

with an .sqf being executed through a trigger on the map;


 disableSerialization;

1 cutRsc ["H8erHUD","PLAIN"];

_name=name player;
_time=time;

waitUntil {!isNull (uiNamespace getVariable "H8erHUD")};
	_display = uiNamespace getVariable "H8erHUD";
		_setText = _display displayCtrl 1001;
			_setText ctrlSetStructuredText (parseText format ["Initializing..."]);
			
sleep 5;

			_setText ctrlSetStructuredText (parseText format ["Connecting..."]);

sleep 5;

			_setText ctrlSetStructuredText (parseText format ["Connected"]);

sleep 5;
		1 cutRsc ["default","PLAIN"];

 

now the last change I made which stopped it from working was:

type = 13;    to    type = CT_STATIC;

and

size = 0.03;    to    sizeEx = 0.03;

 

Not really sure where to go from here, or if I'm going about this the correct way.

 

Thanks for the help.

Share this post


Link to post
Share on other sites

Try this:

rsc_downloadData.hpp:

class rsc_downloadData
{
	idd = 5791;
	movingEnable = 0;
	onLoad = "uiNamespace setVariable ['disp_downloadData', (_this select 0)];";
	onUnLoad = "uiNamespace setVariable ['disp_downloadData', nil];";
	duration = 1e011;
	fadeIn = 0;
	fadeOut = 0;
	class controls
	{
		class MainBackground
		{
			idc = 8000;
			moving = 1;
			type = ST_HUD_BACKGROUND;
			style = ST_LEFT;
			font = "puristaMedium";
			text = "";
			sizeEx = 0.03;
			colorText[] = { 0, 0, 0, 0 };
			colorBackground[] = { 0, 0, 0, 0.4 };
			y = 0.5; x = 1;
			w = 0.3; h = 0.1;
		};
		class  T8L_DDD_head
		{
			idc = -1;
			moving = 1;
			type = CT_STATIC;
			style = ST_LEFT;
			font = "puristaMedium";
			text = "$\ T8L SecuLoadEXEC r0.47";
			sizeEx = 0.03; 
			colorText[] = { 1, 1, 1, 1 };
			colorBackground[] = { 1, 1, 1, 0.2 };
			y = 0.5; x = 1;
			w = 0.28; h = 0.03;
		};
		class  T8L_DDD_line01L
		{
			idc = 8001;
			moving = 1;
			type = CT_STATIC;
			style = ST_LEFT;
			font = "puristaMedium";
			text = "Initializing ...";
			sizeEx = 0.03;
			colorText[] = { 1, 1, 1, 1 };
			colorBackground[] = { 0, 0, 0, 0 };
			y = 0.53; x = 1;
			w = 0.15; h = 0.03;
		};
		class  T8L_DDD_line01R
		{
			idc = 8002;
			moving = 1;
			type = CT_STATIC;
			style = ST_RIGHT;
			font = "puristaMedium";
			text = " --- kb/t";
			sizeEx = 0.03;
			colorText[] = { 1, 1, 1, 1 };
			colorBackground[] = { 0, 0, 0, 0 };
			y = 0.53; x = 1.15;
			w = 0.15; h = 0.03;
		};
		class  T8L_DDD_line02L
		{
			idc = 8003;
			moving = 1;
			type = CT_STATIC;
			style = ST_CENTER;
			font = "puristaMedium";
			text = " --- kb";
			sizeEx = 0.03;
			colorText[] = { 1, 1, 1, 1 };
			colorBackground[] = { 0, 0, 0, 0 };
			y = 0.56; x = 1;
			w = 0.15; h = 0.03;
		};
		class  T8L_DDD_line02R
		{
			idc = 8004;
			moving = 1;
			type = CT_STATIC;
			style = ST_CENTER;
			font = "puristaMedium";
			text = " --- kb";
			sizeEx = 0.03;
			colorText[] = { 1, 1, 1, 1 };
			colorBackground[] = { 0, 0, 0, 0 };
			y = 0.56; x = 1.15;
			w = 0.15; h = 0.03;
		};
	};
};

Use the following code to display it...

("layer_rsc_downloadData" call BIS_fnc_rscLayer) cutRsc ["rsc_downloadData", "PLAIN", 1, false];

To change the text for example, do this:

disableSerialization;

private _line1 = (uiNamespace getVariable "disp_downloadData") displayCtrl 8001;

_line1 ctrlSetText "Connecting...";
_line1 ctrlCommit 0; // Not sure if ctrlCommit is needed with ctrlSetText... Can't remember.

sleep 2;

_line1 ctrlSetText "Connected. Downloading...";
_line1 ctrlCommit 0;

sleep 1;

private _progress = 0;

while {(!isNull (findDisplay 5791))} do // Or check if !isNil with uiNamespace...
{
	_progress = _progress = 1;
	_line1 ctrlSetText format ["Downloading... %1", _progress];
	_line1 ctrlCommit 0;
	sleep 1;
};

 

  • Like 1

Share this post


Link to post
Share on other sites

Awesome mate, got it working!

19 hours ago, HazJ said:

private _progress = 0; 
while {(!isNull (findDisplay 5791))} do // Or check if !isNil with uiNamespace...
{ 
    _progress = _progress = 1;
    _line1 ctrlSetText format ["Downloading... %1", _progress]; 
    _line1 ctrlCommit 0; sleep 1;
};

 

just a quick question, What is this bit for? what does it do?

 

Share this post


Link to post
Share on other sites

About the Dialogs, the best tutorial I have found is this one. Done in 2013 for Arma 2 Operation Arrowhead. It is a same that for learning the BIS engine you have to relay on old tutorials done by the community. Right now there are plenty of tutorials explaining the same again and again but nothing usefull.

 

Dialog tutorial for noobs by Icemann77.

http://www.armaholic.com/page.php?id=18362

 

Right now for Arma 3 you don't need to download the Arma 2 tool as Arma 3 have a tool in the game for creating Displays/Dialogs. But the scripting is more or less well explained in this tutorial.

Share this post


Link to post
Share on other sites

That just increases the % number every second. I forgot to add an exitWith in there by the way. Was just an example.

Share this post


Link to post
Share on other sites

@HazJ, Absolute legend mate!

 

I have the script working, the player interacts with the laptop and boom the display pops up and does its thing. Thanks heaps mate!

 

One last question how would I go about closing the display?

I tried:

closeDialog 1;

and,

("layer_rsc_downloadData" call BIS_fnc_rscLayer) closeDisplay 1;

and what the video tutorial had,

1 cutRsc ["default","PLAIN"];

 

but it didn't close... :(

 

Edit: Scratch that, figured it out, my bad.

if anyone was interested:

("layer_rsc_downloadData" call BIS_fnc_rscLayer) cutRsc ["default","PLAIN"];

Thanks again HazJ, what a legend!

Edited by SHIFTY_TFD
Durp-a-Durp

Share this post


Link to post
Share on other sites

I would do it this way:

("layer_rsc_downloadData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];

Both should work though.

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

×