Jump to content

Recommended Posts

Hi all,

 

Following my search for a progress bar, I'm trying to output a simple text. Nothing fancy here.

I watched this video and tried the method. However I can't even change the class name...

 

Is there a quick way to output a text, without using a hpp file ?

Share this post


Link to post
Share on other sites

Currently using this :

 

text.sqf

 disableSerialization;

 1 cutRsc ["Jagger","PLAIN"];
waitUntil {!isNull (uiNameSpace getVariable "Jagger")};
	_display = uiNameSpace getVariable "Jagger";
	_setText = _display displayCtrl 1001;
	_setText ctrlSetStructuredText (parseText format ["Wonno"]);
	// _setText ctrlSetBackgroundColor [0,1,1,0.5];

dialogs.hpp

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

Any simpler way ?

Share this post


Link to post
Share on other sites

Hi all,

 

Following my search for a progress bar, I'm trying to output a simple text. Nothing fancy here.

I watched this video and tried the method. However I can't even change the class name...

 

Is there a quick way to output a text, without using a hpp file ?

that video has a  link to a Example mission

 

did you get is working?

Share this post


Link to post
Share on other sites

You can use the same approach larrow showed you for the progress bar.

 

Is there a quick way to output a text, without using a hpp file ?

 

Put the stuff from the hpp file into the description.ext :P

Share this post


Link to post
Share on other sites

that video has a  link to a Example mission

 

did you get is working?

 

Yes I did.

 

You can use the same approach larrow showed you for the progress bar.

 

Put the stuff from the hpp file into the description.ext :P

 

There was no use of hpp file of the description.ext file in Larrow's approach ...

Share this post


Link to post
Share on other sites

Please look again, how I quoted. Both my answers are independent from each other.

You can either put it into the description.ext, OR use larrow's approach.

Share this post


Link to post
Share on other sites

Ok, trying Larrow's method... This is the code for the progress bar :

with uiNamespace do { 
     my_awesome_progressBar = findDisplay 46 ctrlCreate ["RscProgress", -1]; 
     my_awesome_progressBar ctrlSetPosition [ 0.345, 0.3 ]; 
     my_awesome_progressBar progressSetPosition 0; 
     my_awesome_progressBar ctrlCommit 0;
     my_awesome_progressBar ctrlSetTextColor [0.4,0.804,0,1];
}; 

Do I do this ?

with uiNamespace do { 
     my_awesome_text = findDisplay 46 ctrlCreate ["RscTexts", -1]; 
     my_awesome_text ctrlSetPosition [ 0.345, 0.3 ]; 
     my_awesome_text ctrlCommit 0;
     my_awesome_text ctrlSetTextColor [0.4,0.804,0,1];
}; 

Share this post


Link to post
Share on other sites

I would put ctrlCommit as the last line in that segment

Share this post


Link to post
Share on other sites

i use the script from the video to display a killfeed

 

so in my killfeed.sqf ill end with

 

killfeed.sqf:

_line = if(_victim == _killer) then { 
format["%1! killed himself",name _victim];	
} else {
format["%1 ==Killed== %2 from %3 mtr",name _killer,name _victim,_dis];

disableSerialization;

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


waitUntil {!isNull (uiNameSpace getVariable "KILLFEED")};
	_display = uiNameSpace getVariable "KILLFEED";
		_setText = _display displayCtrl 1001;
			_setText ctrlSetStructuredText (parseText format ["%1.",_line]);
			_setText ctrlSetBackgroundColor [0,0,0,0.5];

Share this post


Link to post
Share on other sites

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

my_awesome_progressBar ctrlSetText "Hello world.";

And "RscTexts" should probably be "RscText" instead. (https://community.bistudio.com/wiki/ctrlCreate/classnames)

 

Thank you, that works great. Anyway I can change the properties of the text (without hpp) ?

Share this post


Link to post
Share on other sites

Thank you, that works great. Anyway I can change the properties of the text (without hpp) ?

You mean its styling? Font size etc?

Then you might want to replace "RscText" with "RscStructuredText", and ctrlSetText with ctrlSetStructuredText.

Share this post


Link to post
Share on other sites

You mean its styling? Font size etc?

Then you might want to replace "RscText" with "RscStructuredText", and ctrlSetText with ctrlSetStructuredText.

 

Will try that, thank you !

Share this post


Link to post
Share on other sites

Tried the exemple on here : https://community.bistudio.com/wiki/ctrlSetStructuredText

with uiNamespace do {
     my_awesome_text = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
     my_awesome_text ctrlSetPosition [2,0,0.3,0.1];
     my_awesome_text ctrlCommit 0;
     my_awesome_text ctrlSetStructuredText parseText "<t>Hey there, it works... for now</t>";
};

However I have no way of moving the position of the text, what's the coordinate of the center of the screen ?

Share this post


Link to post
Share on other sites

Tried the exemple on here : https://community.bistudio.com/wiki/ctrlSetStructuredText

with uiNamespace do {
     my_awesome_text = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
     my_awesome_text ctrlSetPosition [2,0,0.3,0.1];
     my_awesome_text ctrlCommit 0;
     my_awesome_text ctrlSetStructuredText parseText "<t>Hey there, it works... for now</t>";
};

However I have no way of moving the position of the text, what's the coordinate of the center of the screen ?

This might clear things up: https://community.bistudio.com/wiki/SafeZone

The center is 0.5,0.5. And 0,0 is the top left corner of the 4:3 center. So anything outside it is over 1 or below zero.

Share this post


Link to post
Share on other sites

Thanks figured out the [0.5,0.5] coords !

Share this post


Link to post
Share on other sites

Thanks figured out the [0.5,0.5] coords !

 

Hold on! The 0.5,0.5 isn't the same on every monitor and resolution, you have to work with the safezone in order to make it work for everyone.

Share this post


Link to post
Share on other sites

Hold on! The 0.5,0.5 isn't the same on every monitor and resolution, you have to work with the safezone in order to make it work for everyone.

0.5,0.5 is the only thing that is the same on all resolutions! :D 

Share this post


Link to post
Share on other sites

Yeh, you're right.... however, if he uses it without safezone it will be screwed up on other resolutions.

Share this post


Link to post
Share on other sites

Safezone, is it an absolute coordinate system, with the center as reference ?

Share this post


Link to post
Share on other sites
Guest

Safezone, is it an absolute coordinate system, with the center as reference ?

 

No, safezone is not absolute, it takes care of your computer resolution and must be used in must cases to have the same render between clients.

Share this post


Link to post
Share on other sites

How does it works for a simple text output ?

 

Is that it ?

//Creates centered control with 80% width and height:

x = safezoneX + 0.1 * safezoneW;
y = safezoneY + 0.1 * safezoneH;
w = safezoneW * 0.8;
h = safezoneH * 0.8;

Edited by cybercoco

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

×