Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- djComputer = 714
- nSelect = 1
- function cPrint(text)
- local w, h = term.getSize()
- local x, y = term.getCursorPos()
- term.setCursorPos(math.ceil((w/2)-(text:len()/2)), y)
- print(text)
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function mainLayout()
- clear()
- term.setTextColour(colours.white)
- cPrint("What would you like to do?")
- term.setCursorPos(1,3)
- if nSelect == 1 then
- term.setTextColour(colours.green)
- cPrint("[ Play new song ]")
- else
- term.setTextColour(colours.white)
- cPrint(" Play new song ")
- end
- end
- function mainScreen()
- while true do
- mainLayout()
- event, p1, p2, p3 = os.pullEvent()
- if event == "key" then
- key = p1
- if key == 200 and nSelect > 1 then
- nSelect = nSelect-1
- elseif key == 208 and nSelect < 1 then
- nSelect = nSelect+1
- elseif key == 200 and nSelect == 1 then
- nSelect = 1
- elseif key == 208 and nSelect == 1 then
- nSelect = 1
- elseif key == 28 and nSelect == 1 then
- rednet.send(djComputer, "StartNewSong")
- end
- end
- end
- end
- mainScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement