Advertisement
tima_gt

tde-menu 3.2

Dec 25th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.92 KB | None | 0 0
  1. local function default()
  2. term.setBackgroundColor(colors.black)
  3. term.setTextColor(colors.white)
  4. end
  5. local function searchApps()
  6. if fs.exists("tde-programs-cfg") then
  7. file = fs.open("tde-programs-cfg", "r")
  8. a = file.readLine()
  9. if a == "1" then
  10. a = 1
  11. elseif a == "2" then
  12. a = 2
  13. elseif a == "3" then
  14. a = 3
  15. elseif a == "4" then
  16. a = 4
  17. elseif a == "5" then
  18. a = 5
  19. else
  20. a = 0
  21. end
  22. i = 0
  23. progg = {}
  24. while i <= a do
  25. i = i + 1
  26. if a ~= 0 then
  27. progg[i] = file.readLine()
  28. end
  29. if (i == a) or (a == 0) then
  30. break
  31. end
  32. end
  33. os.loadAPI("advPrint")
  34. while true do
  35. default()
  36. term.clear()
  37. advPrint.tout(1, "X [Menu]")
  38. default()
  39. i = 0
  40.  
  41. while --[[progg[i] ~= nil not good thing]] true do
  42. i = i + 1
  43. if i == 1 then
  44. advPrint.tout(i + 2, "  "..progg[i])
  45. elseif i == a + 1 then
  46. break
  47. elseif i ~= 1 then
  48. print("  "..progg[i])
  49. elseif i == a then
  50. break
  51. end
  52. end
  53. i = 1
  54. local event, button, X, Y = os.pullEventRaw()
  55. if event == "mouse_click" then
  56. if a == 1 then
  57. if X >= 3 and X <= 13 and Y == 1 + 2 then
  58. term.clear()
  59. term.setCursorPos(1, 1)
  60. shell.run(progg[i])
  61. elseif X == 1 and Y == 1 then
  62. break
  63. end
  64. elseif a == 2 then
  65. if X >= 3 and X <= 13 and Y == 1 + 2 then
  66. term.clear()
  67. term.setCursorPos(1, 1)
  68. shell.run(progg[1])
  69. elseif X >= 3 and X <= 13 and Y == 2+2 then
  70. term.clear()
  71. term.setCursorPos(1, 1)
  72. shell.run(progg[2])
  73. elseif X == 1 and Y == 1 then
  74. break
  75. end
  76. end
  77. i = i + 1
  78. end
  79. end
  80. end
  81. end
  82. if not fs.exists("tde-programs-cfg") then
  83. default()
  84. term.clear()
  85. icon1 = paintutils.loadImage("tde-redstone-icon")
  86. os.loadAPI("advPrint")
  87. while true do
  88. default()
  89. term.clear()
  90. advPrint.tout(1, "X [Menu]")
  91. paintutils.drawImage(icon1, 3, 3)
  92. default()
  93. advPrint.tout(10, "   Redstone")
  94. local event, button, X, Y = os.pullEventRaw()
  95.   if event == "mouse_click" then
  96. if X == 1 and Y == 1 then
  97. break
  98. elseif X >= 3 and Y >= 3  and X <= 3 + 8 and Y <= 3 + 5 then
  99. shell.run("tde-redstone")
  100. end
  101. end
  102. end
  103. else
  104. searchApps()
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement