Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ni=peripheral.wrap("back")
- if ni.listModules~=nil then --NeuralInterface Script
- --Modul Abfrage
- if ni.hasModule("plethora:kinetic")==false then print("please add kinetic module") end
- if ni.hasModule("plethora:introspection")==false then print("please add introspection module") end
- if peripheral.getType("front")~="modem" then print("please add modem on front side") end
- launchStrength=0.05723
- --connect
- rednet.open("front")
- ni.look(90,0)
- while true do
- resp={os.pullEvent("modem_message")}--rednet Event Abfrage
- mes=resp[5].message
- if mes=="north" then ni.launch(180,0,launchStrength) end
- if mes=="south" then ni.launch(0,0,launchStrength) end
- if mes=="east" then ni.launch(270,0,launchStrength) end
- if mes=="west" then ni.launch(90,0,launchStrength) end
- if mes=="up" then ni.look(180,-90) end
- end
- --if ni.hasModule("plethora:sensor")==false then print("please add kinetic module") end
- end
- --Computer
- if ni.listModules==nil then
- if peripheral.getType("right")~="appliedenergistics2:interface" then print("please add interface on right side") end
- if peripheral.getType("top")~="manipulator" then print("please add manipulator on left side") end
- if peripheral.getType("front")~="modem" then print("please add modem on back side") end
- --peripherals
- me=peripheral.wrap("right")
- inv=peripheral.wrap("top")
- rednet.open("back")
- --variables
- args={...}
- file=args[1]
- chestSide="west"
- delay=0.4
- --sort blocks from me to colors
- items=me.findItems(me.listAvailableItems()[1])
- id={}
- for i=1,#items do
- name=items[i].getMetadata().displayName
- if string.find(name,"Black")~=nil then id[" "]=items[i] end --Black
- if string.find(name,"White")~=nil then id["0"]=items[i] end --White
- if string.find(name,"Orange")~=nil then id["1"]=items[i] end --Orange
- if string.find(name,"Magenta")~=nil then id["2"]=items[i] end --Magenta
- if string.find(name,"Light Blue")~=nil then id["3"]=items[i] end --Light Blue
- if string.find(name,"Yellow")~=nil then id["4"]=items[i] end --Yellow
- if string.find(name,"Lime")~=nil then id["5"]=items[i] end --Lime
- if string.find(name,"Pink")~=nil then id["6"]=items[i] end --Pink
- if string.find(name,"Gray")~=nil then id["7"]=items[i] end --Gray
- if string.find(name,"Light Gray")~=nil then id["8"]=items[i] end --Light Gray
- if string.find(name,"Cyan")~=nil then id["9"]=items[i] end --Cyan
- if string.find(name,"Purple")~=nil then id["a"]=items[i] end --Purple
- if string.find(name,"Blue")~=nil then id["b"]=items[i] end --Blue
- if string.find(name,"Brown")~=nil then id["c"]=items[i] end --Brown
- if string.find(name,"Green")~=nil then id["d"]=items[i] end --Green
- if string.find(name,"Red")~=nil then id["e"]=items[i] end --Red
- if string.find(name,"Black")~=nil then id["f"]=items[i] end --Black
- end
- function getCharCount(str,char)
- charnum=0
- for i=1, #str do
- if string.sub(str,i,i)==char then
- charnum=charnum+1
- end
- end
- return(charnum)
- end
- function fileToTable(file)
- if fs.exists(file)~=true then
- print("file"..file.." not found")
- return(false)
- end
- fp=fs.open(file,"r")
- line={}
- i=1
- line[i]=fp.readLine()
- if line[i]==nil then return(false) end
- while line[i]~=nil do
- i=i+1
- line[i]=fp.readLine()
- end
- return(line)
- end
- img=fileToTable(file)
- chars={}
- i=1
- i2=1
- i3=1
- while img[i]~=nil do
- for i2=1, #img[i] do
- chars[i3]=string.sub(img[1],i2,i2)
- i3=i3+1
- end
- i=i+1
- end
- onechar=""
- for i=1, #img do
- onechar=onechar..img[i]
- end
- --Print Needed Colors
- term.clear()
- term.setCursorPos(1,1)
- term.write("Slot1 weiß: "..tostring(getCharCount(onechar,"0")))term.setCursorPos(1,2)
- term.write("Slot2 orange: "..tostring(getCharCount(onechar,"1")))term.setCursorPos(1,3)
- term.write("Slot3 magenta: "..tostring(getCharCount(onechar,"2")))term.setCursorPos(1,4)
- term.write("Slot4 hellblau: "..tostring(getCharCount(onechar,"3")))term.setCursorPos(1,5)
- term.write("Slot5 gelb: "..tostring(getCharCount(onechar,"4")))term.setCursorPos(1,6)
- term.write("Slot6 hellgrün: "..tostring(getCharCount(onechar,"5")))term.setCursorPos(1,7)
- term.write("Slot7 pink: "..tostring(getCharCount(onechar,"6")))term.setCursorPos(1,8)
- term.write("Slot8 grau: "..tostring(getCharCount(onechar,"7")))term.setCursorPos(21,1)
- term.write("Slot9 hellgrau: "..tostring(getCharCount(onechar,"8")))term.setCursorPos(21,2)
- term.write("Slot10 cyan: "..tostring(getCharCount(onechar,"9")))term.setCursorPos(21,3)
- term.write("Slot11 lila: "..tostring(getCharCount(onechar,"a")))term.setCursorPos(21,4)
- term.write("Slot12 blau: "..tostring(getCharCount(onechar,"b")+getCharCount(onechar,"b")))term.setCursorPos(21,5)
- term.write("Slot13 braun: "..tostring(getCharCount(onechar,"c")))term.setCursorPos(21,6)
- term.write("Slot14 grün: "..tostring(getCharCount(onechar,"d")))term.setCursorPos(21,7)
- term.write("Slot15 rot: "..tostring(getCharCount(onechar,"e")))term.setCursorPos(21,8)
- term.write("Slot16 schwarz: "..tostring(getCharCount(onechar,"f")))term.setCursorPos(1,9)
- maxX=#img[1]
- maxY=#img
- print("Höhe: "..tostring(#img))
- print("Breite: "..tostring(#img[1]))
- as=io.read() --wait for interaction
- --not needed actually
- blocks={}
- for i1=1,#onechar do
- table.insert(blocks,string.sub(onechar,i1,i1))
- end
- --build/request Items
- function pushBit(block)
- while inv.getInventory().getItem(1)~=nil do
- sleep(0.1)
- end
- block.export("up",1,1)
- inv.getInventory().pullItems(chestSide,1,1,1)
- end
- i=1
- while i<#blocks do
- for i2=1,maxX do
- pushBit(id[blocks[i]])
- print(i.."/"..#blocks)
- i=i+1
- end
- rednet.broadcast("north")
- sleep(delay)
- end
- end
Add Comment
Please, Sign In to add comment