Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("touch");
  2.  
  3. mon = peripheral.wrap("front");
  4.  
  5. local t1 = touch.new("front");
  6. local t = t1;
  7.  
  8. function writeButtons()
  9. t1:add("Cell 1", nil, 1, 1, 9, 2, colors.red, colors.lime);
  10. t1:add("Cell 2", nil, 11, 1, 19, 2, colors.red, colors.lime);
  11. t1:add("Cell 3", nil, 21, 1, 29, 2, colors.red, colors.lime);
  12. t1:add("Cell 4", nil, 1, 4, 9, 5, colors.red, colors.lime);
  13. t1:add("Cell 5", nil, 11, 4, 19, 5, colors.red, colors.lime);
  14. t1:add("Cell 6", nil, 21, 4, 29, 5, colors.red, colors.lime);
  15.  
  16. t1:add("Cell 7", nil, 1, 6, 9, 7, colors.red, colors.lime);
  17. t1:add("Cell 8", nil, 11, 6, 19, 7, colors.red, colors.lime);
  18. t1:add("Cell 9", nil, 21, 6, 29, 7, colors.red, colors.lime);
  19. t1:add("Cell 10", nil, 1, 9, 9, 10, colors.red, colors.lime);
  20. t1:add("Cell 11", nil, 11, 9, 19, 10, colors.red, colors.lime);
  21. t1:add("Cell 12", nil, 21, 9, 29, 10, colors.red, colors.lime);
  22.  
  23. t = t1;
  24. t:draw();
  25. end
  26.  
  27. writeButtons();
  28.  
  29. while true do
  30. local event, p1 = t:handleEvents(os.pullEvent());
  31. if(event == "button_click") then
  32. t:toggleButton(p1);
  33. print(p1);
  34. end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement