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:)
[1.31] Turtle.detect gives id
Started by maarten1012, Mar 10 2012 04:15 PM
10 replies to this topic
#1
Posted 10 March 2012 - 04:15 PM
#2
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
#3
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
#4
Posted 12 March 2012 - 03:03 PM
when i use:
it's give a error: attempt to concatenate nil and string
please help...
-- 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...
#5
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.
#6
Posted 15 March 2012 - 09:11 AM
Use the new turtle.compare() command.
#7
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.
#8
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.
#9
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
/>
#10
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.
#11
Posted 01 April 2012 - 12:16 AM
This won't happen, fortunately.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


This topic is locked








