Jump to content
Sign in to follow this  
unidad2pete

How to display the player a server variable by titleRsc?

Recommended Posts

Hello;

I just learned a little about titleRsc.

I can display text using this code in description.ext

class RscText
{
access = 0;
type = CT_STATIC;
idc = -1;
style = ST_LEFT;
w = 0.1; h = 0.05;
font = "puristaMedium";
sizeEx = 0.04;
colorBackground[] = {0,0,0,0};
colorText[] = {0,0,0,1};
text = "";
fixedWidth = 0;
shadow = 0;
};
class RscTitles
{
titles[] = {MYTITLE}; // optional

class MYTITLE
{	
	idd = -1;	
	movingEnable = false;
	duration = 90000;
	fadein = 0; 
	name = "MYTITLEl"; 
	controls[] = {"HelloWorld"};

	class HelloWorld: RscText
	{	
		x = 0;
		y = 0;
		w = 1;
		h = 1;
		text = "Hello World";
	};	
};
};

I show " Hello World" permanently on screen or other text in text = " TEXT HERE "; when i call with titleRsc ["MYTITLE", "PLAIN", 1];

But I do not get how to display a variable of server through RscText.

Init.sqf

if (isDedicated) then {
scoreweast = 0;
scoreeast = 0;
};

Currently I show these variables (scoreweast and scoreeast) by a permanent hint.

I want to show these variables in RscText.

What is I have to put in text = "Hello World" to show the variables?

I appreciate a lot your help.

Share this post


Link to post
Share on other sites

funny... im working on samething right now.. :)

....looks like its better to use cutRsc

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

and the text can be later changed by...

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

...i have mission where its done...

http://loonywarrior.dyndns.org/arma/HiA3_Sniper_Long_Range.Stratis.zip

just be aware that its ugly code transfered from Arma 2.. look for OSD.. (code handling with the text is only on few lines....)

Share this post


Link to post
Share on other sites

Uff ... I am a little noob. Not fully understand English, and I can not understand how to do it with explanations of wiki.

I have tried to understand looking at your mission, but is a little big for my knowledge.

Could you tell me where I can find the code in your mission, and how it works?

I have seen 1521 cutRsc ["OSD","PLAIN"]; in init.sqf.

But I can not understand what happens when I see osd.hpp

Edited by unidad2pete

Share this post


Link to post
Share on other sites

its not my mission... i used it as "guide"..

its in resources/osd.hpp and client function update osd

anyway... try this...

in RscTitles class

class LW_teamDeathmatch_OSD
{
 idd = -1;
 duration = 100;
 movingEnable = false;
 enableSimulation = false;
 controlsBackground[] = { };
 controls[] = { "InfoLine" };
 objects[] = { };

 onLoad = "uiNamespace setVariable [""LW_teamDeathmatch_OSD_display"", _this select 0];";

 class InfoLine
 {
   idc = 9701;

   type = 13;
   style = 0;

   text = "";
   size = 0.03;

   colorBackground[] = { 0, 0, 0, 0.3 };
   colorText[] = { 1, 1, 1, 1 };

   x = safeZoneX + 0.03;
   y = safeZoneH + safeZoneY - (0.14 + 0.0825);
   w = 1.0;
   h = 0.14;
 };
};

init.sqf

_null = [] spawn
{
 waitUntil { alive player};

 sleep 2;

 cutRsc ["LW_teamDeathmatch_OSD", "PLAIN", 0];

 disableSerialization;

 _display = uiNamespace getVariable "LW_teamDeathmatch_OSD_display";

 _infoLine  = _display displayCtrl 9701;

 while { true } do
 {
   _infoLine ctrlSetStructuredText parseText format ["<t>%1</t>", time];

   sleep 0.3;
 };
};

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  

×