r/ComputerCraft • • Dec 29 '20

Running turtle programs in lua programing?

In running an if then statement as follows:

If message == "dig" then
Shell.run(excavate x)
End.
A little help?

1 Upvotes

4 comments sorted by

5

u/fatboychummy Dec 29 '20

Can you reword this to be a bit more coherent?

I'm having trouble understanding what it is you're asking for.

I'm going to attempt to understand it though...

...From a glance I think you're having trouble getting shell.run to work. You need quotes around excavate, so

if message == "dig" then
  shell.run("excavate", x)
end

1

u/thewittyrobin Dec 29 '20

How do you write a comment as script so I can write it the way I have it?

1

u/fatboychummy Dec 29 '20

Add four spaces before every line of code, or wrap your code with 3 backticks. The latter is not supported by old reddit though, if you use old reddit.

1

u/thewittyrobin Dec 29 '20

Alright. Im at work right at this moment so ill have to post the exact code in a few hours. Your help is really appreciated. The stem of the issue is I have an advanced pocket computer tied to an advanced turtle using button presses to to move and execute commands. For some reason I can get the dude to turn left and right but not move backwards or forwards. So I thought getting the turtle commands going would be simpler.