Jump to content
  • 0

Debugging the Debug


Defent

Question

Hello, 

I'm having some trouble with my debug monitor causing some weird errors:
 

  Quote

 

16:14:08 Error in expression <unt playableUnits),r_player_blood,round _humanity,_killsH,_killsB,_kills,(round >

16:14:08   Error position: <_humanity,_killsH,_killsB,_kills,(round >
16:14:08   Error Undefined variable in expression: _humanity
16:14:08 File mpmissions\DayZ_Epoch_11.Chernarus\custom\debug.sqf, line 24
16:14:12 Wrong text element 'null'
16:14:12 Wrong text element 'null'
16:14:12 Wrong text element 'null'

The debug monitor works in all its glory with a toggle function. 
Here is some info:
 

This is in my init.sqf to make it so it is enabled by default.

if {!isDedicated} then {
debugMonitor = true;
[] execvm "custom\debug.sqf";
};

Here is the debug.sqf

while {debugmonitor} do
{

	_kills = 		player getVariable["zombieKills",0];
	_killsH = 		player getVariable["humanKills",0];
	_killsB = 		player getVariable["banditKills",0];
	_humanity =		player getVariable["humanity",0];
	
	hintSilent parseText format ["
	<t size='1.15' font='Bitstream'align='center' color='#5882FA'>Website:</t><br/>
	<t size='1.15' font='Bitstream'align='center'>Numenadayz.com</t><br/>	
	<t size='1.15' font='Bitstream'align='center' color='#5882FA'>Teamspeak:</t><br/>
	<t size='1.15' font='Bitstream'align='center'>ts.numenadayz.com</t><br/>
	<t size='0.95' font='Bitstream' align='left' color='#FFBF00'>Players Online: </t><t size='0.95 'font='Bitstream' align='right'>%1</t><br/>
        <t size='0.95' font='Bitstream' align='left' color='#FFBF00'>Blood: </t><t size='0.95' font='Bitstream' align='right'>%2</t><br/>
	<t size='0.95' font='Bitstream' align='left' color='#FFBF00'>Humanity: </t><t size='0.95' font='Bitstream' align='right'>%3</t><br/>
	<t size='0.95' font='Bitstream' align='left' color='#FFBF00'>Murders: </t><t size='0.95' font='Bitstream' align='right'>%4</t><br/>
	<t size='0.95' font='Bitstream' align='left' color='#FFBF00'>Bandits Killed: </t><t size='0.95' font='Bitstream' align='right'>%5</t><br/>
	<t size='0.95' font='Bitstream' align='left' color='#FFBF00'>Zombies Killed: </t><t size='0.95' font='Bitstream' align='right'>%6</t><br/>
        <t size='0.95' font='Bitstream' align='left' color='#FFBF00'>FPS: </t><t size='0.95' font='Bitstream' align='right'>%7</t><br/>
	<t size='1.15' font='Bitstream' align='center' color='#5882FA'>Restart in %8 Minutes</t><br/>
	<t size='1' font='Bitstream' align='center'>Press F10 to toggle</t>",
	
	(count playableUnits),r_player_blood,round _humanity,_killsH,_killsB,_kills,(round diag_fps),(round(180-(serverTime) / 60))
	];
sleep 1;
};

and this part calls the debug monitor when you press F10

if (_dikCode == 0x44) then {
	if (isNil 'debugMonitor') then 
	{
		debugMonitor = true;
		[] execvm "custom\debug.sqf";
	}
	else
	{
		debugMonitor = !debugMonitor;
		hintSilent '';
		[] execvm "custom\debug.sqf";
	};
};

is the isNil value causing the problem? and if so what can I replace it with?

I used this debug monitor before without any problems, but when I added a toggle function this happend.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

instead of debugMonitor = !debugMonitor;

use

debugMonitor = if (debugMonitor) then {false} else {true};

Also, try assign all local variables to a private array.

private ["_kills","_killsH","_killsB","_humanity"];

Edit: fixed code.

 

I've had issues using var = !var in the past.

Link to comment
Share on other sites

  • 0
  On 2/16/2014 at 9:25 PM, Defenting said:
16:14:12 Wrong text element 'null'
16:14:12 Wrong text element 'null'
16:14:12 Wrong text element 'null'

 

you are running the debug on the server ... move the init line inside this block:

if (!isDedicated) then {
	//Conduct map operations
	0 fadeSound 0;
	waitUntil {!isNil "dayz_loadScreenMsg"};
	dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
	
	//Run the player monitor
	_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
	_playerMonitor = 	[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";	
	
	//anti Hack
	[] execVM "\z\addons\dayz_code\system\antihack.sqf";

	//Lights
	//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
	
};
Link to comment
Share on other sites

  • 0

But if you ARE running the debug on the server then this is the way some of those values work:

 

"Players Online"       :  (playersNumber west),

"Hummanity"              :  round (player getVariable['humanity', 0]),

"Zombies (alive/total)" : count (entities 'zZombie_Base'), / ({alive _x} count (entities 'zZombie_Base')),

Link to comment
Share on other sites

  • 0
  On 2/17/2014 at 10:28 AM, Sandbird said:

But if you ARE running the debug on the server then this is the way some of those values work:

 

"Players Online"       :  (playersNumber west),

"Hummanity"              :  round (player getVariable['humanity', 0]),

"Zombies (alive/total)" : count (entities 'zZombie_Base'), / ({alive _x} count (entities 'zZombie_Base')),

 

I don't believe the "player" works on the serverside which was causing him the errors. Using player on the client of course means that player, but I believe the server has to know which player to get the variable from.

Link to comment
Share on other sites

  • 0

As I said, the debug monitor worked fine without any errors before. It's only when I added a toggle function when it gave me these messages BUT STILL WORKS.
I removed the below code and added the codes mentioned above.

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

The debug monitor has always been server side. 

I have the init inside that block and it did not change anything. 

Link to comment
Share on other sites

  • 0
  On 2/19/2014 at 11:17 AM, Defent said:

Nope, I was wrong - problem still happens. Even with the fixes you mentioned.

 

I have solved same error 

It happens because of overlapping function key in 'dayz_spaceInterrupt.sqf'

If you look careful u will finds that your

 

if (_dikCode == 0x44) then {

 

overlaps with another function:

 

if (_dikCode in[0x02,0x03,0x04,0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {

 
And that creates problems and spam in RTP log. Just deleting "0x44" out of "...if (_dikCode..." is not an option because every time u will press F10 menu will popup.
 
As such, solution is here:
 
1) Delete "0x44" from: "if (_dikCode in[..." so it will look like this:
 
if (_dikCode in[0x02,0x03,0x04,0x58,0x57,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {
	_handled = true;
};

2) Rewrite your "if (_dikCode == 0x44) then {" function with this:

if (_dikCode == 0x44) then {
	if (isNil 'debugMonitor') then 
	{
		debugMonitor = true;
		[] execvm "custom\debug.sqf";
		_handled = true;
	}
	else
	{
		debugMonitor = if (debugMonitor) then {false} else {true};
		hintSilent '';
		[] execvm "custom\debug.sqf";
		_handled = true;
	};
};

Done!

Link to comment
Share on other sites

  • 0

And If your are interested here is my:

dayz_spaceInterrupt.sqf

 

  Reveal hidden contents

 

Here is my 

custom_monitor.sqf

 

  Reveal hidden contents

 

And in my init.sqf:

if (!isDedicated) then {
	// Custom Monitor
	[] execVM "custom\custom_monitor.sqf";
};
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...