5 posts
Posted 10 March 2012 - 04:15 PM
The function: turtle.detect() returns true or false, but wouldn't it be great so that it returns a block id for axample: turtle.return() returns the block id.
sry for bad english:)
8 posts
Location
Poland
Posted 11 March 2012 - 09:23 AM
There is now need to add next function like turtle.return(). Just turtle.detect() should return block ID, and if someone need to know is there anything or not, it's possible by:
local exist = turtle.detect()
if exist == 0 then
-- if there is air do something
else
-- there is any block and do sth
end
724 posts
Posted 11 March 2012 - 02:32 PM
It can be like that:
-- use it as now:
if turtle.detect() then --some block ahead
else --way clear
end
-- some new info:
detected, name, id, meta = turtle.detect()
if detected then -- other vars filled
rednet.send(0,name.." ahead")
else -- other vars are nil
result = turtle.forward() -- try to go
end
1 posts
Posted 12 March 2012 - 03:03 PM
when i use:
-- use it as now:
if turtle.detect() then --some block ahead
else --way clear
end
-- some new info:
detected, name, id, meta = turtle.detect()
if detected then -- other vars filled
print(name.." ahead") --error line
else -- other vars are nil
result = turtle.forward() -- try to go
end
it's give a error: attempt to concatenate nil and string
please help…
473 posts
Location
Poland
Posted 12 March 2012 - 03:09 PM
It is a suggestion how it should work, not how it actually works. turtle.detect() returns a boolean (true/false) value.
278 posts
Posted 15 March 2012 - 09:11 AM
Use the new turtle.compare() command.
18 posts
Posted 15 March 2012 - 07:13 PM
Turtle compare is good, but limited to the maximum of 9 to compare against (turtle inventory) Would be good a turtle.detect() is practicly useless.
88 posts
Posted 15 March 2012 - 08:16 PM
block id's can be different for every installation it will be very unstable don't ask for block id's ask for more inventory space. also seeing the block ID is magic this is a tech mod.
18 posts
Posted 15 March 2012 - 08:22 PM
Well, the block id's wouldn't be hard coded necessarily, but maybe retrieved from the mods config file. Oh, and move invent space would be nice :D/>/>
88 posts
Posted 16 March 2012 - 12:11 AM
its been shot down by dan or one of the forum staff since the introduction of turtles. compare is what you get be happy or code your own peripheral.
454 posts
Location
London
Posted 01 April 2012 - 01:16 AM
This won't happen, fortunately.