Posted 22 January 2016 - 03:20 AM
Hello, I'm new to computercraft and coding and I would appreciate it if I could please get some help with this program I have been writing.
This program is a WIP program for refueling using a fuel source from another minecraft mod, which is the lava crystal from awayoftime's blood magic mod. What is supposed to happen is that the turtle will extract the exact amount of fuel the user wants (10 times the amount of "cycles' the user specifies). The program is also supposed to inform you of the amount of fuel you have added to the turtle, and the new total amount of fuel in the turtle.
The problem is, the program consistently seems to refuel for 10 more points of fuel than it should. I know I am making some stupid mistake in the code, but I cannot identify what it is or how I can fix it.
I would like to note that I doubt that there is anything wrong with the lava crystal, as it consistently refuels for 10 points of fuel each time I refuel it normally (using the 'refuel' program).
This program is a WIP program for refueling using a fuel source from another minecraft mod, which is the lava crystal from awayoftime's blood magic mod. What is supposed to happen is that the turtle will extract the exact amount of fuel the user wants (10 times the amount of "cycles' the user specifies). The program is also supposed to inform you of the amount of fuel you have added to the turtle, and the new total amount of fuel in the turtle.
The problem is, the program consistently seems to refuel for 10 more points of fuel than it should. I know I am making some stupid mistake in the code, but I cannot identify what it is or how I can fix it.
select(1) -- slot 1 is where you put the lava crystal
local fuel
print("Lava Crystals grant 10 FP per cycle.")
term.write("How many refuel cycles do you want? ")
fuel = read()
for x = 0, fuel do
turtle.refuel() --supposed to refuel the specified amount, e.g. if you wrote 10, the turtle would refuel 10 times, giving you 100 fuel points.
end
print(10*fuel.." Fuel Points were added.")
print("This TURTLE now has "..turtle.getFuelLevel().." FP in total.") --tells the user how much fuel has been added and the current total amount of fuel
I would like to note that I doubt that there is anything wrong with the lava crystal, as it consistently refuels for 10 points of fuel each time I refuel it normally (using the 'refuel' program).