Jump to content
Sign in to follow this  
][niipaa

[BETA 0.74 Stable] New Error Undefined Variables Messages

Recommended Posts

I retract my previous statement, something is seriously wrong with this new system. Yes my camera woes were my fault, but these other things (IE The entirety of Survival V.53/.54), no no, can't call myself on that one. Because I haven't touched any of those scripts since 0.72, try booting up now, and barely anything works. So I urge those to caution scripting right now if your luck is bad like mine, otherwise carry on.

So, I hate to be the possible bearer of bad bugs, but I think something went a little haywire when creating the prereqs of just what is an Undefined Variable. I'll keep this short, though for the record I do understand the difference between good/bad scripting, and that the community wholly benefits from those willing to take the time to clean up and optimize scripts. However, it would seem that in this attempt, now everything would appear to be an Undefined Variable (If not assigned something beforehand, logically). Let's take this simple Intro script I've been working on after the patch. It uses a BETA 0.72 Stable release Intro as it's base, though I read nothing about a changing of other syntaxes. Anyways here we go:

_camera = camera camCreate [98252.45,-21060.45,18.77];

One would assume this simple line would essentially create a Camera at this position. This is the exact line I used before, with zero issues back in 0.72. Now, with this latest Stable Release, camera itself returns as an undefined variable, thusly _camera isn't correct for the rest of the script, and the camera never gets created. Now, to my knowledge, technically camera is an object, thereby it can be swapped out with createVehicle. Though that didn't work either returning the same error. Trying to wrap the classname in quotes, forces all other code utilizing _camera to throw Error Type String, Expected Object, Array errors, and again, not running the script correctly.

It should also be noted I feel, that in other scripts where I needed to reference objNull, a once empty object classname, now returns this very same error. If there is some new way to scripting that we are moving towards, I am all for it, but I need to know what is required for making that move.

Perhaps I'm doing something wrong, I am not beyond mistakes. But for .SQF code that worked just hours ago to suddenly stop working with zero changes, I guess I feel like it could go here for troubleshooting. Because it's not the only script now spitting these errors at me when it shouldn't, and I'm unsure of how to go about fixing it.

Edited by ][Niipaa

Share this post


Link to post
Share on other sites

Shouldn't it be

_camera = "camera" camCreate [];

Share this post


Link to post
Share on other sites

See, I've tried that zapat, but then all the following _camera commands, like say:

_camera camCommitPrepared 10;

_camera camPreparePos [1904.61,5714.20,14.68];

_camera camPrepareFOV 0.700;

Return an "Error Type String, Expected Object, Array"

Not to mention I've been using that same line for a long time and never had any of these woes until just this morning. Also, wasn't trying to sound like an ass with that initial sentence, I'm not really frustrated as all, just boggled. And I should've made my first post clearer on other things I'd tried.

And again, all this code had worked flawless and error free just before the patch.

Share this post


Link to post
Share on other sites

I am not getting errors with my line. Undefined pops up with yours though, as you write camera (a variable), instead of "camera" (a string argument) when creating it.

Share this post


Link to post
Share on other sites

So to sum this all up than keep that wall of text I had going before: I made a simple mistake due to being over-tired. I admit my defeat there. I guess the system I used before is the system BI is trying to weed out of scripting, fair enough. I'll keep my words at this, rather than say something I might regret. Thanks for the help Zapat, you helped my tired eyes see the error. Though I'd of preferred the old system to have stayed. In retrospect though, this really just means I need to spam a lot of quotes into otherwise solid scripts for certain things (My vehicle spawning script uses Objnull a lot). That isn't anything strenuous. Perhaps I was too presumptuous and quick to the point the finger, when sometimes one needs to look in the mirror first. Apologize for wasting the bandwidth on this silly problem. And your time Zapat.

Edited by ][Niipaa

Share this post


Link to post
Share on other sites

I hear you, I have the same myterious problems and there is no real documentation about what an undeclared variable really means.

I just HOPED it was only a "" left out (as it requires a string as arg). But I fail myserably with some of my lines as well. (Some from the thousands and I don't understand why either)

Share this post


Link to post
Share on other sites

I guess that's the mystery that is the SQS/SQF language friend. Appreciate your time out to help again, and your patience, sometimes I get rascally when I'm tired. And I'd rather take a few missing quotes and the humbling hit to the ego than some of the nightmares I can only imagine either of us have gone through. Script Command inconsistency, locality, been there done that. And then there's those little things, the things that never get explained, and work one day and not the next (Not referring to this problem, as it was an actual mistake). But I've seen many a script shot down in flames to the unforgiving, unexplained errors. I regress though, thanks again, and have a wonderful almost-weekend sir.

Share this post


Link to post
Share on other sites
[Niipaa;2449131']I need to spam a lot of quotes into otherwise solid scripts for certain things (My vehicle spawning script uses Objnull a lot).

Now it is time for me to be confused. :)

What was the real problem, and what is the solution, what are you hinting about in that line of yours? I myself use objNull alot: what does this mean for the undefined vars problem?

So do you happen to find out what is an undefined var, and what is not? :)

Share this post


Link to post
Share on other sites

Well, my problem with the camera was I forgot the age old "Internal", "Back" camera effect array.

As for objNull, I was actually using objNul, because ArmA likes to swap between "nul" or "null" quite often, and my variables that I thought were getting assigned to ObjNull, were instead getting assigned to an unassigned variable of objNul. And it just never gave me an error before this new system because they've revamped its catch methods.

Though strange bugs still occur in like my Magazine Script. Where now if a player had a non-GL rifle, they'd get an undefined variable error _GLMuzzle, which used to just turn out as an empty string before the new system. I've since rewrote it and got it working error free. It'll be a busy few weeks I feel finding all the quirks I never knew were quirks. So they were right to an extent, it is forcing out better scripts and an understanding thereof, instead of having certain things be working in a smoke and mirrors sense of the word. Your scripts and use of objNull should be just fine. I just went in and corrected my longstanding error of that too, and I can't even blame that one tiredness. Just inconsistent use of nul and null, and confusing it in my head.

Oddly enough, I can see this system being super helpful, and as for knowing what is an undefined var, the system just got smarter I suppose. So all those times I thought I was doing it right, I was just limping by on broken stilts.

Just an update, looks like my head wasn't totally up my ass. This new script system has broken just about every aspect and script in Survival V0.53 and V0.54 (A popular mission by Dominic (Genesis92x) and myself). We were going to release .54 today with a complete overhaul, but being that, well, I wasn't entirely wrong, and my wishful thinking of me just being dumbass was too good to be true, we can't. Think that's where I'll call it a day.

Edited by ][Niipaa

Share this post


Link to post
Share on other sites

I've been having whacky issues as well, even to the point where I've seen _x be called out as an undefined variable. Even stranger I sent my entire mission folder to a friend and he ran everything and didn't see a single error message pop up. We both have straight vanilla A3 installs with the latest patch, so I'm baffled.

Share this post


Link to post
Share on other sites
I've been having whacky issues as well, even to the point where I've seen _x be called out as an undefined variable. Even stranger I sent my entire mission folder to a friend and he ran everything and didn't see a single error message pop up. We both have straight vanilla A3 installs with the latest patch, so I'm baffled.

Hey MeatballCB - can you post up your code (and rpt if possible) that caused _x to be an undefined variable? Would be very interested to see how that is the case.

Share this post


Link to post
Share on other sites

I agree with Das, I'd love to see the amount of magic that could sum that up.

Share this post


Link to post
Share on other sites

So here's the basics of what I'm seeing. I'm using spunFIN's Ambient Combat script (which has worked without a problem prior to the patch), and when that fires, I see this error message pop up.

_xError.jpg

The actual block of text is a portion of Ambient combat supporting script (LV_fnc_ACcleanUp.sqf) that is checking for dead groups and removing them. Here's the full script.

//ARMA3Alpha function LV_fnc_ACcleanUp v0.85 - by SPUn / lostvar
//removes dead groups and groups in defined distance
private ["_i","_wGroup","_leader","_uns","_sUnit","_maxDis","_nsUnit","_tempUnits","_x"];
_sUnit = _this select 0;
_maxDis = _this select 1;

while{true}do{
_i = 0;
while{_i < (count LV_ACS_activeGroups)}do{
	_wGroup = LV_ACS_activeGroups select _i;
	_leader = leader _wGroup;
	_uns = { alive _x } count units _wGroup;

if((typeName _sUnit) == "ARRAY")then{
 _tempUnits = [];
 {
   if(alive _x)then{
     _tempUnits set[(count _tempUnits), _x];
   };
 }forEach _sUnit;
 if((count _tempUnits)>1)then{
   _nearestUnit = _tempUnits select 0;
   {
     if((_x distance _leader)<(_nearestUnit distance _leader))then{
       _nearestUnit = _x;
     };
   }forEach _tempUnits;
   _nsUnit = _nearestUnit;
 }else{
   _nsUnit = _tempUnits select 0;
 };	
};		
//		hint format["cleanUp, total groups: %1",(count LV_ACS_activeGroups)];

	if(_uns < 1)then{
		LV_ACS_activeGroups = LV_ACS_activeGroups - [_wGroup];
		if((side _wGroup) == west)then{
			LV_AI_westGroups = LV_AI_westGroups - [_wGroup];
		}else{
			LV_AI_eastGroups = LV_AI_eastGroups - [_wGroup];
		};
	}else{
		if(_leader distance _nsUnit > _maxDis)then{
			LV_ACS_activeGroups = LV_ACS_activeGroups - [_wGroup];
			if((side _wGroup) == west)then{
				LV_AI_westGroups = LV_AI_westGroups - [_wGroup];
			}else{
				LV_AI_eastGroups = LV_AI_eastGroups - [_wGroup];
			};
			{ deleteVehicle _x }forEach units _wGroup;
		};
	};
	sleep 1;
	_i = _i + 1;
};
sleep 30;
};

Here's the latest .rpt file as well.

I'm also seeing some crazy generic undefined variables in other portions of the script that actually look like it's referencing internal A3 functions.

ret_error.jpg

What's strange is that the script actually seems to be working correctly, it's just spitting out errors every 20 seconds once it starts running. Not sure we're going to find a work around to this and I think BI is going to have either fix it, or tweak the error messages so script writers can figure out what they have wrong.

Share this post


Link to post
Share on other sites

Yeah, something is just not right. I went through every single script/function script I'm using with a fine toothed comb looking for any local variables and made sure they were in the definition statement, including _x, _this and _ret and it's still spitting out errors. I don't have any idea where to even continue looking.

Share this post


Link to post
Share on other sites

I downloaded the Ambient Combat script and gave it a whirl in the editor.

Lots of errors like:

Error in expression <fihPtype,_fihSrate,_GLradius,_fihSkills,_fihGroup,_fihInit,_fihID];
nul = [_newS>
 Error position: <_fihGroup,_fihInit,_fihID];
nul = [_newS>
 Error Undefined variable in expression: _fihgroup

I think lot of the problems with undefined variables in these scripts are due to the use of the nil command in the scripts. For example in the scripts: _milGroup = if (count _this > 9) then { _this select 9; } else {nil;};

From the wiki: Nil value. This value can be used to undefine existing variables.

This was fine in previous builds, but with the new behaviour of Arma to throw an error when a variable is undefined means that the whole way the scripts work generates lots of undefined variable errors as the author builds the core functionality on testing to see if a variable exists or is undefined. Don't get me wrong, whoever wrote it is very clever, but unfortunately, his method for the scripts has become verboten.

Unless you are feeling very brave and want to update them all yourself, your best bet is to contact the author and ask him politely if he will consider a rewrite. Sorry I can't be more help, I didn't realise it was an issue with somebody else's work. If you get stuck on anything you've written, I'd be glad to help out as best I can.

Share this post


Link to post
Share on other sites

Thanks much for looking, and I'll let the author know what you think it might be. Is this something I could do a simple find/replace on nil to fix myself?

Edited by MeatballCB

Share this post


Link to post
Share on other sites

Thank you for finding this problem and the reason for it! o/

This seems very fustrating issue, since I got all errors in MeatballCB's mission isolated, and I dont have any errors in my own missions.

So thats great, but since Das got those errors, I'm a bit troubled.. :P

Is my best shot now that BIS changed the nil handling method back like it was before on to 0.75dev and hopefully keeps it that way for next stable update?

Edit. Should be no errors anymore, and nil seems to work like it used to. Those new errors seems to be coming from faulty scripts or wrong usage of them, so hold your horses and double check everything o/

Edited by spunFIN
edit

Share this post


Link to post
Share on other sites

The first time I tried the 'Supports' showcase on the latest beta 0.74.108135 (Stable), I got this error message

http://s16.postimg.org/8geh6sxcl/arma3_2013_07_26_18_44_31_52.jpg

Zoom the script error window

arma3_2013_07_26_18_44_31_52_zoom.jpg

It says:

Error undefined variable in expression: bis_supp_refreshmainwindow

File A3\modules_f\supports\init_provider.sqf, line 12

According to SPOTREP #00008 changelog

spotrepenginelog.jpg

'Supports' showcase is in SP mode, included by default in Arma 3. Go Arma 3 devs, you can fix it. ;)

Share this post


Link to post
Share on other sites

Hi guys, sorry to dig up maybe an old thread but this one was kinda relevant to my problem. Im getting this undefined var problem too but only about 50 percent of time i play the mission. here is the script that causes it:

---------------------------

private ["_soldiers", "_number", "_i", "_xx", "_yy", "_zz", "_man"];

_soldiers = +(list vsichniCiv);

_number = (count _soldiers) - 0.01;

_i = 0;

while {_i < _number} do

{

_xx = 20 - (random 40);

_yy = 20 - (random 40);

_zz = random 20;

_man = _soldiers select _i;

_man setVelocity [_xx,_yy,_zz];

_man setDir (random 360);

_i = _i + 1;

};

sleep 0.1;

{_x setDamage 1} forEach _soldiers;

--------------------------

I am using this script to create the feeling that there was a battle before with random bodies lying all around, it takes all the guys under the trigger "vsichniCiv" and one by one sets them random velocity, then kills them. It looks very good with the bodies totally random every time you arive on the scene, but half of the time it just produces the "undefined variable error" and the people are still running around happily. The problem is that I cant tell why, because it is not reproducible, even if i dont touch the mission and run it 10 times, about 5times it will work and about 5 times it wont :(

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  

×