Advertisement
Legebatterie

appStore

Jan 2nd, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. --Variables
  2. newAppName="AppName"
  3.  
  4. --Design
  5. paintutils.drawFilledBox(1,1,51,19,colors[col])
  6. paintutils.drawFilledBox(2,2,50,18,colors[colWind])
  7. paintutils.drawBox(2,2,50,18,colors.black)
  8. term.setTextColor(colors.black)
  9. term.setBackgroundColor(colors.red)
  10. term.setCursorPos(50,2)
  11. write("X")
  12.  
  13. term.setBackgroundColor(colors.lightGray)
  14. term.setTextColor(colors[colText])
  15. term.setCursorPos(36,3)
  16. write(" browse App ")
  17.  
  18. term.setCursorPos(3,3)
  19. write(" list Apps ")
  20.  
  21. term.setBackgroundColor(colors[colWind])
  22. term.setCursorPos(6,7)
  23. write("App-name")
  24. term.setCursorPos(23,7)
  25. write("creator")
  26. term.setCursorPos(39,7)
  27. write("pastebin")
  28.  
  29. term.setCursorPos(5,16)
  30. print("path: maxintosh/"..currentUser.."/programs/"..newAppName)
  31.  
  32.  
  33. term.setBackgroundColor(colors.green)
  34. term.setTextColor(colors.black)
  35. term.setCursorPos(22,11)
  36. write(" install ")
  37. term.setCursorPos(19,13)
  38. write("install via code")
  39.  
  40. --Click
  41. while true do
  42. event,n,x,y=os.pullEvent("mouse_click")
  43.  
  44. --X
  45. if x==50 and y==2 then
  46. error()
  47. end
  48.  
  49. -----Instant-Install----
  50. if y==13 then
  51. term.setBackgroundColor(colors[colWind])
  52. term.setTextColor(colors[colText])
  53. term.setCursorPos(19,14)
  54. write("code: ")
  55. code=read()
  56. sleep(0.5)
  57. paintutils.drawBox(19,14,40,14,colors[colWind])
  58. term.setCursorPos(19,14)
  59. write("name: ")
  60. name=read()
  61. sleep(0.5)
  62. term.setTextColor(colors[colWind])
  63. term.setCursorPos(5,8)
  64. shell.run("pastebin get",code,"maxintosh/"..currentUser.."/programs/"..name)
  65. term.setTextColor(colors[colText])
  66. paintutils.drawBox(19,14,40,14,colors[colWind])
  67. term.setCursorPos(22,14)
  68. write("success")
  69. sleep(1)
  70. paintutils.drawBox(19,14,40,14,colors[colWind])
  71.  
  72.  
  73. end
  74.  
  75. --Browse
  76. if x>35 and y==3 then
  77. paintutils.drawBox(36,3,49,3,colors.lightGray)
  78. term.setTextColor(colors[colText])
  79. term.setCursorPos(37,3)
  80. newAppName=read()
  81.  
  82. if fs.exists("maxintosh/appData/"..newAppName) then
  83. f=fs.open("maxintosh/appData/"..newAppName,"r")
  84. newAppName=f.readLine()
  85. newAppCreator=f.readLine()
  86. newAppCode=f.readLine()
  87. f.close()
  88.  
  89. term.setCursorPos(6,9)
  90. paintutils.drawBox(3,9,49,9,colors[colWind])
  91. term.setTextColor(colors[colText])
  92. term.setBackgroundColor(colors[colWind])
  93.  
  94. term.setCursorPos(6,9)
  95. write(newAppName)
  96. term.setCursorPos(23,9)
  97. write(newAppCreator)
  98. term.setCursorPos(39,9)
  99. write(newAppCode)
  100. paintutils.drawBox(5,16,49,16,colors[colWind])
  101. term.setCursorPos(5,16)
  102. print("path: maxintosh/"..currentUser.."/programs/"..newAppName)
  103.  
  104. else
  105. sleep(1)
  106. paintutils.drawBox(36,3,49,3,colors.lightGray)
  107. term.setTextColor(colors.red)
  108. term.setCursorPos(4,3)
  109. write(newAppName.." not found")
  110. end
  111. end
  112.  
  113. --Install
  114. if y==11 and not(newAppName=="appName") then
  115. term.setCursorPos(4,4)
  116. term.setBackgroundColor(colors[colWind])
  117. term.setTextColor(colors[colWind])
  118. shell.run("pastebin get ",newAppCode, "maxintosh/"..currentUser.."/programs/"..newAppName)
  119. term.setCursorPos(4,4)
  120. term.setTextColor(colors.green)
  121. sleep(1)
  122. print("succesfully installed "..newAppName)
  123. end
  124.  
  125. --List Apps
  126. if y==3 and x<25 then
  127. paintutils.drawFilledBox(4,4,48,16,colors[colWind])
  128. paintutils.drawBox(4,4,48,16,colors.black)
  129. term.setBackgroundColor(colors.red)
  130. term.setTextColor(colors.black)
  131. term.setCursorPos(48,4)
  132. write("X")
  133.  
  134. appList={}
  135. appList=fs.list("maxintosh/appData")
  136. max=table.maxn(appList)
  137.  
  138. i=1
  139. y=1
  140. while i<max do
  141. term.setTextColor(colors[colText])
  142. term.setBackgroundColor(colors[colWind])
  143. term.setCursorPos(6,y+5)
  144. write(appList[i])
  145. term.setCursorPos(21,y+5)
  146. write(tostring(appList[i+1]))
  147. term.setCursorPos(36,y+5)
  148. write(tostring(appList[i+2]))
  149. i=i+3
  150. y=y+2
  151. end
  152.  
  153. notXed=true
  154. while notXed==true do
  155. event,n,x,y=os.pullEvent("mouse_click")
  156.  
  157. if x==48 and y==4 then
  158. notXed=false
  159. shell.run("maxintosh/"..currentUser.."/programs/appStore")
  160. error()
  161. end
  162.  
  163. end
  164. end
  165.  
  166. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement