i was able to find the problem.
I had to add
local EVENT = os.pullEvent()
into Main "Viewer" program.
There have been 6 items by Xande (Search limited from 29-March 23)
Posted by Xande on 01 January 2015 - 12:22 PM in Ask a Pro
print("movement started") local event, side, x, y = os.pullEvent() if event == "monitor_touch" then print("Touch detected at"..x.." X and "..y.." Y")
Posted by Xande on 01 January 2015 - 01:10 AM in Ask a Pro
Bomb Bloke, on 31 December 2014 - 11:55 PM, said:
Lyqyd, on 31 December 2014 - 09:12 PM, said:
local event, side, x, y = os.pullEvent()
Posted by Xande on 31 December 2014 - 08:06 PM in Ask a Pro
rednet.send(5, "Down") break
Posted by Xande on 31 December 2014 - 06:49 PM in Ask a Pro
--Programm Name movement while true do local event, side, x, y = os.pullEvent() if event == "monitor_touch" then --Move Down if (x == 9 and y == 13) or (x == 10 and y == 13) then rednet.send(5, "Down") break end --Move Right if (x == 15 and y == 8) or (x == 16 and y == 8) then rednet.send(5, "Right") break end --Move forward if(x == 9 and y == 8) or (x == 10 and y == 8) then rednet.send(5, "Forward") break end --Move Left if (x == 3 and y == 8) or (x == 4 and y == 8) then rednet.send(5, "Left") break end --Move UP if (x == 9 and y == 3) or (x == 10 and y == 3) then rednet.send(5, "Up") break end --Move Back if (x == 8 and y == 17) or (x == 9 and y == 17) or (x == 10 and y == 17) or (x == 11 and y == 17) then rednet.send(5, "Back") break end end end
--Programm Name Viewer -- #4 Cpu // Turtel #5 rednet.open("back") monitor = peripheral.wrap("left") term.setBackgroundColor(32) term.clear() term.setCursorPos(1,1) monitor.setTextScale(1) while rednet.isOpen("back") == true do local ID, MSG, PORT = rednet.receive() if MSG == "Detect" then shell.run("draw") end if MSG == "FuelLevel" then shell.run("getTank") end if MSG == "End" then rednet.close("back") end if MSG == "Move" then shell.run("movement") end end
local event, side, x, y = os.pullEvent()
--Programm Name TView rednet.open("right") --Functions function mMovement() rednet.send(4,"Move") shell.run("mMovement") end function getFuelLevel() rednet.send(4, "FuelLevel") local TANK = turtle.getFuelLevel() if TANK == 0 then shell.run("refuel") else rednet.send(4, TANK) end end function detect() rednet.send(4, "Detect") --detect top shell.run("detectt") --detect Left turtle.turnLeft() shell.run("detectf") --detect forward turtle.turnRight() shell.run("detectf") --detect Right turtle.turnRight() shell.run("detectf") --turn normal turtle.turnLeft() -- detect bottom shell.run("detectb") end --Main local bRunning = true while bRunning == true do detect() getFuelLevel() mMovement() bRunning = false end rednet.send(4, "End")
--Programm Name mMovement local ID, MSG, PORT = rednet.receive() if MSG == "Forward" then if turtle.detect() == true then turtle.dig() turtle.forward() else turtle.forward() end end if MSG == "Back" then turtle.turnRight() turtle.turnRight() if turtle.detect() == true then turtle.dig() turtle.forward() else turtle.forward() end end if MSG == "Left" then turtle.turnLeft() if turtle.detect() == true then turtle.dig() turtle.forward() else turtle.forward() end end if MSG == "Right" then turtle.turnRight() if turtle.detect() == true then turtle.dig() turtle.forward() else turtle.forward() end end if MSG == "Up" then if turtle.detectUp() == true then turtle.digUp() turtle.up() else turtle.up() end end if MSG == "Down" then if turtle.detectDown() == true then turtle.digDown() turtle.down() else turtle.down() end end