Advertisement
Marlingaming

CC Tweaked CCSPS Iron - Train Net App

Feb 1st, 2022 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. local Username = "guest"
  2. local AccountID = "0"
  3.  
  4. local function Clear()
  5. term.clear()
  6. term.getCursorPos(1,1)
  7. end
  8.  
  9. local function GetStatus(line)
  10. local id = rednet.lookup("TrainNet_M")
  11. rednet.send(id,line)
  12. local a, b, c = rednet.receive()
  13. return(b)
  14. end
  15.  
  16. local function WirelessLogin()
  17. local AccountDetails = AccountID
  18. rednet.host("1000",Username)
  19. local id, message = rednet.receive()
  20. rednet.send(id, AccountDetails,"1000")
  21. end
  22.  
  23. function CUI(m) --declare function
  24. n=1
  25. local l = #m
  26. while true do
  27. term.setCursorPos(1,5)
  28. for i=1, #m, 1 do --traverse the table of options
  29. if i==n then term.clearLine() print(i, ">",m[i]) else term.clearLine() print(i, "-", m[i]) end --print them
  30. end
  31. a, b= os.pullEvent("key") --wait for keypress
  32. if b==keys.w and n>1 then n=n-1 end
  33. if b==keys.s and n<l then n=n+1 end
  34. if b==keys.enter then break end
  35. end
  36. return n --return the value
  37. end
  38.  
  39. function Login()
  40. local file = fs.open("os/System/Client/Files/.UserFile","r")
  41. Username = file.readLine()
  42. file.close()
  43. end
  44.  
  45. function LinesScreen()
  46. Clear()
  47. print("Operating Lines")
  48. local options = {"exit"}
  49. local n = CUI(options)
  50. if options[n] == "exit" then
  51. Menu()
  52. else
  53. LineDisplay(n)
  54. end
  55. end
  56.  
  57. function AccountScreen()
  58. Clear()
  59. print("hello ",Username)
  60. print("=Account Details=")
  61. print("WIP")
  62. print("press enter to exit")
  63. repeat
  64. local event, key = os.pullEvent("key")
  65. until key == keys.enter
  66. Menu()
  67. end
  68.  
  69. function PassScreen()
  70. print("coming soon!")
  71. print("press enter to exit")
  72. repeat
  73. local event, key = os.pullEvent("key")
  74. until key == keys.enter
  75. Menu()
  76. end
  77.  
  78. function Menu()
  79. Clear()
  80. local options = {"Find_Line","Check_Account","Passes","exit"}
  81. local n = CUI(options)
  82. if options[n] == "Find_Line" then
  83. LinesScreen()
  84. elseif options[n] == "Check_Account" then
  85. AccountScreen()
  86. elseif options[n] == "Passes" then
  87. PassScreen()
  88. elseif options[n] == "exit" then
  89.  
  90. end
  91. end
  92.  
  93. Login()
  94. Menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement