Dope

Statusbar gets messed up

11 posts in this topic

Anyone mind taking a look ? I tried to remove some things that we dont need but when I remove hunger and thirst the whole bar gets messed up and poptabs and poptabs in the locker are the same if i got 350 poptabs for example on hand it also shows that i have 325 in the safe but i dont have them in the safe

Spoiler

/*
    @file Version: 0.2
    @file Name: statusBar.sqf
    @file  EpochMod StatusBar Port for Wasteland / Exile by CRE4MPIE
    @file Created: 21/4/2015
    @file Updated by CRE4MPIE for new Exile Attributes 
    @File Edited 15/3/2016
    @notes: Added custom Icons and Attributes, removed garbage
    All Credits Due to the original creator of this script.
*/
waitUntil {!(isNull (findDisplay 46))};
disableSerialization;

[] spawn
{
    _uid = getPlayerUID player;

    while {true} do
    {
        uisleep 5;
        
            _rscLayer = "RscStatusBar" call BIS_fnc_rscLayer;
            _rscLayer cutRsc ["RscStatusBar","PLAIN",1,false];

            if(isNull ((uiNamespace getVariable "RscStatusBar")displayCtrl 55554)) then
            {
                diag_log "statusbar is null create";
                disableSerialization;
                _rscLayer = "RscStatusBar" call BIS_fnc_rscLayer;
                _rscLayer cutRsc ["RscStatusBar","PLAIN",1,false];
            };
            //initialize variables and set values
            _unit = _this select 0;
            _damage = round ((1 - (damage player)) * 100);
            //_damage = (round(_damage * 100));
            _wallet = (player getVariable ["ExileMoney", 0]);
            _respect = ExileClientPlayerScore;
            _serverFPS = round diag_fps;
            _pos = getPosATL player;
            _dir = round (getDir (vehicle player));
            _grid = mapGridPosition  player; _xx = (format[_grid]) select  [0,3];
            _yy = (format[_grid]) select  [3,3];
            _time = (round(180-(serverTime)/60));  //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals
            _hours = (floor(_time/60));
            _minutes = (_time - (_hours * 60));
            _locker = (player getVariable ["ExileLocker", 0]);

            switch(_minutes) do
            {
                case 9: {_minutes = "09"};
                case 8: {_minutes = "08"};
                case 7: {_minutes = "07"};
                case 6: {_minutes = "06"};
                case 5: {_minutes = "05"};
                case 4: {_minutes = "04"};
                case 3: {_minutes = "03"};
                case 2: {_minutes = "02"};
                case 1: {_minutes = "01"};
                case 0: {_minutes = "00"};
            };

            //Color Gradient
            _colourDefault     = parseText "#FBFCFE"; //
            _colour90         = parseText "#F5E6EC"; //
            _colour80         = parseText "#F0D1DB"; //
            _colour70         = parseText "#EBBBC9"; //
            _colour60         = parseText "#E6A6B8"; //
            _colour50         = parseText "#E191A7"; //
            _colour40         = parseText "#DB7B95"; //
            _colour30         = parseText "#D66684"; //
            _colour20         = parseText "#D15072"; //
            _colour10         = parseText "#CC3B61"; //
            _colour0         = parseText "#C72650"; //
            _colourDead     = parseText "#000000";

            //Colour coding
            //Damage
            _colourDamage = _colourDefault;
            if(_damage >= 100) then{_colourDamage = _colourDefault;};
            if((_damage >= 90) && (_damage < 100)) then {_colourDamage =  _colour90;};
            if((_damage >= 80) && (_damage < 90)) then {_colourDamage =  _colour80;};
            if((_damage >= 70) && (_damage < 80)) then {_colourDamage =  _colour70;};
            if((_damage >= 60) && (_damage < 70)) then {_colourDamage =  _colour60;};
            if((_damage >= 50) && (_damage < 60)) then {_colourDamage =  _colour50;};
            if((_damage >= 40) && (_damage < 50)) then {_colourDamage =  _colour40;};
            if((_damage >= 30) && (_damage < 40)) then {_colourDamage =  _colour30;};
            if((_damage >= 20) && (_damage < 30)) then {_colourDamage =  _colour20;};
            if((_damage >= 10) && (_damage < 20)) then {_colourDamage =  _colour10;};
            if((_damage >= 1) && (_damage < 10)) then {_colourDamage =  _colour0;};
            if(_damage < 1) then{_colourDamage =  _colourDead;};
            
            //display the information
            ((uiNamespace getVariable "RscStatusBar")displayCtrl 55554) ctrlSetStructuredText
            parseText
            format
            ["
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.6'  shadowColor='#000000' image='addons\statusbar\icons\players.paa' color='%9'/> %2</t>
                <t shadow='1' shadowColor='#000000' color='%14'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\health.paa' color='%9'/> %3%1</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\poptab_ca.paa' color='%9'/> %4</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\locker.paa' color='%9'/> %4</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\exile.paa' color='%9'/> %8</t>
                <t shadow='1' shadowColor='#000000' color='%9'>FPS: %7</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\compass.paa' color='%9'/> %11</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.6'  shadowColor='#000000' image='addons\statusbar\icons\restart.paa' color='%9'/>%12:%13</t>",

                        "%",
                        count playableUnits,
                        _damage,
                        _wallet,
                        _serverFPS,
                        _respect,
                        _colourDefault,
                        format["%1/%2",_xx,_yy],
                        _dir,
                        _hours,
                        _minutes,
                        _colourDamage,
                        _locker
            ];
    };
};
 

 

