Advertisement
hevohevo

ComputerCraft: rc0

Jun 11th, 2016
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. -- リモコン側プログラム
  2.  
  3.  
  4. term.setTextColor(colors.white)
  5. term.setBackgroundColor(colors.black)
  6. term.setCursorPos(1,1)
  7. term.clear()
  8.  
  9. print("Remote Contorol Button")
  10. print(" Order?")
  11. local win1 = window.create(term.current(), 4, 4, 19, 5, true)
  12. local win2 = window.create(term.current(), 4, 9, 19, 5, true)
  13. local win3 = window.create(term.current(), 1, 20, 26, 1, true)
  14.  
  15. win1.setBackgroundColor(colors.blue)
  16. win1.clear()
  17. win1.setCursorPos(5,3)
  18. win1.write("Calling Turtles")
  19.  
  20. win2.setBackgroundColor(colors.red)
  21. win2.clear()
  22. win2.setCursorPos(7,3)
  23. win2.write("Start building")
  24.  
  25. win3.setBackgroundColor(colors.green)
  26. win3.clear()
  27. win3.setCursorPos(2, 1)
  28. win3.write("message...")
  29.  
  30. rednet.open("back")
  31.  
  32. while true do
  33.   local event, b, x, y = os.pullEvent("mouse_click")
  34.   win3.clear()
  35.   win3.setCursorPos(1,1)
  36.   win3.write(x)
  37.   win3.write(",")
  38.   win3.write(y)
  39.  
  40.   if (x >= 4 and x <= 22) and (y >= 4 and y <= 8) then
  41.     win3.write(" PUSH: Call")
  42.     -- rednet.broadcast("start_build")
  43.   elseif (x >= 4 and x <= 22) and (y >= 9 and y <= 13) then
  44.     win3.write(" PUSH: Build")
  45.     break
  46.   else
  47.     -- do nothing
  48.   end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement