Created
February 13, 2015 10:27
-
-
Save dunkfordyce/f7e3b902b9ea6870e2f8 to your computer and use it in GitHub Desktop.
computercraft altar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- simple altar turtle | |
-- anything put in its inventory it will place | |
-- into the altar and wait for it to become "something else" | |
-- by dunkfordyce/d1223m | |
altar = peripheral.wrap('front') | |
os.queueEvent('turtle_inventory') | |
while true do | |
print('waiting for inventory') | |
os.pullEvent('turtle_inventory') | |
print('getting orb') | |
turtle.select(16) | |
turtle.suck() | |
for i=1,15 do | |
d = turtle.getItemDetail(i) | |
if d then | |
print('found '..d.name) | |
turtle.select(i) | |
turtle.drop() | |
break | |
end | |
end | |
while true do | |
o = altar.getStackInSlot(1) | |
if not o or o.id ~= d.name then | |
if o then | |
print('crafted '..o.id) | |
end | |
break | |
end | |
os.sleep(1) | |
end | |
for i=1, 15 do | |
if turtle.getItemCount(i) == 0 then | |
print('found free slot '..i) | |
turtle.select(i) | |
break | |
end | |
end | |
while turtle.suck() do | |
print('removing item') | |
turtle.dropUp() | |
end | |
print('replacing orb') | |
turtle.select(16) | |
turtle.drop() | |
more = false | |
for i=1, 15 do | |
if turtle.getItemCount(i) > 0 then | |
print('found more things to craft') | |
os.queueEvent('turtle_inventory') | |
more = true | |
break | |
end | |
end | |
if not more then | |
print('nothing more to craft') | |
os.sleep(0.5) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment