Advertisement
tima_gt

tde-menu 3.4-alpha

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