Instead of the usual introductory text, here's how the implementation of a very simple train (engine and coach) in m4nfo would look like (courtesy of Snail: French NG train set):
include(fset.m4) // all local IDs, texts, etc
include(fset_templates.m4) // vehicle templates
setfeature(_TRAIN)
grfinit(GRF_FRENCHSET,
grfname(ALL,"French Set Protoype v0.02 12/12/2011")
grfdescription(ALL, UTF8 CRLF T_LGRAY " © 2010 - 2012 by Jacopo Coletto.")
grfurl(ALL, "http://www.frenchset.fr")
grfpalette(DOS)
grfversion(2)
grfminversion(1)
)
//------------------------------------------------------------------
// tank locomotive "030T Tramway"
//------------------------------------------------------------------
definevehicle(_030TRAMWAY,{"030T Tramway"},
newgraphics()
intro(1-1-1881)
climate(TEMPERATE)
reliability(16)
vehlife(23)
modlife(60)
enginetype(STEAM)
railtype(RAIL)
speed(45 km/h)
power(125 hp)
runningcost(55)
dualhead(NO)
capacity(0)
weight(15 t)
price(2)
aiusage(0)
effort(35 kN)
vehlen(3/8) // make 62.5% shorter
seteffect(steam(4)) // set position of steam effect
retire(16) // 16 years
flags(FLIPPING) // allow "flipping" in OTTD
)
//------------------------------------------------------------------
// short passenger coach
//------------------------------------------------------------------
definevehicle(_MSP, {"Passenger coach"},
newgraphics()
intro(1-1-1881)
climate(TEMPERATE)
vehlife(30)
modlife(120)
loadamount(4)
speed(40 km/h)
enginetype(WAGON)
railtype(RAIL)
runningcost(5)
dualhead(NO)
cargotype(MENU) // use first refittable
capacity(18)
weight(5 t)
price(40)
cargoclasses(+PASS, -EXPRESS) // exclude "tourists"
vehlen(4/8) // make 50% shorter
retire(16) // 16 years
)
namevehicle(_MSP,
D,"Reisezugwagen",
F,"Voiture voyageur",
E,UTF8 "Vagón de pasajeros",
I,"Carrozza viaggiatori"
)
//------------------------------------------------------------------
// graphics: tank locomotive "030T Tramway"
//------------------------------------------------------------------
spriteblock(
set(
template({TMPL_NG_6M},030T_Tramway.pcx, x(10,26,58,100,
128,144,176,218), y(10))
)
)
def(0) spriteset(move(0),load(0))
//------------------------------------------------------------------
// graphics: menu entry for "030T Tramway"
//------------------------------------------------------------------
spriteblock(
set(
sprite(030T_Tramway.pcx 260 10 _WEST) // black
)
)
def(1) spriteset(move(0),load(0))
//------------------------------------------------------------------
// graphics: tramway coach
//------------------------------------------------------------------
spriteblock(
set(
template({TMPL_NG_6M},voyageurs_courte.pcx, x(10,26,58,100,
10,26,58,100), y(10))
)
)
def(2) spriteset(move(0),load(0))
makevehicle(_030TRAMWAY,
link(ref(1), MENU) // purchase menu entry
default(ref(0)) // locomotive
override(_MSP, ref(2)) // tramway coach
)
Above example gives only a first impression. This manual will supply thorough insight how to code (nearly) all of the 'features' available in TTD: vehicles, stations, houses, industries, objects, etc, and how to use the most intricate qualities of TTDPatch's 'newGRFs' in an easily understandable way.
Parts of the following texts assumes the reader having a minimal grasp of standard nfo as well as some understanding of software development terminology.