User Tools

Site Tools


usage:atlatc:examples:ars_cycling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
usage:atlatc:examples:ars_cycling [2022-06-28 11:44]
56independent created
usage:atlatc:examples:ars_cycling [2022-07-03 14:08] (current)
56independent [Code] Synatx highlighting
Line 9: Line 9:
 There is no concept of ARS matching and this simply sets the first available route. There is no concept of ARS matching and this simply sets the first available route.
  
 +One usecase is with depots designed to store trains. By setting the route to a free track, this allows for trains to be stored where it is possible. Another usecase is terminal stations which branch out. This allows trains to go to an available track instead of waiting for a train to depart or segregating tracks by line. 
 ===== Explanation ===== ===== Explanation =====
 The code takes the name of the signal and the last route as constants. When a train runs over the rail, the code attempts to find a setabble route. If unable to, the code gives up. The code takes the name of the signal and the last route as constants. When a train runs over the rail, the code attempts to find a setabble route. If unable to, the code gives up.
  
 ===== Code ===== ===== Code =====
-<code>+<code lua>
 signalPos = "" -- Add the name of the signal signalPos = "" -- Add the name of the signal
 lastRoute = "" -- The number name of the final route lastRoute = "" -- The number name of the final route
Line 21: Line 22:
   l = tostring(i)   l = tostring(i)
   if can_set_route(signalPos, l) then   if can_set_route(signalPos, l) then
-  set_route(signalPos, "t" .. l)+  set_route(signalPos, l)
   end   end
   end   end
 end end
 </code> </code>
usage/atlatc/examples/ars_cycling.1656409477.txt.gz · Last modified: 2022-06-28 11:44 by 56independent