HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Setting Non-Integer Variables to Null AND Determing Array Total Active Fields

12-18-2003, 01:55 AM#1
GabeStah
Hello,

This is a pretty straightforward pair of questions, but very vital it seems (otherwise I'm going to have a heck of a time figuring these values out.)

I'm wondering if it's possible to set variables without integer values (such as Points or Multiboards) to null (I.E. Delete thier value entirely)?

Also, is there a function or method to use the ENTIRE set of variables in any given array without having to specify each array number via a loop or otherwise?

I.E. If I want to compare Integer values of an array...

Code:
If (var_intTotalCountArray[x]) is equal to (var_intCount)
    Then ...

...Where x doesn't HAVE to be a specific integer, but rather empty somehow, or set to something that checks ALL values of var_intTotalCountArray against var_intCount in one statement.

Any advice or help would be appreciated. Or even some knowledge of whether either of these things are impossible or not would be good too, so at least I know if I should be trying something else.

Thanks,

-GabeStah-
12-18-2003, 01:58 AM#2
35263526
Any variable can be set to Null.

I don't think that you can access all of the data in an array without using loops.
12-18-2003, 02:04 AM#3
GabeStah
Thanks for the quick reply 35263526, but I guess I didn't explain it very well. I don't know how to actually set those variables to null in WE. When trying to set a variable such as a Point, you can only set it to specific functions (Such as 'Unit - Position of Unit,' 'Point With Offset,' 'Point With Polar Offset,' etc.) There is no option for null, or inputing a specific value (such as zero, and even then, for Points and other numerical variables, setting to zero might not always null the field anyway.)

Can you specify how I can set the value to null in the editor? My fear is you'll say only JASS... =/

As for the array stuff, thanks for the information; sucks but at least I know.

-GabeStah-
12-18-2003, 02:23 AM#4
Shvegait
The first option on any of those variable settings is usually something like "No point", "No unit", "No destructible", etc. This is the equivalent of "null".
12-18-2003, 03:06 AM#5
GabeStah
Hehe, yeah some of them exist (like for units) but stuff like "Points" don't have an option for "no point" or null or "nothing." =/
12-18-2003, 11:37 AM#6
weaaddar
I'll explain the hierachry of war3 types breifly.
Theres boolean, handle, real, int, string. These are the 5 native types of war3.

Setting a real & an int to null will set them to 0. Setting a boolean to null will set its state to null, but null acts just like false.(wierd three stated boolean!)
Strings when set to null assign nothing to them. Slightly better then "" which probably costs a byte or so of memory.

Handles, are war3 pointer equivalants, when set to null derefence what they were pointing to.

Handles are the super class of widgets, (which is the super class of units (the superclass of heroes), doodads (the superclass of destructables), and items.) leader/multiboard, dialogs timers. Basically everything is a handle.

There is no easy way to invoke the garbage collector. However, it is run each time a trigger ceases to run. The problem with the garbage collector is that local variables sometime sit in memory because you never set them to null. This is a problem with jass and can be remedied by using the Custom Script command and going set udg_(variable name)=null
This merely derefrences it. It might turn out to be just what you need.
12-19-2003, 03:12 AM#7
GabeStah
Thanks for the reply Weaaddar. That null script helps a ton and makes me feel better about having longer arrays without them getting too out of control ><

Thanks again,

-GabeStah-