1583 posts
Location
Germany
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.
770 posts
Location
In My Lonely Little Computer Corner
Posted 12 June 2013 - 06:53 PM
I can't think of any use for it.
18 posts
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/>
171 posts
Location
Eastern USA
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.
1583 posts
Location
Germany
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/>/>
]]--
587 posts
Location
Wrocław, Poland
Posted 16 June 2013 - 10:00 AM
It would not be really useful, sorry :(/>
7508 posts
Location
Australia
Posted 16 June 2013 - 12:19 PM
1583 posts
Location
Germany
Posted 16 June 2013 - 12:34 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 ^^
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)^_^/>
7508 posts
Location
Australia
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.
60 posts
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.
7508 posts
Location
Australia
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.
60 posts
Posted 16 June 2013 - 12:49 PM
His actual post never says it for cc-emu :P/>
1583 posts
Location
Germany
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)
1029 posts
Location
Missouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension
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.
1583 posts
Location
Germany
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.
15 posts
Location
Microscopic Village in Nebraska.
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.
2427 posts
Location
UK
Posted 18 January 2017 - 10:04 AM
I'm making
this which is similar but it's bugged at the moment.
15 posts
Location
Microscopic Village in Nebraska.
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.
2427 posts
Location
UK
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.