This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
longbyte1's profile picture

Does Turtle.detect() Return A Block Id?

Started by longbyte1, 26 February 2012 - 09:49 PM
longbyte1 #1
Posted 26 February 2012 - 10:49 PM
I would really like for this to be implemented, if this is not available. turtle.detect() I think only returns 1 or 0, but extending it would work very well and it wouldn't affect many programs. All that would have to be changed is from == 1 to >= 1, and I hardly believe this is hard to fix. turtle.detect() will return a block ID number (so redundant). A database (encoded array or table) file found in the ROM, which contains all block IDs either scanned on mod startup or updated via HTTP could be accessed later to convert this ID into a string. Any ideas besides shooting mine down? :D/>/>

(Darn, that auto title fixer is worsening my capitalization!)
Liraal #2
Posted 26 February 2012 - 10:51 PM
it's not available, dunno about the future though
Casper7526 #3
Posted 26 February 2012 - 11:07 PM
The #1 reason that there will never be a direct way to access the blockid or blockname is that those 2 pieces of information can change. Therefor if I wrote a code that used 1 blockid or 1 name it might not work on someone elses CC.

There will be a way to do a sort of check on what your mining eventually, it just hasn't been added yet.
Sebra #4
Posted 27 February 2012 - 02:07 PM
Can it be expanded like:
bool,name,id,meta=turtle.detect()
so it will not interfere existent programs
name would dependent of language, id of mods installed, but it is at least will give some info to know. For example program can search for " Ore" at the end of name or have a configurable list of ids. Turtle can search for a block with name, it got from user or names can be written in blueprint. Or turtle can report to user "Bedrock found, cannot dig". The need is quite more, than this reason.
And I want ask for eye for turtle. In separate thread.
What way are you talking about?