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
m Value types moved to Help:Values: This one's way more detailed and just needs to push to the "help" direction
After the move earlier, now the re-write/unification --> POINT3D needs information about the measurement scale used.
Line 1: Line 1:
A value type is the type of data you assign to an INI flag.<br>
{{BigHorizontalBar|Incomplete|This page is not complete yet. For example, there are still Locomotors and probably other value types. If you are familiar with this topic, please help us by expanding this page.}}
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.
When referring to possible values in flag-headers, ModEnc contributors often use programming or mathematic terms to describe the values you can add.


==Boolean values==
If you are not familiar with these terms, this page should give you an idea about what these different data types stand for and what values [[TD]], [[RA]], [[TS]], [[RA2]] and [[YR]] would accept as such.
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.<br>
==[http://en.wikipedia.org/wiki/Signedness Signed/Unsigned]==
An example INI flag would be [[Radar]]=yes/no.
{{tocright}}
For flags expecting numbers, this prefix tells you whether you can use negative values or not - "sign" refers to the minus and imaginary plus in front of numbers. If a value is marked "unsigned", it doesn't accept signs, and therefore you cannot use negative values (as you'd have to apply a sign, minus, to make it negative).
 
Signed == Positive and negative values<br>
Unsigned == Positive values only
 
==[http://en.wikipedia.org/wiki/Integer Integers]==
Theoretically, all natural numbers, their negatives, and zero. According to pd, the actual programming data type used by the games is often [http://en.wikipedia.org/wiki/Long_integer signed long integer], with a notable exception being [[ExtraLight]], which only uses [http://en.wikipedia.org/wiki/Integer_%28computer_science%29 integer]; the difference is the maximum size of the number they can hold:


Despite some people's thought, it does not matter whether you type '''yes''', '''true''' or '''1'''.<br>
'''Signed long''' values can be any integer (mathematically) from '''-2147483648''' to '''2147483647'''.<br>
Actually, if the value is one of those three, it will be considered '''"yes"'''.
'''Integer''' values, the programming data type, can "only" be mathematical integers from '''−32768''' to '''32767'''.


Otherwise, it will be considered '''"no"'''.<br>
==[http://en.wikipedia.org/wiki/Floating_point Floating Point Values]==
So you could as well go ahead and type e.g. "[[Capturable]]=no way!" and it would work just fine.
Or "floats", for short, are basically '''[http://en.wikipedia.org/wiki/Real_number real numbers]''', 3.141592654 (Pi) for instance.<br>
Technically, one would have to differ between floats and doubles (double-precision floating point values), though as INI flags, there is no noticeable difference.
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.<br>
So RechargeTime=0.01 would result in the same as RechargeTime=.01.


==Bytes==
An example for a float INI tag is the [[RechargeTime]] tag.
 
==[http://en.wikipedia.org/wiki/Byte Bytes]==
In very rare cases, the game (assuming [[YR]]) does only accept bytes as a value.<br>
In very rare cases, the game (assuming [[YR]]) does only accept bytes as a value.<br>
An example is the [[CloakRadiusInCells]] tag.
Bytes are comparatively small numbers, which often have values less than 20.<br>
 
Bytes are basicly small numbers, which often have values less than 20.
Usually, these bytes are unsigned.
Usually, these bytes are unsigned.


Line 27: Line 35:
'''signed''' bytes go from '''-128 to 127'''.
'''signed''' bytes go from '''-128 to 127'''.


==Numbers==
An example using this type is the [[CloakRadiusInCells]] tag.
Actually, it is wrong to call them just "numbers", though it sounds much easier than the correct term '''signed long'''.<br>
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.<br>
==[http://en.wikipedia.org/wiki/Truth_value Boolean values]==
Only one INI flag is actually stored as an integer value (WORD), that being the [[ExtraLight]] tag.
A boolean value is a "yes" or "no" value, usually stored as 0 or 1 ("no" or "yes") in a byte.


'''Signed long''' values can be any integer (mathematically) from '''-2147483648''' to '''2147483647'''.<br>
In the [[INIs]], no matter what some people think, it does not matter whether you type '''yes''', '''true''' or '''1''' - if the value is one of those three, it will be considered '''"yes"''', otherwise, it will be considered '''"no"'''.<br>
This is quite a lot, but it works fine.<br>
So you could just as well go ahead and type e.g. "[[Capturable]]=no way!" and it would work just fine.
You could actually go ahead and put "[[Strength]]=2147483647" on a unit. This would make it practically invincible.


==Floating point values==
An example INI flag would be [[Radar]]=yes/no.
Or short: "floats".
 
Floats are basicly '''real numbers''', 3.141592654 (Pi) for instance.<br>
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.<br>
==[http://en.wikipedia.org/wiki/String_%28computer_science%29 Strings]==
So RechargeTime=0.01 would result in the same as RechargeTime=.01 .
Strings are simply put '''texts'''. On ModEnc, this data type is often followed by a restriction, like "String (names of animations)". Adhere to these restrictions, or get ready for the consequences.


==Strings==
==[http://en.wikipedia.org/wiki/LSD#Sensory.2Fperception Colors]==
Strings are simply put '''texts'''.
 
Usually, in INI files, string are used to make editing the tags easier.<br>
Actually, "yes" on a boolean tag is a string, which is being interpreted as 1.
 
The same goes for e.g. [[Armor]]s.<br>
Armor=light will internally result in Armor=3.<br>
However, you cannot go ahead and type Armor=3 in the INI file, because the game assumes you put a preset string there.<br>
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).<br>
In this case, the game would then search for a [[UnitType]] with the ID "CMIN".<br>
Internally, not the string, but a pointer to CMIN's data will be stored.<br>
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).
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]]):
There are two color formats (in [[TS]], [[RA2]] and [[YR]]):


===RGB===
===[http://en.wikipedia.org/wiki/RGB RGB]===
The most common way to clearly represent a color is in the RGB format.<br>
The most common way to clearly represent a color is in the RGB format.<br>
It consists of 3 bytes which represents the amount of the basic colors in this order: '''red''', '''green''', '''blue'''.<br>
It consists of 3 bytes which represents the amount of the basic colors in this order: '''red''', '''green''', '''blue'''.<br>
The RGB format is used, for instance, on the [[RadColor]] tag.
The RGB format is used, for instance, on the [[RadColor]] tag.


===HSB===
===[http://en.wikipedia.org/wiki/HSV_color_space HSB]===
HSB appears more rarely than RGB.<br>
HSB appears more rarely than RGB.<br>
The 3 bytes represent '''hue''', '''saturation''' and '''brightness'''.<br>
The 3 bytes represent '''hue''', '''saturation''' and '''brightness'''.<br>
Line 81: Line 64:
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==
==[http://en.wikipedia.org/wiki/CLSID CLSIDs/Locomotors]==
CLSID in registry format.<br>
Commonly seen as [[Locomotor]]s, CLSIDs are also used for [[AI Generals]], for example. They are in registry format.
Example value:{4A582741-9839-11d1-B709-00A024DDAFD1}<br>
 
An example for a CLSID INI tag is the [[Locomotor]] tag.
An example would be the ship locomotor, {2BEA74E1-7CCA-11d3-BE14-00104B62A16C}.


==POINT3D==
==POINT3D==
Line 90: Line 73:
The 3 bytes represent '''X''', '''Y''' and '''Z'''.<br>
The 3 bytes represent '''X''', '''Y''' and '''Z'''.<br>
An example for a POINT3D INI tag is the [[ExitCoord]] tag.
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...}}


[[Category:INI Flags]]
[[Category:INI Flags]]
[[Category:General Editing Information]]

Revision as of 19:05, 15 August 2006

Incomplete
This page is not complete yet. For example, there are still Locomotors and probably other value types. If you are familiar with this topic, please help us by expanding this page.


When referring to possible values in flag-headers, ModEnc contributors often use programming or mathematic terms to describe the values you can add.

If you are not familiar with these terms, this page should give you an idea about what these different data types stand for and what values TD, RA, TS, RA2 and YR would accept as such.

Signed/Unsigned

For flags expecting numbers, this prefix tells you whether you can use negative values or not - "sign" refers to the minus and imaginary plus in front of numbers. If a value is marked "unsigned", it doesn't accept signs, and therefore you cannot use negative values (as you'd have to apply a sign, minus, to make it negative).

Signed == Positive and negative values
Unsigned == Positive values only

Integers

Theoretically, all natural numbers, their negatives, and zero. According to pd, the actual programming data type used by the games is often signed long integer, with a notable exception being ExtraLight, which only uses integer; the difference is the maximum size of the number they can hold:

Signed long values can be any integer (mathematically) from -2147483648 to 2147483647.
Integer values, the programming data type, can "only" be mathematical integers from −32768 to 32767.

Floating Point Values

Or "floats", for short, are basically 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. 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.

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

Bytes

In very rare cases, the game (assuming YR) does only accept bytes as a value.
Bytes are comparatively 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.

An example using this type is the CloakRadiusInCells tag.

Boolean values

A boolean value is a "yes" or "no" value, usually stored as 0 or 1 ("no" or "yes") in a byte.

In the INIs, no matter what some people think, it does not matter whether you type yes, true or 1 - if the value is one of those three, it will be considered "yes", otherwise, it will be considered "no".
So you could just as well go ahead and type e.g. "Capturable=no way!" and it would work just fine.

An example INI flag would be Radar=yes/no.

Strings

Strings are simply put texts. On ModEnc, this data type is often followed by a restriction, like "String (names of animations)". Adhere to these restrictions, or get ready for the consequences.

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.

CLSIDs/Locomotors

Commonly seen as Locomotors, CLSIDs are also used for AI Generals, for example. They are in registry format.

An example would be the ship locomotor, {2BEA74E1-7CCA-11d3-BE14-00104B62A16C}.

POINT3D

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