Computer craft trouble

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Dutton

New Member
Jul 29, 2019
6
0
0
I wrote a simple program into a turtle, and its name is prog. Its on the disk directory. When I'm in the disk directory and type prog it pops up with this message "bios:338: [string "prog"]:2: 'C' expected" Thanks
 

Poppycocks

New Member
Jul 29, 2019
1,914
0
0
Means that there's a problem in your program [named "prog": on line 2: it's expecting a "C" in there somewhere. Why? I cannot fathom.

Pastebin or spoiler us your code.
 

Dutton

New Member
Jul 29, 2019
6
0
0
Not sure if the syntax of this is right but its a simple check fuel program.
function Fuel
If turtle.getFuelLevel() < 200
turtle.refuel(1)
end
end

Fuel
print turtle.FuelLevel()
 

jnads

New Member
Jul 29, 2019
248
0
0
Not sure if the syntax of this is right but its a simple check fuel program.
function Fuel
If turtle.getFuelLevel() < 200
turtle.refuel(1)
end
end

Fuel
print turtle.FuelLevel()
1. function Fuel()

2. if turtle.getFuelLevel() < 200 then


3. If you name your turtles (label set name [name]):

a. It saves your fuel when you destroy your turtle..... I don't need to draw the lines but:
i. Place turtle
ii. Insert Lava bucket(s)
iii. Type "refuel all"
iv. Repeat for 10,000 movement.
v. ??? Profit!

b. It saves your programs (they are normally deleted when you pickaxe your turtle).
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
1. b. add "local" at the start "local function fuel()"
c. Naming convention in Lua make names start without a cap for the first word.
3. I am pretty sure that the correct syntax is "label set [name]", at least I use that one all the time.
4. at the end, it should be turtle.getFuelLevel()

Oh well, srew it:
Code:
local function fuel()
  if (turtle.getFuelLevel() < 200) then
    turtle.refuel(1)
--Will only take 1 item from the currently selected slot, might not be what is wanted here.
  end
end
 
fuel()
print turtle.getFuelLevel()