Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c= require ("component")
- ct = c.transposer
- sides = require ("sides")
- gpu = c.gpu
- colors = require("colors")
- r1=c.proxy(c.get("b12"))
- r2=c.proxy(c.get("6df"))
- os= require ("os")
- tty = require("tty")
- -- ######################
- local truhe = sides.east
- anzahl = ct.getInventorySize(truhe)
- -- ######################
- i = 0
- x = 1
- er = 2
- rot = 0xFF0000
- weiss = 0x0000FF
- f1=0
- f2=0
- f3=0
- f4=0
- f5=0
- f6=0
- f7=0
- f8=0
- f9=0
- f10=0
- f11=0
- f12=0
- f13=0
- f14=0
- f15=0
- f16=0
- -- ######################
- function farbe(i)
- gpu.setBackground(i, true)
- tty.clear()
- end
- function pulse(i)
- local an = 0
- -- print(i)
- if i then
- -- gpu.bind(c.get("2b51"))
- -- os.execute("resolution 80 25")
- farbe(i)
- -- gpu.bind(c.get("727"))
- -- os.execute("resolution 50 25")
- end
- while an < i do
- r2.setOutput(sides.south, 15)
- os.sleep(0.2)
- r2.setOutput(sides.south, 0)
- an = an+1
- end
- r2.setOutput(sides.east, 15)
- os.sleep(0.2)
- r2.setOutput(sides.east, 0)
- end
- function foo (a)
- item = ct.getStackInSlot(truhe, a)
- if item then
- local name = item.label
- local anzahl = item.size
- -- print (name, ", ",anzahl)
- if string.find(name, "Weiße Wolle") then
- f1 = item.size
- elseif string.find(name, "Orange Wolle") then
- f2 = item.size
- elseif string.find(name, "Magenta Wolle") then
- f3 = item.size
- elseif string.find(name, "Hellblaue Wolle") then
- f4 = item.size
- elseif string.find(name, "Gelbe Wolle") then
- f5 = item.size
- elseif string.find(name, "Hellgrüne Wolle") then
- f6 = item.size
- elseif string.find(name, "Rosa Wolle") then
- f7 = item.size
- elseif string.find(name, "Graue Wolle") then
- f8 = item.size
- elseif string.find(name, "Hellgraue Wolle") then
- f9 = item.size
- elseif string.find(name, "Türkise Wolle") then
- f10 = item.size
- elseif string.find(name, "Violette Wolle") then
- f11 = item.size
- elseif string.find(name, "Blaue Wolle") then
- f12 = item.size
- elseif string.find(name, "Braune Wolle") then
- f13 = item.size
- elseif string.find(name, "Grüne Wolle") then
- f14 = item.size
- elseif string.find(name, "Rote Wolle") then
- f15 = item.size
- elseif string.find(name, "Schwarze Wolle") then
- f16 = item.size
- end
- else
- --print (er)
- if er == anzahl then
- gpu.setForeground(rot)
- print("Das Inventar ist leer")
- gpu.setForeground(weiss)
- else
- er = er +1
- end
- end
- end
- -- print ("Erkannte größe des Inventars: ", anzahl)
- -- print (" ")
- -- print ("Liste Inventar auf")
- -- print ("")
- local a = 1
- while (a < anzahl) do
- foo(a)
- a = a+1
- end
- ins = r1.getInput(sides.north)
- if ins == 15 and f1 == 0 then
- pulse(0)
- elseif ins == 15 and f2 == 0 then
- pulse(1)
- elseif ins == 15 and f3 == 0 then
- pulse(2)
- elseif ins == 15 and f4 == 0 then
- pulse(3)
- elseif ins == 15 and f5 == 0 then
- pulse(4)
- elseif ins == 15 and f6 == 0 then
- pulse(5)
- elseif ins == 15 and f7 == 0 then
- pulse(6)
- elseif ins == 15 and f8 == 0 then
- pulse(7)
- elseif ins == 15 and f9 == 0 then
- pulse(8)
- elseif ins == 15 and f10 == 0 then
- pulse(9)
- elseif ins == 15 and f11 == 0 then
- pulse(10)
- elseif ins == 15 and f12 == 0 then
- pulse(11)
- elseif ins == 15 and f13 == 0 then
- pulse(12)
- elseif ins == 15 and f14 == 0 then
- pulse(13)
- elseif ins == 15 and f15 == 0 then
- pulse(14)
- elseif ins == 15 and f16 == 0 then
- pulse(15)
- elseif ins == 15 then
- mytable = {}
- mytable = {["f1"] = f1,
- ["f2"] = f2,
- ["f3"] = f3,
- ["f4"] = f4,
- ["f5"] = f5,
- ["f6"] = f6,
- ["f7"] = f7,
- ["f8"] = f8,
- ["f9"] = f9,
- ["f10"] = f10,
- ["f11"] = f11,
- ["f12"] = f12,
- ["f13"] = f13,
- ["f14"] = f14,
- ["f15"] = f15,
- ["f16"] = f16,
- }
- local key = next(mytable)
- local max = mytable[key]
- for k, v in pairs(mytable) do
- if mytable[k] < max then
- key, max = k, v
- end
- end
- -- print(key, max)
- if key == "f1" then
- pulse(0)
- elseif key == "f2" then
- pulse(1)
- elseif key == "f3" then
- pulse(2)
- elseif key == "f4" then
- pulse(3)
- elseif key == "f5" then
- pulse(4)
- elseif key == "f6" then
- pulse(5)
- elseif key == "f7" then
- pulse(6)
- elseif key == "f8" then
- pulse(7)
- elseif key == "f9" then
- pulse(8)
- elseif key == "f10" then
- pulse(9)
- elseif key == "f11" then
- pulse(10)
- elseif key == "f12" then
- pulse(11)
- elseif key == "f13" then
- pulse(12)
- elseif key == "f14" then
- pulse(13)
- elseif key == "f15" then
- pulse(14)
- elseif key == "f16" then
- pulse(15)
- end
- end
Add Comment
Please, Sign In to add comment