Jump to content
  • 0

Is 1.0.5.1 more strict now ? when it comes to 'Undefined variable in expression' ?


Sandbird

Question

I am converting my old 1.0.4.2 script to the 1.0.5.1 version and i keep getting my client log spammed with messages like:

  Error position: <s_vehicle_unlock;
player_curre>
  Error Undefined variable in expression: s_vehicle_unlock
File mpmissions\__CUR_MP.Tavi\addons\specials.sqf, line 64

All i got in that line is:

player_Vehicle removeAction s_vehicle_unlock;

This is a variable inside a while loop that guarantees to remove an addaction from the player's options....because sometimes players turn too fast or something and some addactions are getting stuck in their GUI.

 

This worked fine before...and its not the first Undefined variable in expression i see...i keep getting errors like this when i 'remove' addactions or even when i am calling methods inside my code when the method is bellow the executing code.

Example as an algorithm:

private ["_blah","_myvalue"];


1. [_blah] call my_custom_funtion;
2.  if (_myvalue == "5") {
3.  ...do stuff then
4.  };
....
....
77.  my_custom_funtion = {
        .....
99.     _myvalue = "5"; 
100. };

Like this, i would get 100% a undefined variable in expression on for the _myvalue on line 2, although i am calling my_custom_function every time and with proper data.

The same code was working fine in 1.0.4.2...

 

 

 

Link to comment
Share on other sites

Recommended Posts

  • 0

What I always do: bevor it's used the first time (or in init.sqf) set a value for it depending what suitable values are.

I guess for fn_selfAction something like: s_vehicle_unlock = -1; Or if it's a string variable s_vehicle_unlock = ""; (So what to assign depends on what makes sense of course :) )

 

Or check if the var is NIL and enclose the command with it

 

if (!isNil "s_vehicle_unlock") then {

 

}

 

I was also wondering that I get errors for nearly every script.

 

Maybe there are better ways...but at least the issues are gone for me.

 

If a variable is first used in an if close for an comparison or something the scripting engine complains. There needs to be an initialisation before.

So in your example above it's exactly that case. Not initialized before but used (in the if clause).

 

(https://community.bistudio.com/wiki/Variables)

Link to comment
Share on other sites

  • 0

Me too ;)

And I for whatever reason had a lot to do with my old 1.0.4.2 mission to use it in 1.0.5.1. Don't ask me why.

I often think: why are no other people complaining about these scripts which throw the errors for me...but I think they don't see the errors in the rpt log or don't care.

Link to comment
Share on other sites

  • 0

Me too ;)

And I for whatever reason had a lot to do with my old 1.0.4.2 mission to use it in 1.0.5.1. Don't ask me why.

I often think: why are no other people complaining about these scripts which throw the errors for me...but I think they don't see the errors in the rpt log or don't care.

 

uhhhh cause most of the people here just copy paste.......the biggest problem in epoch forums.....compared to opendayz.net

They cant code...

Link to comment
Share on other sites

  • 0

Apparently this has become more of an issue since the Steam takeover and the 1.63 update.  A while back I found a post that even Bohemia acknowledged it and that the private variables (beginning with _) should be explicitly declared.  But they didn't fix it themselves.  They posted a link on how to fix it on their site.  At the time I didn't pay any attention to it and now that I'm trying to fix it, I cannot find that post.  I am going through all the scripts we are running and declaring them if they aren't declared already. If I can find that original post or the Bohemia link, I'll post it here.  I continue to look for it to fix it on my server, too.

 

What I find amazing are the warnings and errors I get in my ,.RPT file that I cannot clean up.  Things like "Strange convex component...",  "Server object not found...", "Cannot load sound...", "Unsupported language English in stringtable...", and more.  The oddest one is a msg that reads "Unknown entity:  'C inatallations and equipment, fuel and...." with a paragraph of text that looks like a description of some sort. There are actually several of these (incorrect spelling and all!).  I've been trying to figure out where these are coming from with not a lot of luck so far.  I'm kinda obsessive about errors and want all my systems to run clean.  With Arma2 and Dayz/Epoch it isn't easy since scripts can come from anywhere and may be coded well or not.

 

Bob

Link to comment
Share on other sites

  • 0

Apparently this has become more of an issue since the Steam takeover and the 1.63 update.  A while back I found a post that even Bohemia acknowledged it and that the private variables (beginning with _) should be explicitly declared.  But they didn't fix it themselves.  They posted a link on how to fix it on their site.  At the time I didn't pay any attention to it and now that I'm trying to fix it, I cannot find that post.  I am going through all the scripts we are running and declaring them if they aren't declared already. If I can find that original post or the Bohemia link, I'll post it here.  I continue to look for it to fix it on my server, too.

 

