Guest User

buttonMain

a guest
Mar 15th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. displayText = "template"
  2. --The X position on the screen
  3. startX = 2
  4. --The Y position on the screen
  5. startY = 2
  6. --Use 0 if only a single line
  7. height = 0
  8. width  = string.len(displayText)
  9. --Color of the button and text
  10. boxColor  = colors.blue
  11. TextColor = colors.white
  12. ---------------------------------------------------
  13. slc = 0
  14. paintutils.drawBox(startX,startY, width,height,boxColor)
  15. term.setCursorPos(startX, startY)
  16. term.setTextColor(textColor)
  17. print(displayText)
  18.  
  19. while true do
  20.  local event, button, X, Y = os.pullEventRaw()
  21.   if(slc == 0) then
  22.     if(event == "mouse_click") then
  23.       if(X >= startX and X <= width and Y >= startY and Y <= height) then
  24.         --Write what the button has to do in the if
  25.         if(true) then
  26.         os.reboot()
  27.         end
  28.         --------------------------------------
  29.       end
  30.     end
  31.   end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment