This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
riciJak's profile picture

Help with events

Started by riciJak, 01 May 2014 - 06:06 PM
riciJak #1
Posted 01 May 2014 - 08:06 PM
Hi, I need some help with my code. I got two turtle to summon wither for my netherstar generator.

What I want :

If they recieve a redstone signal they'll get 4soulsand 3skull in the enderchest
then check their invetory if it is >=5soulsand and >=4skull(they got both 1 soulsand and 1skull at first ) if both condition is true they'll send a rs signal
and I have a AND gate to recieve 2 signal from them and send it back to tell them both to summon the wither.

But if there is'nt enough soulsand or skull then they'll emit a redstone clock on my alarm so I'll know If I ran out of materials and want it to keep checking if soulsand>=5 and skull>=4 then if both are true it'll summon the wither.
and the alarm will turn off.




http://pastebin.com/VXJ9AXAy





chest = peripheral.wrap("bottom")

count = 0

while true do
offRs() -- turn off all rs sides
term.clear()
term.setCursorPos(1,1)

if rs.getInput("front", true) then --the 1st signal


print("Initializing.")
textutils.slowPrint("}}}}}}}}}}}}}}}}}}}}")
print(" ")
print("Loading Materials.")
textutils.slowPrint("}}}}}}}}}}}}}}}}}}}}")

do fillIt() -- fill 4soulsand and 3skull

sleep(1)
print(" ")
print("Checking Materials.")

do checkIt() -- check item amounts

sleep(1)
textutils.slowPrint("}}}}}}}}}}}}}}}}}}}}")
print(" ")
end

if count == 0 then  -- turtle got enough to summon wither
rs.setOutput("right", true) -- send to AND gate
end

if rs.getInput("back", true) then --AND gate
print("Summoning Wither.")
sleep(1)
summon()
sleep(180)
else sleep(1)
end

if count ~= 0 then
print("Missing Materials.")
print(" ")

rsClock()
sleep(1)

end
end
end
end
Edited on 02 May 2014 - 10:25 AM
Bomb Bloke #2
Posted 02 May 2014 - 02:54 AM
Unless you've got a rather specific setup filling that enderchest, you'll want OpenPeripheral's ability to identify items.

You should be able to wrap the chest as a peripheral, and then you can search it for the items you want and extract them.

This is assuming you're using whatever mod it is that adds those colour-coded ender chests. I doubt you'll have any luck getting turtles to interact with vanilla enderchests.