Jump to content
Sign in to follow this  
Von Quest

rscText - Need to display Text/Data in Top-Middle of Screen?

Recommended Posts

In desperate need of help!

My head is about to explode!!! Been tying for 6 months now, and can not get my head around this.

Please, please, I need help. Or, better yet, I would prefer a working example from beginning to end.

I'm working on several addons now that require Data to be displayed. I can not get them working!

To keep it simple, lets just focus on one. I'm trying to get an Altimeter working for my HALO system.

I can display Graphics; and I can get the Script to display the Altitude; but can NOT get them

to work together where they are in the top-center of the screen (or where ever I want)...

I wanted it to popup in the top-center so it will cover-up the current ATL Altitude you get, but MY readout

is always stuck over in the top-right of the screen for Structured Text or Hint style (getposASL).

How in the heck do you display Data/Variables/Readouts/etc, and position it where you need OVER

the Graphics you want? Looking for simple working EXAMPLE: init, description, hpp, script, etc. Anyone?

Share this post


Link to post
Share on other sites

it may work like with hint, you just need to pass getposatl to string

hint (str getposAtL " Altitude")

Share this post


Link to post
Share on other sites

Anyone? I'm guessing its called ctrlSetText? I'm trying to display a HUD/Resource.

I'm working on several projects that will display a "gadget" of sorts. The first batch you

will NOT interact (dialog) with them; they'll just display a readout (like a digital Altimeter).

I can not figure out how to get the .sqf to display over the screen of the graphic. I can

get Hints, SideChat, etc, over the graphic/image, but I need the freedom and full control

of the rscTitles (is that right?). I feel like I'm missing something simple to get 'unstuck'.

:banghead:

Share this post


Link to post
Share on other sites

Ok, I started completely over from scratch... and still feel like I was months ago. Frick!

I think perhaps I need to rephrase the question. I can get everything working, but I can

NOT get the Script Data to display OVER the Resource as needed. The code below will

work (just a sample test), but as you can see, its only going to display as a simple HINT.

script.sqf

///////////// Von Quest Industries /////////////
///////////// WIP - Altimeter GUI - WIP ////////
////////////////////////////////////////////////

disableSerialization; 
cutRsc ["VQI_ALTIMETER_1", "PLAIN"];
_display = uiNamespace getVariable "VQI_ALTIMETER_1";  
_ctrlBar = _display displayCtrl 1000;

for [{ _i=0 },{ _i < 1 },{ _i = _i + 0.01 }] do
{
 _ctrlBar progressSetPosition (_i + 0.01);
 hint format ["%1", _i];
 sleep 0.1;
};

sleep 0.5;
cutRsc ["Default", "PLAIN"];

altimeter.hpp

class VQI_ALTIMETER_1 {					// UNIQUE MAIN-CLASSSNAME of this GUI/Project
idd = 123;				          	// Display ID, can use -1 IF NO reference
movingEnable = 0;					// Able to MOVE graphic (need in resource?)
fadein = 0;							// How quick it goes away (seconds)
duration = 5;						// Time it will be displayed (seconds)
fadeout = 3;						// How quick it pops on (seconds)
name = "VQI Altimeter One";			// Easy-To-Read 'Proper Name' in i.e. Trigger Menu
onLoad = "uiNamespace setVariable ['VQI_Altimeter_1', _this select 0]";	// ????

controls[] = {"VQIA1_BKGD","VQIA1_READOUT"};	// List ALL SUB-CLASSNAMES (in foreground) below

	class VQIA1_BKGD {				// SUB-CLASSNAME of specific section or element
	idc = -1;						// Control ID, can use -1 IF NO reference
	type = 0;						// Control #: Static, Text, Button, Listbox, etc
	style = 48;						// Control #: Picture, Border, Text Align, etc
	text = "Altimeter\graphics\navyseals_loadingscreen.jpg";	// text OR graphic to display (path)
	colorBackground[] = {0,0,0,0};	// Background Color (r,g,b,a)
	colorText[] = {1,1,1,1};		// Font Color or Foreground (r,g,b,a)
	font = "PuristaMedium";			// Font Family
	sizeEx = 0.05;					// Font Size (0..1)
	x = 0.4;						// Offset from the left side of the window (0..1; 0.0 = left side; 1.0 = right side) 
	y = safezoneY;					// Offset from the top side of the window (0..1; 0.0 = left side; 1.0 = right side) 
	w = 0.5;						// Width of this control (0..1) 
	h = 0.5;  						// Height of this control (0..1) 
	};

