Advertisement
Plazter

Spawn Monitor

May 17th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. -- This code is made by Plazter, Feel free to change the code for the better.
  2. -- The code was made to make it easy for spawn monitors in a minecraft server.
  3.  
  4. m = peripheral.find("monitor")
  5. -- settings
  6. local function mWrite(text)
  7.         local x2,y2 = m.getCursorPos()
  8.         local x,y = m.getSize()
  9.         m.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  10.         m.write(text)  
  11. end
  12.  
  13. local function nLine()
  14.     line = line + 2
  15.     m.setCursorPos(1,line)
  16. end
  17.  
  18. local function rank(text)
  19.     m.setCursorPos(1,line)
  20.     mWrite(text)
  21.     nu = 0
  22. end
  23.  
  24. local function msg(text)
  25.   line = line +1
  26.   m.setCursorPos(1,line)
  27.   nu = nu + 1
  28.  
  29.   m.write(nu..": ".. text)
  30. end
  31.  
  32. local function col(text)
  33.     if text == "white" then
  34.         m.setTextColor(colors.white)
  35.     elseif text == "black" then
  36.         m.setTextColor(colors.black)
  37.     elseif text == "red" then
  38.         m.setTextColor(colors.red)
  39.     elseif text == "green" then
  40.         m.setTextColor(colors.green)
  41.     elseif text == "orange" then
  42.         m.setTextColor(colors.orange)
  43.     elseif text == "gray" then
  44.         m.setTextColor(colors.gray)
  45.     elseif text == "lgray" then
  46.         m.setTextColor(colors.lightGray)
  47.     elseif text == "brown" then
  48.         m.setTextColor(colors.brown)
  49.     elseif text == "blue" then
  50.         m.setTextColor(colors.blue)
  51.     elseif text == "cyan" then
  52.         m.setTextColor(colors.cyan)
  53.     elseif text == "purple" then
  54.         m.setTextColor(colors.purple)
  55.     elseif text == "pink" then
  56.         m.setTextColor(colors.pink)
  57.     elseif text == "lime" then
  58.         m.setTextColor(colors.lime)
  59.     elseif text == "lblue" then
  60.         m.setTextColor(colors.lightBlue)
  61.     elseif text == "magenta" then  
  62.         m.setTextColor(colors.magenta)
  63.     elseif text == "yellow" then
  64.         m.setTextColor(colors.yellow)
  65.     end
  66. end
  67.  
  68. local function title(text)
  69. m.clear()
  70. m.setCursorPos(1,1)
  71. mWrite(text)
  72. end
  73.  
  74. line = 1
  75. nu = 0
  76.  
  77.  
  78. -- Main program, Dont delete above this
  79. title("Your Title here")
  80. msg("some rule or perk")
  81. msg("Perk")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement