Difference between revisions of "Action0"

From GRFSpecs
Jump to navigationJump to search
(the "master feature list" now has its own page. also update the links to subpages)
(unify spelling of features to other actions' tables)
Line 59: Line 59:
 
!colspan="2"|[[Features|Feature]]
 
!colspan="2"|[[Features|Feature]]
 
|-
 
|-
|00 || [[Action0/Vehicles/Trains|trains]]
+
|00 || [[Action0/Vehicles/Trains|Trains]]
|rowspan="4"|[[Action0/Vehicles|common vehicle properties]]
+
|rowspan="4"|[[Action0/Vehicles|Common vehicle properties]]
 
|-
 
|-
|01 || [[Action0/Vehicles/RoadVehicles|road vehicles]]
+
|01 || [[Action0/Vehicles/RoadVehicles|Road Vehicles]]
 
|-
 
|-
|02 || [[Action0/Vehicles/Ships|ships]]
+
|02 || [[Action0/Vehicles/Ships|Ships]]
 
|-
 
|-
|03 || [[Action0/Vehicles/Planes|planes]]
+
|03 || [[Action0/Vehicles/Planes|Aircraft]]
 
|-
 
|-
 
|04
 
|04
|colspan="2"| [[Action0/Stations|stations]]
+
|colspan="2"| [[Action0/Stations|Stations]]
 
|-
 
|-
 
|05
 
|05
|colspan="2"| [[Action0/Canals|canals]]
+
|colspan="2"| [[Action0/Canals|Canals]]
 
|-
 
|-
 
|06
 
|06
|colspan="2"| [[Action0/Bridges|bridges]]
+
|colspan="2"| [[Action0/Bridges|Bridges]]
 
|-
 
|-
 
|07
 
|07
|colspan="2"| [[Action0/Houses|houses]] (see [[DefaultHouseProps|defaults]])
+
|colspan="2"| [[Action0/Houses|Houses]] (see [[DefaultHouseProps|defaults]])
 
|-
 
|-
 
|08
 
|08
|colspan="2"| [[Action0/Global Variables|global variables]]
+
|colspan="2"| [[Action0/Global Variables|Global Variables]]
 
|-
 
|-
 
|09
 
|09
|colspan="2"| [[Action0/Industry Tiles|industry tiles]] (see [[IndustryTileDefaultProps|defaults]])
+
|colspan="2"| [[Action0/Industry Tiles|Industry Tiles]] (see [[IndustryTileDefaultProps|defaults]])
 
|-
 
|-
 
|0A
 
|0A
|colspan="2"| [[Action0/Industries|industries]] (see [[IndustryDefaultProps|defaults]])
+
|colspan="2"| [[Action0/Industries|Industries]] (see [[IndustryDefaultProps|defaults]])
 
|-
 
|-
 
|0B
 
|0B
|colspan="2"| [[Action0/Cargos|cargos]] (see [[CargoDefaultProps|defaults]])
+
|colspan="2"| [[Action0/Cargos|Cargos]] (see [[CargoDefaultProps|defaults]])
 
|-
 
|-
 
|0C
 
|0C
|colspan="2"| [[Action0/Sound Effects|sound effects]]
+
|colspan="2"| [[Action0/Sound Effects|Sound Effects]]
 
|-
 
|-
 
|0D
 
|0D
|colspan="2"| [[Action0/Airports|airports]]
+
|colspan="2"| [[Action0/Airports|Airports]]
|-
 
|0E
 
|colspan="2"| signals (Action 0 is not valid for this feature)
 
 
|-
 
|-
 
|0F
 
|0F
|colspan="2"| [[Action0/Objects|newobjects]]
+
|colspan="2"| [[Action0/Objects|Objects]]
 
|-
 
|-
 
|10
 
|10
|colspan="2"| [[Action0/Railtypes|rail types]] (OpenTTD r18969)
+
|colspan="2"| [[Action0/Railtypes|Railtypes]] (OpenTTD r18969)
 
|-
 
|-
 
|11
 
|11
|colspan="2"| [[Action0/Airport Tiles|airport tiles]] (OpenTTD r19204)
+
|colspan="2"| [[Action0/Airport Tiles|Airport Tiles]] (OpenTTD r19204)
|-
 
|12
 
|colspan="2"| towns (Action 0 is not valid for this feature)
 
 
|}
 
|}
   

Revision as of 20:55, 21 June 2011

Introduction

Defining new graphics feature properties

Action 0 allows to change the feature properties of 'features', i.e. vehicles, stations, bridges, houses and more.

Syntax

The data for Action 0 looks as follows:

<Sprite-number> * <Length> 00 <Feature> <Num-props> <Num-info> <Id> (<Property <New-info>)...

Here is a short overview of what every term means:

Element Size Description
<Sprite-number> dec A sequential sprite number
<Length> dec The total number of bytes in the action
00 B Action type. In this case, 00
<Feature> B Which type of feature you would like to change
<Num-props> B How many properties you would like to change per vehicle or station
<Num-info> B How many vehicles/stations you would like to change
<Id> B* The ID of the first vehicle/station to change
<Property> B What property to change for each vehicle/station
<New-info> V The new value of the property

You can put an Action 0 anywhere after Action 8 in the GRF file.

The <Id> is an extended byte since TTDPatch 2.0.1 alpha 61, to support the definition of >255 sound effects. In OpenTTD since r13482, extended IDs (up to 65535) can be used for vehicles as well. However there is currently a caveat that articulated parts must be below 128.

Descriptions

Sprite-number

Action 0 can appear anywhere in the GRF file, so set it to the sprite number you are currently at.

Length

The total number of bytes in Action 0. Start counting from <Action>, the bit that sets the pseudo-sprite to act as the specified action.

Action

The type of action this pseudo-sprites defines. It should be 00 here because we want this pseudo-sprite to act as Action 0.

Feature

This sets the type of feature that you wish to change. Set it to:

Value Feature
00 Trains Common vehicle properties
01 Road Vehicles
02 Ships
03 Aircraft
04 Stations
05 Canals
06 Bridges
07 Houses (see defaults)
08 Global Variables
09 Industry Tiles (see defaults)
0A Industries (see defaults)
0B Cargos (see defaults)
0C Sound Effects
0D Airports
0F Objects
10 Railtypes (OpenTTD r18969)
11 Airport Tiles (OpenTTD r19204)

Num-props

This is the number of properties that you wish to change per vehicle or station. Note: even if you wish to set the same properties to the same value for different vehicles then you must still repeat the properties and their values for each vehicle.

Num-info

Simply the number of vehicles that you will change using this action 0.

Id

The Vehicle ID of the first vehicle or station to change. If num-info is greater than one, this vehicle/station and the following vehicles/stations will be changed.

Property

The number of the property that will be changed. This and the New-info section are repeated as many times as there are properties to set; in total, there are < num-props> property bytes.

See relevant sub-section (links at the bottom) for more details.

New-info

The new information that will replace the previous information for the specified property. This is a variable size; dependent upon the property. Each property byte is followed by <num-info> new-info sections. The appropriate \b, \w, and \d escape sequences can be quite useful for most < new-info>s. See the discussion of escape sequences for further information.

Features and properties

Each feature has its own very specific properties. These are explained in detail in their separate pages.

You will also find the minimum GRF version (in Action 8) that supports this property, or alternatively if the property was introduced between version changes, the patch version number that you can check with Action 7.

Example