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

[Qeustion]Turtle Inventory

Started by Uch1ha_Sasuke, 11 July 2012 - 06:57 AM
Uch1ha_Sasuke #1
Posted 11 July 2012 - 08:57 AM
Okey so I have started to make a new program on my turtle that will lay an area I tell it to with the resources i put within its inventory.
I have however stumbled on a problem and I need some help please.
??? I want my turtle to check after placing each block if it still has blocks left in its inventory so that if I was to say place the blocks 200 long and 200 wide
( of course its inventory is not enough to place this amount of blocks) to place the blocks until it runs out and just wait there but not stopping my program like a "pause"
for the program to just wait and then lets say ask a question to continue. So when u reload the turtle that u can then say continue using read() that it will go on where the
program was "paused" so it wont have to rerun but keep the count on where it was in the program.

Sasuke
xuma202 #2
Posted 11 July 2012 - 11:13 AM
Take a look at coroutine in the lua help pages. They are like a thread that can yield itself and that can be resumed. But when your
turtle get's rebooted all the variables will be lost so you can try saving them. I remember someone made an API for such in Lua
here in the CC forums peristent variables or so. Make a sear for it, shpuld be in the program library.
Teraminer #3
Posted 11 July 2012 - 04:29 PM
Use help turtle it will show you all the "commands" or go here :http://computercraft.info/wiki/index.php?title=Turtle_%28API%29 it's all the commands turtle.getItemCount() is what you need.
I hope it helped :)/>/>.