Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --testFile
- --NAPTlME
- --RIM motor
- --NAPTlME
- rednet.open('right')
- print(os.getComputerID())
- function update()
- --fs.delete("open")
- local y = fs.open('open','w')
- y.writeLine(north)
- y.writeLine(south)
- y.writeLine(east)
- y.writeLine(west)
- y.writeLine(up)
- y.writeLine(down)
- y.close()
- end
- if not fs.exists('open') then
- north = "0"
- south = "0"
- east = "0"
- west = "0"
- up = "0"
- down = "0"
- update()
- os.reboot()
- else
- local z = fs.open('open','r')
- north = tonumber(z.readLine())
- south = tonumber(z.readLine())
- east = tonumber(z.readLine())
- west = tonumber(z.readLine())
- up = tonumber(z.readLine())
- down = tonumber(z.readLine())
- z.close()
- end
- m = peripheral.wrap('bottom')
- sleep(0.25)
- function retract(n)
- m.move(n,false,false)
- end
- function moving()
- if east > 0 then
- east = east - 1
- update()
- retract(5)
- elseif north > 0 then
- north = north - 1
- update()
- retract(2)
- elseif down >0 then
- down = down - 1
- update()
- retract(0)
- elseif up >0 then
- up = up -1
- update()
- retract(1)
- elseif south > 0 then
- south = south - 1
- update()
- retract(3)
- elseif west >0 then
- west = west - 1
- update()
- retract(4)
- end
- end
- moving()
- while true do
- id,msg = rednet.receive()
- if id == 100 then
- if msg == "open" then
- east = 3
- north = 3
- down = 5
- update()
- os.reboot()
- elseif
- msg == "close" then
- up = 5
- south = 3
- west = 3
- update()
- os.reboot()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement