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

Chunks loading and unloading

Started by jebus, 17 January 2013 - 12:33 AM
jebus #1
Posted 17 January 2013 - 01:33 AM
Hi,

I'm using these mining turtles on a feed the beast server and was wondering:

Could I run some code before the chunk, containing that turtle, unloads
and also
run some code after the chunk has (re)loaded?

The goal is to make it pick up where it left of. (Save the stack?)
Maybe something already exists and I wouldn't want to reinvent the wheel.

Grtz,

Jordi
KaoS #2
Posted 17 January 2013 - 01:38 AM
you cannot run before unloading. on chunk reload the startup file will run. I wouldn't worry much about this as the computercraft development want to make your turtle automatically resume where it left off if it is unloaded, even if you close the server
jebus #3
Posted 17 January 2013 - 02:39 AM
follow ups :P/>

1) Can I write data somewhere, so it is retrievable on reload?
2) Can I change the startup file?
3) What happens when a turtle mines his friend?
4) What happens when a turtle puts something in a ender chest?

Grtz,

Jordi
theoriginalbit #4
Posted 17 January 2013 - 02:43 AM
1) Can I write data somewhere, so it is retrievable on reload?
2) Can I change the startup file?
3) What happens when a turtle mines his friend?
4) What happens when a turtle puts something in a ender chest?
1) yes you can write to a file that is persistent on the turtle, take a look at file io in Lua :)/>
2) yes by making a program called startup
3) it mines the other turtle and places it in its inventory if there is space
4) same thing as when a player does it
jebus #5
Posted 17 January 2013 - 02:48 AM
4) Which player?

Thanks a ton!!!!
Cloudy #6
Posted 17 January 2013 - 02:57 AM
Turtles can't interact with Vanilla ender chests as they're only accessible by players - and the inventory is stored with the players.
remiX #7
Posted 17 January 2013 - 02:58 AM
4) Which player?

Thanks a ton!!!!

Any player… The items will just be in the ender chest, if you're using pumps to suck items out, the items will be sucked out.
Lyqyd #8
Posted 17 January 2013 - 07:33 AM
4) Which player?

Thanks a ton!!!!

Any player… The items will just be in the ender chest, if you're using pumps to suck items out, the items will be sucked out.

Again, this does not apply to the vanilla ender chests; it only applies to the mod by the same name. Just to be doubly clear.
remiX #9
Posted 17 January 2013 - 08:08 AM
4) Which player?

Thanks a ton!!!!

Any player… The items will just be in the ender chest, if you're using pumps to suck items out, the items will be sucked out.

Again, this does not apply to the vanilla ender chests; it only applies to the mod by the same name. Just to be doubly clear.

Yeah, my reply was 1 minute after Cloudy's and I hadn't seen his comment. Also, I don't use turtles so I went for the bullet…