Advertisement
SirBaconBitz

Portal Program

Feb 1st, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. shell.run("destination")
  2. redstone.setOutput("top", true)
  3. sides = peripheral.getNames()
  4. for k,v in pairs(sides) do
  5. name = peripheral.getType(v)
  6. if name == "Dialling Device" then
  7. dial = peripheral.wrap(v)
  8. end
  9. end
  10. while true do
  11. local words = {}
  12. e, msg, b, c = os.pullEvent("chat_command")
  13. if msg == "updatedest" then
  14. shell.run("delete destination")
  15. shell.run("pastebin get J6TkdfJX destination")
  16. shell.run("destination")
  17. elseif string.find(msg, "open") then
  18. for word in msg:gmatch('[^%-]+') do
  19. table.insert(words, word)
  20. end
  21. for k, v in pairs(destination) do
  22. if k == words[2] then
  23. dial.dial(tostring(v))
  24. end
  25. end
  26. redstone.setOutput("top", false)
  27. elseif msg == "terminate" then
  28. dial.terminate()
  29. redstone.setOutput("top", true)
  30. elseif msg == "update" then
  31. shell.run("delete startup")
  32. shell.run("pastebin get K0BJbYA8 startup")
  33. os.reboot()
  34. end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement