Jump to content

Custom debug monitor


Kisha

Recommended Posts

I don't know what you want exactely, if you don't refresh the monitor it will fade away by itself (like the default Epoch debug monitor).

All other debug monitors usually refresh the data every second so it stays on all the time, which costs some performance.. :D

Link to comment
Share on other sites

 

why has no one mentioned using key down/key up event handlers so the debug is toggleable on a key press

something along the lines of this

fnc_debug = 
{
	while {debugMonitor} do
	{
		hintSilent parseText format ["<t size='0.95' font='Bitstream' align='left' >Debug Monitor Goes Here</t>"];
	};
};

fnc_debugTog = 
{
	if (isNil 'debugMonitor') then 
	{
		debugMonitor = true;
		[] spawn fnc_debug;
	}
	else
	{
		debugMonitor = !debugMonitor;
		hintSilent '';
		[] spawn fnc_debug;
	};
};

keyDownEvent = 
{
	_key = _this select 1;
	if (_key == 0xCF) then {[] spawn fnc_debugTog;};//0xCF is the END key go here for a list of key codes http://community.bistudio.com/wiki/DIK_KeyCodes
};
(findDisplay 46) displayAddEventHandler ['KeyUp','_this call keyDownEvent'];

 I modified the dayz_spaceinterrupt.sqf to include this code, and everything works, but the question is how to call the  [] spawn fnc_debugTog; once on player join so that the debug monitor would show. Calling it in compiles/init gives undefined variable fnc_debugTog....

 

//Edit: nvm got this to work without using functions. Have a nice toggleable debug monitor now. Kudos BushWookie :lol:

Link to comment
Share on other sites

 I modified the dayz_spaceinterrupt.sqf to include this code, and everything works, but the question is how to call the  [] spawn fnc_debugTog; once on player join so that the debug monitor would show. Calling it in compiles/init gives undefined variable fnc_debugTog....

 

//Edit: nvm got this to work without using functions. Have a nice toggleable debug monitor now. Kudos BushWookie :lol:

 

Can you show what you did to get it to work? Thanks

Link to comment
Share on other sites

Credit goes to BushWookie

 

Copy dayz_spaceInterrupt.sqf from dayz_code.pbo\actions into your custom folder.

 

Change the path of dayz_spaceInterrupt.sqf in your custom compiles to:

dayz_spaceInterrupt 	= compile preprocessFileLineNumbers "custom\dayz_spaceInterrupt.sqf";

Create a new file in your custom folder called debug.sqf

Paste this in it

while {debugMonitor} do
{
 //Modify your debug starting here
	_pic = (gettext (configFile >> 'CfgVehicles' >> (typeof vehicle player) >> 'picture'));
        if (player == vehicle player) then
        {
            _pic = (gettext (configFile >> 'cfgWeapons' >> (currentWeapon player) >> 'picture'));
        }
            else
        {
            _pic = (gettext (configFile >> 'CfgVehicles' >> (typeof vehicle player) >> 'picture'));
        };
hintSilent parseText format ["
	<t size='1' font='Bitstream' align='center' color='#669933'>%1</t><br/>
	<img size='4' image='%9'/><br/>
        <t size='1' font='Bitstream' align='left'>Zombies Killed: </t><t color='#669933' size='1.2' font='Bitstream' align='right'>%2</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Survivors Killed: </t><t color='#669933' size='1' font='Bitstream' align='right'>%4</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Bandits Killed: </t><t color='#669933' size='1' font='Bitstream' align='right'>%5</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>FPS: </t><t color='#669933' size='1' font='Bitstream' align='right'>%8</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Humanity: </t><t color='#5882FA' size='1' font='Bitstream' align='right'>%7</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Blood: </t><t color='#ff5200' size='1' font='Bitstream' align='right'>%6</t><br/>
	<t size='1' font='Bitstream' align='center' color='#669933'>Press INSERT to toggle</t>
	",
        (name player),
        (player getVariable['zombieKills', 0]),
        (player getVariable['headShots', 0]),
        (player getVariable['humanKills', 0]),
        (player getVariable['banditKills', 0]),
        (player getVariable['USEC_BloodQty', r_player_blood]),
        (player getVariable['humanity', 0]),
        (round diag_fps),
        _pic];
//Don't modify below this line
	sleep 1;
};

Open custom\dayz_spaceInterrupt.sqf

 

Replace this:

if (_dikCode == 210) then {
		_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

with this:

if (_dikCode == 210) then {
	if (isNil 'debugMonitor') then {
		debugMonitor = true;
		_nill = execvm "custom\debug.sqf";
	} else {
		debugMonitor = !debugMonitor;
		hintSilent '';
		_nill = execvm "custom\debug.sqf";
	};
};

Comment out this:

if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
	dayz_lastCheckBit = diag_tickTime;
	_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

like this:

/*
if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
	dayz_lastCheckBit = diag_tickTime;
	_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};
*/

If you want the debug monitor to be auto-shown when player connects

add this to the end of !isDedicated block in your init.sqf in MPMissions:

if (isNil 'debugMonitor') then 
{
	debugMonitor = true;
	_nill = execvm "custom\debug.sqf";
};

Enjoy :)

Link to comment
Share on other sites

Credit goes to BushWookie

 

Copy dayz_spaceInterrupt.sqf from dayz_code.pbo\actions into your custom folder.

 

Change the path of dayz_spaceInterrupt.sqf in your custom compiles to:

dayz_spaceInterrupt 	= compile preprocessFileLineNumbers "custom\dayz_spaceInterrupt.sqf";

Create a new file in your custom folder called debug.sqf

Paste this in it

while {debugMonitor} do
{
 //Modify your debug starting here
	_pic = (gettext (configFile >> 'CfgVehicles' >> (typeof vehicle player) >> 'picture'));
        if (player == vehicle player) then
        {
            _pic = (gettext (configFile >> 'cfgWeapons' >> (currentWeapon player) >> 'picture'));
        }
            else
        {
            _pic = (gettext (configFile >> 'CfgVehicles' >> (typeof vehicle player) >> 'picture'));
        };
hintSilent parseText format ["
	<t size='1' font='Bitstream' align='center' color='#669933'>%1</t><br/>
	<img size='4' image='%9'/><br/>
        <t size='1' font='Bitstream' align='left'>Zombies Killed: </t><t color='#669933' size='1.2' font='Bitstream' align='right'>%2</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Survivors Killed: </t><t color='#669933' size='1' font='Bitstream' align='right'>%4</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Bandits Killed: </t><t color='#669933' size='1' font='Bitstream' align='right'>%5</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>FPS: </t><t color='#669933' size='1' font='Bitstream' align='right'>%8</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Humanity: </t><t color='#5882FA' size='1' font='Bitstream' align='right'>%7</t><br/>
        <t color='#ffffff' size='1' font='Bitstream' align='left'>Blood: </t><t color='#ff5200' size='1' font='Bitstream' align='right'>%6</t><br/>
	<t size='1' font='Bitstream' align='center' color='#669933'>Press INSERT to toggle</t>
	",
        (name player),
        (player getVariable['zombieKills', 0]),
        (player getVariable['headShots', 0]),
        (player getVariable['humanKills', 0]),
        (player getVariable['banditKills', 0]),
        (player getVariable['USEC_BloodQty', r_player_blood]),
        (player getVariable['humanity', 0]),
        (round diag_fps),
        _pic];
//Don't modify below this line
	sleep 1;
};

Open custom\dayz_spaceInterrupt.sqf

 

Replace this:

if (_dikCode == 210) then {
		_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

with this:

if (_dikCode == 210) then {
	if (isNil 'debugMonitor') then 
	{
		debugMonitor = true;
		_nill = execvm "custom\debug.sqf";
	}
	else
	{
		debugMonitor = !debugMonitor;
		hintSilent '';
		_nill = execvm "custom\debug.sqf";
	};
};

Comment out this:

if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
	dayz_lastCheckBit = diag_tickTime;
	_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

like this:

/*
if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
	dayz_lastCheckBit = diag_tickTime;
	_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};
*/

If you want the debug monitor to be auto-shown when player connects

add this to the end of your init.sqf in MPMissions:

if (isNil 'debugMonitor') then 
{
	debugMonitor = true;
	_nill = execvm "custom\debug.sqf";
};

Enjoy :)

can I add restart in minutes? Thanks

Link to comment
Share on other sites

Yeah, modify debug.sqf any way you like. There are some server restart timer examples on previous pages.

Yeah I know how to, just read somewhere in previous post that what caused problems before. But may be it's just my English lol. Anyway thanks a lot for the reply) Cheers

Link to comment
Share on other sites

At a guess would something like this work?

Define the images first,

_logo = "custom\stats_logo.paa";

(small images 32*32/16*16)
r_player_blood = "custom\blood.paa";

round _humanity = "custom\humanity.paa";

   

		hintSilent parseText format 
                              [
                                "
				<img size='6' image='%1'/>
				<br/>
                                <br/>
				<img size='4' image='%2'/>
                                <img size='4' image='%3'/>
				<br/>
				<br/>
				<t size='1'		font='Bitstream'align='center'color='#FFFF00'>Restart in %8 minutes!</t>
				<br/>
				<br/>
				<t size='1' 		font='Bitstream' align='center'>Use F10 to Toggle</t>
				<br/>

                                _logo, //1
                                r_player_blood, //2
                                round _humanity, //3
                               
                            ];   

Would need to play around with layout..etc
Link to comment
Share on other sites

  • 2 weeks later...

Hi there,

 

Not sure if this is the correct place to ask this question but saves making a new thread.

 

I am using THIS debug monitor and its really nice and almost works perfectly.

 

The only issue is it does not display the correct player count. It is ALWAYS at 1, even if the server has more than 1 player.

 

For some reason though it works perfectly for the server owner (with UID in super.sqf).

 

Any ideas on a fix? 

Link to comment
Share on other sites

only way to fix this easily: disable your antihacks (that is the only reason it should not work correctly, if you don't use any AH check the debug monitor again).

 

 

Thanks for the reply Axe Cop.

 

I am using AH and dont want to sacrifice them in order to display online players. So i will simply remove the online players bit   :P

 

Thanks again 

Link to comment
Share on other sites

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
  • Advertisement
×
×
  • Create New...