How can I make this Debug Toggle?

QueZ

Well-Known Member
Love this debug monitor, simple and easy to install however...
How can I make this Debug Toggle?
It's always on, but i'd much rather have it toggle.
Any help would be appreciated.


custom_monitor.sqf (drop this into root mission.pbo)
Code:
if (isNil "custom_monitor") then {custom_monitor = true;} else {custom_monitor = !custom_monitor;};
 
while {custom_monitor} do
{
    _humanity =        player getVariable["humanity",0];
    _headShots =    player getVariable["headShots",0];
    hintSilent parseText format ["
    <t size='1' font='Bitstream' align='left' color='#EE2C2C'>Restart:</t><t size='1' font='Bitstream'align='right'color='#EE2C2C'>%7 min</t><br/>
    <t size='1'font='Bitstream'align='left'>Survived:</t><t size='1'font='Bitstream'align='right'>%1 Days</t><br/>
    <t size='1'font='Bitstream'align='left'>Blood:</t><t size='1'font='Bitstream'align='right'>%2</t><br/>
    <t size='1'font='Bitstream'align='left'>Humanity:</t><t size='1'font='Bitstream'align='right'>%3</t><br/>
    <t size='1'font='Bitstream'align='left'>Zombies (alive/total):</t><t size='0.95'font='Bitstream'align='right'>%5/%4</t><br/>
    <t size='1'font='Bitstream'align='left'>FPS:</t><t size='1'font='Bitstream'align='right'>%6</t><br/>
 
    ",(dayz_Survived),r_player_blood,round _humanity,(count entities "zZombie_Base"),({alive _x} count entities "zZombie_Base"),(round diag_fps),(180-(round(serverTime/60)))];
sleep 1;
};


init.sqf (this code goes at the very bottom)
Code:
[] ExecVM "custom_monitor.sqf";
 
Code:
dayz_spaceInterrupt = {
    private ["_dikCode", "_handled"];
    _dikCode = _this select 1;
    _handled = false;
 
    if (_dikCode == 0x9D) then {
        if (debugMonitor) then {
            debugMonitor = false;
            hintSilent "";
        } else {[] spawn fnc_debug;};
    };
    _handled
};
 
fnc_debug = {
    debugMonitor = true;
    while {debugMonitor} do
    {
        _humanity =        player getVariable["humanity",0];
        _headShots =    player getVariable["headShots",0];
        hintSilent parseText format ["
        <t size='1' font='Bitstream' align='left' color='#EE2C2C'>Restart:</t><t size='1' font='Bitstream'align='right'color='#EE2C2C'>%7 min</t><br/>
        <t size='1'font='Bitstream'align='left'>Survived:</t><t size='1'font='Bitstream'align='right'>%1 Days</t><br/>
        <t size='1'font='Bitstream'align='left'>Blood:</t><t size='1'font='Bitstream'align='right'>%2</t><br/>
        <t size='1'font='Bitstream'align='left'>Humanity:</t><t size='1'font='Bitstream'align='right'>%3</t><br/>
        <t size='1'font='Bitstream'align='left'>Zombies (alive/total):</t><t size='0.95'font='Bitstream'align='right'>%5/%4</t><br/>
        <t size='1'font='Bitstream'align='left'>FPS:</t><t size='1'font='Bitstream'align='right'>%6</t><br/>
   
        ",(dayz_Survived),r_player_blood,round _humanity,(count entities "zZombie_Base"),({alive _x} count entities "zZombie_Base"),(round diag_fps),(180-(round(serverTime/60)))];
    sleep 1;
    };
};
 
[] spawn fnc_debug;


Rctrl should toggle it
 
Code:
dayz_spaceInterrupt = {
    private ["_dikCode", "_handled"];
    _dikCode = _this select 1;
    _handled = false;
 
    if (_dikCode == 0x9D) then {
        if (debugMonitor) then {
            debugMonitor = false;
            hintSilent "";
        } else {[] spawn fnc_debug;};
    };
    _handled
};
 
fnc_debug = {
    debugMonitor = true;
    while {debugMonitor} do
    {
        _humanity =        player getVariable["humanity",0];
        _headShots =    player getVariable["headShots",0];
        hintSilent parseText format ["
        <t size='1' font='Bitstream' align='left' color='#EE2C2C'>Restart:</t><t size='1' font='Bitstream'align='right'color='#EE2C2C'>%7 min</t><br/>
        <t size='1'font='Bitstream'align='left'>Survived:</t><t size='1'font='Bitstream'align='right'>%1 Days</t><br/>
        <t size='1'font='Bitstream'align='left'>Blood:</t><t size='1'font='Bitstream'align='right'>%2</t><br/>
        <t size='1'font='Bitstream'align='left'>Humanity:</t><t size='1'font='Bitstream'align='right'>%3</t><br/>
        <t size='1'font='Bitstream'align='left'>Zombies (alive/total):</t><t size='0.95'font='Bitstream'align='right'>%5/%4</t><br/>
        <t size='1'font='Bitstream'align='left'>FPS:</t><t size='1'font='Bitstream'align='right'>%6</t><br/>
 
        ",(dayz_Survived),r_player_blood,round _humanity,(count entities "zZombie_Base"),({alive _x} count entities "zZombie_Base"),(round diag_fps),(180-(round(serverTime/60)))];
    sleep 1;
    };
};
 
[] spawn fnc_debug;


Rctrl should toggle it


Thank you so much yet again Matt... why are you not a mod here yet? hahaha works 100% I am using the H key ;)
 
Thank you so much yet again Matt... why are you not a mod here yet? hahaha works 100% I am using the H key ;)

Probably because I really havn't done anything worthwhile. Retra does scripting tutorials, others have their own mods, and the rest are founders (and scripting geniuses!)
 
Back
Top