Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables --
- local mouseWidth = 0
- local mouseHeight = 0
- local currentDestination = "None"
- local currentPlayer = "None"
- local Turtle = 3
- --Set turtle connection --
- rednet.open("bottom")
- --Set monitor properties
- local monitor = peripheral.wrap("back")
- monitor.setBackgroundColor(colors.black)
- monitor.clear()
- function setcurrentDestinationData()
- --Write first list of destinations
- monitor.setCursorPos(2,2)
- if currentDestination == "Tribble" then
- monitor.setBackgroundColor((colors.green))
- else
- monitor.setBackgroundColor((colors.red))
- end
- monitor.write(" Tribble ")
- monitor.setCursorPos(2,4)
- if currentDestination == "PietervBerkel" then
- monitor.setBackgroundColor((colors.green))
- else
- monitor.setBackgroundColor((colors.red))
- end
- monitor.write(" PietervBerkel ")
- monitor.setCursorPos(2,6)
- if currentDestination == "Razyr" then
- monitor.setBackgroundColor((colors.green))
- else
- monitor.setBackgroundColor((colors.red))
- end
- monitor.write(" Razyr ")
- monitor.setCursorPos(2,8)
- if currentDestination == "GrooteMoeite" then
- monitor.setBackgroundColor((colors.green))
- else
- monitor.setBackgroundColor((colors.red))
- end
- monitor.write(" GrooteMoeite ")
- monitor.setCursorPos(2,10)
- if currentDestination == "Louw" then
- monitor.setBackgroundColor((colors.green))
- else
- monitor.setBackgroundColor((colors.red))
- end
- monitor.write(" Louw ")
- monitor.setCursorPos(2,12)
- if currentDestination == "Ace_Of_Knaves" then
- monitor.setBackgroundColor((colors.green))
- else
- monitor.setBackgroundColor((colors.red))
- end
- monitor.write(" Ace_Of_Knaves ")
- monitor.setCursorPos(2,14)
- if currentDestination == "None" then
- monitor.setBackgroundColor((colors.green))
- else
- monitor.setBackgroundColor((colors.red))
- end
- monitor.write(" None ")
- end
- -- Perform clicked action --
- function checkClickPosition()
- -- 1st Row --
- if(mouseWidth > 1 and mouseWidth < 20 and mouseHeight == 2) then
- currentDestination = "Tribble"
- setcurrentDestinationData()
- sendTurtleMessage(1)
- -- 1st Row --
- elseif(mouseWidth > 1 and mouseWidth < 20 and mouseHeight == 4) then
- currentDestination = "PietervBerkel"
- setcurrentDestinationData()
- sendTurtleMessage(2)
- -- 1st Row --
- elseif(mouseWidth > 1 and mouseWidth < 20 and mouseHeight == 6) then
- currentDestination = "Razyr"
- setcurrentDestinationData()
- sendTurtleMessage(3)
- -- 2nd Row --
- elseif(mouseWidth > 1 and mouseWidth < 20 and mouseHeight == 8) then
- currentDestination = "GrooteMoeite"
- setcurrentDestinationData()
- sendTurtleMessage(4)
- -- 3rd Row --
- elseif(mouseWidth > 1 and mouseWidth < 20 and mouseHeight == 10) then
- currentDestination = "Louw"
- setcurrentDestinationData()
- sendTurtleMessage(5)
- -- 4th Row --
- elseif(mouseWidth > 1 and mouseWidth < 20 and mouseHeight == 12) then
- currentDestination = "Ace_Of_Knaves"
- setcurrentDestinationData()
- sendTurtleMessage(6)
- -- 5th Row --
- elseif(mouseWidth > 1 and mouseWidth < 20 and mouseHeight == 14) then
- currentDestination = "None"
- setcurrentDestinationData()
- sendTurtleMessage(7)
- end
- sleep(5)
- currentDestination = "None"
- setcurrentDestinationData()
- end
- -- Send message --
- function sendTurtleMessage(Message)
- rednet.send(Turtle,Message)
- end
- --First time data setup --
- setcurrentDestinationData()
- function monitorActivities()
- event,p1,p2,p3 = os.pullEvent()
- if event == "monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- end
- repeat
- monitorActivities()
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement