Advertisement
Guest User

zara

a guest
Mar 5th, 2015
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. --Variables
  2. local iS = peripheral.wrap("back")
  3. local iO = peripheral.wrap("left")
  4. local m = peripheral.wrap("monitor_38")
  5. local dataL = {}
  6.  
  7. --Functions
  8.  
  9. function load()
  10.  local file = fs.open("data","r")
  11.  if file ~= nil then
  12.  local data = file.readAll()
  13.  file.close()
  14.  return textutils.unserialize(data)
  15.  end
  16. end
  17.  
  18. function tfc()
  19.   mmsg("Charging        ",2,2,8)
  20.   itz = iS.list(0)
  21.   if itz ~= nil then
  22.    for itzst, kk in pair(itz) do
  23.     for it0, st in pairs(dataL) do
  24.      if itzst == st then do
  25.       for j = 1, 27 do
  26.        if dataL[it0][j] == itzst then
  27.          
  28.  
  29.        end
  30.       end
  31.      end  
  32.     end
  33.    end
  34.   end
  35.  mmsg("   Complete            ",1,3,64)
  36.  
  37.  
  38. --[[
  39.   for t,w in pairs(itz) do
  40.    for line2 in it0:lines do
  41.     if tonumber(line2) == t then
  42.      mmsg("                   ",1,3,1)
  43.      mmsg("MFSU Empty       ",2,2,8)
  44.     iS.extract(0,t,1,1)
  45.     iO.setOutput(colors.green)
  46.     end
  47.    end
  48.   end
  49.   sleep(1)
  50. ]]--
  51. end
  52. end
  53.  
  54. function msg(mes,h,j,col)
  55.  term.setCursorPos(h,j)
  56.  term.setTextColor(col)
  57.  print(mes)
  58. end
  59.  
  60. function mmsg(mes,h,j,col)
  61.  m.setCursorPos(h,j)
  62.  m.setTextColor(col)
  63.  m.write(mes)
  64. end
  65.  
  66. --Code
  67. m.clear()
  68. term.clear()
  69. msg("Working",5,1,colors.lime)
  70. mmsg("Working",5,1,colors.lime)
  71. dataL = load()
  72. if dataL ~= nil then
  73. while true do
  74.  msg("Wait for item",3,2,8)
  75.  ev, p1 = os.pullEvent()
  76.  if ev == "redstone" then
  77.   sleep(0.2)
  78.   tfc()
  79.   p = true
  80.   while p do
  81.   msg("Charging",3,2,8)
  82.   l = iS.list(1)
  83.    if l ~= nil then
  84.     for k,v in pairs(l) do
  85.     it1 = io.open("items" , "r")
  86.      for line1 in it1:lines() do
  87.       if tonumber(line1) == k then
  88.       mmsg("Put in MFSU   ",2,2,8)
  89.       iS.extract(1,k,0,1)
  90.       iO.setOutput(colors.red)
  91.       sleep(1)
  92.       tfc()  
  93.       end
  94.      end
  95.     end
  96.    sleep(1)
  97.    end
  98.   end
  99.  end
  100.  if (ev == "key") and ( p1 == 16 ) then
  101.   iO.setOutput(0)
  102.   msg("Stopped",5,3,colors.red)
  103.   mmsg("Stopped",5,5,colors.red)
  104.   break
  105.  end
  106. end
  107. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement