ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Help:Values: Difference between revisions

From ModEnc
Jump to navigation Jump to search
Pd (talk | contribs)
→‎Numbers: - Mr. Idiot (me) confused signed and unsigned...
CnCVK (talk | contribs)
No edit summary
Line 81: Line 81:
This unique HSB format is used in the [<tt>[[Colors]]</tt>] section.
This unique HSB format is used in the [<tt>[[Colors]]</tt>] section.


==CLSID==
CLSID in registry format.
Example values:
{4A582741-9839-11d1-B709-00A024DDAFD1}
An example for a CLSID INI tag is the [[Locomotor]] tag.
==POINT3D==
Coordinates.
The 3 bytes represent '''X''', '''Y''' and '''Z'''.<br>
An example for a POINT3D INI tag is the [[ExitCoord]] tag.


{{BigHorizontalBar|Incomplete|This page is not complete yet. For example, there are still Locomotors and probably other value types. Unfortunately, I do not have time to continue right now...}}
{{BigHorizontalBar|Incomplete|This page is not complete yet. For example, there are still Locomotors and probably other value types. Unfortunately, I do not have time to continue right now...}}


[[Category:INI Flags]]
[[Category:INI Flags]]

Revision as of 11:57, 15 August 2006

A value type is the type of data you assign to an INI flag.
This can be one number, multiple numbers, floating point values (see below), "yes or no", and so on.

This page should give you an idea about how different data types are called and what values TD, RA, TS, RA2 and YR would accept as such.

Boolean values

Let's start with the most basic value type: the boolean type.

A boolean value is basicly a "yes" or "no" value, usually stored as 0 or 1 ("no" or "yes") in a byte.
An example INI flag would be Radar=yes/no.

Despite some people's thought, it does not matter whether you type yes, true or 1.
Actually, if the value is one of those three, it will be considered "yes".

Otherwise, it will be considered "no".
So you could as well go ahead and type e.g. "Capturable=no way!" and it would work just fine.

Bytes

In very rare cases, the game (assuming YR) does only accept bytes as a value.
An example is the CloakRadiusInCells tag.

Bytes are basicly small numbers, which often have values less than 20. Usually, these bytes are unsigned.

While
unsigned bytes can be any integer (mathematically) from 0 to 255,
signed bytes go from -128 to 127.

Numbers

Actually, it is wrong to call them just "numbers", though it sounds much easier than the correct term signed long.
Over the ModEnc, this value type is often refered to as "Integer", which is technically not correct either.

In fact, numbers are usually stored by the game (RA, TS, RA2 or YR) as signed long values.
Only one INI flag is actually stored as an integer value (WORD), that being the ExtraLight tag.

Signed long values can be any integer (mathematically) from -2147483648 to 2147483647.
This is quite a lot, but it works fine.
You could actually go ahead and put "Strength=2147483647" on a unit. This would make it practically invincible.

Floating point values

Or short: "floats".

Floats are basicly real numbers, 3.141592654 (Pi) for instance.
Technically, one would have to differ between floats and doubles (double-precision floating point values), though as INI flags, there is no noticeable difference.

An example for a float INI tag is the RechargeTime tag.

Something special about this value type is that - if your value is between 0 and 1/-1 - you can leave out the 0 before the dot.
So RechargeTime=0.01 would result in the same as RechargeTime=.01 .

Strings

Strings are simply put texts.

Usually, in INI files, string are used to make editing the tags easier.
Actually, "yes" on a boolean tag is a string, which is being interpreted as 1.

The same goes for e.g. Armors.
Armor=light will internally result in Armor=3.
However, you cannot go ahead and type Armor=3 in the INI file, because the game assumes you put a preset string there.
Preset strings (e.g. for armors: "None", "Flak" etc.) that represent numbers in order to make them understandable are called enumeration members (the enumeration itself would be a list of all the members along with their respective numeric values).

The FreeUnit tag gets a string as well (example: FreeUnit=CMIN).
In this case, the game would then search for a UnitType with the ID "CMIN".
Internally, not the string, but a pointer to CMIN's data will be stored.
This type of string should be called an ObjectType pointer. If a UnitType is asked for, you can call it "UnitType pointer" and so on.

Colors

Colors are nothing but a list of 3 bytes (see above), seperated by a comma (example: SovietLoad=0,235,255). There are two color formats (in TS, RA2 and YR):

RGB

The most common way to clearly represent a color is in the RGB format.
It consists of 3 bytes which represents the amount of the basic colors in this order: red, green, blue.
The RGB format is used, for instance, on the RadColor tag.

HSB

HSB appears more rarely than RGB.
The 3 bytes represent hue, saturation and brightness.
TS, RA2 and YR have a unique HSB format which does not work the same way as e.g. the HSB format in MS Paint does.
There is no clear algorithm yet that can convert Westwood's HSB format to RGB or vice versa (BobingAbout created a pretty exact one, a conversion tool was available and will be available again soon).
This unique HSB format is used in the [Colors] section.

CLSID

CLSID in registry format. Example values: {4A582741-9839-11d1-B709-00A024DDAFD1} An example for a CLSID INI tag is the Locomotor tag.

POINT3D

Coordinates. The 3 bytes represent X, Y and Z.
An example for a POINT3D INI tag is the ExitCoord tag.

Incomplete
This page is not complete yet. For example, there are still Locomotors and probably other value types. Unfortunately, I do not have time to continue right now...