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

Storing internal data

Started by Mendoza, 13 March 2014 - 01:50 PM
Mendoza #1
Posted 13 March 2014 - 02:50 PM
How I can store internal data (That cannot be erased when I exit MC) on the turtle? (Like the fuel level)

Thanks
CometWolf #2
Posted 13 March 2014 - 02:59 PM
All data on the turtle can be erased obviously, unless you put it in the rom folder externally. Im guessing what you want is to store info that isn't lost when the turtle reboots. Why do you need to store the fuel level though? turtle.getFuelLevel() will always give you the current amount of fuel.

Anyways, to write files to the harddrive of a computer/turtle you'll need to use the fs api
http://computercraft.info/wiki/Fs_%28API%29
Mainly fs.open, as this is used to create, write and read files depending on what arguments you give it.
http://computercraft.info/wiki/Fs.open
Mendoza #3
Posted 17 March 2014 - 01:35 PM
Ok, thanks

PD: The fuel level was an example
Edited on 17 March 2014 - 12:36 PM