Well, as i'm a newbie, there are my way to try to have a neat and clear thing ^^:
- Using comments to "cut" my program in different steps:
-- Init
-- Color
-- Variables
-- Program
-- Functions
-- Program
-- Ending
To know how to cut, i'm asking thing like: "What should happend at start but never again?"
For you, think should be something like that:
-- Init
-- Color
-- Variables
-- Program
term.clear()
term.setCursorPos(1,1)
term.setCursorBlink(true)
turtle.select(1)
textutiles.slowPrint("Welcome...please enter the WaterBukkit:")
-- Functions
-- Program
-- Ending
As your while will only run if there isnt 1 item in slot 1, you can do
while turtle.getItemCount(1) ~= 1 do
and delete your if.
Beside having eStop = ioread() then an if
if io.read() == "stop" then
works well
As turtle.getItemCount(1) will look in 1st slot, turtle.select(1) isnt needed. actually you'r doing: "i'm selecting 1st slot then i count item in 1st slot"
but turtle.getItemCount(1) = "i count item in 1st slot"
this line can be deleted
io.read() will pauses the program, waiting an input, so the 2nd while isn't needed.
So … rewriten, looks like (note: its "textutils" not "textutiles" ^^):
-- Init
-- Colors
-- Variables
-- Program
term.clear()
term.setCursorPos(1,1)
term.setCursorBlink(true)
textutils.slowPrint("Welcome...please enter the WaterBukkit:")
-- Functions
-- Program
while turtle.getItemCount(1) ~= 1 do
textutils.slowPrint("Start in 3 seconds!")
sleep(3)
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Program has startes")
textutils.slowWrite("Type stop to stop the program")
if io.read() == "stop" then
break
end
end
-- Ending
term.write("It works")
Hope it will help =)