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

Calling a program in another function

Started by Sivarias, 06 June 2013 - 01:31 PM
Sivarias #1
Posted 06 June 2013 - 03:31 PM
Parent program
Name: test

z=0
if turtle.forward() then
z=z+1
else
refuel
end

Child program
Name: Refuel

if turtle.getFuelLevel<65 then
turtle.select(2)
turtle.refuel()
print("All fuelled up boss")
end

i'm getting an error that says = sign expected. That usually means for me that I forgot parens at the end of an api, so I go back through and change line 5 in test to
refuel()
then it says it's trying to call a value of nil

I'm esentially trying to call programs in other programs so I'm not retyping things like refuelling all the time

any tips would be appreciated
Edited by
Lyqyd #2
Posted 06 June 2013 - 08:12 PM
Split into new topic.

Use: shell.run("refuel")