Xylem_Gaming

Messenger (ServerScreen)

Apr 7th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. tx,ty = term.getSize()
  2. id = os.getComputerID()
  3. tc = term.isColor()
  4.  
  5. local function printCentered(text, y)
  6.   if math.floor(#text/2) == 2 then
  7.     centerx = math.floor((tx - string.len(text))/2)
  8.   end
  9.   centerx = math.floor((tx - string.len(text))/2)
  10.   term.setCursorPos(centerx,y)
  11.   print(text)
  12. end
  13.  
  14. function drawTab()
  15.   term.setCursorPos(1,1)
  16.   print("ID: "..id)
  17.   --help()
  18. end
  19.  
  20. function drawTitle(title)
  21.   if tc then
  22.     term.setTextColor(colors.red)
  23.     printCentered(title,3)
  24.     term.setTextColor(colors.white)
  25.   else
  26.     printCentered(title,3)
  27.   end
  28. end
  29.  
  30. function drawMenu(options)
  31.   local tnum = table.getn(options)
  32.   for i in ipairs(options) do
  33.     printCentered(options[i],i+4)
  34.   end
  35. end
  36.  
  37. function select(number,selection)
  38.   local index = number + 4
  39.   printCentered("> "..selection.." <",index)
  40. end
  41.  
  42. --[[
  43. function help()
  44.   helptxt = ("Use the arrow keys to navigate")
  45.   if tx - 7 < string.len(helptxt) then
  46.     term.setCursorPos(tx-string.len(helptxt),1)
  47.     print(helptxt)
  48. end
  49. --]]
  50.  
  51. function exe(selection)
  52.  
  53. end
Add Comment
Please, Sign In to add comment