Creeper9207

pfm

Feb 8th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.70 KB | None | 0 0
  1. root = "/"
  2. scroll = 0
  3. allowScroll = false
  4. scrollText = ""
  5. rendLine = true
  6. fileSelected = ""
  7. clickDoubleTimer = false
  8. lasClickDoubleTimer = false
  9. cdTimer = 0
  10. cdLasTimer = 0
  11. cdTotalTimer = 0
  12. copyFile = ""
  13. deleteFiles = true
  14. openWith = ""
  15. Who = "By Felix"
  16. instaClose = true
  17. Version = "Lemon File Manager v0.9.8"
  18. timeX = ""
  19. renderTime = true
  20. dragLasY = 0
  21. changepos = true
  22. --TEXT ENTER VAR
  23. enterText = false
  24. textData = ""
  25. textPurpose = ""
  26. --END
  27. fSetFile = true
  28. loopRun = true
  29. w, h = term.getSize()
  30. h = h - 1
  31. renderXX = true
  32. --DEBUG FEATURE REMOVE
  33. renstr = ""
  34. --END
  35. blackStr = ""
  36. for i=1,w do
  37. blackStr = blackStr.." "
  38. end
  39. menuVisible = false
  40. menuX = w + 50
  41. menuY = h + 51
  42. menuWidth = 10
  43. menuHeight = 7
  44. menuItems = {}
  45. menuItemsRenX = {}
  46. filesx = {}
  47. directoriesx = {}
  48. xtra = 3
  49. screenpos = {}
  50. filepos = {}
  51. menuCheck = false
  52.  
  53. function startMain()
  54.  
  55. function Even(number)
  56. even = true
  57. for i=1,number do
  58. if even == true then
  59. even = false
  60. else
  61. even = true
  62. end
  63. end
  64. return even
  65. end
  66.  
  67. function displayError(errorA)
  68. renderXX = false
  69. term.clear()
  70. term.setCursorPos(w / 2 + string.len(errorA) / 2, h + 1 / 2)
  71. write(errorA)
  72. os.pullEvent("key")
  73. renderXX = true
  74. end
  75.  
  76. function keyPressWait()
  77. print("[Lemon] Press Any Key...")
  78. os.pullEvent("key")
  79. end
  80.  
  81. function fManRun(locationPath)
  82. if fs.exists(locationPath) == true then
  83. if openWith ~= "" then
  84. renderXX = false
  85. term.setBackgroundColor(colors.black)
  86. term.setTextColor(colors.white)
  87. term.clear()
  88. term.setCursorPos(1, 1)
  89. shell.run(locationPath, tostring(openWith))
  90. print("[Lemon] Press Any Key...")
  91. os.pullEvent("key")
  92. renderXX = true
  93. openWith = ""
  94. else
  95. renderXX = false
  96. term.setBackgroundColor(colors.black)
  97. term.setTextColor(colors.white)
  98. term.clear()
  99. term.setCursorPos(1, 1)
  100. shell.run(locationPath)
  101. print("[Lemon] Press Any Key...")
  102. os.pullEvent("key")
  103. renderXX = true
  104. end
  105. end
  106. end
  107.  
  108. function dataReader(data, sep, onelas, cooler)
  109. if type(data) == "string" then
  110. dataR = {}
  111. dataR[1] = ""
  112. readingIndex = 1
  113. for i=1,string.len(data) do
  114. currChar = string.sub(data, i, i)
  115. if currChar == sep then
  116. readingIndex = readingIndex + 1
  117. dataR[readingIndex] = ""
  118. else
  119. dataR[readingIndex] = dataR[readingIndex]..currChar
  120. end
  121. end
  122. else
  123. dataR[1] = ""
  124. end
  125. if onelas == 1 then
  126. dataR[1] = dataR[readingIndex]
  127. end
  128. if cooler == 1 then
  129. dataR[1] = readingIndex
  130. end
  131. return dataR
  132. end
  133.  
  134. function menuResolve(menuString, argsxx)
  135. if menuString == "Run" then
  136. if fs.isDir(root..fileSelected) == false then
  137. fManRun(root..fileSelected)
  138. else
  139. if changepos == true then
  140. root = root..fileSelected.."/"
  141. end
  142. fileSelected = ""
  143. end
  144. elseif menuString == "Edit" then
  145. if fs.isDir(root..fileSelected) == false then
  146. renderXX = false
  147. term.setBackgroundColor(colors.black)
  148. term.setTextColor(colors.white)
  149. term.clear()
  150. term.setCursorPos(1, 1)
  151. shell.run("edit", root..fileSelected)
  152. renderXX = true
  153. end
  154. elseif menuString == "Copy" then
  155. copyFile = root..fileSelected
  156. elseif menuString == "Delete" then
  157. if fs.exists(root..fileSelected) == true then
  158. if deleteFiles == true then
  159. fs.delete(root..fileSelected)
  160. fileSelected = nil
  161. end
  162. end
  163. elseif menuString == "Deselect" then
  164. if changepos == true then
  165. fileSelected = ""
  166. end
  167. elseif menuString == "Open with" then
  168. if openWith == "" then
  169. openWith = root..fileSelected
  170. else
  171. openWith = ""
  172. end
  173. elseif menuString == "Yes" then
  174. loopRun = false
  175. term.setBackgroundColor(colors.black)
  176. term.setTextColor(colors.white)
  177. term.clear()
  178. term.setCursorPos(1, 1)
  179. loopRun = false
  180. sleep(1)
  181. shell.run("/.os/gui")
  182. elseif menuString == "No" then
  183. fSetFile = true
  184. if fileSelected == "" then
  185. menuItems = {"Paste", "New", "nfx"}
  186. menuItemsRenX = {" Paste ", " New ", "New Folder"}
  187. else
  188. menuItems = {"Run", "----------", "Edit", "Copy", "Delete", "Deselect", "Open with", "rnm"}
  189. menuItemsRenX = {" Run ", "----------", " Edit ", " Copy ", " Delete ", " Deselect ", "Open With.", " Rename "}
  190. end
  191. elseif menuString == "nfx" then
  192. enterText = true
  193. textData = ""
  194. textPurpose = "nf"
  195. elseif menuString == "nf" then
  196. if argsxx ~= nil then
  197. if fs.exists(root..argsxx) == false then
  198. fs.makeDir(argsxx)
  199. fileSelected = argsxx
  200. end
  201. end
  202. elseif menuString == "Paste" then
  203. if fs.exists(copyFile) == true then
  204. copyFileString = dataReader(copyFile, "/", 1)[1]
  205. if fs.exists(root..copyFileString) == true then
  206.  
  207. else
  208.  
  209. end
  210. copyFileRoot = ""
  211. rootsX = tostring(dataReader(copyFile, "/", 0, 1)[1])
  212. --rootsX = 3
  213. for i=2,rootsX - 1 do
  214. copyFileRoot = copyFileRoot.."/"..dataReader(copyFile, "/", 0, 0)[i]
  215. end
  216. copyFileRoot = copyFileRoot.."/"
  217. rnn = copyFileString
  218. num = 2
  219. errorX = false
  220. if fs.exists(root..rnn) == true then
  221. while true do
  222. if fs.exists(root..rnn) == true then
  223. rnn = copyFileString
  224. rnn = rnn..tostring(num)
  225. num = num + 1
  226. else
  227. break
  228. end
  229. end
  230. end
  231. if fs.isDir(copyFile) == true then
  232. fs.copy(copyFile, root..rnn)
  233. else
  234. readerX = fs.open(copyFile, "r")
  235. copyDataX = readerX.readAll()
  236. readerX.close()
  237. writerX = fs.open(root..rnn, "w")
  238. writerX.write(copyDataX)
  239. writerX.close()
  240. end
  241. end
  242. elseif menuString == "rnm" then
  243. changepos = false
  244. enterText = true
  245. textData = ""
  246. textPurpose = "rename"
  247. elseif menuString == "rename" then
  248. if fileSelected ~= nil and fileSelected ~= "" then
  249. if fs.exists(root..tostring(argsxx)) == false then
  250. fs.copy(root..fileSelected, root..tostring(argsxx))
  251. fs.delete(root..fileSelected)
  252. fileSelected = nil
  253. end
  254. changepos = true
  255. end
  256. elseif menuString == "New" then
  257. enterText = true
  258. textData = ""
  259. textPurpose = "nw"
  260. elseif menuString == "nw" then
  261. if fs.exists(root..argsxx) == false then
  262. fileNew = fs.open(root..argsxx, "w")
  263. fileNew.write("")
  264. fileNew.close()
  265. fileSelected = argsxx
  266. end
  267. else
  268.  
  269. end
  270. end
  271.  
  272. function backUpRoot(rootP)
  273. if rootP ~= "/" then
  274. rootx = rootP
  275. lef = string.len(rootP) - 1
  276. for i=1,string.len(rootP) do
  277. check = i + lef
  278. check = check - 1
  279. if check > 0 then
  280. --DO CHECK HERE
  281. if string.sub(rootP, check, check) == "/" then
  282. break
  283. end
  284. --END CHECK HERE
  285. lef = lef - 2
  286. end
  287. end
  288. rootx = string.sub(rootx, 1, check)
  289. else
  290. rootx = rootP
  291. end
  292. return rootx
  293. end
  294.  
  295. function getFiles(path, many)
  296. files = {"", ""}
  297. mIndex = 1
  298. cout = 0
  299. sDir = shell.resolve( path )
  300. local tAll = fs.list( sDir )
  301. for n, sItem in pairs( tAll ) do
  302. local sPath = fs.combine( sDir, sItem )
  303. if fs.isDir( sPath ) == false then
  304. files[mIndex] = dataReader(sPath, "/", 1)[1]
  305. mIndex = mIndex + 1
  306. files[mIndex] = ""
  307. cout = cout + 1
  308. end
  309. end
  310. if many == 1 then
  311. files[1] = cout
  312. end
  313. return files
  314. end
  315.  
  316. function getDirectories(path, many)
  317. directories = {"", ""}
  318. mIndex = 1
  319. cout = 0
  320. sDir = shell.resolve( path )
  321. local tAll = fs.list( sDir )
  322. for n, sItem in pairs( tAll ) do
  323. local sPath = fs.combine( sDir, sItem )
  324. if fs.isDir( sPath ) then
  325. directories[mIndex] = dataReader(sPath, "/", 1)[1]
  326. mIndex = mIndex + 1
  327. directories[mIndex] = ""
  328. cout = cout + 1
  329. end
  330. end
  331. if many == 1 then
  332. directories[1] = cout
  333. end
  334. return directories
  335. end
  336.  
  337. function updateList()
  338. filesMany = getFiles(root, 1)[1]
  339. directoriesMany = getDirectories(root, 1)[1]
  340. filesx = getFiles(root, 0)
  341. directoriesx = getDirectories(root, 0)
  342. scrollText = ""
  343. for i=1,w / 2 do
  344. scrollText = scrollText.."v"
  345. end
  346. for i=1,w / 2 do
  347. scrollText = scrollText.."^"
  348. end
  349. if fileSelected == nil or fileSelected == " " then
  350. fileSelected = ""
  351. end
  352. menuVisible = true
  353. menuX = w - menuWidth - 1
  354. menuY = 2
  355. renstr = openWith
  356. if fSetFile == true then
  357. if fileSelected == "" or fileSelected == nil or fileSelected == " " then
  358. menuItems = {"Paste", "New", "nfx"}
  359. menuItemsRenX = {" Paste ", " New File ", "New Folder"}
  360. else
  361. menuItems = {"Run", "----------", "Edit", "Copy", "Delete", "Deselect", "Open with", "rnm"}
  362. menuItemsRenX = {" Run ", "----------", " Edit ", " Copy ", " Delete ", " Deselect ", "Open With.", " Rename "}
  363. end
  364. end
  365. menuHeight = table.getn(menuItems)
  366. timeX = tostring(textutils.formatTime(os.time(), false))
  367. if string.sub(root, string.len(root) - 1, string.len(root)) == "//" then
  368. root = string.sub(root, 1, string.len(root) - 1)
  369. end
  370. end
  371.  
  372. function render()
  373. while loopRun == true do
  374. sleep(0)
  375. if loopRun == false then
  376. term.setBackgroundColor(colors.black)
  377. term.setTextColor(colors.white)
  378. term.clear()
  379. term.setCursorPos(1, 1)
  380. end
  381. if renderXX == true then
  382. if clickDoubleTimer ~= lasClickDoubleTimer then
  383. if clickDoubleTimer == true then
  384. cdTimer = os.time()
  385. cdLasTimer = os.time()
  386. else
  387. cdTotalTimer = 0
  388. end
  389. lasClickDoubleTimer = clickDoubleTimer
  390. end
  391. if clickDoubleTimer == true then
  392. cdTimer = os.time()
  393. cdTotalTimer = cdTimer - cdLasTimer
  394. if cdTotalTimer > 0.003 then
  395. clickDoubleTimer = false
  396. end
  397. end
  398. term.setBackgroundColor(colors.white)
  399. term.clear()
  400. ind = 1
  401. allowScroll = true
  402. for i=4,h do
  403. term.setCursorPos(1, i)
  404. --RENDER AND DOCUMENT ALL FILES!!
  405. if directoriesx[i - 3 + scroll] ~= nil and directoriesx[i - 3 + scroll] ~= "" then
  406. term.setBackgroundColor(colors.gray)
  407. term.setTextColor(colors.white)
  408. write("[=]")
  409. term.setBackgroundColor(colors.white)
  410. term.setTextColor(colors.gray)
  411. screenpos[i] = directoriesx[i - 3 + scroll]
  412. if directoriesx[i - 3 + scroll] == fileSelected then
  413. term.setBackgroundColor(colors.lightBlue)
  414. write(" "..directoriesx[i - 3 + scroll]..string.sub(blackStr, 1, w))
  415. else
  416. write(" "..directoriesx[i - 3 + scroll])
  417. end
  418. end
  419. if ind > directoriesMany - scroll then
  420. if filesx[ind - directoriesMany + scroll] ~= nil and filesx[ind - directoriesMany + scroll] ~= "" then
  421. term.setBackgroundColor(colors.gray)
  422. if openWith ~= "" then
  423. if openWith ~= root..filesx[ind - directoriesMany + scroll] then
  424. term.setTextColor(colors.orange)
  425. else
  426. term.setTextColor(colors.lime)
  427. end
  428. else
  429. term.setTextColor(colors.lime)
  430. end
  431. write("-~-")
  432. term.setBackgroundColor(colors.white)
  433. term.setTextColor(colors.gray)
  434. filepos[i] = filesx[ind - directoriesMany + scroll]
  435. if filesx[ind - directoriesMany + scroll] == fileSelected then
  436. term.setBackgroundColor(colors.lightBlue)
  437. write(" "..filesx[ind - directoriesMany + scroll]..string.sub(blackStr, 1, w))
  438. else
  439. write(" "..filesx[ind - directoriesMany + scroll])
  440. end
  441. end
  442. end
  443. --END
  444. ind = ind + 1
  445. end
  446. term.setBackgroundColor(colors.lightBlue)
  447. term.setCursorPos(1, 1)
  448. term.clearLine()
  449. term.setTextColor(colors.white)
  450. write("[Close]")
  451. if renderTime == true then
  452. term.setCursorPos(w - string.len(timeX), 1)
  453. write(timeX)
  454. end
  455. term.setTextColor(colors.lightGray)
  456. term.setBackgroundColor(colors.white)
  457. term.setCursorPos(1, 2)
  458. write(root..string.sub(blackStr, 1, w))
  459. term.setCursorPos(1, 3)
  460. term.setBackgroundColor(colors.gray)
  461. term.setTextColor(colors.lightBlue)
  462. write("<< ")
  463. if fileSelected == ".." then
  464. term.setBackgroundColor(colors.lightBlue)
  465. else
  466. term.setBackgroundColor(colors.white)
  467. end
  468. term.setTextColor(colors.lightGray)
  469. write(" .."..string.sub(blackStr, 1, w))
  470. term.setCursorPos(1, h + 1)
  471. term.setBackgroundColor(colors.yellow)
  472. term.clearLine()
  473. term.setTextColor(colors.cyan)
  474. if enterText == false then
  475. write(Version.." "..Who)
  476. else
  477. write(textData.."|")
  478. end
  479. if allowScroll == true then
  480. term.setCursorPos(w, h + 1)
  481. term.setBackgroundColor(colors.gray)
  482. term.setTextColor(colors.white)
  483. if scroll < directoriesMany + filesMany - h + 3 then
  484. write("v")
  485. else
  486. write(" ")
  487. end
  488. term.setCursorPos(w, 2)
  489. if scroll ~= 0 then
  490. write("^")
  491. else
  492. write(" ")
  493. end
  494. term.setCursorPos(w - 1, h + 1)
  495. term.setBackgroundColor(colors.gray)
  496. term.setTextColor(colors.white)
  497. if scroll < directoriesMany + filesMany - h + 3 then
  498. write("v")
  499. else
  500. write(" ")
  501. end
  502. term.setCursorPos(w - 1, 2)
  503. if scroll ~= 0 then
  504. write("^")
  505. else
  506. write(" ")
  507. end
  508. if scroll < directoriesMany + filesMany - h + 3 or scroll ~= 0 then
  509. switch = 1
  510. for i=3,h do
  511. if switch == 1 then
  512. switch = 1
  513. term.setBackgroundColor(colors.gray)
  514. else
  515. switch = 1
  516. term.setBackgroundColor(colors.lightGray)
  517. end
  518. term.setCursorPos(w, i)
  519. write(" ")
  520. term.setCursorPos(w - 1, i)
  521. write(" ")
  522. end
  523. else
  524. for i=3,h do
  525. term.setBackgroundColor(colors.gray)
  526. term.setCursorPos(w, i)
  527. write(" ")
  528. term.setCursorPos(w - 1, i)
  529. write(" ")
  530. end
  531. end
  532. end
  533. if menuVisible == true then
  534. if fSetFile == true then
  535. term.setBackgroundColor(colors.cyan)
  536. else
  537. term.setBackgroundColor(colors.green)
  538. end
  539. term.setTextColor(colors.black)
  540. for i=1,table.getn(menuItems) do
  541. term.setCursorPos(menuX, menuY + i - 1)
  542. if menuItemsRenX[i] ~= nil then
  543. write(menuItemsRenX[i])
  544. end
  545. end
  546. for i=table.getn(menuItems) + 1,h + 1 do
  547. term.setCursorPos(menuX, menuY + i - 1)
  548. write(" ")
  549. end
  550. end
  551. end
  552. if loopRun == false then
  553. term.setBackgroundColor(colors.black)
  554. term.setTextColor(colors.white)
  555. term.clear()
  556. term.setCursorPos(1, 1)
  557. end
  558. end
  559. end
  560.  
  561. function input()
  562. while true do
  563. local event, p1, p2, p3 = os.pullEvent()
  564. if event == "mouse_click" then
  565. if menuVisible == false then
  566. menuCheck = true
  567. else
  568. if p2 > menuX - 1 and p2 < menuX - 1 + menuWidth + 1 and p3 > menuY - 1 and p3 < menuY - 1 + menuHeight + 1 then
  569. menuCheck = false
  570. itM = p3 - menuY + 1
  571. if menuItems[itM] ~= nil then
  572. if fSetFile == true then
  573. if fileSelected ~= nil and fileSelected ~= "" then
  574. menuResolve(tostring(menuItems[itM]))
  575. end
  576. if fileSelected == "" then
  577. menuResolve(tostring(menuItems[itM]))
  578. end
  579. else
  580. menuResolve(tostring(menuItems[itM]))
  581. end
  582. else
  583. break
  584. end
  585. else
  586. menuCheck = true
  587. end
  588. end
  589. if menuCheck == true then
  590. if p3 == 1 then
  591. if p1 == 1 then
  592. if p2 < 8 then
  593. if instaClose == true then
  594. menuResolve("Yes")
  595. else
  596. fSetFile = false
  597. menuItems = {"Yes", "No"}
  598. menuItemsRenX = {" Yes ", " No "}
  599. end
  600. end
  601. end
  602. elseif p3 == 3 then
  603. if changepos == true then
  604. fileSelected = ".."
  605. end
  606. if cdTotalTimer ~= 0 then
  607. if changepos == true then
  608. root = backUpRoot(root)
  609. end
  610. scroll = 0
  611. end
  612. clickDoubleTimer = true
  613. elseif p3 < h + 1 then
  614. if p3 ~= 2 then
  615. if p2 <= w - menuWidth - 2 then
  616. pe = p3 - 4
  617. file11 = false
  618. if pe >= directoriesMany - scroll then
  619. --Clicked On A File
  620. if filepos[p3] ~= nil and filepos[p3] ~= "" then
  621. file11 = true
  622. --renderXX = false
  623. --term.setBackgroundColor(colors.black)
  624. --term.setTextColor(colors.white)
  625. --term.clear()
  626. --term.setCursorPos(1, 1)
  627. --shell.run(root..filepos[p3])
  628. --renderXX = true
  629. if p1 == 1 then
  630. if changepos == true then
  631. fileSelected = filepos[p3]
  632. end
  633. if cdTotalTimer ~= 0 then
  634. fManRun(root..fileSelected)
  635. end
  636. clickDoubleTimer = true
  637. end
  638. else
  639. if changepos == true then
  640. fileSelected = filepos[p3]
  641. end
  642. end
  643. else
  644. --Clicked On A Folder
  645. if screenpos[p3] ~= nil and screenpos[p3] ~= "" then
  646. if p1 == 1 then
  647. if changepos == true then
  648. fileSelected = screenpos[p3]
  649. end
  650. if cdTotalTimer ~= 0 then
  651. if changepos == true then
  652. root = root..screenpos[p3].."/"
  653. end
  654. if changepos == true then
  655. fileSelected = ""
  656. end
  657. end
  658. clickDoubleTimer = true
  659. else
  660. if changepos == true then
  661. fileSelected = screenpos[p3]
  662. end
  663. end
  664. end
  665. end
  666. end
  667. else
  668. if p2 >= w - 1 then
  669. if allowScroll == true then
  670. if scroll ~= 0 then
  671. scroll = scroll - 1
  672. end
  673. end
  674. end
  675. end
  676. elseif p3 == h + 1 then
  677. if p2 >= w - 1 then
  678. if allowScroll == true then
  679. if scroll < directoriesMany + filesMany - h + 3 then
  680. scroll = scroll + 1
  681. end
  682. end
  683. end
  684. end
  685. end
  686. elseif event == "mouse_drag" then
  687. if allowScroll == true then
  688. if p2 >= w - 1 then
  689. if dragLasY ~= p3 then
  690. if p3 > dragLasY then
  691. if scroll < directoriesMany + filesMany - h + 3 then
  692. scroll = scroll + 1
  693. end
  694. else
  695. if scroll ~= 0 then
  696. scroll = scroll - 1
  697. end
  698. end
  699. end
  700. dragLasY = p3
  701. end
  702. end
  703. elseif event == "mouse_scroll" then
  704. if allowScroll == true then
  705. if p1 == 1 then
  706. if scroll < directoriesMany + filesMany - h + 3 then
  707. scroll = scroll + 1
  708. end
  709. else
  710. if scroll ~= 0 then
  711. scroll = scroll - 1
  712. end
  713. end
  714. end
  715. elseif event == "key" then
  716. if enterText == true then
  717. if p1 == 28 then
  718. local ok, err = (menuResolve(textPurpose, textData))
  719. textData = ""
  720. textPurpose = ""
  721. enterText = false
  722. elseif p1 == 14 then
  723. textData = string.sub(textData, 1, string.len(textData) - 1)
  724. end
  725. end
  726. elseif event == "char" then
  727. if enterText == true then
  728. textData = textData..p1
  729. end
  730. end
  731. updateList()
  732. end
  733. end
  734. updateList()
  735.  
  736. parallel.waitForAny(render, input)
  737.  
  738. end
  739.  
  740. while true do
  741. ok, err = pcall(startMain)
  742. if not ok then
  743. term.setBackgroundColor(colors.blue)
  744. for i=-5,5 do
  745. term.setCursorPos(1, h / 2 + i)
  746. term.clearLine()
  747. end
  748. term.setTextColor(1)
  749. term.setCursorPos(math.floor(w-string.len(" Runtime Error! "))/2, h / 2 - 4)
  750. term.setBackgroundColor(colors.white)
  751. term.setTextColor(colors.blue)
  752. write(" Runtime Error! ")
  753. term.setCursorPos(math.floor(w-string.len(err))/2, h / 2 - 2)
  754. term.setBackgroundColor(colors.blue)
  755. term.setTextColor(1)
  756. write(err)
  757. term.setCursorPos(math.floor(w-string.len("A/?? - Continue Program"))/2, h / 2 + 2)
  758. write("A/?? - Continue Program")
  759. term.setCursorPos(math.floor(w-string.len("B - Terminate Program"))/2, h / 2 + 4)
  760. write("B - Terminate Program")
  761. local event, p1 = os.pullEvent("char")
  762. if p1 == "B" or p1 == "b" then
  763. term.setBackgroundColor(colors.black)
  764. term.setTextColor(colors.white)
  765. term.setCursorPos(1, 1)
  766. term.clear()
  767. break
  768. else
  769. changepos = true
  770. enterText = false
  771. textData = ""
  772. textPurpose = ""
  773. updateList()
  774. end
  775. else
  776. break
  777. end
  778.  
  779. end
Advertisement
Add Comment
Please, Sign In to add comment