Advertisement
VADemon

PortalRadio

Jun 26th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.70 KB | None | 0 0
  1. monitorSide = "right"
  2. diskdriveSide = "top"
  3. musicdiscTitlePos = {1, 11}
  4. statementPos = {1,6}
  5.  
  6. monitor = peripheral.wrap(monitorSide)
  7.  
  8. --term.redirect(monitor)
  9. term.setCursorPos(3,6)
  10.  
  11. term.write("  This statement is false.")
  12.  
  13. term.setCursorPos(statementPos[1], statementPos[2]) -- set to statement text line
  14.  
  15. ----
  16. audioList = {
  17. -- ["Audio Title"] = 42, -- length in seconds
  18.     ["portalgun:stillalive"] = (176),
  19.     ["portalgun:wantyougone"] = 142,
  20.     ["portalgun:radioloop"] = 22,
  21.    
  22. }
  23.  
  24. while true do
  25.  
  26. if disk.hasAudio( diskdriveSide ) then
  27.  
  28.     local audio = disk.getAudioTitle( diskdriveSide )
  29.     local audioLength = 600
  30.  
  31.     if audio then
  32.        
  33.         if audioList[ audio ] then
  34.             audioLength = audioList[ audio ]
  35.         end
  36.        
  37.         term.setCursorPos(musicdiscTitlePos[1], musicdiscTitlePos[2])
  38.         term.write( disk.getAudioTitle( diskdriveSide ) )
  39.         term.setCursorPos(statementPos[1], statementPos[2]) -- set pos to This statement is false
  40.        
  41.         disk.playAudio( diskdriveSide )
  42.        
  43.         sleep(audioLength)
  44.        
  45.         disk.stopAudio( diskdriveSide )
  46.        
  47.         term.setCursorPos(musicdiscTitlePos[1], musicdiscTitlePos[2])
  48.         term.write( "PortalRadio is off." )
  49.         term.setCursorPos(statementPos[1], statementPos[2]) -- set pos to This statement is false
  50.         sleep(2)
  51.     else
  52.         term.setCursorPos(musicdiscTitlePos[1], musicdiscTitlePos[2])
  53.         term.write( "PortalRadio: Insert music disc" )
  54.         term.setCursorPos(statementPos[1], statementPos[2]) -- set pos to This statement is false
  55.         sleep(10)
  56.     end
  57.    
  58. else
  59.     term.setCursorPos(musicdiscTitlePos[1], musicdiscTitlePos[2])
  60.     term.write( "PortalRadio: Insert music disc" )
  61.     term.setCursorPos(statementPos[1], statementPos[2]) -- set pos to This statement is false
  62.     sleep(10)
  63. end
  64.     sleep(1)
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement