Hi guys. Complete coding noob here. Has anyone written a simple program to display flashing text in the center of the screen/monitor?
3 replies to this topic
#1
Posted 17 April 2013 - 07:18 PM
#2
Posted 17 April 2013 - 08:30 PM
side = "right" -- replace right with the side your monitor is on, or with nothing if you want to display it on the computer screen text = "hello" -- replace hello with the text you want displayed flashSpeed = 2 -- replace with the speed you want to flash at, measured in seconds if side ~= "" then term.redirect(peripheral.wrap(side)) end w, h = term.getSize() term.setBackgroundColor(colors.black) term.setTextColor(colors.white) while true do term.clear() sleep(flashSpeed) term.setCursorPos((w + 1)/2 - text:len()/2, h/2) term.write(text) sleep(flashSpeed) end
There you go. It will display text in the center of a monitor or screen, depending on the side variable. If you want me to explain it, just ask.
#3
Posted 18 April 2013 - 12:38 AM
Moved to Ask a Pro.
#4
Posted 18 April 2013 - 10:18 AM
What do you mean with flashing?
Do you mean as GravityScore showed or with colors?
Otherwise you'll have to explain better what you mean with flashing text..
But anyway, Hope you liked this
Do you mean as GravityScore showed or with colors?
--[[ Flashing Text ]]-- w,h = term.getSize() function clear() term.clear() term.setCursorPos(1,1) end function centerPrint(y,text) term.setCursorPos(w/2 - #text/2, y) write(text) end function main(t) while true do clear() term.setTextColor(2 ^ math.random(1,15) ) centerPrint(h/2,"Enter Message Here!") sleep(t) end end main(0.1)
Otherwise you'll have to explain better what you mean with flashing text..
But anyway, Hope you liked this
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











