Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this script displays Line data, and a Map on a terminal, switching between the two after a set variable
- local TrainLines = {{"Line A","Stopped","Platform A","Spawn to Capital",0,0,10,10}}
- local SwitchTimes = 30
- local DisplayInfo = 0
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function DisplayLineMap()
- Clear()
- for i = 1, #TrainLines do
- paintutils.drawLine(TrainLines[i][5],TrainLines[i][6],TrainLines[i][7],TrainLines[i][8],colors.red)
- end
- end
- local function DisplayLineStatus()
- Clear()
- print("Line Name --- Status --- Platform --- Stops")
- for i = 1, #TrainLines do
- print(TrainLines[i][1].."--"..TrainLines[i][2].."--"..TrainLines[i][3].."--"..TrainLines[i][4])
- end
- end
- function TerminalControl()
- os.startTimer(SwitchTimes)
- repeat
- local event = {os.pullEvent()}
- until event[1] == "timer"
- if DisplayInfo == 0 then
- DisplayInfo = 1
- DisplayLineMap()
- elseif DisplayInfo == 1 then
- DisplayInfo = 0
- DisplayLineStatus()
- end
- TerminalControl()
- end
- TerminalControl()
Add Comment
Please, Sign In to add comment