If you have the RosterEntry for your locomotive (call it ¡°re¡±) then you can get the label for a particular function with e.g.
re.getFunctionLabel(12)
You could write a loop over 0 to 28 to pull all the names and make a map from names to numbers.
Bob
On Aug 13, 2018, at 9:08 AM, LMSFAN72 <andrew@...> wrote:
Hi
I have no idea if this is actually possible, but,...
I would like to be able to write a script that uses a function's name to turn on a function of my running locomotive rather than the F numbers. This is because I want to be able to select a loco from my roster via a dropdown box and then automate the running of that on my layout. I can use sensors and speeds generically to achieve that but I have many different decoders in the locos so the functions are not very similar. What is similar, however, is the function label that I have used (e.g. "Headlight"). Can anyone suggest a way/some scripting to do this? Maybe there a way to read the labels associated with a throttle's function and then use that to set the function?
--
Bob Jacobsen
rgj1927@...