Defent Posted February 16, 2014 Report Share Posted February 16, 2014 Hello, I'm having some trouble with my debug monitor causing some weird errors: 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 More sharing options...
0 vbawol Posted February 16, 2014 Report Share Posted February 16, 2014 try putting () around: round _humanity To: (round _humanity) Link to comment Share on other sites More sharing options...
0 icomrade Posted February 16, 2014 Report Share Posted February 16, 2014 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 More sharing options...
0 Defent Posted February 16, 2014 Author Report Share Posted February 16, 2014 Thank you both, this seems to have done the trick. No more errors spamming my rpt atleast. Link to comment Share on other sites More sharing options...
0 Halvhjearne Posted February 17, 2014 Report Share Posted February 17, 2014 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 More sharing options...
0 Sandbird Posted February 17, 2014 Report Share Posted February 17, 2014 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 More sharing options...
0 TheVampire Posted February 17, 2014 Report Share Posted February 17, 2014 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 More sharing options...
0 Defent Posted February 17, 2014 Author Report Share Posted February 17, 2014 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 More sharing options...
0 Defent Posted February 19, 2014 Author Report Share Posted February 19, 2014 Nope, I was wrong - problem still happens. Even with the fixes you mentioned. Link to comment Share on other sites More sharing options...
0 mclemur Posted March 31, 2014 Report Share Posted March 31, 2014 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 More sharing options...
0 mclemur Posted March 31, 2014 Report Share Posted March 31, 2014 And If your are interested here is my: dayz_spaceInterrupt.sqf private ["_dikCode","_handled","_primaryWeapon","_secondaryWeapon","_nearbyObjects","_nill","_shift","_ctrl","_alt","_dropPrimary","_dropSecondary","_iItem","_removed","_iPos","_radius","_item"]; _dikCode = _this select 1; _handled = false; if (_dikCode == 0x44) then { if (debugMonitor) then { debugMonitor = false; hintSilent ""; _handled = true; } else { [] spawn fnc_debug; _handled = true; }; }; 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; }; if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3)) then { if(diag_tickTime - dayz_lastCheckBit > 10) then { dayz_lastCheckBit = diag_tickTime; call dayz_forceSave; }; call dayz_EjectPlayer; }; // esc if (_dikCode == 0x01) then { DZE_cancelBuilding = true; call dayz_EjectPlayer; }; // surrender if (_dikCode in actionKeys "Surrender") then { _vehicle = vehicle player; _inVehicle = (_vehicle != player); _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder and !_inVehicle); if (_canDo and !DZE_Surrender and !(player isKindOf "PZombie_VB")) then { DZE_Surrender = true; _dropPrimary = false; _dropSecondary = false; _primaryWeapon = primaryWeapon player; if (_primaryWeapon != "") then {_dropPrimary = true;}; _secondaryWeapon = ""; { if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith { _secondaryWeapon = _x; }; } forEach (weapons player); if (_secondaryWeapon != "") then {_dropSecondary = true;}; if (_dropPrimary or _dropSecondary) then { player playActionNow "PutDown"; _iPos = getPosATL player; _radius = 1; _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; _item setposATL _iPos; if (_dropPrimary) then { _iItem = _primaryWeapon; _removed = ([player,_iItem,1] call BIS_fnc_invRemove); if (_removed == 1) then { _item addWeaponCargoGlobal [_iItem,1]; }; }; if (_dropSecondary) then { _iItem = _secondaryWeapon; _removed = ([player,_iItem,1] call BIS_fnc_invRemove); if (_removed == 1) then { _item addWeaponCargoGlobal [_iItem,1]; }; }; player reveal _item; }; // set publicvariable that allows other player to access gear player setVariable ["DZE_Surrendered", true, true]; // surrender animation player playMove "AmovPercMstpSsurWnonDnon"; }; _handled = true; }; if (_dikCode in actionKeys "MoveForward") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};}; if (_dikCode in actionKeys "MoveLeft") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};}; if (_dikCode in actionKeys "MoveRight") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};}; if (_dikCode in actionKeys "MoveBack") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};}; //Prevent exploit of drag body if ((_dikCode in actionKeys "Prone") and r_drag_sqf) exitWith { force_dropBody = true; }; if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) exitWith { force_dropBody = true; }; _shift = _this select 2; _ctrl = _this select 3; _alt = _this select 4; //diag_log format["Keypress: %1", _this]; if ((_dikCode in actionKeys "Gear") and (vehicle player != player) and !_shift and !_ctrl and !_alt && !dialog) then { createGearDialog [player, "RscDisplayGear"]; _handled = true; }; if (_dikCode in (actionKeys "GetOver")) then { if (player isKindOf "PZombie_VB") then { _handled = true; DZE_PZATTACK = true; } else { _nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8]; if (count _nearbyObjects > 0) then { if((diag_tickTime - dayz_lastCheckBit > 4)) then { [objNull, player, rSwitchMove,"GetOver"] call RE; player playActionNow "GetOver"; dayz_lastCheckBit = diag_tickTime; } else { _handled = true; }; }; }; }; //if (_dikCode == 57) then {_handled = true}; // space //if (_dikCode in actionKeys 'MoveForward' or _dikCode in actionKeys 'MoveBack') then {r_interrupt = true}; if (_dikCode == 210) then { _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf"; }; if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true}; if (_dikCode in actionKeys "PushToTalk" and (diag_tickTime - dayz_lastCheckBit > 10)) then { dayz_lastCheckBit = diag_tickTime; [player,50,true,(getPosATL player)] spawn player_alertZombies; }; if (_dikCode in actionKeys "VoiceOverNet" and (diag_tickTime - dayz_lastCheckBit > 10)) then { dayz_lastCheckBit = diag_tickTime; [player,50,true,(getPosATL player)] spawn player_alertZombies; }; if (_dikCode in actionKeys "PushToTalkDirect" and (diag_tickTime - dayz_lastCheckBit > 10)) then { dayz_lastCheckBit = diag_tickTime; [player,15,false,(getPosATL player)] spawn player_alertZombies; }; if (_dikCode in actionKeys "Chat" and (diag_tickTime - dayz_lastCheckBit > 10)) then { dayz_lastCheckBit = diag_tickTime; [player,15,false,(getPosATL player)] spawn player_alertZombies; }; 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"; }; // numpad 8 0x48 now pgup 0xC9 1 if ((_dikCode == 0xC9 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User15")) then { DZE_Q = true; }; // numpad 2 0x50 now pgdn 0xD1 if ((_dikCode == 0xD1 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User16")) then { DZE_Z = true; }; // numpad 8 0x48 now pgup 0xC9 0.1 if ((_dikCode == 0xC9 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User13")) then { DZE_Q_alt = true; }; // numpad 2 0x50 now pgdn 0xD1 if ((_dikCode == 0xD1 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User14")) then { DZE_Z_alt = true; }; // numpad 8 0x48 now pgup 0xC9 0.01 if ((_dikCode == 0xC9 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User7")) then { DZE_Q_ctrl = true; }; // numpad 2 0x50 now pgdn 0xD1 if ((_dikCode == 0xD1 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User8")) then { DZE_Z_ctrl = true; }; // numpad 4 0x4B now Q 0x10 if (_dikCode == 0x10 or (_dikCode in actionKeys "User17")) then { DZE_4 = true; }; // numpad 6 0x4D now E 0x12 if (_dikCode == 0x12 or (_dikCode in actionKeys "User18")) then { DZE_6 = true; }; // numpad 5 0x4C now space 0x39 if (_dikCode == 0x39 or (_dikCode in actionKeys "User19")) then { DZE_5 = true; }; _handled Here is my custom_monitor.sqf fnc_debug = { debugMonitor = true; private ["_nearestCity", "_textCity", "_kills","_killsH","_killsB","_humanity","_headShots","_zombies","_zombiesA","_pic"]; while {debugMonitor} do { _nearestCity = nearestLocations [getPos player, ["NameCityCapital","NameCity","NameVillage","NameLocal"],750]; _textCity = "Wilderness"; if (count _nearestCity > 0) then {_textCity = text (_nearestCity select 0)}; _kills = player getVariable["zombieKills",0]; _killsH = player getVariable["humanKills",0]; _killsB = player getVariable["banditKills",0]; _humanity = player getVariable["humanity",0]; _headShots = player getVariable["headShots",0]; _zombies = count entities "zZombie_Base"; _zombiesA = {alive _x} count entities "zZombie_Base"; _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='left' color='#EEC900'>%1 in:</t><t size='1' font='Bitstream' align='right' color='#FFFAF0'>%2</t><br/> <img size='3' image='%12'/><br/> <t size='1' font='Bitstream' align='left' color='#EE0000' >Blood Left:</t><t size='1' font='Bitstream' align='right' color='#EE0000' >%3</t><br/> <t size='1' font='Bitstream' align='left' color='#104E8B' >Humanity:</t><t size='1' font='Bitstream' align='right' color='#104E8B' >%4</t><br/> <t size='1' font='Bitstream' align='left' color='#EEC900' >Hero Killed:</t><t size='1' font='Bitstream' align='right' color='#EEC900' >%5</t><br/> <t size='1' font='Bitstream' align='left' color='#EEC900' >Bandits Killed:</t><t size='1' font='Bitstream' align='right' color='#EEC900' >%6</t><br/> <t size='1' font='Bitstream' align='left' color='#EEC900' >Zedz Killed:</t><t size='1' font='Bitstream' align='right' color='#EEC900' >%7</t><br/> <t size='1' font='Bitstream' align='left' color='#EEC900' >Headshots:</t><t size='1' font='Bitstream' align='right' color='#EEC900' >%8</t><br/> <t size='1' font='Bitstream' align='left' color='#EEC900' >Zedz (alive/total): </t><t size='1' font='Bitstream' align='right' color='#EEC900' >%10/%9</t><br/> <t size='1' font='Bitstream' align='left' color='#104E8B' >FPS: </t><t size='1' font='Bitstream' align='right' color='#104E8B' >%11</t><br/> <t size='1' font='Bitstream' align='center' color='#104E8B' >Press F10 to toggle!</t><br/> <t size='1' font='Bitstream' align='center' color='#5882FA' >Restart in %14 minutes</t><br/> <t size='1' font='Bitstream' align='center' color='#FFFFFF' >28 Months Later 28ML</t> ", (name player), //%1 _textCity, //%2 (r_player_blood), //%3 (round _humanity), //%4 _killsH, //%5 _killsB, //%6 _kills, //%7 _headShots, //%8 _zombies, //%9 _zombiesA , //%10 (round(diag_fps)), //%11 _pic, //%12 (round(180-(serverTime) / 60)) //%13 ]; sleep 1; }; }; [] spawn fnc_debug; And in my init.sqf: if (!isDedicated) then { // Custom Monitor [] execVM "custom\custom_monitor.sqf"; }; Link to comment Share on other sites More sharing options...
Question
Defent
Hello,
I'm having some trouble with my debug monitor causing some weird errors:
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.
Here is the debug.sqf
and this part calls the debug monitor when you press F10
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
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 accountSign in
Already have an account? Sign in here.
Sign In Now