Iain, Define the memory variable with whatever system name you want and use the r???? names as the user names. ?I use IM900, etc., for the system names. Setting UseExtraColor to it's current state has no impact on anything. ?I handle block locking outside of the ManageBlocks process. ? A typical allocation action: ?????????????? On Change To True, Set Memory, "OD1-Lock". to 2.?? ?????????????? On Change To True, Set Memory, "BDM-Lock". to W.?? ?????????????? On Change To True, Set Sensor, "LK-BSME" to Active?? ?????????????? On Change To True, Clear Signal Mast Held, "SM-CS1W".?? ?????????????? On Change To True, Set Memory, "OD1-Signal". to SM-CS1W.?? ?????????????? On Change To True, Set Memory, "rBlocks". to iBDM1, iBDM2, iOD1.?? ?????????????? On Change To True, Set Memory, "rDirection". to W.?? ?????????????? On Change To True, Set Memory, "rAction". to reserve.?? ?????????????? On Change To True, Set Memory, "Message".?? You could update a sensor within the script but you have to have a method to correlate a block name with a locking sensor name. ?It is easier to let the Logix handle it. To initialize Logix, create a LRoute with the "Initializer" type selected. ?To simplify things, select one sensor from Output Actions and return to the Basics tab and select Create. ?This will create a RTXINITIALIZER Logix. ?As of 4.19.5, the name changes to IX:RTXINITIALIZER. ? This is the first Logix that runs after panel loading is complete. Once the Logix is created, you can edit the RTXINITIALIZER Logix to perform whatever startup processing you need. ?Here is mine: ? IX:RTXINITIALIZER1T? Route 1C Initialize?? ?? Antecedent: R1? ??? [x]? R1? IF? IX:RTXINITIALIZER type??? ???????????? THEN?? ?????????????? On Change To True, Run Script from file, preference:scripts/TurnoutSimulator.py.?? ?????????????? On Change To True, Set Memory, "rAction". to Done.?? ?????????????? On Change To True, Set Memory, "rDebug". to No.?? ?????????????? On Change To True, Run Script from file, preference:scripts/ManageBlocks2.py.?? ?????????????? On Change To True, Set Sensor, "Reset1" to Active?? ?????????????? On Change To True, Delayed Set Sensor, "Reset2" to Active, after 10 seconds.?? I am using ManageBlocks2 which has additional features. ? Notice that the script is part of the user files location. ?This way it is protected from JMRI installs. Dave Sand ----- Original message ----- From: Iain <iain@...> Subject: Re: [jmriusers] Displaying the "Alternative Track Colour" when using Logix (or Lroute or anything else that works) Date: Friday, May 08, 2020 12:05 PM Had my first read through of the code and I think (?) I understand it. The reserve/release does exactly what I want - by flipping? the variable?layoutBlock.setUseExtraColor() so I'll get either (as set up) Dark-Grey or white. Excellent! I have played with reserving Memorys and I have the problem that JMRI insists on putting IM at the front - is that OK or should I be using the user name column? It looks as if I will have to add to the .py Script an "rTest" function so I can check which state the block is in - normal or reserved since I do not want my Logix to reallocate a reserved block or an occupied block.? The test for an "active" occupied block is already available on a sensor setting.? I can see that there is a?layoutBlock.getUseExtraColor() construct so if I read that and have an "rState" memory to return I would be able to test that as 0 or 1 perhaps? It will complicate the Logix a bit since I will have to fetch the value before I can test it - unlike with a sensor - or is there a way to set a sensor from within the Script?? There must be, I just don't know enough about JMRI.? Could you give me a hint please when you have time? Finally, my ignorance showing again, I have no idea how to set a Logix to run on start up?????? |