Posted 20 August 2015 - 03:09 PM
Hello guys,
Im currently working on a little setup in my base.
I want a turtle to check the item amount in a chest and send the number to a computer which prints it on a monitor but I have no idea how to do that..
currently i am that far:
turtle code so far:
Computer code:
now.. theres my problem… how do I tell the turtle to send the correct number to the computer and then how to get the computer to print the number to the top monitor?
thanks for the help! :)/>
Im currently working on a little setup in my base.
I want a turtle to check the item amount in a chest and send the number to a computer which prints it on a monitor but I have no idea how to do that..
currently i am that far:
turtle code so far:
-- Startup for the turtle:
rednet.open("right")
while true do
id, message = rednet.receive()
if id == 5 then
if message = Cobbleanzahl -- Anzahl is german for amount. Dont mind that
shell.run("Anzahl")
end
end
end
-- The "Anzahl" code that gets the item count
-- priniting on the turtle(( How do I get the monitor to print that?))
print("Wird gezaehlt!") -- german for "getting amount/counting"
-- functions
local Anzahl = turtle.getItemCount()
-- Those lines are those who get the amount
turtle.suck()
sleep(1)
-- HERE's my question: How do I get the monitor to print that via rednet?
print("Anzahl:"..Anzahl)
sleep(1)
turtle.drop()
--
Computer code:
-- startup:
--open up modem
rednet.open("right")
-- select the 2 monitors
m = peripheral.wrap("top") -- the monitor that shows the amount(if possible)
ml = peripheral.wrap("left") -- the touchscreen monitor to run the programs
-- functions ( those are only for the computer)
local id = os.getComputerID()
local name = os.getComputerLabel()
-- settings for monitors, text etc
term.setBackgroundColor(colors.blue) ( No i dont want to clear it. i just want it to be blue on the text itself)
print("ID:"..id)
print("Name:"..name)
term.setBackgroundColor(colors.black)
print("Wie kann ich dir helfen?") -- german for "how can I help you?"
-- my monitor setup
m.setBackgroundColor(colors.blue)
ml.setBackgroundColor(colors.black()
-- the stuff for the touchscreen is comming in here I guess.(I can do that myself)
-- cobbleamount program to let the turtle run the program
rednet.send(8, Cobbleanzahl)
-- Now what I think should be what gets the job done together with
-- the turtle to get the amount to the computer
while true do
id, message = rednet.receive()
if id == 8 then
if message ==
now.. theres my problem… how do I tell the turtle to send the correct number to the computer and then how to get the computer to print the number to the top monitor?
thanks for the help! :)/>
Edited on 20 August 2015 - 01:18 PM