cybercoco 16 Posted January 2, 2016 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
cybercoco 16 Posted January 2, 2016 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
spidypiet 17 Posted January 2, 2016 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
R3vo 2652 Posted January 2, 2016 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
cybercoco 16 Posted January 3, 2016 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
R3vo 2652 Posted January 3, 2016 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
cybercoco 16 Posted January 3, 2016 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
Lala14 135 Posted January 3, 2016 I would put ctrlCommit as the last line in that segment Share this post Link to post Share on other sites
cybercoco 16 Posted January 3, 2016 Where do I put the text :huh: ? Share this post Link to post Share on other sites
Greenfist 1863 Posted January 3, 2016 Where do I put the text :huh: ? 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) Share this post Link to post Share on other sites
spidypiet 17 Posted January 3, 2016 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
cybercoco 16 Posted January 3, 2016 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
Greenfist 1863 Posted January 3, 2016 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
cybercoco 16 Posted January 5, 2016 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
cybercoco 16 Posted January 8, 2016 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
Greenfist 1863 Posted January 8, 2016 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
cybercoco 16 Posted January 8, 2016 Thanks figured out the [0.5,0.5] coords ! Share this post Link to post Share on other sites
R3vo 2652 Posted January 8, 2016 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
Greenfist 1863 Posted January 8, 2016 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
R3vo 2652 Posted January 8, 2016 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
cybercoco 16 Posted January 8, 2016 Safezone, is it an absolute coordinate system, with the center as reference ? Share this post Link to post Share on other sites
Guest Posted January 9, 2016 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
cybercoco 16 Posted January 9, 2016 (edited) 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 January 10, 2016 by cybercoco Share this post Link to post Share on other sites