What I find amazing are the warnings and errors I get in my ,.RPT file that I cannot clean up.  Things like "Strange convex component...",  "Server object not found...", "Cannot load sound...", "Unsupported language English in stringtable...", and more.  The oddest one is a msg that reads "Unknown entity:  'C inatallations and equipment, fuel and...." with a paragraph of text that looks like a description of some sort. There are actually several of these (incorrect spelling and all!).  I've been trying to figure out where these are coming from with not a lot of luck so far.  I'm kinda obsessive about errors and want all my systems to run clean.  With Arma2 and Dayz/Epoch it isn't easy since scripts can come from anywhere and may be coded well or not.

 

Bob

 

Extract the dayz_code.pbo and do a search there..maybe your errors are there.

 

Most of my errors are in fn_selfactions.sqf....and its been 4h already since i started fixing them.

I tried earlier to replace characterID to playerUID for plot poles and friend lists and i just realized that although i get no errors anymore, none of the vehicles on the map get updated.

I left dayz and coding 4 months ago, came back only to find it worst. This steamID has been nothing but problems.

Link to comment
Share on other sites

  • 0

Strange convex component. is a problem in some models

http://forums.bistudio.com/showthread.php?64592-Strange-convex-component

 

Object not found:

 

Sounds not found:

http://forums.bistudio.com/showthread.php?85630-Error-Cannot-load-sound-ca-dubbing (?)

 

The others I've never seen. The models I could not fix as these are binarized and not allowed to change.

The object not found thingy I did not try to solve.

 

Just left these things as they are.

 

Some other diag_logs I've commented out in the dayz_server files just to keep the log more clean.

 

@Sandbird: same for me. Also had a 4-5 months break and needed to learn (and search) a lot of things from scratch ;)

Link to comment
Share on other sites

  • 0

Thanks, jahangir13.  I'm probably going to start working on them in the morning.  I still want to find that Bohemia thread that someone had indicated told how to fix the undefined variables in the Arma2 files.  Probably some kind of global search and replace.   If I find it, I'll post here.

Link to comment
Share on other sites

  • 0

Wish there was a fast way to encapsulate all variables from this :

  if (_isPole && (_ownerID == dayz_playerUID)) then {
          if (s_player_ShowPoleRadius < 0) then {
          s_player_ShowPoleRadius = player addAction ["Show Plots radius","addons\various\player_showPlotRadius.sqf",_cursorTarget, 0, false, true, "",""];
      };
  } else {
      player removeAction s_player_ShowPoleRadius;
      s_player_ShowPoleRadius = -1;
  };

to this

  if (_isPole && (_ownerID == dayz_playerUID)) then {
          if (s_player_ShowPoleRadius < 0) then {
          s_player_ShowPoleRadius = player addAction ["Show Plots radius","addons\various\player_showPlotRadius.sqf",_cursorTarget, 0, false, true, "",""];
      };
  } else {
        if (not isNil "s_player_ShowPoleRadius") then
        {
              player removeAction s_player_ShowPoleRadius;
              s_player_ShowPoleRadius = -1;
        };
  };

or this:

  if (_isPole && (_ownerID == dayz_playerUID)) then {
          if (s_player_ShowPoleRadius < 0) then {
          s_player_ShowPoleRadius = player addAction ["Show Plots radius","addons\various\player_showPlotRadius.sqf",_cursorTarget, 0, false, true, "",""];
      };
  } else {
        if (isNil "s_player_ShowPoleRadius") then
        {
            s_player_ShowPoleRadius = -1;
        };
         player removeAction s_player_ShowPoleRadius;
         s_player_ShowPoleRadius = -1;
  };
Link to comment
Share on other sites

  • 0

Maybe a thing which needs to be done only 1 time is to look for all these variables in fn_selfAction (and other scripts, hm) and assign a value to them. I am not sure if it is relevant if these are boolean, string or number variables or arrays (but not sure). Maybe it's enough to just set them to <variable> = ""; in a file (e.g. variables.sqf) which is loaded early in init.sqf.

So if you then have this file once you can always use this in new versions and if you add a new script just add the additional global variables (not starting with '_') to this variables file.

 

This is the changelog:

http://www.arma2.com/downloads/ARMA2OA_Update_163_readme.txt

 

There is the change line:

[97926]  Changed: Scripting: When a global variable is assigned a nil value, it is now deleted (was kept with a nil value).

It's a bit work once but one does not need to wait for new errors again and again while starting/stopping the server always.

Link to comment
Share on other sites

  • 0

