Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- -- Username
- local ufile = fs.open("disk/user.lua","r")
- local username = ufile.readLine()
- ufile.close()
- -- Money Read
- local mrfile = fs.open("disk/money.lua","r")
- local money = mrfile.readLine()
- mrfile.close()
- --inputredient Available
- -- Coffe Read
- local cffile = fs.open("disk/coffe.lua","r")
- local cff = cffile.readLine()
- cffile.close()
- --SugarCont Read
- local scfile = fs.open("disk/sugar.lua","r")
- local sugarCont = scfile.readLine()
- scfile.close()
- --blazeCont Read
- local blfile = fs.open("disk/blaze.lua","r")
- local BlazeCont = blfile.readLine()
- blfile.close()
- --CreamCont Read
- local crfile = fs.open("disk/cream.lua","r")
- local CreamCont = crfile.readLine()
- crfile.close()
- --GoldenCont Read
- local gofile = fs.open("disk/golden.lua","r")
- local GoldenCont = gofile.readLine()
- gofile.close()
- --TearCont Read
- local tefile = fs.open("disk/tear.lua","r")
- local TearCont = tefile.readLine()
- tefile.close()
- if money == 0 then
- print("You don't have enougth money")
- sleep(2)
- disk.eject("right")
- os.reboot()
- end
- function line()
- term.clear()
- term.setCursorPos(1,1)
- term.write(string.rep("-", 51)) -- Repeat string x amount of times
- term.setCursorPos(1,19)
- term.write(string.rep("-", 51))
- end
- -- Menu Zone
- line()
- term.setCursorPos(1,2)
- print("Username: "..username)
- print("Current Money: "..money.. " Euros")
- print("Number of inputredients remaininput: "..cff)
- term.setCursorPos(1,6)
- if sugarCont == "0" then
- print("1.Extra Sugar = 5$ (Not Avalaible)")
- else
- print("1.Extra Sugar = 5$ (Avalaible)")
- end
- if BlazeCont == "0" then
- print("2.Strong = 10$ (Not Avalaible)")
- else
- print("2.Strong = 10$ (Avalaible)")
- end
- if CreamCont == "0" then
- print("3.Cream = 10$ (Not Avalaible)")
- else
- print("3.Cream = 10$ (Avalaible)")
- end
- if GoldenCont == "0.0" then
- print("4.Premium = 25$ (Not Avalaible)")
- else
- print("4.Premium = 25$ (Avalaible)")
- end
- if TearCont == "0" then
- print("5.Healthy = 30$ (Not Avalaible)")
- else
- print("5.Healthy = 30$ (Avalaible)")
- end
- print("6. Make Coffe")
- print("7. Exit")
- print ("Enter inputredient Selection : ")
- local input = read()
- if input == "1" then
- if tonumber(money) < 5 then
- print("You don't have enougth money")
- make()
- sleep(2)
- disk.eject("right")
- os.reboot()
- else
- m = money - 5.0
- local wfile = fs.open("disk/money.lua","w")
- wfile.write(m)
- wfile.close()
- c = cff - 1.0
- local cffile = fs.open("disk/coffe.lua","w")
- cffile.write(c)
- cffile.close()
- s = sugarCont - 1.0
- local scfile = fs.open("disk/sugar.lua","w")
- scfile.write(s)
- scfile.close()
- rednet.broadcast("sugar","cof2")
- os.reboot()
- end
- end
- if input == "2" then
- if tonumber(money) < 10 then
- print("You don't have enougth money")
- make()
- sleep(2)
- disk.eject("right")
- os.reboot()
- else
- m = money - 10.0
- local wfile = fs.open("disk/money.lua","w")
- wfile.write(m)
- wfile.close()
- c = cff - 1.0
- local cffile = fs.open("disk/coffe.lua","w")
- cffile.write(c)
- cffile.close()
- b = BlazeCont - 1.0
- local blfile = fs.open("disk/blaze.lua","w")
- blfile.write(s)
- blfile.close()
- rednet.broadcast("blaze","cof2")
- os.reboot()
- end
- end
- if input == "3" then
- if tonumber(money) < 10 then
- print("You don't have enougth money")
- make()
- sleep(2)
- disk.eject("right")
- os.reboot()
- else
- m = money - 10.0
- local wfile = fs.open("disk/money.lua","w")
- wfile.write(m)
- wfile.close()
- c = cff - 1.0
- local cffile = fs.open("disk/coffe.lua","w")
- cffile.write(c)
- cffile.close()
- cr = CreamCont - 1.0
- local crfile = fs.open("disk/cream.lua","w")
- crfile.write(cr)
- crfile.close()
- rednet.broadcast("cream","cof2")
- os.reboot()
- end
- end
- if input == "4" then
- if tonumber(money) < 25 then
- print("You don't have enougth money")
- make()
- sleep(2)
- disk.eject("right")
- os.reboot()
- else
- m = money - 25.0
- local wfile = fs.open("disk/money.lua","w")
- wfile.write(m)
- wfile.close()
- c = cff - 1.0
- local cffile = fs.open("disk/coffe.lua","w")
- cffile.write(c)
- cffile.close()
- g = GoldenCont - 1.0
- local gofile = fs.open("disk/golden.lua","w")
- gofile.write(g)
- gofile.close()
- rednet.broadcast("golden","cof2")
- os.reboot()
- end
- end
- if input == "5" then
- if tonumber(money) < 30 then
- print("You don't have enougth money")
- make()
- sleep(2)
- disk.eject("right")
- os.reboot()
- else
- m = money - 30.0
- local wfile = fs.open("disk/money.lua","w")
- wfile.write(m)
- wfile.close()
- c = cff - 1.0
- local cffile = fs.open("disk/coffe.lua","w")
- cffile.write(c)
- cffile.close()
- t = TearCont - 1.0
- local tefile = fs.open("disk/tear.lua","w")
- tefile.write(t)
- tefile.close()
- rednet.broadcast("tear","cof2")
- os.reboot()
- end
- end
- if input == "7" then
- inMainMenu = false
- disk.eject("right")
- os.reboot()
- end
- if input == "6" then
- rednet.broadcast("make","cof2")
- if redstone.getInput("bottom") == true then
- c = 6
- local cffile = fs.open("disk/coffe.lua","w")
- cffile.write(c)
- cffile.close()
- disk.eject("right")
- os.reboot()
- else
- term.clear()
- term.setCursorPos(1,1)
- term.write("---------------------------------------------------")
- term.setCursorPos(1,19)
- term.write("---------------------------------------------------")
- term.setCursorPos(15,9)
- print("Brewinput Coffe")
- term.setCursorPos(15,10)
- sleep(3)
- end
- end
- function make()
- rednet.broadcast("make","cof2")
- if redstone.getInput("bottom") == true then
- c = 6
- local cffile = fs.open("disk/coffe.lua","w")
- cffile.write(c)
- cffile.close()
- disk.eject("right")
- os.reboot()
- else
- term.clear()
- term.setCursorPos(1,1)
- term.write("---------------------------------------------------")
- term.setCursorPos(1,19)
- term.write("---------------------------------------------------")
- term.setCursorPos(15,9)
- print("Brewinput Coffe")
- term.setCursorPos(15,10)
- sleep(3)
- make()
- end
- end
- if tonumber(cff) == 0 then
- make()
- end
Advertisement
Add Comment
Please, Sign In to add comment