Posted 13 February 2013 - 11:46 PM
Hey there.
For some reason, this variable is not being read properly. When I manually check it in lua, I get the right number returned.
I have a turtle receive function:
and a computer sending function:
The turtle is receiving the right number, I'm just not sure why it isn't using it in the function on line 6.
Any ideas?
For some reason, this variable is not being read properly. When I manually check it in lua, I get the right number returned.
I have a turtle receive function:
rednet.open("right")
while true do
id, msg = rednet.receive()
amount = tonumber(msg)
turtle.suckUp()
turle.drop(amount)
turtle.dropDown()
end
and a computer sending function:
rednet.open("top")
term.setCursorPos(1,1)
print("What item would you like?")
item = read()
shell.run("clear")
term.setCursorPos(1,1)
print("You asked for " ..item.. ".")
print("How many would you like?")
amount = read()
shell.run("clear")
term.setCursorPos(1,1)
quantity = tostring(amount)
if item == "cobblestone" then
rednet.send(1,quantity)
elseif item == "dirt" then
rednet.send(35,quantity)
end
print("Fetching " ..amount.. " " ..item)
print("Your items are in the chest.")
sleep(2)
shell.run("reboot")
The turtle is receiving the right number, I'm just not sure why it isn't using it in the function on line 6.
Any ideas?