Difference between revisions of "Action0"

From GRFSpecs
Jump to navigationJump to search
m (Add road stops to feature table)
 
(19 intermediate revisions by 9 users not shown)
Line 1: Line 1:
  +
==Introduction==
   
  +
Action 0 allows to change the feature properties of 'features', i.e. vehicles, stations, bridges, houses and more.
'''''Defining new graphics feature properties'''''
 
  +
Each feature has its own very specific properties. These are explained in detail in their separate pages.
   
  +
You will also find the minimum version requirements for properites on the pages.
=Action 0=
 
  +
Note, that due to the nature of Action 0 unknown properties cannot be ignored. Only a whole Action 0 can be skipped.
  +
OpenTTD and TTDPatch will disable GRFs once they encounter an unknown property. So, if you use some properties for optional features, which you want to disable for older versions of OpenTTD or TTDPatch, you have to skip the Action 0 using [[Action9|Action 9]].
   
Defining new graphics feature properties
 
   
  +
== Syntax ==
-=What does it do?=-
 
 
Action 0 is similar to [[TTDAlter]] in that it changes the feature properties of 'features', i.e. vehicles, stations, bridges, houses and more.  That means that you can change properties like:
 
*vehicle introduction date
 
*top speed
 
*wagon capacity
 
 
and many more.
 
 
-=Format=-
 
   
 
The data for Action 0 looks as follows:
 
The data for Action 0 looks as follows:
   
<pre>-+&lt;Sprite-number&gt; * &lt;Length&gt; 00 &lt;Feature&gt; &lt;Num-props&gt; &lt;Num-info&gt; &lt;Id&gt; (&lt;Property &lt;New-info&gt;)...+-</pre>
+
<Sprite-number> * <Length> 00 <Feature> <Num-props> <Num-info> <Id> (<Property <New-info>)...
   
 
Here is a short overview of what every term means:
 
