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

TIE [Turtle Inventory Emulator] - Is it useful?

Started by H4X0RZ, 12 June 2013 - 01:46 PM
H4X0RZ #1
Posted 12 June 2013 - 03:46 PM
I'm working on a little API that emulates the turtle's inventory.
Now I want to know if it's useful in any way!

So, have you a use for it?

If it isn't useful in any way, I won't make it more complex.

Thanks for reading
-Freack100-

Edit :
Yes, I know that I haven't uploaded it yet.
nutcase84 #2
Posted 12 June 2013 - 06:53 PM
I can't think of any use for it.
Wiiplay123 #3
Posted 15 June 2013 - 02:48 PM
If you can put that API into a fighter, you can make a TIE Fighter! *Ba dum tss*
It might be useful for testing turtle programs without doing stuff :D/>
electrodude512 #4
Posted 15 June 2013 - 07:44 PM
I'd use this for CC-Emu if you uploaded it, but it would also have to partially simulate a whole minecraft world.
H4X0RZ #5
Posted 15 June 2013 - 07:56 PM
I'd use this for CC-Emu if you uploaded it, but it would also have to partially simulate a whole minecraft world.
You can use it were ever you want :D/>/>
I hope you know how the "OOP" in the API works :P/>/>

Examplecode:

os.loadAPI("TIE")
Inv1 = TIE.Inventory.create()
Inv1:select(4):setItem("Stone"):setAmount(30)
print(Inv1:getInformation())
--[[
this code would print "Slot 4 contais 30 Stone"
:D/>/>
]]--
jesusthekiller #6
Posted 16 June 2013 - 10:00 AM
It would not be really useful, sorry :(/>
theoriginalbit #7
Posted 16 June 2013 - 12:19 PM
Feel free to use and extend this code. I haven't worked on this is a very long time.

http://www.computercraft.info/forums2/index.php?/topic/11356-testing-turtle-scripts-in-cc-emu-kinda/
H4X0RZ #8
Posted 16 June 2013 - 12:34 PM
Feel free to use and extend this code. I haven't worked on this is a very long time.

http://www.computercraft.info/forums2/index.php?/topic/11356-testing-turtle-scripts-in-cc-emu-kinda/
Thx for that.
But I don't think I can use it because your API works very differently than mine ^^
yours overrides the native turtle commands.
Mine uses two tables (one for the name, one for the amount) and edits it ^^

On-Topic:
Now I'm working on a Movement emulation!
In this moment it has a limitation of the area (6*16) but I will add the normal area of the computer (19*51)^_^/>
theoriginalbit #9
Posted 16 June 2013 - 12:39 PM
Thx for that.
But I don't think I can use it because your API works very differently than mine ^^
yours overrides the native turtle commands.
Mine uses two tables (one for the name, one for the amount) and edits it ^^
Well it actually puts them into the turtle.native and turtle tables. this means that a script, no matter how it is programmed will work without having to change any of the calls to work specifically for the API.
Sorroko #10
Posted 16 June 2013 - 12:44 PM
I don't think Freack's api overwrites the native turtle functions (at all), that's what he means.
theoriginalbit #11
Posted 16 June 2013 - 12:48 PM
I don't think Freack's api overwrites the native turtle functions (at all), that's what he means.
There is no turtle.native in CC-Emu. just like there is no turtle in CC-Emu.

Some people in their scripts do use turtle.native in their scripts, so if you're going to make a script to allow testing of turtle code in CC-Emu then you need to allow for all variables.
Sorroko #12
Posted 16 June 2013 - 12:49 PM
His actual post never says it for cc-emu :P/>
H4X0RZ #13
Posted 16 June 2013 - 04:44 PM
^ ^
| |
thats right!

I've got an idea!
This API is quite useful for games ^_^/>
(It has working Invetorys and some Movement)
Geforce Fan #14
Posted 18 June 2013 - 05:25 PM
If I'm reading this right, you're making a turtle display its inventory on the screen.
This would be useful if you send the info to a computer and then displayed the inventory, but on the turtle it's totally useless.
H4X0RZ #15
Posted 18 June 2013 - 06:00 PM
If I'm reading this right, you're making a turtle display its inventory on the screen.
This would be useful if you send the info to a computer and then displayed the inventory, but on the turtle it's totally useless.
Not realy…
The system behind my API is quite simple.
1. You create a new Inventory
2. You can set/drop/select/whatever the inventory
(3.) Print out informations about the slot

This don't get real data, it creates Virtual Inventorys.
hermanoid #16
Posted 18 January 2017 - 03:53 AM
Did anything ever come of this? I have a use for it (my use might be as useful as many claim this to be… We shall see) and would really appreciate a link to whatever you have so far. If it's in GitHub, I'd be glad to contribute.
Lupus590 #17
Posted 18 January 2017 - 10:04 AM
I'm making this which is similar but it's bugged at the moment.
hermanoid #18
Posted 20 January 2017 - 03:02 AM
That's certainly interesting, but would certainly not work for my purposes (Your Inventory-Api.lua is similar to what I'm doing, with the exception of a not being object-oriented) (Why I want Object-Oriented is another story)

If you really want an explanation of what I'm doing… I'm not really sure enough about any specifics to explain it to you. Sorry.
Lupus590 #19
Posted 20 January 2017 - 01:47 PM
My idea for toetle is it can be as advanced as you want it to be, my end goal is to have it where the programmer (E.G. you) can provide their own handler functions and toetle will map the turtle API to those. Your functions could do a full simulation of the turtle's inventory. But as I said toetle is currently bugged and I don't have the time and knowledge to debug it. (I should probably poke that Ask a Pro thread I made…)

As for the inventory-api.lua, I don't know anything of that (another project member wrote it). It's licensed as MIT so if it's useful to you then just credit the Hive Development Team (or whetever we named ourselves in the License file at the root of the repo)

You may want to look at the inventory management code of this project: http://www.computercraft.info/forums2/index.php?/topic/22479-command-computers-turtle-api/

Also, why Object-Oriented (OO)? OO in Lua slows down the code.