I'm trying to write some autorenews for the AI (don't ask why), but things are just not working out.
Here's the NFO code:
Code:
// AI Autoreplaces
// 5+ unit pax d elec trains (321 14 pendo 39 (future?))
1783 * 18 02 00 B8 81 10 00 FF 02
39 80 00 00
14 80 01 01
AA 00
// 5+ unit pax elec single trains (AL6 18 91 1A)
1784 * 18 02 00 B7 81 10 00 FF 02
1A 80 00 00
18 80 01 01
AA 00
// 5+ unit pax single trains (express 03 pannier 01 4mt 2E type3 0E 67 04)
1785 * 30 02 00 B6 81 10 00 FF 05
04 80 00 00
0E 80 01 01
2E 80 02 02
01 80 03 03
03 80 04 04
AA 00
// 5+unit goods trains (jinty 00 pannier 01 4mt 2E type3 0E type5 17 (future?))
1786 * 30 02 00 B5 81 10 00 FF 05
17 80 00 00
0E 80 01 01
2E 80 02 02
01 80 03 03
00 80 04 04
AA 00
// 4-unit elec double trains (AM10 06 321 14 pendo 39 (future?))
1787 * 22 02 00 B4 81 10 00 FF 03
39 80 00 00
14 80 01 01
06 80 02 02
AA 00
// 4-unit pax single trains (express 03 pannier 01 4mt 2E type2 0D (future?))
1788 * 26 02 00 B3 81 10 00 FF 04
0D 80 00 00
2E 80 01 01
01 80 02 02
03 80 03 03
AA 00
// 4-unit pax double trains (DMU 0B sprinter 0C voyager 2F)
1789 * 22 02 00 B2 81 10 00 FF 03
2F 80 00 00
0C 80 01 01
0B 80 02 02
AA 00
// 4-unit goods trains (jinty 00 pannier 01 4mt 2E type1 05 (future?))
1790 * 26 02 00 B1 81 10 00 FF 04
05 80 00 00
2E 80 01 01
01 80 02 02
00 80 03 03
AA 00
// it's 4 pax non-elec, is it double? d no
1791 * 15 02 00 F3 81 60 2F 00 FF 01 B2 00 01 FF B3 00
1792 * 15 02 00 F2 81 60 0C 00 FF 01 B2 00 01 FF F3 00
1793 * 15 02 00 F1 81 60 0B 00 FF 01 B2 00 01 FF F2 00
// it's 6 pax, is it electric? e/d no
1794 * 15 02 00 E7 81 60 39 00 FF 01 B8 00 01 FF B6 00
1795 * 15 02 00 E6 81 60 14 00 FF 01 B8 00 01 FF E7 00
1796 * 15 02 00 E5 81 60 1A 00 FF 01 B7 00 01 FF E6 00
1797 * 15 02 00 E4 81 60 18 00 FF 01 B7 00 01 FF E5 00
// it's 4 pax, is it electric? e no
1798 * 15 02 00 E3 81 60 39 00 FF 01 B4 00 01 FF F1 00
1799 * 15 02 00 E2 81 60 14 00 FF 01 B4 00 01 FF E3 00
1800 * 15 02 00 E1 81 60 06 00 FF 01 B4 00 01 FF E2 00
// it's 6+, is it goods or pax? p g
1801 * 14 02 00 A4 82 42 00 FF 01 E4 00 01 03 B5 00
// it's 4, is it goods or pax? p g
1802 * 14 02 00 A3 82 42 00 FF 01 E1 00 01 03 B1 00
// how long is the train? 4 5
1803 * 14 02 00 A2 81 40 10 FF 01 A3 00 00 03 A4 00
// only continue if we are an AI company: otherwise, just autorenew
// 1804 * 14 02 00 A1 81 43 10 FF 01 AA 00 00 00 A2 00
// time to autorenew!
1804 * 14 02 00 A0 81 0C 00 FF 01 A2 00 34 34 AA 00
1805 * 6 03 00 00 00 A0 00
And here's the test: For the purposes of the test, all vehicle lifespans are reduced to two years. I set the year to 1966, and build a Pannier Tank (id 01), a mail van and a passenger car. If my action 2s are correct, this should be recognised as a 4 car, non-electric, non-double, passenger train, and should run this autoreplace:
Code:
// 4-unit pax single trains (express 03 pannier 01 4mt 2E type2 0D (future?))
1788 * 26 02 00 B3 81 10 00 FF 04
0D 80 00 00
2E 80 01 01
01 80 02 02
03 80 03 03
AA 00
And indeed, when it comes time for the train to be replaced, it is replaced with ID 0D. Note that this is the
only place in the entire scheme that id 0D appears, thus proving that it's reading this action 2.
Now comes the fun bit.
Another two years roll around, and the new 0D loco is autoreplaced with... ID
05! This is where I start to question my sanity. When that train gets old, it continues to be replaced with ID 05.
Now, I send the train to the depot, sell the locomotive, and build an ID 05 (so it's basically exactly the same train, just with a loco bought by me rather than by the autorenew). When that train gets old, the loco is replaced with...
ID 0D. The correct autoreplacement. Which of course is then autoreplaced by ID 05 again, and so on...
thoughts ???