Getting Started

Create a new project and add a reference to TurtleLib.

ComputerCraft objects you would expect to see in minecraft are available in the TurtleLib.ComputerCraft namespace, the additional objects needed to simulate the game world are found in TurtleLib.Simulation.

The first object we need is a world, in which we can place blocks, computers, turtles, and more.

var world = new TurtleLib.Simulation.World();

Next we can create a computer.

var computer = new TurtleLib.ComputerCraft.Computer();

Now we can place it in the world, at location 0,0,0

world.AddEntity(computer, new TurtleLib.Simulation.Point(0, 0, 0));

And now let's simulate a lua script running on that computer. First, write the script:

TurtleLib.Simulation.ComputerScript script;
script = (term, peripheral, os) =>
  term.write("Hello World");

Good, now queue the script to be run when the world simulation begins.

world.QueueScript(computer, script);

After you've queued all the scripts you'd like to run, start the world sim.


When you run this program, you'll see a window open that represents the terminal of the computer object you added to the world, and "Hello World" will print.

Last edited Jun 24, 2013 at 11:21 PM by payonel, version 3


No comments yet.