Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RadioRave v1.2 by Hyper_Space
- -- Credit to Vic Fieger for the Karmatic Arcade font, which has been adapted for ComputerCraft and used in the HyperPrint API.
- -- Got a suggestion? Awesome! Please send it over to me at or contact Hyper_Space on the ZephTech Minecraft Server.
- -- Changelog
- -- v1.2 - Checks added. Terminal imagery has now been designed, with a help message on the right. Auto-updater
- -- added.
- -- v1.1 - Vastly improved monitor graphics, including a fancy top-monitor animation.
- -- v1.0 - Original program.
- -- To-Do
- -- -Colour themes
- if fs.exists("HyperPrint")== false then
- term.clear()
- term.setCursorPos(1,1)
- print("RadioRave requires HyperPrint (http://pastebin.com/bKb3SEe8) to function as intended")
- return
- end
- os.loadAPI("HyperPrint")
- montop = peripheral.wrap("top")
- monleft = peripheral.wrap("left")
- monright = peripheral.wrap("right")
- if (peripheral.getType("top") ~= "monitor")
- or (peripheral.getType("left") ~= "monitor")
- or (peripheral.getType("right") ~= "monitor") then
- term.clear()
- term.setCursorPos(1,1)
- print("RadioRave requires advanced monitors attached at the top, left and right to function as intended.")
- return
- end
- montop.setTextScale(0.5)
- monleft.setTextScale(0.5)
- monright.setTextScale(0.5)
- phase = 0
- vol = 0
- termxmax,termymax = term.getSize()
- title = "RadioRave"
- term.clear()
- for i=1,30 do
- paintutils.drawLine(i,1,i,termymax,colours.blue)
- end
- for i=2,29 do
- paintutils.drawLine(i,2,i,termymax-1,colours.cyan)
- end
- HyperPrint.printNote(2,2)
- HyperPrint.printR(10,6)
- for i=32,termxmax-1 do
- paintutils.drawLine(i,1,i,3,colours.blue)
- end
- for i=33,termxmax-2 do
- paintutils.drawLine(i,2,i,2,colours.cyan)
- end
- term.setCursorPos(37,2)
- term.setTextColour(colours.white)
- print(title)
- term.setBackgroundColour(colours.black)
- term.setCursorPos(32,4)
- print("v1.2 by Hyper_Space")
- term.setCursorPos(32,6)
- print("To start using this")
- term.setCursorPos(32,7)
- print("program, simply")
- term.setCursorPos(32,8)
- print("place an OpenBlocks")
- term.setCursorPos(32,9)
- print("radio under the")
- term.setCursorPos(32,10)
- print("computer and press")
- term.setCursorPos(32,11)
- print("the arrows to")
- term.setCursorPos(32,12)
- print("adjust the volume.")
- os.unloadAPI("HyperPrint")
- function touchscreens()
- while true do
- os.loadAPI("HyperPrint")
- term.redirect(monleft)
- for i=1,15 do
- paintutils.drawLine(i,1,i,10,colours.blue)
- end
- HyperPrint.printLessThan(3,0)
- term.redirect(monright)
- for i=1,15 do
- paintutils.drawLine(i,1,i,10,colours.blue)
- end
- HyperPrint.printGreaterThan(2,0)
- rs.setAnalogOutput("bottom",vol)
- event,side,x,y = os.pullEvent()
- if (side == "left") and (event == "monitor_touch") then
- term.redirect(monleft)
- for i=1,15 do
- paintutils.drawLine(i,1,i,10,colours.cyan)
- end
- HyperPrint.printLessThan(3,0)
- if vol ~= 0 then
- vol = vol-1
- end
- term.redirect(term.native())
- sleep(0.15)
- elseif (side == "right") and (event == "monitor_touch") then
- term.redirect(monright)
- for i=1,15 do
- paintutils.drawLine(i,1,i,10,colours.cyan)
- end
- HyperPrint.printGreaterThan(2,0)
- if vol ~= 15 then
- vol=vol+1
- end
- term.redirect(term.native())
- sleep(0.15)
- end
- end
- os.unloadAPI("HyperPrint")
- end
- function top()
- while true do
- os.loadAPI("HyperPrint")
- term.redirect(montop)
- if phase == 0 then
- for i=1,15 do
- paintutils.drawLine(i,1,i,10,colours.blue)
- end
- paintutils.drawPixel(6,2,colours.black)
- paintutils.drawPixel(6,9,colours.black)
- paintutils.drawLine(5,3,6,3,colours.black)
- paintutils.drawLine(5,8,6,8,colours.black)
- paintutils.drawLine(4,4,6,4,colours.black)
- paintutils.drawLine(4,7,6,7,colours.black)
- for i=5,6 do
- paintutils.drawLine(3,i,6,i,colours.black)
- end
- paintutils.drawLine(10,4,10,7,colours.black)
- paintutils.drawLine(13,2,13,9,colours.black)
- phase = 1
- elseif phase == 1 then
- for i=1,15 do
- paintutils.drawLine(i,1,i,10,colours.cyan)
- end
- HyperPrint.printSpeaker(1,0,colours.black)
- paintutils.drawLine(8,5,8,6,colours.black)
- paintutils.drawLine(11,3,11,8,colours.black)
- paintutils.drawLine(14,2,14,9,colours.black)
- phase=2
- elseif phase == 2 then
- for i=1,15 do
- paintutils.drawLine(i,1,i,10,colours.lightBlue)
- end
- HyperPrint.printSpeaker(1,0,colours.black)
- paintutils.drawLine(9,4,9,7,colours.black)
- paintutils.drawLine(12,3,12,8,colours.black)
- paintutils.drawLine(15,1,15,10,colours.black)
- phase=0
- end
- term.redirect(term.native())
- montop.setCursorPos(3,5)
- montop.write("Vol:")
- montop.setCursorPos(3,6)
- montop.write(tostring(vol))
- sleep(0.25)
- end
- os.unloadAPI("HyperPrint")
- end
- parallel.waitForAll(top,touchscreens)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement