Advertisement
V497_Vesper

Nuclear Control PA Sytem

May 24th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. speaker=peripheral.wrap("right")
  2. local speaking = false
  3. local red = true
  4. while true do
  5.   while red or speaking do --#while we are waiting for redstone or the speaker to finish
  6.     local event = os.pullEvent() --#pull an event
  7.     if event == "speechComplete" then --#if the speaker stopped speaking
  8.       speaking = false --#we are no longer waiting for it to finish
  9.     elseif event == "redstone" then --#if a redstone change occured
  10.       red = false --#we are no longer waiting for redstone
  11.     end
  12.   end
  13.   local input = rs.getBundledInput("back")
  14.   speaking = true --#we're now waiting for it to speak
  15.   red = true --#and for a redstone change to occur
  16.   if colors.test(input,colors.red) then
  17.     speaker.speak("Reactor Critical! Reactor critical! Meltdown Imminent")
  18.   elseif colors.test(input,colors.pink) then
  19.     speaker.speak("Danger! Reactor heat level Critical! Evacuate all none essential Personnel!")
  20.   elseif colors.test(input,colors.green) then
  21.     speaker.speak("Danger! Reactor Heat level at 6000 Degrees!")
  22.   elseif colors.test(input,colors.yellow) then
  23.     speaker.speak("Warning! Reactor Heat Level above Acceptable limit!")
  24.   elseif colors.test(input,colors.blue) then
  25.     speaker.speak("Caution! reactor Heat level at 4000 degrees!")
  26.   elseif colors.test(input,colors.magenta) then
  27.     speaker.speak("Caution! Reactor Heat above Normal Level!")
  28.   elseif colors.test(input,colors.orange) then
  29.     speaker.speak("Attention! Reactor Heat Level at 2000 degrees")
  30.   elseif colors.test(input,colors.white) then
  31.     speaker.speak("attention, Reactor heat level increase detected")
  32.   else
  33.     speaking = false --#we aren't waiting if it didn't speak, this is probably not needed but I like to program for any situation.
  34.   end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement