Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("top")
- m.setTextScale(0.5)
- p = peripheral.wrap("back")
- noplayer = "No Player"
- cplayer = noplayer
- color = {}
- color.bc = colors.gray
- color.vc = colors.lime
- color.tc = colors.black
- function draw_bar(y)
- size = {term.getSize()}
- term.setCursorPos(1,y)
- for i = 1,size[1] do
- term.write(" ")
- end
- end
- function cprint(y,text)
- size = {term.getSize()}
- term.setCursorPos(math.ceil((size[1]/2)-(#text/2)+1),y)
- term.write(text)
- end
- while true do
- --print(cplayer)
- term.redirect(m)
- term.setBackgroundColor(color.bc)
- term.clear()
- term.setBackgroundColor(color.vc)
- size = {term.getSize()}
- draw_bar(1)
- draw_bar(size[2])
- term.setTextColor(color.tc)
- term.setCursorPos(1,1)
- evnt = {os.pullEvent()}
- if evnt[1] == "player_on" then
- if cplayer == noplayer then
- cplayer = evnt[2]
- end
- elseif evnt[1] == "player_off" then
- if cplayer ~= noplayer then
- cplayer = noplayer
- end
- end
- cprint(1,cplayer)
- term.restore()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement