Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this script is used to print out ID Papers
- local SecurityCode = "3gd2y32"
- local Details
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function EditItem(item)
- local I = 1
- if item == "Name" then
- I = 1
- elseif item == "Address" then
- I = 2
- elseif item == "SecurityNumber" then
- I = 3
- elseif item == "Settlement" then
- I = 4
- elseif item == "Clearance" then
- I = 5
- end
- Clear()
- print(item)
- print("type answer, then press enter twice to save")
- print("Last Input = "..Details[I])
- local input
- local event, key
- repeat
- event, key = os.pullEvent("key")
- input = read()
- until key == keys.enter
- Details[I] = input
- DocDrawer()
- end
- function CUI(m) --declare function
- n=1
- local l = #m
- while true do
- CenterText(TimeSpot, os.date())
- term.setCursorPos(1,5)
- for i=1, #m, 1 do --traverse the table of options
- if i==n then term.clearLine() print(i, " ["..m[i].."]") else term.clearLine() print(i, " ", m[i]) end --print them
- end
- if b==keys.w and n>1 then n=n-1 end
- if b==keys.s and n<l then n=n+1 end
- if b==keys.enter then break end
- CenterText(TimeSpot, os.date())
- end
- return n --return the value
- end
- local function CleanDoc()
- Details = {"none","n","00000","spawn","0"}
- end
- local function PrintDoc()
- Clear()
- print("print Doc....")
- local printer = peripherals.find("printer")
- local Path = (Details[1].."_"..os.date())
- local file = fs.open(Path,"a")
- file.writeLine("--===ID===--")
- file.writeLine("Name: "..Details[1])
- file.writeLine("Clearance: "..Details[5])
- file.writeLine("Address : "..Details[2])
- file.writeLine("Settlement : "..Details[4])
- file.writeLine("Security Number : "..Details[3])
- file.writeLine("Printed on : "..os.date())
- file.writeLine("On Computer : "..os.computerID())
- file.writeLine(SecurityCode)
- printer.newPage()
- printer.setPageTitle(Details[1].." Identification")
- printer.write(file.readAll()
- printer.endPage()
- file.close()
- CleanDoc()
- Clear()
- DocDrawer()
- end
- local function DocDrawer()
- Clear()
- print("====Identification=Document====")
- local options = {"Name","Address","SecurityNumber","Settlement","Clearance","==print=="}
- local n = CUI(options)
- if options[n] == "Name" then
- EditItem("Name")
- elseif options[n] == "Address" then
- EditItem("Address")
- elseif options[n] == "SecurityNumber" then
- EditItem("SecurityNumber")
- elseif options[n] == "Settlement" then
- EditItem("Settlement")
- elseif options[n] == "Clearance" then
- EditItem("Clearance")
- elseif options[n] == "==print==" then
- PrintDoc()
- end
- end
- CleanDoc()
- Clear()
- DocDrawer()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement