Advertisement
Guest User

mon.lua

a guest
Apr 24th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. screen = peripheral.wrap("top")
  2. station = peripheral.wrap("left")
  3.  
  4. term.redirect(screen)
  5.  
  6. while true do
  7.     screen.clear()
  8.     screen.setCursorPos(1,1)
  9.     screen.setBackgroundColor(colors.black)
  10.    
  11.     stationName = station.getStationName()
  12.     isTrainPresent = station.isTrainPresent()
  13.     isTrainImminent = station.isTrainImminent()
  14.     isTrainEnroute = station.isTrainEnroute()
  15.     trainName = isTrainPresent and station.getTrainName() or "???"
  16.     hasSchedule = isTrainPresent and station.hasSchedule() or "???"
  17.  
  18.     if isTrainPresent then screen.setBackgroundColor(colors.lime)
  19.     elseif isTrainImminent then screen.setBackgroundColor(colors.orange)
  20.     elseif isTrainEnroute then screen.setBackgroundColor(colors.lightBlue)
  21.     end
  22.            
  23.     print("stationName", stationName)
  24.     print("isTrainPresent", isTrainPresent)
  25.     print("isTrainImminent", isTrainImminent)
  26.     print("isTrainEnroute", isTrainEnroute)
  27.     print("trainName", trainName)
  28.     print("hasSchedule", hasSchedule)
  29.      
  30.     sleep()
  31. end
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement