Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Security Card Writer
- -- Requires Security Card API
- --checks if the card API is loaded If not tries to load it and if that fails throws an error
- if(not card)then
- if(os.loadAPI("card")~=true)then
- error("This program needs the security card API")
- end
- end
- local event, side
- term.clear()
- term.setCursorPos(1,1)
- while true do
- print("Please insert a disk to be written to")
- --pullEventRaw stops them from pressing Ctrl-T to terminate
- event, side = os.pullEventRaw("disk")
- if disk.hasAudio(side) then
- print("Wrong disk type")
- print("Press any key to continue...")
- os.pullEventRaw("key")
- else
- break
- end
- end
- print("What should the base level be?")
- local lvl1 = read()
- print("What should the secondary level be?")
- local lvl2 = read()
- print("What should the password be?")
- local pass = read()
- term.scroll(1)
- term.write("Writing")
- textutils.slowPrint("...")
- card.setDiskLevel(side, lvl1, lvl2, pass)
- print("Card has been named:\n Level: "..lvl1.."-"..lvl2.." Card")
- print("Your new security card will be ejected now")
- disk.eject(side)
- os.unloadAPI("card")
- --Good Programming Practice :)
Advertisement
Add Comment
Please, Sign In to add comment