Screenshot_2.png

Edited by Dope

Share this post


Link to post
Share on other sites
            ["
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.6'  shadowColor='#000000' image='addons\statusbar\icons\players.paa' color='%9'/> %2</t> //Notice the %2 here matches the number count below.


                <t shadow='1' shadowColor='#000000' color='%14'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\health.paa' color='%9'/> %3%1</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\poptab_ca.paa' color='%9'/> %4</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\locker.paa' color='%9'/> %4</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\exile.paa' color='%9'/> %8</t>
                <t shadow='1' shadowColor='#000000' color='%9'>FPS: %7</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\compass.paa' color='%9'/> %11</t>
                <t shadow='1' shadowColor='#000000' color='%9'><img size='1.6'  shadowColor='#000000' image='addons\statusbar\icons\restart.paa' color='%9'/>%12:%13</t>",

                        "%", // 1
                        count playableUnits, // 2 - See how this is the second variable in the list
                        _damage, // 3
                        _wallet, // 4
                        _serverFPS, // 5
                        _respect, // 6
                        _colourDefault, // 7
                        format["%1/%2",_xx,_yy], // 8
                        _dir, // 9
                        _hours, // 10
                        _minutes, // 11
                        _colourDamage, // 12
                        _locker // 13

See above - I put comments on the lines that were correct so you can fix the incorrect ones.

Edited by Mr Sin
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

This is what I have on my status bar:

        //display the information 
        ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)ctrlSetStructuredText parseText 
            format["
            <t shadow='1' shadowColor='#000000' color='%10'><img size='1.3'  shadowColor='#000000' image='addons\statusbar\icons\players.paa' color='%10'/> %2</t>
            <t shadow='1' shadowColor='#000000' color='%11'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\health.paa' color='%11'/> %3%1</t> 
            <t shadow='1' shadowColor='#000000' color='%10'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\poptab_ca.paa' color='%10'/> %4%22%21</t> 
            <t shadow='1' shadowColor='#000000' color='%15'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\exile.paa' color='%10'/> %9</t> 
            <t shadow='1' shadowColor='#000000' color='%15'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\fps.paa' color='%10'/> %7</t>
            <t shadow='1' shadowColor='#000000' color='%10'><img size='1.2'  shadowColor='#000000' image='addons\statusbar\icons\restart.paa' color='%10'/> %20</t>",
            
                    "%", 
                    count playableUnits,
                    _damage,
                    _wallet, 
                    _hunger, 
                    _thirst, 
                    _serverFPS, 
                    _energyPercent, 
                    _stamina, 
                    _colourDefault,
                    _colourDamage,
                    _colourHunger,
                    _colourThirst,
                    _colourEnergy,
                    _colourStamina,
                    format["%1/%2",_xx,_yy], 
                    _dir,
                    _hours,
                    _minutes,
                    _time,
                    _locker,
                    "/"
                ];

 

I didn't need most of the things on there so took it out. Our money is displayed in k's instead of singulars (we have 1k rather than 1000pt). Then i work them all out at the top:

		//initialize variables and set values
		_unit = _this select 0;
		_damage = round ((1 - (damage player)) * 100);
		//_damage = (round(_damage * 100));
		_hunger = round (ExileClientPlayerAttributes select 2);
		_thirst = round (ExileClientPlayerAttributes select 3);
		_wallet = ((player getVariable ["ExileMoney", 0])/1000);
		_locker = ((player getVariable ["ExileLocker", 0])/1000);
		_stamina = ExileClientPlayerScore;
		_energy = 100;
		_energyPercent = 100;
		_serverFPS = round diag_fps;
		_pos = getPosATL player;
		_dir = round (getDir (vehicle player));
		_grid = mapGridPosition  player; _xx = (format[_grid]) select  [0,3]; 
		_yy = (format[_grid]) select  [3,3];  
		_time = (round (serverTime/60));
//		_time = (round(240-(serverTime)/60));  //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals
//		_hours = (floor(_time/60));
//		_minutes = (_time - (_hours * 60));

Hope that helps you get a picture of how to do it...

Share this post


Link to post
Share on other sites
On 7/2/2016 at 0:53 PM, Paul said:

