Is there a way to make the program check for available fuel sources in any slot and then ask the user if he want's to use it and if not it will go to the next one, etc.
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Turtles and there Fuel
Started by remiX, 27 November 2012 - 09:13 AMPosted 27 November 2012 - 10:13 AM
I haven't really made turtle programs but a friend of mine asked me to make one that cuts down huge trees without any effort.
Is there a way to make the program check for available fuel sources in any slot and then ask the user if he want's to use it and if not it will go to the next one, etc.
Is there a way to make the program check for available fuel sources in any slot and then ask the user if he want's to use it and if not it will go to the next one, etc.
Posted 27 November 2012 - 10:20 AM
There's no way to automatically detect if a specific block or item can be used as fuel without using it first. On the other hand, you could just ask the user which slot it wants to use as a fuel slot, and then only have it drain down to one so it will not put anything else in that spot.
Posted 27 November 2012 - 10:27 AM
Deleted…
I'm sorry.. i dont think i was helpful with my example
D:
_____________________
-Mikk809h
ComputerCraft is awesome
I'm sorry.. i dont think i was helpful with my example
D:
_____________________
-Mikk809h
ComputerCraft is awesome
Posted 27 November 2012 - 10:48 AM
There's no way to automatically detect if a specific block or item can be used as fuel without using it first.
Oh my word, I didn't even think about that.
So I would make it go through each slot and check if turtle.refuel() returns true. Thanks
Edit: Doing an if statement like this:
if turtle.refuel() then print("Fuel!") else print("Failed") end
I wanted it to just print 'worked' if it can but instead it printed worked and refueled itself. How can I make it just print 'fuel!' when it find's available fuel
Posted 27 November 2012 - 10:55 AM
Again, it can only know if a fuel works once it works. If you don't want it to use up the fuel, it will never know if it does work. Unless you are using Aperture Science Turtles.
So there is no way to automatically tell if an item is fuel. It will only ever use up fuel if it can. It's like a car: you can put water in the tank all you want, but it won't run because it can't catalyze it. Same idea.
So there is no way to automatically tell if an item is fuel. It will only ever use up fuel if it can. It's like a car: you can put water in the tank all you want, but it won't run because it can't catalyze it. Same idea.
Posted 27 November 2012 - 11:14 AM
turtle.refuel(0) returns true if it is a fuel type without using any….
Posted 27 November 2012 - 11:55 AM
Wait….you can define how much fuel it is to use?turtle.refuel(0) returns true if it is a fuel type without using any….
Posted 27 November 2012 - 12:07 PM
Yeah, but I didn't really think about using the number 0 either. That's pretty clever, KaoS :P/>Wait….you can define how much fuel it is to use?turtle.refuel(0) returns true if it is a fuel type without using any….
Posted 27 November 2012 - 12:46 PM
Yeah, but I didn't really think about using the number 0 either. That's pretty clever, KaoS :P/>Wait….you can define how much fuel it is to use?turtle.refuel(0) returns true if it is a fuel type without using any….
haha. I can take absolutely no credit for this innovation as it was actually noted on the documentation but thanks for the compliment :)/>
the defining the amount of fuel used is actually incredibly useful, on my turtles I like to run my networking coroutine as well as a fuelling coroutine in parallel with the shell. the fuel coroutinr keeps the fuel at a certain level (you can actually just make sure you always have JUST enough fuel for the next action to use fuel as it is needed). of course be careful when doing this… if you did it with a crafting turtle you may find your wood vanishing as you try to make planks etc… make a toggle switch or suffer