Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t=term
- side="left"
- term.clear()
- x,y=t.getSize()
- text="Use the arrow keys to change the radio's volume!"
- t.setCursorPos(math.ceil((x-string.len(text))/2), 1)
- t.write(text)
- t.setCursorPos(math.ceil((x-string.len("Volume Level"))/2),2)
- t.write("Volume Level")
- HalfX=math.floor(x/2)
- for i=1,16 do
- term.setCursorPos(HalfX-1,i+2)
- term.write("[ ]")
- end
- term.setCursorPos(HalfX,11)
- term.write("-")
- Selection=7
- rs.setAnalogOutput(side, 7)
- while true do
- event, Key=os.pullEvent("key")
- if Key==200 then
- if Selection~=15 then
- Selection=Selection+1
- end
- elseif Key==208 then
- if Selection~=0 then
- Selection=Selection-1
- end
- end
- rs.setAnalogOutput(side, Selection)
- t.setCursorPos(HalfX, 19-Selection)
- t.write(" ")
- if Selection~=15 then
- t.setCursorPos(HalfX, 17-Selection)
- t.write(" ")
- end
- t.setCursorPos(HalfX, 18-Selection)
- t.write("-")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement