Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nButtons = 3 --The number of buttons
- local nMaxButtonText = 10 --The fake maximum text length
- term.setBackgroundColor(colors.black)
- term.clear()
- local nPadding = 1
- local termX, termY = term.getSize()
- local nMaxButtonLength = nMaxButtonText + (nPadding*2)
- local nButtonDistance = (termX-(nMaxButtonLength*nButtons))/(nButtons-1)
- nButtonDistance = math.floor(nButtonDistance)
- local function drawButton(x,y)
- term.setCursorPos(x,y)
- term.write(string.rep(" ",nMaxButtonText))
- end
- term.setBackgroundColor(colors.blue)
- local xCoord = 1
- for index=1,nButtons do
- drawButton(xCoord, 5)
- xCoord = xCoord + nMaxButtonLength + nButtonDistance
- end
Advertisement
Add Comment
Please, Sign In to add comment