Advertisement
Guest User

startup

a guest
Feb 16th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.76 KB | None | 0 0
  1. m = peripheral.wrap("monitor_3")
  2. redstone.setOutput('right',false)
  3. rednet.open('left')
  4. m.setBackgroundColor(32768)
  5. t = true
  6. f = false
  7. destsboo = {false,false,false,false,false,false}
  8. destsid = {48,49,51,1,1,1}
  9. dests = {"Crafting Room","Storage Unit","Server Room","Undefined","Undefined","Undefined"}
  10. function choose(x)
  11.   if x then
  12.     m.setBackgroundColor(8192)
  13.   else
  14.     m.setBackgroundColor(16384)
  15.   end
  16. end
  17. function reset()
  18.   update(f,t)
  19.   os.sleep(0.25)
  20.   redstone.setOutput('right',true)
  21.   os.sleep(1.5)
  22.   update()
  23.   redstone.setOutput('right',false)
  24. end
  25. function embark()
  26.   update(t,f)
  27.   os.sleep(0.25)
  28.   m.clear()
  29.   m.setTextScale(5)
  30.   for i = 1,5 do
  31.     m.setCursorPos(1,1)
  32.     m.write(string.format(-1*(i-6)))
  33.     os.sleep(1)
  34.   end
  35.   m.setCursorPos(1,1)
  36.   m.setTextColor(8192)
  37.   m.write("GO")
  38.   m.setTextColor(1)
  39.   redstone.setOutput('right',true)
  40.   os.sleep(5)
  41.   redstone.setOutput('right',false)
  42.   destsboo = {false,false,false,false,false,false}
  43. end
  44. function update(x,y)
  45.   m.clear()
  46.   m.setTextScale(0.5)
  47.   m.setTextColor(1)
  48.   m.setCursorPos(1,1)
  49.   m.write("Choose dest(s)")
  50.   for i = 1,6 do
  51.     m.setCursorPos(1,i+1)
  52.     choose(destsboo[i])
  53.     m.write(dests[i])
  54.   end
  55.   m.setCursorPos(1,8)
  56.   choose(x)
  57.   m.write("EMBARK")
  58.   m.setCursorPos(1,9)
  59.   choose(y)
  60.   m.write("RESET")
  61.   m.setBackgroundColor(32768)
  62. end
  63.  
  64. while true do
  65.   update()
  66.   event,side,x,y = os.pullEvent("monitor_touch")
  67.   if y > 1 and y < 8 then
  68.     if destsboo[y-1] then
  69.       destsboo[y-1] = false
  70.       id = destsid[y-1]
  71.       rednet.send(id,'close')
  72.     else
  73.       destsboo[y-1] = true
  74.       id = destsid[y-1]
  75.       rednet.send(id,'open')
  76.     end
  77.   elseif y == 8 then
  78.     embark()
  79.   elseif y == 9 then
  80.     reset()
  81.   end
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement