Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --NanoButton api
- Buttons={
- --Format : [text]={x,y,width,readyColor,notReadyColor}
- ["Spawner Door"]= {['x']=1,['y']=3,['w']=15,['rc']=512,['nrc']=16384,['cc']=512},
- ["Spawner Light"]= {['x']=1,['y']=7,['w']=15,['rc']=512,['nrc']=16384,['cc']=512},
- ["Spawner On"]= {['x']=1,['y']=11,['w']=15,['rc']=512,['nrc']=16384,['cc']=512},
- ["Spawner Off"]= {['x']=1,['y']=15,['w']=15,['rc']=512,['nrc']=16384,['cc']=512},
- }
- MonitorSide="top"
- m=peripheral.wrap(MonitorSide)
- m.clear()
- function drawButtons()
- for text,data in pairs(Buttons) do
- bx=data['x']
- by=data['y']
- bw=data['w']
- bcc=data['cc']
- bl=string.len(text)
- if bw<bl then
- bw=bl+4
- end
- textX=bx+2
- m.setBackgroundColor(bcc)
- for i=bx,bx+bw do
- m.setBackgroundColor(bcc)
- m.setCursorPos(i,by-1)
- m.write(" ")
- m.setCursorPos(i,by)
- m.write(" ")
- m.setCursorPos(i,by+1)
- m.write(" ")
- end
- m.setCursorPos(textX,by)
- m.write(text)
- m.setBackgroundColor(32768)
- end
- end
- drawButtons()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement