Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- event, side, xPos, yPos = os.pullEvent("monitor_touch") --Touch Screen Grab
- mside = "left" -- Modem side
- side = "back" -- Monitor side
- tID = 1840 -- Geoffs ID
- timeout = 600 -- Standby bis Turtle von alleine arbeitet (Default: 600s)
- ftimeout = timeout -- Wichtig fuer for-Schleife !!DONT EDIT!!
- -- Initialisierung des Modems + Monitors
- mon = peripheral.wrap( side )
- modem = peripheral.wrap ( mside )
- peripheral.call( side, "clear" )
- rednet.open( "right" )
- -- Check, ob channel 421 offen
- if not modem.isOpen( 421 ) then
- modem.open( 421 )
- end
- function writeCenter(text, y, mon)
- local w, h = mon.getSize() or term.getSize()
- if mon then
- mon.setCursorPos( math.ceil( w/2 - #text/2 + 1 ), y )
- mon.write( text )
- else
- term.setCursorPos( math.ceil( w/2 - #text/2 ), y )
- term.write( text )
- end
- end
- function drawGUI()
- peripheral.call( side, "clear" )
- mon.setTextColor( colors.green )
- writeCenter( "[Farminfo] ", 2, mon )
- mon.setTextColor( colors.yellow )
- writeCenter( "Geoffs Status:", 3, mon )
- mon.setTextColor( colors.red )
- writeCenter( "Not available", 4, mon )
- mon.setBackgroundColor( colors.white )
- mon.setTextColor ( colors.black )
- writeCenter( "[Refresh]", 9, mon )
- writeCenter( "[Start Turtle]", 11, mon )
- mon.setBackgroundColor( colors.black )
- mon.setTextColor ( colors.white )
- end
- --[[function checkFarmStart()
- while true do
- if yPos == 11 and xPos > 3 and xPos < 19 then
- mon.setTextColor( colors.yellow )
- writeCenter( "Unterwegs zur Farm", 4, mon )
- mon.setTextColor( colors.white )
- writeCenter( "Turtle wurde", 6, mon )
- writeCenter( "gestartet!", 7, mon )
- rednet.send( tID, "start" )
- sleep(5)
- writeCenter( "", 6, mon )
- writeCenter( "", 7, mon )
- --goto restart
- return true
- break
- end
- end
- end]]--
- drawGUI()
- sleep(5)
- ::continue::
- while true do
- if yPos == 11 and xPos > 3 and xPos < 19 or timeout == 0 then
- timeout = ftimeout
- mon.setTextColor( colors.yellow )
- writeCenter( "Unterwegs zur Farm", 4, mon )
- mon.setTextColor( colors.white )
- writeCenter( "Turtle wurde", 6, mon )
- writeCenter( "gestartet!", 7, mon )
- sleep(5)
- writeCenter( "", 6, mon )
- writeCenter( "", 7, mon )
- --if checkFarmStart() then
- rednet.send( tID, "start" )
- id, msg, dist = rednet.receive()
- if msg == "arrived" then
- mon.setTextColor( colors.yellow )
- writeCenter( "Farmt", 4, mon )
- elseif msg == "back" then
- mon.setTextColor( colors.yellow )
- writeCenter( "Faehrt zurueck", 4, mon )
- elseif msg == "store" then
- mon.setTextColor( colors.yellow )
- writeCenter( "Lagere Items in Chest", 4, mon )
- elseif msg == "end" then
- mon.setTextColor( colors.lime )
- writeCenter( "Fahrt beendet", 4, mon )
- mon.setTextColor( colors.yellow )
- for i=1, ftimeout do
- if timeout == 0 then
- rednet.send( tID, "start" )
- break
- --goto continue
- else
- if timeout == 0 then
- -- goto continue
- end
- writeCenter( "Turtle auf Standby", 5, mon)
- writeCenter( "("..timeout.." s)", 6, mon)
- timeout = timeout - 1
- sleep(1)
- end
- end
- end
- end
- end
- goto continue
Add Comment
Please, Sign In to add comment