Jump to content
Sign in to follow this  
sandbird

Generic error in expression

Recommended Posts

Can some please tell me what is wrong with this ? Its been bugging me in the logs for days now..I dont see anything wrong with it.

private ["_grrrVal"];


if (isnil {_object getvariable "Sarge"}) then {_grrrVal= 0;} else {_grrrVal= _object getvariable ["Sarge","0"];};
if (_grrrVal== 1) exitWith {};

if (!_parachuteWest and !(locked _object)) then {
       //if (_objectID == "0" && _uid == "0") then
       if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then
       {
               _object_position = getPosATL _object;
           _isNotOk = true;
       };
};

I get this error:

19:35:48 Error in expression <riable ["Sarge","0"];};
if (_grrrVal== 1) exitWith {  };

if (!_parachuteWes>
19:35:48   Error position: <== 1) exitWith {  };

if (!_parachuteWes>
19:35:48   Error Generic error in expression

I know this is Dayz but its basic Arma scripting. And noone at Dayz knows how to code to help out...Most of those guys are copy/pasters.

I had to do this if (isnil.... cause plain getvariable "Sarge" was causing almost the same error.

This function is in a file called server_updateObject.sqf which runs on every game object when its updated.

I want to check if Sarge value is set to 1, then exit the script, otherwise continue.

(Sarge value is set to objects that i dont want them to be deleted by the script.

But it gives me this so weird message no matter what i do...and its spamming the log, and probably not running the update properly.

Any help would be appreciated.

-Thanks

Share this post


Link to post
Share on other sites

At work so cant test code, but try this out.

private ["_var","_grrrVal"];

_var = _object getvariable "Sarge";
if(isnil "_var") then {_grrrVal= 0;} else {_grrrVal = _var;};
if(_grrrVal== 1) exitwith {};

if(!_parachuteWest and !(locked _object)) then {
       //if (_objectID == "0" && _uid == "0") then
       if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then {
               _object_position = getPosATL _object;
           _isNotOk = true;
       };
};

Share this post


Link to post
Share on other sites

:/ i was so happy to see the server running with no errors....and after 1 minute:

21:54:06 Error in expression <0;} else {_grrrVal = _var;};
if(_grrrVal== 1) exitwith {};



if (!_parachuteWes>
21:54:06   Error position: <== 1) exitwith {};



if (!_parachuteWes>
21:54:06   Error Generic error in expression
21:54:06 File z\addons\dayz_server\compile\server_updateObject.sqf, line 31

I dont understand....with PHP this logic makes sense...wtf is wrong with arma....

And the bad thing is that testing this alone on the server....I get no errors....with 3-4 people also the same.

Placing it on the real server, where tons of people join from different countries.....bam...the error.

So i cant REALLY beta test this properly cause closing the server down on every edit will just piss people off.

Edited by Sandbird

Share this post


Link to post
Share on other sites

If the _grrrVal is being used anywhere else in the script try this out.

if((_object getvariable "Sarge")==1) exitwith {};

if(!_parachuteWest and !(locked _object)) then {
       //if (_objectID == "0" && _uid == "0") then
       if(_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then {
               _object_position = getPosATL _object;
           _isNotOk = true;
       };
};

Share this post


Link to post
Share on other sites

Yes my initial code was like this:

if (_object getVariable "Sarge" == 1) exitWith {};

But it was giving : Generic error in expression.

So i constructed that monstrosity you see up there trying to force getvariable value to be 0 or 1 (not that it could be anything else, beside 'not present' in the object.

You see this Sarge thing is what keeps anything custom on the map (crates, vehicles) to stay put on cleanup executed by the server....so if the object has Sarge set to 1...then exit the updateobjects script...else run it.

I even tried to diag_log the value and all i was getting was zeros and ones...never nil or anything else...so the above code shoudl work T_T.

Is there really a difference between these two ?

if (_object getVariable "Sarge" == 1) exitWith {};

if((_object getvariable "Sarge")==1) exitwith {};

I am more of a PHP guy, but if Arma is that picky...i'll kill myself :/

Edit: wow!

does exitwith with exitWith matters oO?

Edited by Sandbird

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×