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

Help me optimize this?

Started by Yobi, 20 January 2013 - 05:47 PM
Yobi #1
Posted 20 January 2013 - 06:47 PM
Here's the script

It's a program that works as an API, I've just added a couple of things to make it work standalone for testing.
Basically it takes a file that you make yourself on the main system called "position", you input the coordinates and facing of the turtle(0 = south, 2 = north, 1 = west, 3 = east) and it re-writes the main file every time it makes a move. The format for the position file is just a table formatted like so: {x, y, z, direction}

I'm only a couple of weeks into CC programming, so no real advanced stuff yet. I couldn't think of any other way than this to make it so that my turtles will always know where they are, even if the chunk is unloaded and they reset.

Basically I just want some tips on optimizing it and maybe telling me things that I could have done which would have streamlined the process a little more. If you can find out why I need that last end, I would greatly appreciate it. And any suggestions for uses of this script I would be interested to hear, because I can't think of any.
Lyqyd #2
Posted 20 January 2013 - 07:12 PM
You might be interested in checking out my location API: https://github.com/lyqyd/LyqydNet-Programs/blob/master/apis/location

Perhaps some of the ideas in there could be useful to you. Like the inclusion of back(). ;)/>