Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- local iS = peripheral.wrap("back")
- local iO = peripheral.wrap("left")
- local m = peripheral.wrap("monitor_38")
- local dataL = {}
- --Functions
- function load()
- local file = fs.open("data","r")
- if file ~= nil then
- local data = file.readAll()
- file.close()
- return textutils.unserialize(data)
- end
- end
- function tfc()
- mmsg("Charging ",2,2,8)
- itz = iS.list(0)
- if itz ~= nil then
- for itzst, kk in pair(itz) do
- for it0, st in pairs(dataL) do
- if itzst == st then do
- for j = 1, 27 do
- if dataL[it0][j] == itzst then
- end
- end
- end
- end
- end
- end
- mmsg(" Complete ",1,3,64)
- --[[
- for t,w in pairs(itz) do
- for line2 in it0:lines do
- if tonumber(line2) == t then
- mmsg(" ",1,3,1)
- mmsg("MFSU Empty ",2,2,8)
- iS.extract(0,t,1,1)
- iO.setOutput(colors.green)
- end
- end
- end
- sleep(1)
- ]]--
- end
- end
- function msg(mes,h,j,col)
- term.setCursorPos(h,j)
- term.setTextColor(col)
- print(mes)
- end
- function mmsg(mes,h,j,col)
- m.setCursorPos(h,j)
- m.setTextColor(col)
- m.write(mes)
- end
- --Code
- m.clear()
- term.clear()
- msg("Working",5,1,colors.lime)
- mmsg("Working",5,1,colors.lime)
- dataL = load()
- if dataL ~= nil then
- while true do
- msg("Wait for item",3,2,8)
- ev, p1 = os.pullEvent()
- if ev == "redstone" then
- sleep(0.2)
- tfc()
- p = true
- while p do
- msg("Charging",3,2,8)
- l = iS.list(1)
- if l ~= nil then
- for k,v in pairs(l) do
- it1 = io.open("items" , "r")
- for line1 in it1:lines() do
- if tonumber(line1) == k then
- mmsg("Put in MFSU ",2,2,8)
- iS.extract(1,k,0,1)
- iO.setOutput(colors.red)
- sleep(1)
- tfc()
- end
- end
- end
- sleep(1)
- end
- end
- end
- if (ev == "key") and ( p1 == 16 ) then
- iO.setOutput(0)
- msg("Stopped",5,3,colors.red)
- mmsg("Stopped",5,5,colors.red)
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement