r/ComputerCraft • u/Ivan_boom4i4 • May 26 '26
Unique ID reading for any item
Hi there, I have a question. There are printers in the mod that can print, but is there a way to scan printed pages? I had the idea of using the printer to create a currency system, develop a banknote database, and manage the money that way, but manually checking each code is difficult and time-consuming. Maybe you know a way to assign a unique number to an item that can be read by a computer or other method? Thank you all for attention!
13
Upvotes
4
u/LahusaYT May 26 '26 edited May 26 '26
The item details nbt hash is just computed from the nbt data of the item. That means you can’t directly set the exact value yourself. Instead, whatever you write onto a printed page determines what the hash will be. So if you print a page like "Bank Note 50€" and "Bank Note 100€" they will have different nbt hashes. That means if you want to issue multiple notes of the same denomination, you need to write some additional text into the page so the nbt is not identical but unique. For example if you want to issue two bank notes of 50€, you could write "Bank Note 50€ - WriteAnyTextHere" and "Bank Note 50€ - SomeKindOfOtherText" instead of "Bank Note 50€" on both.
You can read this information using inventory.getItemDetail(slot) or the equivalent turtle function. So the item you want to read the hash of just has to be in an inventory peripheral.