Skip to content

Folder: models

Hampton edited this page Sep 6, 2015 · 3 revisions

##What does it do? This contains all the model.js script files.


##What is model.js for? model.js is used for one very important thing: scale speed. This can't be included in any other file because you might have the same decoder, but a different model, thus different gearing, and a different requirement for scale speed.

###Functions:

#####locoSpeedCrunch(mph) This function accepts a speed in mph (as a number) and should return a speed for your locomotive AS A PERCENT, NOT A DCC SPEED-STEP VALUE! It is also important to remember that this function should not actually send any commands your locomotive, it should only take in a number and spit out another number.


When you select a model.js script from the UI, /models is automatically added to the beginning of your file path. This means that all model.js scripts must be inside this folder or they will not load properly.

An interesting thing to consider is that you can create folders inside this folder and the scripts will work fine.

Clone this wiki locally