It matters if its a string, bool, array or anything else....for example i cant figure out how to do Dialogues

 

This is a Dialogue variable....and for some reason i cant initialize it like the ones we said. Tried =1, =nil, =[]; etc

No matter what i tried....i keep getting an error that this is a dialogue, and you gave me something else......

(Recipe_Dialog displayCtrl 1014) ct>
  Error position: <Recipe_Dialog displayCtrl 1014) ct>
  Error Undefined variable in expression: recipe_dialog
File mpmissions\__CUR_MP.Tavi\building\Recipe\recipe_dialog.sqf, line 267
Link to comment
Share on other sites

  • 0

I mean look at this mess:

Error in expression <hen {
_losCheck = 0;
_cantSee = [_agent,_target] call dayz_losCheck;
};
>
  Error position: <_target] call dayz_losCheck;
};
>
  Error Undefined variable in expression: _target
Error in expression < = alive _agent;
_targetPos = getPosATL _target;



_agent moveTo _targetPos;
_a>
  Error position: <_target;



_agent moveTo _targetPos;
_a>
  Error Undefined variable in expression: _target

Do you know where this file is located ?

 

\dayz_code\system\zombie_agent.fsm'

 

Yes thats right....inside the dayz_code.pbo .......

Link to comment
Share on other sites

  • 0

Ah ok, then only the check for !isNil will help there  guess.

 

I am wondering that there are erros for local variables as well as in your zombie_agent.fsm (or why there is no value assigned to it).

But having a look into zombie_agent.fsm I found this: _target = objNull;

Maybe that's how you could initialize your dialog variable (https://community.bistudio.com/wiki/objNull)

 

Really, I am spending too much time in this...and I'm afraid that if a new Epoch version is out, I need to have a look again and again into this stuff ,)

 

P.S.: and don't mention zombie_abent.fsm: I was spending hours yesterday night to figure out a way to get Zeds react faster if I am near after I've slowed down their movement. Tried so many things and it did not work)

But ok...I am not a real developer. I can search for things I need and that's it. These .fms files are already difficult for me to understand in which order what happens. I guess I need to live with that ;))

Link to comment
Share on other sites

  • 0

yup....as always after a release i have to dig in and fix / tweak tons of stuff.

I've posted some fixes in the github, especially about vehicle hitpoints...didnt check if them included them in 1.0.5.1.

Even posted a fix for vehicles with 6 wheels....also didnt see if they included it..crap....so much stuff to redo now ...without even 'actually coding' what i wanted to do in the first place

Link to comment
Share on other sites

  • 0

Well get ready... looks like there won't be an Epoch 1.0.5.2.  According to their milestones here (http://16069-video-guide-to-server-structure-variables-functions-and-diffmerge.  Raymix is good but sometimes hard to follow.  This video not only is the best one I've seen that explains the file structure system, variables, and functions of the Epoch system, but it also has a section on using diffmerge.  He also has a great idea here - https://www.google.com/#q=raymix+modular+player - that proposes a modular player_build.sqf.  It would require the same kind of effort required to realign the variables as you suggest.   I like the concept but unless enough people head in the direction he's suggesting, it would be a lot of work going forward for anyone that wanted to attempt this on their own server. I'm all about modularity and reuse and it's a challenge to get everything running as efficiently and effectively as I'd like.

 

I feel your pain, Sandbird.  I recently inherited the management of an Epoch/Overwatch/Origins server and although I want to add new and fun scripts for players, most of my time has been spent tracking down errors and warnings, cleaning up code, declaring undeclared variables, database cleanup, fixing scripts that don't work quite right, and other similar things.

Link to comment
Share on other sites

  • 0

I use Ultraedit and Ultracompare, check them out , especially UltraCompare...makes comparing 2 folders a child's play.

IFyou see differences double click the file you wanna change and it will open both files in Ultraedit at the line specified.

It marks with different colors when files have differences....very easy to 'update' a server compared to a new build.

Link to comment
Share on other sites

  • 0

Hm, basically you just need both releases and check via total commander or similar tool if the file size is different (right side folder A from release 1.0.4.2 and left side folder A from release 1.0.5.1).

If a new file has a different size, use this (if made custom before) and incorporate the changes into this again. That's how I do it.

I did not have the original epoch release 1.0.4.2 anymore (and you cannot download it from the page anymore...or can you?). So this time I just checked my old mission and server files against the new ones. That took long ,)

Link to comment
Share on other sites

  • 0

Hm, basically you just need both releases and check via total commander or similar tool if the file size is different (right side folder A from release 1.0.4.2 and left side folder A from release 1.0.5.1).

If a new file has a different size, use this (if made custom before) and incorporate the changes into this again. That's how I do it.

