Wow, so this took longer than I thought! I've been busy with other projects but finally had a bit of time to return to this steam engine thing. To work out the scripts involved, I constructed a simple engine model based loosely on the Walschaerts valve gear system (the file is attached). All the motion of all the moving parts with the exception of the reverser lever (which would be operated by the engineer via a linkage) is controlled by scripts, with the input being derived from a moving target.
The target gets around the problem of defining acceleration in an Anim8or controller script without the ability to pass variables from one frame to the next, since the target's motion is keyframed the required motion is easily defined. The target could be considered to be a point on the ground, with the engine driving past it, assuming the wheel diameter was correctly accounted for and it rotated the right way (which in this case it wasn't, and doesn't). A script defines the orientation of the wheel based on the position of the target, with scripts defining the position of the linkages based on the wheel's orientation or the position of other elements, such as the reverser lever. In some cases, linkage orientation is defined using the 'facing' function. So to change the speed or overall motion of the engine it is only necessary to change the animation of the target and the reverser lever, with all elements maintaining their mechanical interaction with each other.
The scripts involved are too complex to list here, they can be dug out of the an8 file if you're interested in seeing how they work or modifying them for other projects. I have kept my (reams of) notes and geometric calculations and should be able to explain what each script is doing. I hit a major hurdle related to the ambiguous triangle problem with sine rule geometry (used to calculate the position of the valve linkage in the reverser gear), I very nearly walked away from the project but luckily had a bit of a brainwave (while on the dunny...haven't we all!) and it all came together tonight. Feel free to fiddle with it, just remember that there is no actual collision detection between elements so it is possible to set the reverser to a position that would be impossible in real life, with potentially weird results.
The plan is to refine the scripts for use with the Stephenson valve gear used on the paddle steamer engine, so I can finally get the beast to run. Fingers crossed other projects stay quiet for a bit, otherwise it could be another year until the next update!