Legebatterie

maxintosh2--settings

Dec 21st, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1. os.loadAPI("maxintosh/mAPI")
  2.  
  3. --Style
  4.  
  5. paintutils.drawFilledBox(44,1,51,6,colors.white)
  6. term.setCursorPos(44,1)
  7. term.setTextColor(colors.purple)
  8. write("Settings")
  9. term.setTextColor(colors[colText])
  10. term.setCursorPos(44,2)
  11. write("Design")
  12. term.setCursorPos(44,3)
  13. write("Bios")
  14. term.setCursorPos(44,4)
  15. write(currentUser)
  16. term.setCursorPos(44,5)
  17. print("System")
  18. term.setCursorPos(44,6)
  19. write("Programs")
  20.  
  21.  
  22.  
  23. --Testing for click
  24.  
  25. while true do
  26. event,n,x,y=os.pullEvent("mouse_click")
  27.  
  28. --Settings
  29. if x>43 and y==1 then
  30. shell.run("maxintosh/desktop")
  31. error()
  32. end
  33.  
  34. --Bios
  35. if x>43 and y==3 then
  36. term.setTextColor(colors.purple)
  37. term.setCursorPos(1,19)
  38. textutils.slowPrint("..entering Bios..")
  39. term.setCursorPos(1,18)
  40. sleep(0.5)
  41. term.setBackgroundColor(colors.black)
  42. term.clear()
  43. shell.run("clear")
  44. print("--Bios--")
  45. print()
  46. term.setTextColor(colors.white)
  47. error()
  48. end
  49.  
  50. --System
  51. if x>43 and y==5 then
  52.  
  53. mAPI.drawWindow(2,2,colWind)
  54.  
  55. term.setBackgroundColor(colors[colWind])
  56. term.setTextColor(colors[colText])
  57.  
  58. term.setCursorPos(4,4)
  59. write("reinstall Maxintosh")
  60. term.setCursorPos(4,7)
  61. write("uninstall Maxintosh")
  62. term.setCursorPos(4,11)
  63. write("change ServerID:")
  64. term.setCursorPos(44,3)
  65. print("ID:",os.getComputerID())
  66.  
  67. while true do
  68. event,n,x,y=os.pullEvent("mouse_click")
  69.  
  70. if x==50 and y==2 then
  71. shell.run("maxintosh/desktop")
  72. error()
  73. end
  74.  
  75. if y==4 and x<25 and x>3 then
  76. term.setCursorPos(1,1)
  77. term.setBackgroundColor(colors.black)
  78. term.setTextColor(colors.white)
  79. shell.run("clear")
  80. fs.delete("startup")
  81. shell.run("pastebin run rMhPLm9D")
  82. error()
  83. end
  84.  
  85. if y==7 and x<25 and x>3 then
  86. fs.delete("startup")
  87. fs.delete("maxintosh")
  88. os.reboot()
  89. end
  90.  
  91. if y==11 then
  92. term.setCursorPos(21,11)
  93. newID=read()
  94. file=fs.open("maxintosh/serverID","w")
  95. file.writeLine(newID)
  96. file.close()
  97. end
  98.  
  99. end
  100.  
  101. end
  102.  
  103. --Account
  104. if x>43 and y==4 then
  105.  
  106.  
  107. mAPI.drawWindow(2,2,colWind)
  108.  
  109. term.setBackgroundColor(colors[colWind])
  110. term.setTextColor(colors[colText])
  111. term.setCursorPos(22,6)
  112. write("Logout")
  113. term.setCursorPos(6,10)
  114. write("change Password")
  115. term.setCursorPos(6,14)
  116. write("delete Account")
  117.  
  118. while true do
  119. event,n,x,y=os.pullEvent("mouse_click")
  120.  
  121. if x==50 and y==2 then
  122. shell.run("maxintosh/desktop")
  123. error()
  124. end
  125.  
  126. if x>22 and x<29 and y==6 then
  127. shell.run("maxintosh/login")
  128. error()
  129. end
  130.  
  131. if x>5 and x<23 and y==14 then
  132. fs.delete("maxintosh/logindata/"..currentUser)
  133. fs.delete("maxintosh/"..currentUser)
  134. os.shutdown()
  135. error()
  136. end
  137.  
  138. if x>5 and x<22 and y==10 then
  139. term.setCursorPos(26,10)
  140. write("new password: ")
  141. newPassword=read()
  142. file=fs.open("maxintosh/logindata/"..currentUser,"w")
  143. file.writeLine(newPassword)
  144. file.close()
  145. paintutils.drawBox(26,10,47,10,colors[colWindow])
  146. term.setCursorPos(26,10)
  147. print(" changed to ",newPassword)
  148. end
  149. end
  150. end
  151.  
  152. --Design
  153. if x>43 and y==2 then
  154.  
  155.  
  156. mAPI.drawWindow(2,2,colWind)
  157.  
  158. term.setBackgroundColor(colors[colWind])
  159. term.setTextColor(colors[colText])
  160. term.setCursorPos(4,5)
  161. write("Desktop Color")
  162. term.setCursorPos(4,8)
  163. write("Window Color")
  164. term.setCursorPos(4,11)
  165. write("Text Color")
  166. term.setCursorPos(4,14)
  167. write("change Desktop Picture")
  168.  
  169. while true do
  170. event,n,x,y=os.pullEvent("mouse_click")
  171.  
  172. if x==50 and y==2 then
  173. shell.run("maxintosh/desktop")
  174. error()
  175. end
  176.  
  177. if x>3 and x<20 and y==5 then
  178. term.setCursorPos(19,5)
  179. write("new Color: ")
  180. newColor=read()
  181. paintutils.drawBox(19,5,48,5,colors[colWindow])
  182. file=fs.open("maxintosh/"..currentUser.."/color","w")
  183. file.writeLine(newColor)
  184. file.writeLine(colWind)
  185. file.writeLine(colText)
  186. col=newColor
  187. file.close()
  188. end
  189.  
  190. if x>3 and x<20 and y==8 then
  191. term.setCursorPos(18,8)
  192. write("new Color: ")
  193. newColor=read()
  194. paintutils.drawBox(18,8,48,8,colors[colWindow])
  195. file=fs.open("maxintosh/"..currentUser.."/color","w")
  196. file.writeLine(col)
  197. file.writeLine(newColor)
  198. file.writeLine(colText)
  199. colWind=newColor
  200. file.close()
  201. end
  202.  
  203. if x>3 and x<20 and y==11 then
  204. term.setCursorPos(16,11)
  205. write("new Color: ")
  206. newColor=read()
  207. paintutils.drawBox(16,11,48,11,colors[colWindow])
  208. file=fs.open("maxintosh/"..currentUser.."/color","w")
  209. file.writeLine(col)
  210. file.writeLine(colWind)
  211. file.writeLine(newColor)
  212. colText=newColor
  213. file.close()
  214. end
  215.  
  216. if x>3 and x<20 and y==14 then
  217. term.setCursorPos(1,1)
  218. term.setBackgroundColor(colors.black)
  219. term.setTextColor(colors.white)
  220. term.clear()
  221. shell.run("paint maxintosh/"..currentUser.."/desktopBackground")
  222. shell.run("maxintosh/desktop")
  223. end
  224.  
  225. end
  226. end
  227.  
  228. --PROGRAMS
  229. if x>43 and y==6 then
  230. mAPI.drawWindow(2,2,colWind)
  231.  
  232. Programs={}
  233. yToP={}
  234. Programs=fs.list("maxintosh/"..currentUser.."/programs/")
  235. max=table.getn(Programs)
  236.  
  237. term.setTextColor(colors[colText])
  238. term.setBackgroundColor(colors[colWind])
  239. term.setCursorPos(31,4)
  240. if not(colWind=="green") then term.setTextColor(colors.green) end
  241. write("create new Program")
  242. term.setTextColor(colors[colText])
  243.  
  244.  
  245. for i=1,max do
  246. term.setCursorPos(4,((i*2)+2))
  247. write(Programs[i])
  248. yToP[(i*2)+2]=Programs[i]
  249. end
  250.  
  251. while true do
  252. event,n,x,y=os.pullEvent("mouse_click")
  253.  
  254. if x==50 and y==2 then
  255. shell.run("maxintosh/desktop")
  256. error()
  257. end
  258. if x>30 and y==4 then
  259. term.setCursorPos(29,6)
  260. write("name: ")
  261. PName=read()
  262. shell.run("edit maxintosh/"..currentUser.."/programs/"..PName)
  263. shell.run("maxintosh/desktop")
  264. error()
  265. end
  266. if not(yToP[y]==nil) and x<20 then
  267. name=y
  268. if n==1 then
  269. shell.run("maxintosh/"..currentUser.."/programs/"..yToP[name])
  270. shell.run("maxintosh/desktop")
  271. error()
  272. elseif n==2 then
  273. mAPI.drawWindow(5,4,colWin)
  274. term.setTextColor(colors[colText])
  275. term.setBackgroundColor(colors[colWind])
  276. term.setCursorPos(7,6)
  277. write(yToP[name])
  278. term.setCursorPos(22,10)
  279. write("uninstall")
  280. term.setCursorPos(23,12)
  281. write("rename")
  282. term.setCursorPos(24,8)
  283. write("edit")
  284.  
  285. while true do
  286. event,n,x,y=os.pullEvent("mouse_click")
  287. if y==4 then
  288. shell.run("maxintosh/desktop")
  289. error()
  290. end
  291. if y==8 then
  292. shell.run(" edit maxintosh/"..currentUser.."/programs/"..yToP[name])
  293. shell.run("maxintosh/desktop")
  294. error()
  295. end
  296.  
  297.  
  298. if y==10 then
  299. fs.delete("maxintosh/"..currentUser.."/programs/"..yToP[name])
  300. shell.run("maxintosh/desktop")
  301. error()
  302. end
  303. if y==12 then
  304. term.setCursorPos(22,13)
  305. n=read()
  306. fs.copy("maxintosh/"..currentUser.."/programs/"..yToP[name],"maxintosh/"..currentUser.."/programs/"..n)
  307. fs.delete("maxintosh/"..currentUser.."/programs/"..yToP[name])
  308. paintutils.drawBox(22,13,40,13,colors[colWind])
  309. end
  310. end
  311. end
  312.  
  313. end
  314. end
  315.  
  316. end
  317. end
Advertisement
Add Comment
Please, Sign In to add comment