Here is a short overview of what every term means:
   
  +
{| |-
||'''Element'''|[[GRFActionsDetailed|'''Size''']]|'''Description'''
 
  +
!Element!![[GRFActionsDetailed|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 [[Action8|Action 8]] in the GRF file.
   
  +
{{ottdp|0.6|2.5|ttdprev=2.0.1 alpha 61}} The <Id> is an extended byte since TTDPatch 2.0.1 alpha 61, to support the definition of >255 sound effects.
&lt;-+Sprite-number+-&gt; |dec|A sequential sprite number
 
   
  +
{{ottdp|0.7|ottdrev=r13482}} {{grf|7|<7}} 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.
&lt;-+Length+-&gt; |dec|The total number of bytes in the action
 
  +
{{ottdp|1.2}} {{grf|8}} In OpenTTD 1.2, extended IDs (up to 65535) can be used for vehicles as well. The ID for articulated vehicles must be below 16384.
   
  +
== Descriptions ==
-+00+- |B|Action type. &nbsp;In this case, 00
 
   
  +
=== Sprite-number ===
&lt;-+Feature+-&gt; |B|Which type of feature you would like to change
 
 
&lt;-+Num-props+-&gt; |B|How many properties you would like to change per vehicle or station
 
 
&lt;-+Num-info+-&gt; |B|How many vehicles/stations you would like to change
 
 
&lt;-+Id+-&gt; |B*|The ID of the first vehicle/station to change
 
 
&lt;-+Property+-&gt; |B|What property to change for each vehicle/station
 
 
&lt;-+New-info+-&gt; |V|The new value of the property||
 
 
You can put an Action 0 anywhere after [[Action8|Action 8]] in the GRF file.
 
 
The &lt;Id&gt; is an extended byte since 2.0.1 alpha 61, to support the definition of &gt;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.
 
 
-=Filling in the terms=-
 
 
===Sprite-number===
 
   
 
Action 0 can appear anywhere in the GRF file, so set it to the sprite number you are currently at.
 
Action 0 can appear anywhere in the GRF file, so set it to the sprite number you are currently at.
   
===Length===
+
=== Length ===
   
The total number of bytes in Action 0. &nbsp;Start counting from &lt;-+Action+-&gt;, the bit that sets the pseudo-sprite to act as the specified action.
+
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===
+
=== 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.
 
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===
+
=== Feature ===
   
This sets the type of feature that you wish to change. Set it to:
+
This sets the type of [[Features|feature]] that you wish to change. Set it to:
  +
{|
  +
!Value
  +
!colspan="2"|[[Features|Feature]]
  +
|-
  +
|00 || [[Action0/Vehicles/Trains|Trains]]
  +
|rowspan="4"|[[Action0/Vehicles|Common vehicle properties]]
  +
|-
  +
|01 || [[Action0/Vehicles/RoadVehicles|Road Vehicles]]
  +
|-
  +
|02 || [[Action0/Vehicles/Ships|Ships]]
  +
|-
  +
|03 || [[Action0/Vehicles/Planes|Aircraft]]
  +
|-
  +
|04
  +
|colspan="2"| [[Action0/Stations|Stations]]
  +
|-
  +
|05
  +
|colspan="2"| [[Action0/Canals|Canals]]
  +
|-
  +
|06
  +
|colspan="2"| [[Action0/Bridges|Bridges]]
  +
|-
  +
|07
  +
|colspan="2"| [[Action0/Houses|Houses]] (see [[DefaultHouseProps|defaults]])
  +
|-
  +
|08
  +
|colspan="2"| [[Action0/Global Settings|Global Settings]]
  +
|-
  +
|09
  +
|colspan="2"| [[Action0/Industry Tiles|Industry Tiles]] (see [[IndustryTileDefaultProps|defaults]])
  +
|-
  +
|0A
  +
|colspan="2"| [[Action0/Industries|Industries]] (see [[IndustryDefaultProps|defaults]])
  +
|-
  +
|0B
  +
|colspan="2"| [[Action0/Cargos|Cargos]] (see [[CargoDefaultProps|defaults]])
  +
|-
  +
|0C
  +
|colspan="2"| [[Action0/Sound Effects|Sound Effects]]
  +
|-
  +
|0D
  +
|colspan="2"| [[Action0/Airports|Airports]]
  +
|-
  +
|0F
  +
|colspan="2"| [[Action0/Objects|Objects]]
  +
|-
  +
|10
  +
|colspan="2"| {{ottdp|1.0|no|ottdrev=r18969}} [[Action0/Railtypes|Railtypes]]
  +
|-
  +
|11
  +
|colspan="2"| {{ottdp|1.1|no|ottdrev=r19204}} [[Action0/Airport Tiles|Airport Tiles]]
  +
|-
  +
|12
  +
|colspan="2"| {{ottdp|1.10|no|ottdrev=gc02ef3e456}} [[Action0/Roadtypes|Roadtypes]]
  +
|-
  +
|13
  +
|colspan="2"| {{ottdp|1.10|no|ottdrev=gc02ef3e456}} [[Action0/Tramtypes|Tramtypes]]
  +
|-
  +
|14
  +
|colspan="2"| {{ottdp|14|no|ottdrev=g4c1406a4b5}} [[Action0/Road Stops|Road Stops]]
  +
|}
   
  +
=== Num-props ===
00 for [[Action0Trains|trains]]
 
   
  +
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.
01 for [[Action0RoadVehicles|road vehicles]]
 
   
  +
=== Num-info ===
02 for [[Action0Ships|ships]]
 
 
03 for [[Action0Planes|planes]]
 
 
04 for [[Action0Stations|stations]]
 
 
05 for [[Action0Canals|canals]]
 
 
06 for [[Action0Bridges|bridges]]
 
 
07 for [[Action0Houses|houses]] (see [[DefaultHouseProps|defaults]])
 
 
08 for [[Action0GeneralVariables|global variables]]
 
 
09 for [[Action0IndustryTiles|industry tiles]] (see [[IndustryTileDefaultProps|defaults]])
 
 
0A for [[Action0Industries|industries]] (see [[IndustryDefaultProps|defaults]])
 
 
0B for [[Action0Cargos|cargos]] (see [[CargoDefaultProps|defaults]])
 
 
0C for [[Action0SoundEffects|sound effects]]
 
 
0D for airports (No official properties)
 
 
0E for signals (Action 0 is not valid for this feature)
 
 
0F for [[Action0Objects|newobjects]]
 
 
10 for [[Action0Railtypes|rail types]] (OpenTTD r18969)
 
 
Note that the above list is the master list for ''all'' actions where not stated otherwise.
 
 
===Num-props===
 
 
This is the number of properties that you wish to change per vehicle or station. &nbsp;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.
 
Simply the number of vehicles that you will change using this action 0.
   
===Id===
+
=== Id ===
  +
The [[VehicleIDs|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 [[VehicleIDs|Vehicle ID]] of the first vehicle or station to change. &nbsp;If num-info is greater than one, this vehicle/station and the following vehicles/stations will be changed.
 
   
  +
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 <
===Property===
 
  +
num-props> property bytes.
 
The number of the property that will be changed. &nbsp;This and the New-info section are repeated as many times as there are properties to set; in total, there are &lt;num-props&gt; property bytes.
 
   
 
See relevant sub-section (links at the bottom) for more details.
 
See relevant sub-section (links at the bottom) for more details.
   
===New-info===
+
=== New-info ===
 
The new information that will replace the previous information for the specified property. &nbsp;This is a variable size; dependent upon the property. Each property byte is followed by &lt;num-info&gt; new-info sections.
 
 
The appropriate \b, \w, and \d escape sequences can be quite useful for most &lt;new-info&gt;s. See [[GRFActionsDetailed#Byte_order|the discussion of escape sequences]] for further information.
 
 
-=Features and properties=-
 
 
Each feature has its own very specific properties. &nbsp;These are explained in detail in the pages listed below:
 
 
{toc}
 
 
You will also find the minimum GRF version (in [[Action8|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 [[Action7|Action 7]].
 
   
  +
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.
-=Example=-
 
  +
The appropriate \b, \w, and \d escape sequences can be quite useful for most <
  +
new-info>s. See [[GRFActionsDetailed#Byte order|the discussion of escape sequences]] for further information.
   
  +
==Example==
For examples please see the action 0 entries for each feature.
 

Latest revision as of 09:45, 11 June 2023

Introduction

Action 0 allows to change the feature properties of 'features', i.e. vehicles, stations, bridges, houses and more. Each feature has its own very specific properties. These are explained in detail in their separate pages.

You will also find the minimum version requirements for properites on the pages. Note, that due to the nature of Action 0 unknown properties cannot be ignored. Only a whole Action 0 can be skipped. OpenTTD and TTDPatch will disable GRFs once they encounter an unknown property. So, if you use some properties for optional features, which you want to disable for older versions of OpenTTD or TTDPatch, you have to skip the Action 0 using Action 9.


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.

Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (2.0.1 alpha 61)2.5 The <Id> is an extended byte since TTDPatch 2.0.1 alpha 61, to support the definition of >255 sound effects.

Supported by OpenTTD 0.7 (r13482)0.7 Not supported by TTDPatch GRFv7 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. Supported by OpenTTD 1.21.2 Not supported by TTDPatch GRFv8 In OpenTTD 1.2, extended IDs (up to 65535) can be used for vehicles as well. The ID for articulated vehicles must be below 16384.

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 Settings
09 Industry Tiles (see defaults)
0A Industries (see defaults)
0B Cargos (see defaults)
0C Sound Effects
0D Airports
0F Objects
10 Supported by OpenTTD 1.0 (r18969)1.0 Not supported by TTDPatch Railtypes
11 Supported by OpenTTD 1.1 (r19204)1.1 Not supported by TTDPatch Airport Tiles
12 Supported by OpenTTD 1.10 (gc02ef3e456)1.10 Not supported by TTDPatch Roadtypes
13 Supported by OpenTTD 1.10 (gc02ef3e456)1.10 Not supported by TTDPatch Tramtypes
14 Supported by OpenTTD 14 (g4c1406a4b5)14 Not supported by TTDPatch Road Stops

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.

Example