Marlingaming

Station Public Line Status Display

Jan 11th, 2022 (edited)
947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. --this script displays Line data, and a Map on a terminal, switching between the two after a set variable
  2. local TrainLines = {{"Line A","Stopped","Platform A","Spawn to Capital",0,0,10,10}}
  3. local SwitchTimes = 30
  4. local DisplayInfo = 0
  5.  
  6. local function Clear()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. local function DisplayLineMap()
  12. Clear()
  13. for i = 1, #TrainLines do
  14.     paintutils.drawLine(TrainLines[i][5],TrainLines[i][6],TrainLines[i][7],TrainLines[i][8],colors.red)
  15. end
  16. end
  17.  
  18. local function DisplayLineStatus()
  19. Clear()
  20. print("Line Name --- Status --- Platform --- Stops")
  21. for i = 1, #TrainLines do
  22.     print(TrainLines[i][1].."--"..TrainLines[i][2].."--"..TrainLines[i][3].."--"..TrainLines[i][4])
  23. end
  24. end
  25.  
  26. function TerminalControl()
  27. os.startTimer(SwitchTimes)
  28. repeat
  29.     local event = {os.pullEvent()}
  30. until event[1] == "timer"
  31. if DisplayInfo == 0 then
  32.     DisplayInfo = 1
  33.     DisplayLineMap()
  34. elseif DisplayInfo == 1 then
  35.     DisplayInfo = 0
  36.     DisplayLineStatus()
  37. end
  38. TerminalControl()
  39. end
  40.  
  41.  
  42.  
  43. TerminalControl()
Add Comment
Please, Sign In to add comment