Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- startPhrase = "let the trial commence"
- term.clear()
- term.setCursorPos(1,1)
- cable = "left"
- monitor = "top"
- mon = peripheral.wrap(monitor)
- mon.clear()
- mon.setTextScale(1)
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- x,y = mon.getSize()
- function borderMonitor()
- mon.setBackgroundColor(colors.gray)
- mon.setTextColor(colors.black)
- for a = 1,x do
- mon.setCursorPos(a,1)
- mon.write("-")
- mon.setCursorPos(a,y)
- mon.write("-")
- end
- for b = 1,y do
- mon.setCursorPos(1,b)
- mon.write("|")
- mon.setCursorPos(x,b)
- mon.write("|")
- end
- mon.setCursorPos(1,1)
- mon.write(string.char(7))
- mon.setCursorPos(x,1)
- mon.write(string.char(7))
- mon.setCursorPos(1,y)
- mon.write(string.char(7))
- mon.setCursorPos(x,y)
- mon.write(string.char(7))
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- end
- borderMonitor()
- running = true
- while running do
- --wait for event to happen
- evt = {os.pullEvent()}
- --if event matches start conditions
- if evt[1] == "chat_message" and ((string.match(evt[2], "yogo_dude") or string.match(evt[2], "Reign01")) and (string.match(string.lower(evt[3]),startPhrase))) then
- --notify in pc who started it
- print("Phrase recieved from "..evt[2])
- --store chest/tape_drive blocks
- c = peripheral.wrap("projecte:alchemical_chest_1094")
- t = "tape_drive_17"
- --look through chest
- for s,i in pairs(c.list()) do
- --if we found tape
- if i.name == "computronics:tape" then
- --give to drive, starting music
- c.pushItems(t,s)
- end
- end
- write("Trial Beings in: ")
- x,y = term.getCursorPos()
- for i = 5,1,-1 do
- write(i)
- term.setCursorPos(x,y)
- sleep(1)
- end
- print("0")
- --get start time
- startH = os.date("%H")
- startM = os.date("%M")
- startS = os.date("%S")
- --run wave program
- shell.run("wave.lua")
- --get end time
- endH = os.date("%H")
- endM = os.date("%M")
- endS = os.date("%S")
- --remove tape, stopping music
- c.pullItems(t,1)
- --calulate time (mins+secs)
- timeM = (endM + 60*(endH-startH))-startM
- timeS = endS - startS
- if timeS < 0 then
- timeM = timeM - 1
- timeS = timeS + 60
- end
- --print time taken
- line1 = "Trial Complete!"
- line2 = "Time: "..timeM.."m"..timeS.."s"
- monX,monY = mon.getSize()
- monX = monX-2
- monY = monY-2
- m = window.create(mon,2,2,monX,monY,true)
- cY = (monY-1)/2
- m.setCursorPos((monX+2-#line1)/2,cY)
- m.write(line1)
- m.setCursorPos((monX+2-#line2)/2,cY+1)
- m.write(line2)
- --wait for next start
- print("Waiting for phrase...")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment