Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function centerText(text) --creates a function called centerText()
- mon = peripheral.wrap("left")
- mon.setTextColour(colours.red)
- mon.setBackgroundColour(colors.black)
- mon.setTextScale(2) --This changes text size 1-5 feel free to adjust it
- local x,y =mon.getSize() --gets the size of the screen.
- local x2,y2 = mon.getCursorPos() --gets the current position of the cursor.
- mon.setCursorPos(math.ceil((x/2) - (text:len() / 2)), math.ceil(y/2)) --sets the cursor to halfway on each axis.
- mon.write(text) --writes the text
- end --ends the function
- while true do --infinite loop
- centerText("Missile Launched") --calls the function
- sleep(1) --sleeps for one second
- mon.clear() --clears the monitor screen
- sleep(1) --sleeps for a second
- end --ends the while loop
Advertisement
Add Comment
Please, Sign In to add comment