try this piece of code:
Code: Select all
-1 * 0 09 <parameter number> 01 \7! <value to check for> <where to skip>
<Things to do when this parameter is active>
<Even more things to do>
<Even even more things to do>
-1 * 2 10 <skip to here>
example from nutracks code:
Code: Select all
// Enable ALL invisible engines (i.e. skip unless parameter 1 is 1)
-1 * 0 09 \b1 01 \7! 01 11
#include "support/all-invis.pnfo"
#include "support/invisible.pnfo"
-1 * 2 10 11
As a general tip I try to have the action10 (the "where to skip) named with the first digit is the parameter number, and the second digit is what "state" the parameter is (in this case, 11, because it skips to this when handling parameter1, and the state/value is 1
And other then this, i advise you to use Action14, altho this isnt supported in OpenTTD 1.0.x.
Code: Select all
-1 * 0 14 "C" "INFO"
"B" "NPAR" \w1 \b03 // Number of parameters
"B" "PALS" \w1 "W" // Windows palette
"B" "VRSN" \w4 \d{{REPO_REVISION}} // GRF version (you should put something like "0.0.1" or similar here (withing quotation marks)
00
00
plus for the parameters itself:
Code: Select all
-1 * -1 14 "C" "INFO"
"C" "PARA"
"C" \d0 // Parameter number
"B" "TYPE" \w1 0 // What type, if its "multiple choise" 0 is a good number
"B" "LIMI" \w8 \d0 \d3 // Limits of the parameter, from low to high, in this case 0 is low and 3 is high (i.e. anything from 0 to 3 can be used)
"B" "DFLT" \w4 \d0 // The default value of the parameter, in this case 0
"T" "NAME" LANG_ID "Parameter0 name" 00
"T" "DESC" LANG_ID "Parameter0 discription" 00
"C" "VALU"
"T" \d0 LANG_ID "Value0 'name'" 00
"T" \d1 LANG_ID "Value1 'name'" 00
"T" \d2 LANG_ID "Value2 'name'" 00
"T" \d3 LANG_ID "Value3 'name'" 00
00
00
00
00
00
Note: The LANG_ID is what translation is used here. Usually if you dont provide any translations, its 7F
You might want to take a look at sprites/nfo/header.pnfo and sprites/nfo/action14/param.pnfo of
nutracks... Note that we use a preprocessor to make templates and stuff, but the code is still valid, but everything written in UPPER CASE is changed into something different. Usually from ids.pnfo or a language files (in strings/7F_english.pnfo or similar)