Well, let's start:
write( "What's your order?" )
local input = read()
--#Notice I didn't forward declare the variable formerly known as x
--#I renamed it to input because it is more descriptive
--#You also must set a value equal to what read() returns, which you did not
--#(although you did delete the function read, by overwriting it with the value of x, which was previously declared as nil)
if input == "Hearty_Breakfast" then
--#notice I removed the 'do' command. do is only used in loops, or to change the scope (this relates to local variables)
--#examples of 'do' would be:
--#for i = 1, 10 do ... end --loops 10 times
--#while true do ... end --loops infinite times
local count = turtle.getItemCount( 1 )
--#I only call turtle.getItemCount once, and store the result in a variable
if count >= 10 then
--#which I then use the greater than or equal to operator on, to determine if enough funds are available
print( "Funds Sufficient" )
turtle.transferTo( 2, count - 10 )
--#Notice I didn't declare a separate variable (x) for count - 10. You can pass values to functions this way
--#the downside to doing so, is you cannot access that same value in a different part of your code
--#However, that wasn't necessary here. Also, x = x+0 is totally redundant, as anything plus 0 equals itself.
turtle.dropDown( 10 )
turtle.select( 2 )
turtle.dropUp()
turtle.select( 1 )
else
print( "Insufficient Funds" )
end
end
I have left out the redstone part, as you are totally wrong. You'll want to use these commands:
rs.getBundledInputrs.getBundledOutputrs.setBundledOutputFor example, let's say I wanted to turn on the 'white' color in front:
rs.setBundledOutput( "front", colors.white )
Now, let's say I want to turn it off:
rs.setBundledOutput( "front", 0 )
Note: The above methods will override
all current outputs of the computer to that side. For example, if I turned on red, then white using the method shown, only white would remain on. To avoid doing this, incorporate rs.getBundledOutput and
colors.subtract/
colors.combine.