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

Use premade program inside a custom one in turtles

Started by magn0053, 02 September 2015 - 02:58 PM
magn0053 #1
Posted 02 September 2015 - 04:58 PM
Hey,

I've recently started playing around with ComputerCraft and Turtles in Tekkit Classic (which means that it TurtleOS 1.3 I'm using) and I wanted to make some of my own programs in which I need to use the program "excavate"! Can I somehow program my turtle to excavate the number of times i type in, and then afterwards make it do something else?

Thanks in advance,
Magn0053
SquidDev #2
Posted 02 September 2015 - 05:20 PM
You're probably looking for shell.run. You pass it the name of the function and then a series of arguments.


for i = 0, 20 do
  shell.run("excavate", 10)
  for _ = 0, 10 do turtle.forward() end
end

It isn't always 'good practice' to use shell.run instead, but for something as simple as this it is fine.
magn0053 #3
Posted 04 September 2015 - 01:56 PM
You're probably looking for shell.run. You pass it the name of the function and then a series of arguments.


for i = 0, 20 do
  shell.run("excavate", 10)
  for _ = 0, 10 do turtle.forward() end
end

It isn't always 'good practice' to use shell.run instead, but for something as simple as this it is fine.

Thx very much, it works well! :)/>