Posted 29 September 2016 - 12:17 AM
i want to write a program for automated draconic heart. i want to send required items from turtle to the chest. program have to do send specific number of these items.
here is the code.
i tried to get items' details and i send to their name's to the variable "d". then compared their name's with all 5 items in "find" function. program giving me items' name and quantity. but it give me error in find() function. i don't know lua very much. i think it is about char - string thing. i could not figure out. i hope you guys give me some help. :)/>
here is the code.
local d = {}
local q = {}
local i = 1
local glow = 0
local quartz = 0
local dia = 0
local drac = 0
local res = 0
turtle.select(1)
while i < 6 do
turtle.select(i)
d[i] = turtle.getItemDetail(i)
q[i] = turtle.getItemCount(i)
print("",d[i].name)
print("",q[i])
i = i + 1
end
function find()
if d[i].name == minecraft.glowstone then
i = glow
elseif
d[i].name == minecraft.quartz_block then
i = quartz
elseif
d[i].name == minecraft.diamond_block then
i = dia
elseif
d[i].name == DraconicEvolution.draconium then
i = 1
while i < 6 and d[i].name == DraconicEvolution.draconium do
if q[i] < q[i+1] then
i = res
else
i = drac
end
end
end
find()
print(""..glow)
print(""..quartz)
print(""..dia)
print(""..res)
print(""..drac)
i tried to get items' details and i send to their name's to the variable "d". then compared their name's with all 5 items in "find" function. program giving me items' name and quantity. but it give me error in find() function. i don't know lua very much. i think it is about char - string thing. i could not figure out. i hope you guys give me some help. :)/>
Edited on 28 September 2016 - 11:12 PM