Item Definition: Difference between revisions

corrections to overview
No edit summary
(corrections to overview)
Line 1: Line 1:
: ''Main page at [http://www.gtamodding.com/index.php?title=Item_Definition GTAModding.com]''
{{IdeSection
{{IdeSection
| noheader = 1
| noheader = 1
Line 7: Line 6:


== Overview ==
== Overview ==
The ''item definition'' files are split up into several sections. There is no order on how you arrange the sections. Also you do not need to use all the sections in a file.
The ''item definition'' files are split up into several sections. There is no order on how you arrange the sections and sections do not need to appear in the file.


=== Format and syntax description ===
=== Format and syntax description ===
The basic structure of the different sections is pretty simple. Each section starts with a four-character section identifier indicating how the content of the section gets interpreted by the game. The identifier is followed by the definition entries. Each entry takes one line and every line follows certain rules which are described in the articles handling the sections in detail (see below). However, lines can also be empty or commented. If so, they get ignored by the games' parser. The end of every section are indicated by the terminating string "end". Both (section identifier and terminating string) are not case sensitive, but by default they are written in lower case.


Comments are usually indicated by the character <code>#</code> (number sign). It is possible to add comments to the end of a line, but breaking the line format for the current section using comments may cause the game to crash during loading. It is recommended that a comment be placed on a separate line. Comments can also be placed outside of sections.
Line comments are indicated by the character <code>#</code> (number sign) and empty lines are allowed. They can be placed anywhere in the file. The game reads up to a maximum of 256 characters for each line and ignores the rest if the line is longer. Each section starts with a section identifier (usually four characters long, e.g. <code>objs</code>, <code>tobj</code>, etc.) indicating how the content of the section gets interpreted by the game. The identifier is followed by the definition entries. Each entry takes one line and every line follows a specific format which are described in the articles handling the sections in detail (see below). The end of any section is indicated by the terminating string <code>end</code>. Both the section identifier and terminating string are case sensitive. Lines within sections are always formatted in the same way differing only in the number of parameters describing the semantical content of the line. Data are usually separated by the character <code>,</code> (comma) but can be separated by <code> </code>&nbsp;(space). Tabs and spaces anywhere in the beginning of the line, between data, or after the data are omitted by the game and can be used to improve readability for human eyes. The games' parser uses an invariant culture to parse numerical values and strings, which means strings are [[Wikipedia:ASCII|ASCII]] encrypted and the decimal separator is <code>.</code> (period).


Lines itself are always formatted in the same way differing only in the number of their parameters describing the semantical content of the line. Parameters are usually separated by the character <code>,</code> (comma). [[wp:Whitespace character|Whitespace characters]] at the beginning or the end of an parameter get trimmed, but they are usually used to give the content a more clear structure to make it more easier to read for humans. Strings can be encased by the character <code>"</code> (quotation mark), but this is optional and rarely used by default. Also the games' parser uses an invariant culture to parse numerical values and strings. Which means strings are [[Wikipedia:ASCII|ASCII]] encrypted and the decimal separator is <code>.</code> (period).
==== Example ====
 
{{Pre|
==== Section example ====
# line comment
objs
objs
...
# default style in objs section
end
200, ind_land101, pjs, 1, 127, 0
# valid style
    200 ind_land101 pjs 1 127 0
end
}}


=== Sections ===
== Format ==
The following table contains basic information about all known sections. For additional information read the articles itself.
The following table contains basic information about all known sections. For additional information read the articles itself.


12,236

edits