But here's a script i have currently writed for my custom warehouse:
local function clear()
term.setCursorPos(1,1)
term.clear()
end
clear()
print("Welkom bij het magazijn")
print("Kies in het menu een nummer")
print("1. Ijzerwaren en ingots")
print("2. edelstenen en equiv exchange")
print("3. voedsel en aanverwanten")
print("4. verbruiks en bouwmateriaal")
print(" selecteer een optie ")
select1 = io.read() --noteerd het keuze nummer
if select1 == "1" then -- eerste menu scherm
clear()
print("Kies in het menu uw item")
print("1. copper ingot")
print("2. iron ingot")
print("3. gold ingot")
print("4. silver ingot")
print("5. tin ingot")
print("6. bronze ingot")
select2 = io.read() --item keuze ijzerwaren
if select2 == "1" then -- als het keuze 1 is top white pulsen voor die retriever etc.
rs.setBundledOutput("top", colors.white)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select2 == "2" then
rs.setBundledOutput("top", colors.orange)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select2 == "3" then
rs.setBundledOutput("top", colors.magneta)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select2 == "4" then
rs.setBundledOutput("top", colors.lightBlue)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select2 == "5" then
rs.setBundledOutput("top", colors.yellow)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select2 == "6" then
rs.setBundledOutput("top", colors.lime)
sleep (0.5)
rs.setBundledOutput("top", 0)
else print("sorry keuze bestaat niet")
sleep (1)
end
elseif select1 == "2" then -- menu 2 openen van het 1e keuzemenu
clear()
print("maak uw keuze:")
print("1. diamond")
print("2. ruby")
print("3. sapphire")
print("4. emerald")
print("5. covelance groen")
print("6. covelance licht blauw")
print("7. covelance blauw")
print("8. dark matter")
print("9. red matter")
print("10. blaze rod")
print("11. glowstone dust")
select3 = io.read() --item keuze voor menu equiv exchange etc.
if select3 == "1" then
rs.setBundledOutput("top", colors.pink)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select3 == "2" then
rs.setBundledOutput("right", colors.pink)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select3 == "3" then
rs.setBundledOutput("right", colors.lime)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select3 == "4" then
rs.setBundledOutput("right", colors.yellow)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select3 == "5" then
rs.setBundledOutput("left", colors.cyan)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select3 == "6" then
rs.setBundledOutput("bottom", colors.white)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
elseif select3 == "7" then
rs.setBundledOutput("bottom", colors.orange)
sleep (0.5)
rs.setBundledOutout("bottom", 0)
elseif select3 == "8" then
rs.setBundledOutput("top", colors.lightGray)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select3 == "9" then
rs.setBundledOutput("top", colors.gray)
sleep (0.5)
rs.setBundledOutput("top", 0)
elseif select3 == "10" then
rs.setBundledOutput("bottom", colors.cyan)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
elseif select3 == "11" then
rs.setBundledOutput("top", colors.gray)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
else
print("sorry keuze bestaat niet")
sleep (1)
end
elseif select1 == "3" then
clear()
print("Maak uw keuze")
print("1. wheat")
print("2. milk")
print("3. bread")
print("4. seeds")
print("5. melon")
print("6. melon seeds")
print("7. pumpkin")
print("8. apple")
print("9. steak")
print("10. cooked chicken")
select4 = io.read()
if select4 == "1" then
rs.setBundledOutput("right", colors.lightGray)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select4 == "2" then
rs.setBundledOutput("right", colors.cyan)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select4 == "3" then
rs.setBundledOutput("left", colors.white)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select4 == "4" then
rs.setBundledOutput("left", colors.lime)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select4 == "5" then
rs.setBundledOutput("left", colors.pink)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select4 == "6" then
rs.setBundledOutput("left", colors.gray)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select4 == "7" then
rs.setBundledOutput("bottom", colors.yellow)
sleep (0.5)
rs.setBundledOutput("bototm", 0)
elseif select4 == "8" then
rs.setBundledOutput("bottom", colors.lightGray)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
elseif select4 == "9" then
rs.setBundledOutput("bottom", colors.gray)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
elseif select4 == "10" then
rs.setBundledOutput("bottom", colors.pink)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
else print("sorry keuze bestaat niet")
sleep (1) end -- error message when number higher then 10 is choosen
elseif select1 == "4" then
clear()
print("Maak uw keuze")
print("1. Wood plank")
print("2. rubber sappling")
print("3. sticky resin")
print("4. glass")
print("5. soul sand")
print("6. marble")
print("7. marble bricks")
print("8. steen bricks")
print("9. redstone dust")
print("10. coal")
print("11. charcoal")
print("12. bone meal")
print("13. whool")
select5 = io.read()
if select5 == "1" then
rs.setBundledOutput("right", colors.white)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select5 == "2" then
rs.setBundledOutput("right", colors.orange)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select5 == "3" then
rs.setBundledOutput("right", colors.magneta)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select5 == "4" then
rs.setBundledOutput("right", colors.lightBlue)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select5 == "5" then
rs.setBundledOutput("right", colors.gray)
sleep (0.5)
rs.setBundledOutput("right", 0)
elseif select5 == "6" then
rs.setBundledOutput("left", colors.lightBlue)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select5 == "7" then
rs.setBundledOutput("left", colors.magneta)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select5 == "8" then
rs.setBundledOutput("left", colors.yellow)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select5 == "9" then
rs.setBundledOutput("left", colors.lightGray)
sleep (0.5)
rs.setBundledOutput("left", 0)
elseif select5 == "10" then
rs.setBundledOutput("bottom", colors.magneta)
sleep (0.5)
rs.setBundledOut("bottom", 0)
elseif select5 == "11" then
rs.setBundledOutput("bottom", colors.lightBlue)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
elseif select5 == "12" then
rs.setBundledOutput("bottom", colors.lime)
sleep (0.5)
rs.setBundledOutput("bottom", 0)
elseif select5 == "13" then
rs.setBundledOutput("left", colors.orange)
sleep (0.5)
rs.setBundledOutput("left", 0)
else print("sorry keuze bestaat niet")
sleep (1) end
else print("sorry keuze bestaat niet")
sleep (1)
sleep (2)
end
shell.run("reboot")
as you can see, its very big LOL. but my questions:
I want to make a message wich will be called if the order is a succes (like not the last else everywhere). So on the end of the code. But when i place it all the way down, it will trigger when i have a failed order or succes order. I dont realy know how to make a succes or failed message.
Secondly. How do i make a quit/back option in my script? (the print("…")'s are the menu's as you would see) but i want to add an option to go back to previous menu.
Lastly, if its not to hard i want to make a user defined amount :)/> (i use pulsing with retrievers as you can see in the code) Sorry i don't comment alot, end most comments are dutch because thats my langauge. I'm totally new to coding, was very happy the whole code worked without bugs *from cc bios* when i made the script, no errors :D/>. after the user defined amount is added i will be testing it.
I have seen:
times = read()
for i = 1, tonumber(times) do
-- do stuff
end
but that will be 40x making that code + a print message where it says "hoeveel wilt u bestellen"
And lastly, if i am not realy that hard, is it possible that you mension the item you are going to order :)/>. So not "amount: " but amount of: …"
Finaly, is it possible to let computercraft store multiple items/amounts and execute them all in 1 time so the computer is realy orderpicking, or is that easyier with turtles? (like the look without turtles to be honest)
Thanks in advance, i am still learning :)/>