View difference between Paste ID: FEJddW85 and i4MhiWJX
SHOW: | | - or go back to the newest paste.
1
function centerText(text)      --creates a function called centerText()
2
 mon = peripheral.wrap("left")
3
 mon.setTextColour(colours.red)
4
 mon.setBackgroundColour(colors.black)
5
 mon.setTextScale(2) --This changes text size 1-5 feel free to adjust it
6
  
7
  local x,y =mon.getSize()  --gets the size of the screen.
8
  local x2,y2 = mon.getCursorPos()   --gets the current position of the cursor.
9
  mon.setCursorPos(math.ceil((x/2) - (text:len() / 2)), math.ceil(y/2))   --sets the cursor to halfway on each axis.
10
  mon.write(text)   --writes the text
11
end    --ends the function
12
while true do   --infinite loop
13
centerText("Missile Launched")  --calls the function
14
sleep(1)   --sleeps for one second
15
mon.clear()  --clears the monitor screen
16
sleep(1) --sleeps for a second
17
end  --ends the while loop