I did not have the original epoch release 1.0.4.2 anymore (and you cannot download it from the page anymore...or can you?). So this time I just checked my old mission and server files against the new ones. That took long ,)

 

Not really hard :P

 

Current link:

https://s3.amazonaws.com/dayzepoch/DayZ_Epoch_Server_1.0.5.1_Release.7z

with my cool URL hacks:

https://s3.amazonaws.com/dayzepoch/DayZ_Epoch_Server_1.0.4.2_Release.7z

 

lol

Link to comment
Share on other sites

  • 0

Hey sandbird same problem here.. spam spam spam in the client log ... dont like it either ...

Any idea what it can cause?

} else {
dayz_addsirens removeAction s_player_sir>
  Error position: <dayz_addsirens removeAction s_player_sir>
  Error Undefined variable in expression: dayz_addsirens
File mpmissions\__CUR_MP.chernarus\dayz_code\compile\fn_selfActions.sqf, line 150
Error in expression <sirens,2,false,true,"",""];
};
} else {
dayz_addsirens removeAction s_player_sir>
  Error position: <dayz_addsirens removeAction s_player_sir>
  Error Undefined variable in expression: dayz_addsirens
File mpmissions\__CUR_MP.chernarus\dayz_code\compile\fn_selfActions.sqf, line 150
Error in expression <sirens,2,false,true,"",""];
};
} else {
dayz_addsirens removeAction s_player_sir>
  Error position: <dayz_addsirens removeAction s_player_sir>
  Error Undefined variable in expression: dayz_addsirens
File mpmissions\__CUR_MP.chernarus\dayz_code\compile\fn_selfActions.sqf, line 150
Error in expression <sirens,2,false,true,"",""];
};
} else {
dayz_addsirens removeAction s_player_sir>
  Error position: <dayz_addsirens removeAction s_player_sir>
  Error Undefined variable in expression: dayz_addsirens
File mpmissions\__CUR_MP.chernarus\dayz_code\compile\fn_selfActions.sqf, line 150

in this 

//Sirens
_isCopcar = typeOf _vehicle in ["LadaLM","HMMWV_Ambulance","HMMWV_Ambulance_CZ_DES_EP1","S1203_ambulance_EP1","GAZ_Vodnik_MedEvac","policecar"];

if (_inVehicle && _isCopcar && (driver _vehicle == player)) then {
        dayz_addsirens = _vehicle;
    if (s_player_sirens_on < 0) then {
        s_player_sirens_on = dayz_addsirens addAction ["Sirens on","addons\sirens\sirens_on.sqf",dayz_addsirens,2,false,true,"",""];
        s_player_sirens_off = dayz_addsirens addAction ["Sirens off","addons\sirens\sirens_off.sqf",dayz_addsirens,2,false,true,"",""];
        };
    } else {
        dayz_addsirens removeAction s_player_sirens_on;
        dayz_addsirens removeAction s_player_sirens_off;
        s_player_sirens_on = -1;
        s_player_sirens_off = -1;
    };
	
Link to comment
Share on other sites

  • 0

 

Hey sandbird same problem here.. spam spam spam in the client log ... dont like it either ...

Any idea what it can cause?

 

 

yeah pretty much you got the same problem...You see with this latest arma patch the fracked up pretty good...for example in your case....you see this ?

} else {
    dayz_addsirens removeAction s_player_sirens_on;
    dayz_addsirens removeAction s_player_sirens_off;
    s_player_sirens_on = -1;
    s_player_sirens_off = -1;
};

you first say remoteaction s_player_sirens_on  but the engine doesnt know wtf is that value...is it a number ? is it an array ? what it is ?

but you bellow you declare it.....s_player_sirens_on is a number and its -1.

So doing that first then it would not give you an error anymore.....so you have to rewrite you else like this:

} else {
    s_player_sirens_on = -1;
    s_player_sirens_off = -1;
    dayz_addsirens removeAction s_player_sirens_on;
    dayz_addsirens removeAction s_player_sirens_off;
};

And this has to happen for tons of other variables..... :/

Link to comment
Share on other sites

  • 0

Well to be honest this whole thing could fail if it goes inside the if...and not the else, true jahangir.

 

The proper way to do this Rythron is to overwrite the variables.sqf file (if you havent done it already in your init.sqf)

 

And in there set all these variables you find from removeAction to an initial value of -1. In your case :

dayz_addsirens = objNull;
s_player_sirens_on = -1;
s_player_sirens_off = -1;

I dont know if you are initializing dayz_addsirens....thats why i did that as well.

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
  • Discord

×
×
  • Create New...