This is what I have on my status bar:


        //display the information 
        ((uiNamespace getVariable "osefStatusBarAdmin")displayCtrl 55554)ctrlSetStructuredText parseText 
            format["
            <t shadow='1' shadowColor='#000000' color='%10'><img size='1.3'  shadowColor='#000000' image='addons\statusbar\icons\players.paa' color='%10'/> %2</t>
            <t shadow='1' shadowColor='#000000' color='%11'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\health.paa' color='%11'/> %3%1</t> 
            <t shadow='1' shadowColor='#000000' color='%10'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\poptab_ca.paa' color='%10'/> %4%22%21</t> 
            <t shadow='1' shadowColor='#000000' color='%15'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\exile.paa' color='%10'/> %9</t> 
            <t shadow='1' shadowColor='#000000' color='%15'><img size='1.0'  shadowColor='#000000' image='addons\statusbar\icons\fps.paa' color='%10'/> %7</t>
            <t shadow='1' shadowColor='#000000' color='%10'><img size='1.2'  shadowColor='#000000' image='addons\statusbar\icons\restart.paa' color='%10'/> %20</t>",
            
                    "%", 
                    count playableUnits,
                    _damage,
                    _wallet, 
                    _hunger, 
                    _thirst, 
                    _serverFPS, 
                    _energyPercent, 
                    _stamina, 
                    _colourDefault,
                    _colourDamage,
                    _colourHunger,
                    _colourThirst,
                    _colourEnergy,
                    _colourStamina,
                    format["%1/%2",_xx,_yy], 
                    _dir,
                    _hours,
                    _minutes,
                    _time,
                    _locker,
                    "/"
                ];

 

I didn't need most of the things on there so took it out. Our money is displayed in k's instead of singulars (we have 1k rather than 1000pt). Then i work them all out at the top:


		//initialize variables and set values
		_unit = _this select 0;
		_damage = round ((1 - (damage player)) * 100);
		//_damage = (round(_damage * 100));
		_hunger = round (ExileClientPlayerAttributes select 2);
		_thirst = round (ExileClientPlayerAttributes select 3);
		_wallet = ((player getVariable ["ExileMoney", 0])/1000);
		_locker = ((player getVariable ["ExileLocker", 0])/1000);
		_stamina = ExileClientPlayerScore;
		_energy = 100;
		_energyPercent = 100;
		_serverFPS = round diag_fps;
		_pos = getPosATL player;
		_dir = round (getDir (vehicle player));
		_grid = mapGridPosition  player; _xx = (format[_grid]) select  [0,3]; 
		_yy = (format[_grid]) select  [3,3];  
		_time = (round (serverTime/60));
//		_time = (round(240-(serverTime)/60));  //edit the '240' value (60*4=240) to change the countdown timer if your server restarts are shorter or longer than 4 hour intervals
//		_hours = (floor(_time/60));
//		_minutes = (_time - (_hours * 60));

Hope that helps you get a picture of how to do it...

where do i change the position ? my health icon is so far away from the pop-tabs icon the fps section is falling off the status-bar and ending up underneath :/

Share this post


Link to post
Share on other sites
4 hours ago, Paul said:

I think positions and font etc is all changed in the hpp/cpp file in the folder.

yeah i tried messing with stuff in there but got no fix :/ 

im out of ideas 

huh.png

Share this post


Link to post
Share on other sites

yeah i tried messing with stuff in there but got no fix :/ 

im out of ideas 

huh.png

in statusBar.hpp change the width (w) of statusBarText. You'll also have to play around with the X coordinate (x) to properly center it again.

Mine for example:

class RscStatusBar
{
        idd = -1;
		duration = 10e10;
        onLoad = "uiNamespace setVariable ['RscStatusBar', _this select 0];";
		fadein = 0;
		fadeout = 0;
		movingEnable = 0;
		objects[] = {};

        class controlsBackground
        {
                class statusBarImage
                {
                        idc = 55557;
						type = 0;
						style = 48;
                        x = safezoneX + safezoneW - 1.883;
                        y = safezoneY + safezoneH - 0.096; //0.068
                        w = 1.35;
                        h = 0.08; //0.06
                        colorText[] = {1, 1, 1, 1};
						colorBackground[]={0,0,0,0};
						sizeEx = 0.4;
						font = "OrbitronLight";
                        text = "";
                };
        };
 
        class controls 
        {
                class statusBarText
                {
                        idc = 55554;
                        x = safezoneX + safezoneW - 2.02;
                        y = safezoneY + safezoneH - 0.063;
                        w = 1.6;
                        h = 0.06;
                        shadow = 2;
                        font = "OrbitronLight";
                        size = 0.032;
                        type = 13;
						style = 2;
                        text = "";
 
                        class Attributes
                        {
								shadow = 2;
                                align="center";
                                color = "#ffffff";
                                font = "OrbitronLight";
                        };
                };
        };
};

@ anyone not using the background image:

Keep in mind that if you don't use a backdrop that the text becomes very hard to read on bright/light backgrounds. I recommend using shadow='2' to get a full black border around the white text. Add shadow = 2 to the statusBar.hpp script and make sure to also add the shadows to the icons in statusBar.sqf like this:

<t shadow='2' shadowColor='#000000' color='%10'><img size='1.3'  shadowColor='#000000' image='addons\statusbar\icons\players.paa' color='%10'/> %2</t>
Edited by iD4NG3R`
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.