Advertisement
Mackan90096

Untitled

May 17th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. --[[
  2. Copyright 2015 Max Thor <thormax5@gmail.com>
  3.  
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7.  
  8. http://www.apache.org/licenses/LICENSE-2.0
  9.  
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. --]]
  16.  
  17. for k, v in pairs(rs.getSides()) do
  18. if peripheral.getType(v) == "modem" then
  19. rednet.open(v)
  20. end
  21. end
  22.  
  23.  
  24. local w, h = term.getSize()
  25.  
  26. function cPrint(sText, y)
  27. local x = math.max(math.floor((w / 2) - (#sText / 2)), 0)
  28. term.setCursorPos(x, y)
  29. print(sText)
  30. end
  31.  
  32. function cWrite(sText, y)
  33. local x = math.max(math.floor((w / 2) - (#sText / 2)), 0)
  34. term.setCursorPos(x, y)
  35. term.write(sText)
  36. end
  37.  
  38. function main()
  39. term.clear()
  40. cPrint("Music DJ", 2)
  41. cPrint("-------------", 3)
  42. cPrint("1: Far", 5)
  43. cPrint("2: Chirp", 6)
  44. cPrint("3: Strad", 7)
  45. cPrint("-------------", 9)
  46. cWrite("> ", 11)
  47. local tune = read()
  48. rednet.send(268, tune)
  49. main()
  50. end
  51.  
  52. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement