Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Decorative Sonar by Gustavo Wizard
- --- Monitor 2x2, btn API
- os.loadAPI("btn")
- m = peripheral.wrap("top")
- local commandBlock = peripheral.wrap("left")
- currentCommand = commandBlock.getCommand()
- m.setTextScale(0.5)
- m.setBackgroundColor(colors.black)
- m.clear()
- m.setTextColor(colors.red)
- m.setCursorPos(8,2)
- m.write("TYPHOON TK-208 SONAR")
- term.redirect(m)
- m.setTextColor(colors.white)
- function fillTable()
- btn.setTable("SONAR ON", on, 6,16,20,22)
- btn.setTable("SONAR OFF", off,20,30,20,22)
- btn.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- btn.checkxy(x,y)
- end
- function on()
- btn.toggleButton("SONAR ON")
- while true do
- local image = paintutils.loadImage("r.nfp")
- paintutils.drawImage(image,8,4)
- sleep(.3)
- local image = paintutils.loadImage("r2.nfp")
- paintutils.drawImage(image,8,4)
- sleep(.3)
- local image = paintutils.loadImage("r3.nfp")
- paintutils.drawImage(image,8,4)
- sleep(.3)
- local image = paintutils.loadImage("r4.nfp")
- paintutils.drawImage(image,8,4)
- commandBlock.setCommand("playsound wizard.sonar_low @a")
- commandBlock.runCommand()
- sleep(.3)
- end
- end
- m.setBackgroundColor(colors.red)
- m.setTextColor(colors.white)
- function off()
- btn.flash("SONAR OFF")
- end
- fillTable()
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement