kk258966

startup

Sep 22nd, 2013
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.40 KB | None | 0 0
  1. --
  2. --RAC Media Player by neonerZ v1.0
  3. --http://youtube.com/neonerz
  4. --
  5.  
  6. -- What side of the computer is the monitor on?
  7. local monitorSide="back"
  8. -- What side of the computer is the disk drive on?
  9. local diskDriveSide = "front"
  10. -- What side of the computer is the redstone to
  11. -- eject the record?
  12. local ejectRedstoneSide = "left"
  13. -- What side of the computer is the bundled cable?
  14. local recordRedSide = "bottom"
  15.  
  16. --Plays Record
  17. function playRecord(diskDriveSide,recordRedSide,discName)
  18. -- Check if there's already a disk in the drive
  19. -- if so, eject it
  20. if disk.isPresent(diskDriveSide) == true then
  21. eject(ejectRedstoneSide)
  22. end
  23.  
  24. -- open music-colors config file
  25. h = fs.open("music-colors","r")
  26. line = tostring(h.readLine())
  27. action = nil
  28.  
  29. -- Find the color interger of the disc selected
  30. while line ~= nil do
  31. value1,discColor = string.match(line,"(.+)%s?:%s?(.+)")
  32. if string.lower(value1) == string.lower(discName) then
  33. print("You want to play "..value1)
  34. print("It is on the "..discColor.." line")
  35. if string.lower(discColor) == "white" then theColor=1
  36. elseif string.lower(discColor) == "orange" then theColor=2
  37. elseif string.lower(discColor) == "magenta" then theColor=4
  38. elseif string.lower(discColor) == "lightblue" then theColor=8
  39. elseif string.lower(discColor) == "yellow" then theColor=16
  40. elseif string.lower(discColor) == "lime" then theColor=32
  41. elseif string.lower(discColor) == "pink" then theColor=64
  42. elseif string.lower(discColor) == "gray" then theColor=128
  43. elseif string.lower(discColor) == "lightgray" then theColor=256
  44. elseif string.lower(discColor) == "cyan" then theColor=512
  45. elseif string.lower(discColor) == "purple" then theColor=1024
  46. elseif string.lower(discColor) == "blue" then theColor=2048
  47. elseif string.lower(discColor) == "brown" then theColor=4096
  48. elseif string.lower(discColor) == "green" then theColor=8192
  49. elseif string.lower(discColor) == "red" then theColor=16384
  50. elseif string.lower(discColor) == "black" then theColor=32768
  51. else print("Error: color out of range") return
  52. end
  53. print("loading track")
  54. -- Pulse the color that's associated to the disc
  55. redstone.setBundledOutput(recordRedSide, theColor)
  56. sleep(1)
  57. redstone.setBundledOutput(recordRedSide, 0)
  58. -- Wait for the disc to load
  59. while not disk.isPresent(diskDriveSide) do
  60. sleep(.5)
  61. end
  62. print("track loaded, playing track")
  63. -- Play disc
  64. disk.playAudio(diskDriveSide)
  65. end
  66. line = h.readLine()
  67. end
  68.  
  69.  
  70. end
  71.  
  72. -- Play without requesting disc
  73. function playButton(diskDriveSide)
  74. if disk.isPresent(diskDriveSide) ~= true then
  75. setAction(monitorSide," No disc loaded ")
  76. sleep(.5)
  77. else
  78. print("playing track")
  79. setAction(monitorSide," Playing disc... ")
  80. sleep(.5)
  81. disk.playAudio(diskDriveSide)
  82. end
  83. end
  84. -- Stop audio
  85. function stop(diskDriveSide)
  86. print("stopping track")
  87. disk.stopAudio(diskDriveSide)
  88. end
  89. -- Eject disc
  90. function eject(ejectRedstoneSide)
  91. print("ejecting track")
  92. redstone.setOutput(ejectRedstoneSide, true)
  93. sleep(1)
  94. redstone.setOutput(ejectRedstoneSide, false)
  95. end
  96.  
  97. -- Display orange message box with message
  98. function setAction(pSide,message)
  99. m = peripheral.wrap(pSide)
  100. m.setCursorPos(14,6)
  101. m.setBackgroundColor(colors.orange)
  102. m.write(" ")
  103. m.setCursorPos(14,7)
  104. m.write(" ")
  105. m.setCursorPos(14,8)
  106. m.write(" ")
  107. m.setCursorPos(14,9)
  108. m.write(" ")
  109. m.setCursorPos(14,10)
  110. m.write(" ")
  111. m.setCursorPos(14,11)
  112. m.write(" ")
  113. m.setCursorPos(14,12)
  114. m.write(" ")
  115. m.setCursorPos(14,13)
  116. m.write(" ")
  117. m.setCursorPos(14,14)
  118. m.write(" ")
  119. m.setCursorPos(14,10)
  120. m.setTextColor(colors.black)
  121. m.write(message)
  122. m.setBackgroundColor(colors.black)
  123.  
  124.  
  125. end
  126.  
  127. -- Display GUI
  128. function setGUI(pSide)
  129. m = peripheral.wrap(pSide)
  130. m.clear()
  131. m.setCursorPos(18,1)
  132. m.setBackgroundColor(colors.black)
  133. m.setTextColor(colors.blue)
  134. m.write("RAC Media Player")
  135.  
  136. m.setCursorPos(3,3)
  137. -- This if checkes to see if the button it's drawing
  138. -- matches the disc in the disk drive (if any) and turns
  139. -- the button yellow if so.
  140. if disk.getLabel(diskDriveSide) =="C418 - cat" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  141. m.write(" ")
  142. m.setBackgroundColor(colors.black)
  143. m.setCursorPos(3,4)
  144. if disk.getLabel(diskDriveSide) =="C418 - cat" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  145. m.setTextColor(colors.black)
  146. m.write(" Cat ")
  147. m.setBackgroundColor(colors.black)
  148. m.setCursorPos(3,5)
  149. if disk.getLabel(diskDriveSide) =="C418 - cat" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  150. m.write(" ")
  151. m.setBackgroundColor(colors.black)
  152.  
  153. m.setCursorPos(15,3)
  154. if disk.getLabel(diskDriveSide) =="C418 - 13" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  155. m.write(" ")
  156. m.setBackgroundColor(colors.black)
  157. m.setCursorPos(15,4)
  158. if disk.getLabel(diskDriveSide) =="C418 - 13" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  159. m.setTextColor(colors.black)
  160. m.write(" 13 ")
  161. m.setBackgroundColor(colors.black)
  162. m.setCursorPos(15,5)
  163. if disk.getLabel(diskDriveSide) =="C418 - 13" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  164. m.write(" ")
  165. m.setBackgroundColor(colors.black)
  166.  
  167. m.setCursorPos(27,3)
  168. if disk.getLabel(diskDriveSide) =="C418 - blocks" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  169. m.write(" ")
  170. m.setBackgroundColor(colors.black)
  171. m.setCursorPos(27,4)
  172. if disk.getLabel(diskDriveSide) =="C418 - blocks" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  173. m.setTextColor(colors.black)
  174. m.write(" Blocks ")
  175. m.setBackgroundColor(colors.black)
  176. m.setCursorPos(27,5)
  177. if disk.getLabel(diskDriveSide) =="C418 - blocks" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  178. m.write(" ")
  179. m.setBackgroundColor(colors.black)
  180.  
  181. m.setCursorPos(39,3)
  182. if disk.getLabel(diskDriveSide) =="C418 - chirp" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  183. m.write(" ")
  184. m.setBackgroundColor(colors.black)
  185. m.setCursorPos(39,4)
  186. if disk.getLabel(diskDriveSide) =="C418 - chirp" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  187. m.setTextColor(colors.black)
  188. m.write(" Chirp ")
  189. m.setBackgroundColor(colors.black)
  190. m.setCursorPos(39,5)
  191. if disk.getLabel(diskDriveSide) =="C418 - chirp" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  192. m.write(" ")
  193. m.setBackgroundColor(colors.black)
  194.  
  195. m.setCursorPos(3,7)
  196. if disk.getLabel(diskDriveSide) =="C418 - far" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  197. m.write(" ")
  198. m.setBackgroundColor(colors.black)
  199. m.setCursorPos(3,8)
  200. if disk.getLabel(diskDriveSide) =="C418 - far" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  201. m.setTextColor(colors.black)
  202. m.write(" Far ")
  203. m.setBackgroundColor(colors.black)
  204. m.setCursorPos(3,9)
  205. if disk.getLabel(diskDriveSide) =="C418 - far" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  206. m.write(" ")
  207. m.setBackgroundColor(colors.black)
  208.  
  209. m.setCursorPos(15,7)
  210. if disk.getLabel(diskDriveSide) =="C418 - mall" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  211. m.write(" ")
  212. m.setBackgroundColor(colors.black)
  213. m.setCursorPos(15,8)
  214. if disk.getLabel(diskDriveSide) =="C418 - mall" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  215. m.setTextColor(colors.black)
  216. m.write(" Mall ")
  217. m.setBackgroundColor(colors.black)
  218. m.setCursorPos(15,9)
  219. if disk.getLabel(diskDriveSide) =="C418 - mall" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  220. m.write(" ")
  221. m.setBackgroundColor(colors.black)
  222.  
  223. m.setCursorPos(27,7)
  224. if disk.getLabel(diskDriveSide) =="C418 - mellohi" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  225. m.write(" ")
  226. m.setBackgroundColor(colors.black)
  227. m.setCursorPos(27,8)
  228. if disk.getLabel(diskDriveSide) =="C418 - mellohi" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  229. m.setTextColor(colors.black)
  230. m.write(" Mellohi ")
  231. m.setBackgroundColor(colors.black)
  232. m.setCursorPos(27,9)
  233. if disk.getLabel(diskDriveSide) =="C418 - mellohi" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  234. m.write(" ")
  235. m.setBackgroundColor(colors.black)
  236.  
  237. m.setCursorPos(39,7)
  238. if disk.getLabel(diskDriveSide) =="C418 - stal" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  239. m.write(" ")
  240. m.setBackgroundColor(colors.black)
  241. m.setCursorPos(39,8)
  242. if disk.getLabel(diskDriveSide) =="C418 - stal" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  243. m.setTextColor(colors.black)
  244. m.write(" Stal ")
  245. m.setBackgroundColor(colors.black)
  246. m.setCursorPos(39,9)
  247. if disk.getLabel(diskDriveSide) =="C418 - stal" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  248. m.write(" ")
  249. m.setBackgroundColor(colors.black)
  250.  
  251. m.setCursorPos(3,11)
  252. if disk.getLabel(diskDriveSide) =="C418 - strad" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  253. m.write(" ")
  254. m.setBackgroundColor(colors.black)
  255. m.setCursorPos(3,12)
  256. if disk.getLabel(diskDriveSide) =="C418 - strad" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  257. m.setTextColor(colors.black)
  258. m.write(" Strad ")
  259. m.setBackgroundColor(colors.black)
  260. m.setCursorPos(3,13)
  261. if disk.getLabel(diskDriveSide) =="C418 - strad" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  262. m.write(" ")
  263. m.setBackgroundColor(colors.black)
  264.  
  265. m.setCursorPos(15,11)
  266. if disk.getLabel(diskDriveSide) =="C418 - ward" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  267. m.write(" ")
  268. m.setBackgroundColor(colors.black)
  269. m.setCursorPos(15,12)
  270. if disk.getLabel(diskDriveSide) =="C418 - ward" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  271. m.setTextColor(colors.black)
  272. m.write(" Ward ")
  273. m.setBackgroundColor(colors.black)
  274. m.setCursorPos(15,13)
  275. if disk.getLabel(diskDriveSide) =="C418 - ward" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  276. m.write(" ")
  277. m.setBackgroundColor(colors.black)
  278.  
  279. m.setCursorPos(27,11)
  280. if disk.getLabel(diskDriveSide) =="C418 - 11" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  281. m.write(" ")
  282. m.setBackgroundColor(colors.black)
  283. m.setCursorPos(27,12)
  284. if disk.getLabel(diskDriveSide) =="C418 - 11" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  285. m.setTextColor(colors.black)
  286. m.write(" 11 ")
  287. m.setBackgroundColor(colors.black)
  288. m.setCursorPos(27,13)
  289. if disk.getLabel(diskDriveSide) =="C418 - 11" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  290. m.write(" ")
  291. m.setBackgroundColor(colors.black)
  292.  
  293. m.setCursorPos(39,11)
  294. if disk.getLabel(diskDriveSide) =="wait" or disk.getLabel(diskDriveSide) =="C418 - wait" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  295. m.write(" ")
  296. m.setBackgroundColor(colors.black)
  297. m.setCursorPos(39,12)
  298. if disk.getLabel(diskDriveSide) =="wait" or disk.getLabel(diskDriveSide) =="C418 - wait" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  299. m.setTextColor(colors.black)
  300. m.write(" Wait ")
  301. m.setBackgroundColor(colors.black)
  302. m.setCursorPos(39,13)
  303. if disk.getLabel(diskDriveSide) =="wait" or disk.getLabel(diskDriveSide) =="C418 - wait" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.green) end
  304. m.write(" ")
  305. m.setBackgroundColor(colors.black)
  306.  
  307.  
  308.  
  309.  
  310.  
  311. m.setCursorPos(2,15)
  312. if disk.getLabel(diskDriveSide) =="pg.stillalive" or disk.getLabel(diskDriveSide) =="Valve - Still Alive" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  313. m.write(" ")
  314. m.setBackgroundColor(colors.black)
  315. m.setCursorPos(2,16)
  316. if disk.getLabel(diskDriveSide) =="pg.stillalive" or disk.getLabel(diskDriveSide) =="Valve - Still Alive" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  317. m.setTextColor(colors.black)
  318. m.write(" Still Alive ")
  319. m.setBackgroundColor(colors.black)
  320. m.setCursorPos(2,17)
  321. if disk.getLabel(diskDriveSide) =="pg.stillalive" or disk.getLabel(diskDriveSide) =="Valve - Still Alive" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  322. m.write(" ")
  323. m.setBackgroundColor(colors.black)
  324.  
  325. m.setCursorPos(18,15)
  326. if disk.getLabel(diskDriveSide) =="pg.radioloop" or disk.getLabel(diskDriveSide) =="Valve - Radio Loop" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  327. m.write(" ")
  328. m.setBackgroundColor(colors.black)
  329. m.setCursorPos(18,16)
  330. if disk.getLabel(diskDriveSide) =="pg.radioloop" or disk.getLabel(diskDriveSide) =="Valve - Radio Loop" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  331. m.setTextColor(colors.black)
  332. m.write(" Radio Loop ")
  333. m.setBackgroundColor(colors.black)
  334. m.setCursorPos(18,17)
  335. if disk.getLabel(diskDriveSide) =="pg.radioloop" or disk.getLabel(diskDriveSide) =="Valve - Radio Loop" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  336. m.write(" ")
  337. m.setBackgroundColor(colors.black)
  338.  
  339. m.setCursorPos(35,15)
  340. if disk.getLabel(diskDriveSide) =="pg.wantyougone" or disk.getLabel(diskDriveSide) =="Valve - Want You Gone" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  341. m.write(" ")
  342. m.setBackgroundColor(colors.black)
  343. m.setCursorPos(35,16)
  344. if disk.getLabel(diskDriveSide) =="pg.wantyougone" or disk.getLabel(diskDriveSide) =="Valve - Want You Gone" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  345. m.setTextColor(colors.black)
  346. m.write(" Want You Gone ")
  347. m.setBackgroundColor(colors.black)
  348. m.setCursorPos(35,17)
  349. if disk.getLabel(diskDriveSide) =="pg.wantyougone" or disk.getLabel(diskDriveSide) =="Valve - Want You Gone" then m.setBackgroundColor(colors.yellow) else m.setBackgroundColor(colors.cyan) end
  350. m.write(" ")
  351. m.setBackgroundColor(colors.black)
  352.  
  353.  
  354. m.setCursorPos(12,19)
  355. m.setBackgroundColor(colors.blue)
  356. m.setTextColor(colors.white)
  357. m.write(" Play ")
  358. m.setBackgroundColor(colors.black)
  359.  
  360. m.setCursorPos(19,19)
  361. m.setBackgroundColor(colors.blue)
  362. m.setTextColor(colors.white)
  363. m.write(" Stop ")
  364. m.setBackgroundColor(colors.black)
  365.  
  366. m.setCursorPos(26,19)
  367. m.setBackgroundColor(colors.blue)
  368. m.setTextColor(colors.white)
  369. m.write(" Eject ")
  370. m.setBackgroundColor(colors.black)
  371.  
  372. m.setCursorPos(34,19)
  373. m.setBackgroundColor(colors.blue)
  374. m.setTextColor(colors.white)
  375. m.write(" Back ")
  376. m.setBackgroundColor(colors.black)
  377.  
  378. end
  379.  
  380. -- Check if music-colors config file is present.
  381. -- If not, create it.
  382. if fs.exists("music-colors") ~= true then
  383. h = fs.open("music-colors", "w")
  384. h.writeLine("cat:orange")
  385. h.writeLine("far:yellow")
  386. h.writeLine("mall:green")
  387. h.writeLine("chirp:blue")
  388. h.writeLine("blocks:red")
  389. h.writeLine("stal:lightgray")
  390. h.writeLine("13:lightblue")
  391. h.writeLine("mellohi:purple")
  392. h.writeLine("strad:white")
  393. h.writeLine("wait:magenta")
  394. h.writeLine("ward:lime")
  395. h.writeLine("11:pink")
  396. h.writeLine("still-alive:cyan")
  397. h.writeLine("radio-loop:black")
  398. h.writeLine("want-you-gone:brown")
  399. h.close()
  400. end
  401.  
  402. -- Display GUI
  403. setGUI(monitorSide)
  404.  
  405. -- Always wrap peripherals. Wrapping it
  406. -- to the m variable
  407. m = peripheral.wrap(monitorSide)
  408.  
  409. -- Start while loop
  410. while true do
  411. -- Wait for monitor_touch event
  412. event, side, xPos, yPos = os.pullEvent("monitor_touch")
  413. --If Play button is pressed
  414. if (yPos == 19) and (xPos >= 12 and xPos <= 17) then
  415. -- setAction is the function we setup above that
  416. -- display's the orange message box
  417. setAction(monitorSide," Play! ")
  418. playButton(diskDriveSide)
  419. setGUI(monitorSide)
  420. --If Stop button is pressed
  421. elseif (yPos == 19) and (xPos >= 19 and xPos <= 24) then
  422. setAction(monitorSide," Stop! ")
  423. sleep(.5)
  424. stop(diskDriveSide)
  425. setGUI(monitorSide)
  426. --If Eject button is pressed
  427. elseif (yPos == 19) and (xPos >= 26 and xPos <= 32) then
  428. setAction(monitorSide," Eject! ")
  429. print("ejecting track")
  430. eject(ejectRedstoneSide)
  431. setGUI(monitorSide)
  432. --If Back button is pressed
  433. elseif (yPos == 19) and (xPos >= 34 and xPos <= 40) then
  434. setAction(monitorSide," Goodbye! ")
  435. sleep(2)
  436. m.clear()
  437. return
  438.  
  439. --Cat
  440. elseif (yPos >= 3 and yPos <=6 ) and (xPos >= 2 and xPos <= 12) then
  441. setAction(monitorSide," Loading Cat... ")
  442. if disk.getLabel(diskDriveSide) =="C418 - cat" then
  443. playButton(diskDriveSide)
  444. else
  445. playRecord(diskDriveSide,recordRedSide,"cat")
  446. end
  447. setGUI(monitorSide)
  448. --13
  449. elseif (yPos >= 3 and yPos <=6 ) and (xPos >= 14 and xPos <= 24) then
  450. setAction(monitorSide," Loading 13... ")
  451. if disk.getLabel(diskDriveSide) =="C418 - 13" then
  452. playButton(diskDriveSide)
  453. else
  454. playRecord(diskDriveSide,recordRedSide,"13")
  455. end
  456. setGUI(monitorSide)
  457. --Blocks
  458. elseif (yPos >= 3 and yPos <=6 ) and (xPos >= 26 and xPos <= 36) then
  459. setAction(monitorSide," Loading Blocks... ")
  460. if disk.getLabel(diskDriveSide) =="C418 - blocks" then
  461. playButton(diskDriveSide)
  462. else
  463. playRecord(diskDriveSide,recordRedSide,"blocks")
  464. end
  465. setGUI(monitorSide)
  466. --Chirp
  467. elseif (yPos >= 3 and yPos <=6 ) and (xPos >= 38 and xPos <= 48) then
  468. setAction(monitorSide," Loading Chirp... ")
  469. if disk.getLabel(diskDriveSide) =="C418 - chirp" then
  470. playButton(diskDriveSide)
  471. else
  472. playRecord(diskDriveSide,recordRedSide,"chirp")
  473. end
  474. setGUI(monitorSide)
  475. --Far
  476. elseif (yPos >= 7 and yPos <= 9 ) and (xPos >= 2 and xPos <= 12) then
  477. setAction(monitorSide," Loading Far... ")
  478. if disk.getLabel(diskDriveSide) =="C418 - far" then
  479. playButton(diskDriveSide)
  480. else
  481. playRecord(diskDriveSide,recordRedSide,"far")
  482. end
  483. setGUI(monitorSide)
  484. --Mall
  485. elseif (yPos >= 7 and yPos <= 9 ) and (xPos >= 14 and xPos <= 24) then
  486. setAction(monitorSide," Loading Mall... ")
  487. if disk.getLabel(diskDriveSide) =="C418 - mall" then
  488. playButton(diskDriveSide)
  489. else
  490. playRecord(diskDriveSide,recordRedSide,"mall")
  491. end
  492. setGUI(monitorSide)
  493. --Mellohi
  494. elseif (yPos >= 7 and yPos <= 9 ) and (xPos >= 26 and xPos <= 36) then
  495. setAction(monitorSide," Loading Mellohi... ")
  496. if disk.getLabel(diskDriveSide) =="C418 - mellohi" then
  497. playButton(diskDriveSide)
  498. else
  499. playRecord(diskDriveSide,recordRedSide,"mellohi")
  500. end
  501. setGUI(monitorSide)
  502. --Stal
  503. elseif (yPos >= 7 and yPos <= 9 ) and (xPos >= 38 and xPos <= 48) then
  504. setAction(monitorSide," Loading Stal... ")
  505. if disk.getLabel(diskDriveSide) =="C418 - stal" then
  506. playButton(diskDriveSide)
  507. else
  508. playRecord(diskDriveSide,recordRedSide,"stal")
  509. end
  510. setGUI(monitorSide)
  511. --Strad
  512. elseif (yPos >= 11 and yPos <= 14) and (xPos >= 2 and xPos <= 12) then
  513. setAction(monitorSide," Loading Strad... ")
  514. if disk.getLabel(diskDriveSide) =="C418 - strad" then
  515. playButton(diskDriveSide)
  516. else
  517. playRecord(diskDriveSide,recordRedSide,"strad")
  518. end
  519. setGUI(monitorSide)
  520. --Ward
  521. elseif (yPos >= 11 and yPos <= 14) and (xPos >= 14 and xPos <= 24) then
  522. setAction(monitorSide," Loading Ward... ")
  523. if disk.getLabel(diskDriveSide) =="C418 - ward" then
  524. playButton(diskDriveSide)
  525. else
  526. playRecord(diskDriveSide,recordRedSide,"ward")
  527. end
  528. setGUI(monitorSide)
  529. --11
  530. elseif (yPos >= 11 and yPos <= 14) and (xPos >= 26 and xPos <= 36) then
  531. setAction(monitorSide," Loading 11... ")
  532. if disk.getLabel(diskDriveSide) =="C418 - 11" then
  533. playButton(diskDriveSide)
  534. else
  535. playRecord(diskDriveSide,recordRedSide,"11")
  536. end
  537. setGUI(monitorSide)
  538. --Wait
  539. elseif (yPos >= 11 and yPos <= 14) and (xPos >= 38 and xPos <= 48) then
  540. setAction(monitorSide," Loading Wait... ")
  541. if disk.getLabel(diskDriveSide) =="wait" or disk.getLabel(diskDriveSide) =="C418 - wait" then
  542. playButton(diskDriveSide)
  543. else
  544. playRecord(diskDriveSide,recordRedSide,"wait")
  545. end
  546.  
  547. setGUI(monitorSide)
  548.  
  549. --Still Alive
  550. elseif (yPos >= 15 and yPos <= 18) and (xPos >= 2 and xPos <= 16) then
  551. setAction(monitorSide," Loading Still Alive...")
  552. if disk.getLabel(diskDriveSide) =="pg.stillalive" or disk.getLabel(diskDriveSide) =="Valve - Still Alive" then
  553. playButton(diskDriveSide)
  554. else
  555. playRecord(diskDriveSide,recordRedSide,"still-alive")
  556. end
  557. setGUI(monitorSide)
  558. --Radio Loop
  559. elseif (yPos >= 15 and yPos <= 18) and (xPos >= 18 and xPos <= 33) then
  560. setAction(monitorSide," Loading Radio Loop... ")
  561. if disk.getLabel(diskDriveSide) =="pg.radioloop" or disk.getLabel(diskDriveSide) =="Valve - Radio Loop" then
  562. playButton(diskDriveSide)
  563. else
  564. playRecord(diskDriveSide,recordRedSide,"radio-loop")
  565. end
  566. setGUI(monitorSide)
  567. --Want You Gone
  568. elseif (yPos >= 15 and yPos <= 18) and (xPos >= 35 and xPos <= 49) then
  569. setAction(monitorSide," Loading WantYouGone...")
  570. if disk.getLabel(diskDriveSide) =="pg.wantyougone" or disk.getLabel(diskDriveSide) =="Valve - Want You Gone" then
  571. playButton(diskDriveSide)
  572. else
  573. playRecord(diskDriveSide,recordRedSide,"want-you-gone")
  574. end
  575. setGUI(monitorSide)
  576. end
  577.  
  578.  
  579. end
  580.  
  581.  
  582. -- This is a quick way to test monitor_touch
  583. --m.setCursorPos(1,1)
  584. --m.clearLine()
  585. --while true do
  586. -- m.setCursorPos(1,1)
  587. -- event, side, xPos, yPos = os.pullEvent("monitor_touch")
  588. -- m.clearLine()
  589. -- m.write(event.." => Side: " .. tostring(side) .. ", " ..
  590. -- "xPos: ".. xPos ..", " ..
  591. -- "yPos: ".. yPos)
  592. -- setAction(monitorSide," test ")
  593. --
  594. --end
Advertisement
Add Comment
Please, Sign In to add comment