	class VQIA1_READOUT {			// SUB-CLASSNAME of specific section or element
	idc = 1000;						// Control ID, can use -1 IF NO reference
	type = 0;						// Control #: Static, Text, Button, Listbox, etc
	style = 2;						// Control #: Picture, Border, Text Align, etc
	text = "";						// text OR graphic to display (path)
	colorBackground[] = {0,0,0,0};	// Background Color (r,g,b,a)
	colorText[] = {1,1,1,1};		// Font Color or Foreground (r,g,b,a)
	font = "PuristaMedium";			// Font Family
	sizeEx = 0.05;					// Font Size (0..1)
	x = 0.5;						// Offset from the left side of the window (0..1; 0.0 = left side; 1.0 = right side) 
	y = safezoneY;					// Offset from the top side of the window (0..1; 0.0 = left side; 1.0 = right side) 
	w = 0.75;						// Width of this control (0..1) 
	h = 0.75;  						// Height of this control (0..1) 
	};
};

Do I need to rephrase the Question? That's half the battle... I don't know the terminology. :p

Share this post


Link to post
Share on other sites

I just have ideas: did you check if _ctrlBar exists? (eg. you may have to wait until !isNull uiNamespace getVariable "VQI_ALTIMETER_1".

Or you may have to ctrlCommit the control, but I don't know progressbar that much. I just spent some hours with a non-updating UI element of mine, which was missing ctrlCommit.

Othere than that it seems fine for the first quick blick.

Do I understand the problem correctly? The progress bar is shown but it doesn't get updated as _i changes? Or the whole progressbar is missing?

Edit: Oh sorry: the classes are a total mess. The readout is RscText class (type 0) and you are trying to change a progress bar (RscProgress https://community.bistudio.com/wiki/DialogControls-ProgressBar) feauture, which is not possible. ProgressBars are type = 8.

Readout class should look like something like this: (Dunno if BKGD is needed at all)

class VQIA1_READOUT {            // SUB-CLASSNAME of specific section or element
       idc = 1000;                        // Control ID, can use -1 IF NO reference
       type = 8;                        // type 8 is progressbar
       style = 0;                       
     colorFrame[] = {0,0,0,1};     //needed for type 8
     colorBar[] = {1,1,1,1};          //needed for type 8
     texture = "#(argb,8,8,3)color(1,1,1,1)";            //needed for type 8
       x = 0.5;                        // Offset from the left side of the window (0..1; 0.0 = left side; 1.0 = right side) 
       y = safezoneY;                    // Offset from the top side of the window (0..1; 0.0 = left side; 1.0 = right side) 
       w = 0.75;                        // Width of this control (0..1) 
       h = 0.75;                          // Height of this control (0..1) 
       };

And if you don't want to mindfuck yourself on the long run, you'd better start using inheritance from BIS provided base classes. YOu'll spare some sleepless nights for yourself.

Start here: http://forums.bistudio.com/showthread.php?144954-Dialog-Tutorial-For-Noobs-By-A-Noob&highlight=iceman77

and try to embrace the way defines.hpp work. And give iceman a cookie if you see him. :)

Edited by zapat

Share this post


Link to post
Share on other sites

Zap buddy! Thank you so much for responding...

Um, I was afraid of that. No, there is not supposed to be a progressBar. I just threw that up there because

I knew it worked (sorta). But that's NOT the code I would use. I just thought that was the easiest way to

go since I wanted to rule out as many 'issues' as I could and thus just find the small snippet I was looking for.

I'm only displaying one number. That's it. The players Altitude in a Digital Watch. getposASL

	//Altimeter
while {true} do {
hintsilent parseText format["<t color='#FFFFFF' shadow='1' shadowColor='#000000' underline='true'>Altitude<br/></t><t color='#66F4F0' size='1.4'>%1</t>",(getPosASL player) select 2];
sleep 0.1;
};

As soon as I saw your name, I recognized it because I've read literally hundreds of posts on this and saw you

had other posts in the past. And, YES, I've been through and built Iceman77's GUI at least 4 or 5 times now.

The background IS the Altimeter.jpg (graphic) and the Script should display the players height (number) over

the dial. I'm not sure what's you mean by the Classes are a mess. Is that where I went wrong? Can you help?

----------

UPDATE:

OK, I think I got IT! Wow. After months of off & on experiments (and 3 broken mice); I think I have a breakthrough...

Edited by Goblin
epiphany

Share this post


Link to post
Share on other sites

Then you are good with type=0, and your original class.

But then don't use _ctrlBar progressSetPosition (_i + 0.01);

but _ctrlBar ctrlSetText (str _i);

Anyhow, you may not need this if you solved it already.

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  

×