I have some difficulties to understand all the callback staff, as documentation is great when you now whad you are searching for, but very hard to learn from scratch

I have two sets of sprites each assigned different CID. Now I want to make a train unit consisting of two wagons (using thos sprites) that you can buy at once. I studied HiroTrams and some other threads on this forum, and I have following code, still it is not working due some misunderstanding and I am not abel to figure it out.
Code: Select all
//Two sets of sprites
19 * 09 02 00 AA 01 01 00 00 00 00
20 * 09 02 00 BB 01 01 01 00 01 00
//Use set AA for first car and set BB for second
21 * 18 02 00 01 81 40 80 FF 00 00 02 AA 00 00 00 BB 00 01 01
//Callback to attach one more vehicle
22 * 12 02 00 02 81 10 00 FF 01 40 80 01 FF
//If callback is 16, goto 0002 else goto 0001
23 * 13 02 00 00 81 0C 00 FF 02 00 16 16 01 00
//Set some train properties, including callback bit for articulated train.
24 * 40 00 00 0E 01 40 00 00 00 03 50 04 50 05 02 06 07 09 50 00 0B 70 00 12 FD 14 4B 15 00 16 0C 17 10 19 02 1E 10 21 02 22 40
//Start loading by goto 0000.
25 * 07 03 00 01 40 00 00 00