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

Is it possible to grab items from the users inventory?

Started by gergy008, 11 September 2012 - 02:13 PM
gergy008 #1
Posted 11 September 2012 - 04:13 PM
I've not been using ComputerCraft long - however I already know Lua through Roblox. Therefore I'm not that familiar with the API's that ComputerCraft uses.

I've been looking though the API list and I can't seem to find an API that allows the computer to access the users inventory. I'm making a ticket system for minecarts, where the user has to pay to catch a ride :)/>/> My question is is there an existing API for this and if so where can I find information on how to use it?

I was thinking of using floppy disks with ID values on them created by a computer, this could make it like printed ticket, but I can't see a way for the user to be able to pay for it. If accessing the user's inventory isn't possible then I suppose it would make a nice challenging little API project :P/>/>

Thanks in advance!
~Gergy
Cranium #2
Posted 11 September 2012 - 07:11 PM
As far as I know, turtles can't interact with a player's inventory, unless it's throught he GUI and the player in adding something to it. If you are using tekkit, or even just redpower, you can have a filter take the ticket(disk) out of the disk drive after it validates the balance or name. You can do like subway systems do and have each player have to pay a certain amount to receive a preloaded "ticket", and use that ticket to pay for minecart rides. Each time they enter their destination or whatever, it will deduct an amount from teh ticket balance, and spit it out back to them, or take it with the filter if it's empty. You could also have an admin on whatever server manage a train ticket balance system where everybody "pays" the admin, and the admin loads a certain amount of money onto the ticket. There are endless ways this could all be implemented, but it's all up to you how intense it should be.