Jump to content




[1.31] Turtle.detect gives id


  • This topic is locked This topic is locked
10 replies to this topic

#1 maarten1012

  • Members
  • 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:)

#2 Chlorek

  • New Members
  • 8 posts
  • LocationPoland

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 Sebra

  • Members
  • 726 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


#4 Pascal

  • New Members
  • 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...

#5 Liraal

  • New Members
  • 477 posts
  • LocationPoland

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 Mendax

  • Members
  • 366 posts

Posted 15 March 2012 - 09:11 AM

Use the new turtle.compare() command.

#7 Holofire

  • Members
  • 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.

#8 passinglurker

  • New Members
  • 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.

#9 Holofire

  • Members
  • 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/>

#10 passinglurker

  • New Members
  • 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.

#11 Advert

    Custom Title

  • Moderators
  • 459 posts
  • LocationLondon

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