Advertisement
DOGGYWOOF

Card System Setup

Jun 18th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. -- Prompt user to insert a disk into the device
  2. print("Please insert a disk into the device and press Enter.")
  3. while not disk.isPresent("back") do
  4. os.pullEvent("disk")
  5. end
  6.  
  7. -- Download prhVcdAv from pastebin as startup in the root directory
  8. local startupCode = "prhVcdAv"
  9. local startupPath = "/startup"
  10. shell.run("pastebin", "get", startupCode, startupPath)
  11.  
  12. -- Once disk is inserted, create a directory /disk/Cards/ if it doesn't exist
  13. local cardsDir = "/disk/Cards"
  14. if not fs.exists(cardsDir) then
  15. fs.makeDir(cardsDir)
  16. end
  17.  
  18. -- Prompt user to insert an override card into the bottom drive and press Enter.
  19. print("Please insert an override card into the bottom drive and press Enter.")
  20. while not disk.isPresent("bottom") do
  21. os.pullEvent("disk")
  22. end
  23.  
  24. -- Download n5Mx91gK as /disk/touch.lua
  25. local touchCode = "n5Mx91gK"
  26. local touchPath = "/disk/touch.lua"
  27. shell.run("pastebin", "get", touchCode, touchPath)
  28.  
  29. -- Run touch.lua on the right monitor
  30. local monitorSide = "right"
  31. if peripheral.isPresent(monitorSide) and peripheral.getType(monitorSide) == "monitor" then
  32. shell.run(touchPath)
  33. else
  34. print("No monitor found on the right side.")
  35. end
  36.  
  37. -- Get the ID of the inserted disk
  38. local diskID = disk.getID("bottom")
  39. local diskName = tostring(diskID)
  40.  
  41. -- Save the disk ID as a file in /disk/ with the name as the disk's ID
  42. local diskFilePath = "/disk/" .. diskName
  43. local file = fs.open(diskFilePath, "w")
  44. file.writeLine(diskName)
  45. file.close()
  46.  
  47. print("Setup complete.")
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement