Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Rail Cart elevator monitor By Jonnathon Clayton (AKA THC Butterz) V2.0.0
- Note: For a great comptercraft controlled elevator check out Ominous Penguin's tutorial here:
- https://www.youtube.com/watch?v=OiMmMBS5e_s#t=756
- Special Thanks and Credit:
- Credit to ben657 for his config file API
- Special thanks to Ominous Penguin for tips and coding advice.
- -- Maximum of 16 floors, floors must have unique color wire
- -- Floors must be wired in color order per Color API
- -- Refer to the Color API here: http://computercraft.info/wiki/Colors_%28API%29
- -- floor 1 = white, floor 2 = orange, floor 16 = black etc...
- --]]
- fs.delete("req/config")
- shell.run("pastebin", "get", "rfqYgmrL", "req/config")
- print("Downloading Required Files")
- sleep(2)
- os.loadAPI("req/config")
- config.load("configs","server")
- term.clear()
- config.writeVal("floors","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("bcol","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("tcol","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("scal","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f1","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f2","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f3","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f4","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f5","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f6","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f7","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f8","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f9","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f10","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f11","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f12","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f13","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f14","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f15","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("f16","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m1","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m2","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m3","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m4","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m5","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m6","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m7","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m8","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m9","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m10","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m11","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m12","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m13","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m14","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m15","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- config.writeVal("m16","nil")
- config.save()
- config.load("configs","server")
- term.clear()
- term.setCursorPos(1, 1)
- print("What color do you want the monitor backgrounds to be?")
- tbcol = string.lower(io.read())
- if tbcol == "white" then
- bcol = 1
- else if tbcol == "orange" then
- bcol = 2
- else if tbcol == "magenta" then
- bcol = 4
- else if tbcol == "lightblue" then
- bcol = 8
- else if tbcol == "yellow" then
- bcol = 16
- else if tbcol == "lime" then
- bcol = 32
- else if tbcol == "pink" then
- bcol = 64
- else if tbcol == "grey" then
- bcol = 128
- else if tbcol == "lightgrey" then
- bcol = 256
- else if tbcol == "cyan" then
- bcol = 512
- else if tbcol == "purple" then
- bcol = 1024
- else if tbcol == "blue" then
- bcol = 2048
- else if tbcol == "brown" then
- bcol = 4096
- else if tbcol == "green" then
- bcol = 8192
- else if tbcol == "red" then
- bcol = 16384
- else if tbcol == "black" then
- bcol = 32768
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- config.writeVal("bcol",bcol)
- config.save()
- config.load("configs","server")
- term.clear()
- term.setCursorPos(1, 1)
- print("What color do you want the monitor text to be?")
- ttcol = string.lower(io.read())
- if ttcol == "white" then
- tcol = 1
- else if ttcol == "orange" then
- tcol = 2
- else if ttcol == "magenta" then
- tcol = 4
- else if ttcol == "lightblue" then
- tcol = 8
- else if ttcol == "yellow" then
- tcol = 16
- else if ttcol == "lime" then
- tcol = 32
- else if ttcol == "pink" then
- tcol = 64
- else if ttcol == "grey" then
- tcol = 128
- else if ttcol == "lightgrey" then
- tcol = 256
- else if ttcol == "cyan" then
- tcol = 512
- else if ttcol == "purple" then
- tcol = 1024
- else if ttcol == "blue" then
- tcol = 2048
- else if ttcol == "brown" then
- tcol = 4096
- else if ttcol == "green" then
- tcol = 8192
- else if ttcol == "red" then
- tcol = 16384
- else if ttcol == "black" then
- tcol = 32768
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- config.writeVal("tcol",tcol)
- config.save()
- config.load("configs","server")
- term.clear()
- term.setCursorPos(1, 1)
- print("On a scale from 1 to 5")
- term.setCursorPos(1, 2)
- print("1 being tiny and 5 being massive")
- term.setCursorPos(1, 3)
- print("How big do you want the monitor text?")
- scal = tonumber(read())
- config.writeVal("scal",scal)
- config.save()
- config.load("configs","server")
- term.clear()
- term.setCursorPos(1, 1)
- print("How many floors do you have?")
- number = tonumber(read())
- config.writeVal("floors",number)
- config.save()
- config.load("configs","server")
- term.clear()
- term.setCursorPos(1, 1)
- nof = tonumber(config.readVal("floors"))
- if nof >= 2 then
- if nof <= 16 then
- term.clear()
- term.setCursorPos(1, 1)
- print("What is the name of your first floor?")
- f1 = read()
- config.writeVal("f1",f1)
- print("What is the number of your first floor monitor?")
- m1 = read()
- config.writeVal("m1",m1)
- config.save()
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your second floor?")
- f2 = read()
- config.writeVal("f2",f2)
- print("What is the number of your second floor monitor?")
- m2 = read()
- config.writeVal("m2",m2)
- config.save()
- if nof >= 3 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your third floor?")
- f3 = read()
- config.writeVal("f3",f3)
- print("What is the number of your third floor monitor?")
- m3 = read()
- config.writeVal("m3",m3)
- config.save()
- end
- if nof >= 4 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your forth floor?")
- f4 = read()
- config.writeVal("f4",f4)
- print("What is the number of your forth floor monitor?")
- m4 = read()
- config.writeVal("m4",m4)
- config.save()
- end
- if nof >= 5 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your fifth floor?")
- f5 = read()
- config.writeVal("f5",f5)
- print("What is the number of your fifth floor monitor?")
- m5 = read()
- config.writeVal("m5",m5)
- config.save()
- end
- if nof >= 6 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your sixth floor?")
- f6 = read()
- config.writeVal("f6",f6)
- print("What is the number of your sixth floor monitor?")
- m6 = read()
- config.writeVal("m6",m6)
- config.save()
- end
- if nof >= 7 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your seventh floor?")
- f7 = read()
- config.writeVal("f7",f7)
- print("What is the number of your seventh floor monitor?")
- m7 = read()
- config.writeVal("m7",m7)
- config.save()
- end
- if nof >= 8 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your eighth floor?")
- f8 = read()
- config.writeVal("f8",f8)
- print("What is the number of your eighth floor monitor?")
- m8 = read()
- config.writeVal("m8",m8)
- config.save()
- end
- if nof >= 9 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your ninth floor?")
- f9 = read()
- config.writeVal("f9",f9)
- print("What is the number of your ninth floor monitor?")
- m9 = read()
- config.writeVal("m9",m9)
- config.save()
- end
- if nof >= 10 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your tenth floor?")
- f10 = read()
- config.writeVal("f10",f10)
- print("What is the number of your tenth floor monitor?")
- m10 = read()
- config.writeVal("m10",m10)
- config.save()
- end
- if nof >= 11 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your eleventh floor?")
- f11 = read()
- config.writeVal("f11",f11)
- print("What is the number of your eleventh floor monitor?")
- m11 = read()
- config.writeVal("m11",m11)
- config.save()
- end
- if nof >= 12 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your twelfth floor?")
- f12 = read()
- config.writeVal("f12",f12)
- print("What is the number of your twelfth floor monitor?")
- m12 = read()
- config.writeVal("m12",m12)
- config.save()
- end
- if nof >= 13 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your thirteenth floor?")
- f13 = read()
- config.writeVal("f13",f13)
- print("What is the number of your thirteenth floor monitor?")
- m13 = read()
- config.writeVal("m13",m13)
- config.save()
- end
- if nof >= 14 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your fourteenth floor?")
- f14 = read()
- config.writeVal("f14",f14)
- print("What is the number of your fourteenth floor monitor?")
- m14 = read()
- config.writeVal("m14",m14)
- config.save()
- end
- if nof >= 15 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your fifteenth floor?")
- f15 = read()
- config.writeVal("f15",f15)
- print("What is the number of your fifteenth floor monitor?")
- m15 = read()
- config.writeVal("m15",m15)
- config.save()
- end
- if nof >= 16 then
- term.clear()
- term.setCursorPos(1, 1)
- config.load("configs","server")
- print("What is the name of your sixteenth floor?")
- f16 = read()
- config.writeVal("f16",f16)
- print("What is the number of your sixteenth floor monitor?")
- m16 = read()
- config.writeVal("m16",m16)
- config.save()
- end
- fs.delete("server.lua")
- if not shell.run("pastebin", "get", "kULurzKm", "server.lua") then
- print("A error occurred, please try again!")
- return
- end
- file = io.open("/startup", "w")
- file:write("shell.run(\"/"..shell.resolve(".").."/server.lua\")")
- file:close()
- term.write("Done")
- term.clear()
- term.setCursorPos(1, 1)
- print("Setup is complete press any key to reboot")
- os.pullEvent("key")
- os.reboot()
- else
- print("This program only supports 16 floors")
- print("please re-run this script and try again")
- end
- else
- print("You need at least 2 floors")
- print("please re-run this script and try again")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement