Made an update… Added a neat little clock for the hell of it:
http://pastebin.com/8tVUZqFs
Side="back"
local running = true
local selected = 1
local Output = 0
X=0
States={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
--[[numbers]]--
function Numbers(Number,X,Y)
if Number==0 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print("## #")
term.setCursorPos(X,Y+2)
print("# # #")
term.setCursorPos(X,Y+3)
print("# # #")
term.setCursorPos(X,Y+4)
print("# ##")
term.setCursorPos(X,Y+5)
print("######")
end
if Number==1 then
term.setCursorPos(X,Y)
print(" #")
term.setCursorPos(X,Y+1)
print(" ###")
term.setCursorPos(X,Y+2)
print(" #")
term.setCursorPos(X,Y+3)
print(" #")
term.setCursorPos(X,Y+4)
print(" #")
term.setCursorPos(X,Y+5)
print(" #")
end
if Number==2 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print(" #")
term.setCursorPos(X,Y+2)
print("######")
term.setCursorPos(X,Y+3)
print("# ")
term.setCursorPos(X,Y+4)
print("# ")
term.setCursorPos(X,Y+5)
print("######")
end
if Number==3 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print(" #")
term.setCursorPos(X,Y+2)
print("######")
term.setCursorPos(X,Y+3)
print(" #")
term.setCursorPos(X,Y+4)
print(" #")
term.setCursorPos(X,Y+5)
print("######")
end
if Number==4 then
term.setCursorPos(X,Y)
print("# #")
term.setCursorPos(X,Y+1)
print("# #")
term.setCursorPos(X,Y+2)
print("######")
term.setCursorPos(X,Y+3)
print(" #")
term.setCursorPos(X,Y+4)
print(" #")
term.setCursorPos(X,Y+5)
print(" #")
end
if Number==5 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print("# ")
term.setCursorPos(X,Y+2)
print("######")
term.setCursorPos(X,Y+3)
print(" #")
term.setCursorPos(X,Y+4)
print(" #")
term.setCursorPos(X,Y+5)
print("######")
end
if Number==6 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print("# ")
term.setCursorPos(X,Y+2)
print("######")
term.setCursorPos(X,Y+3)
print("# #")
term.setCursorPos(X,Y+4)
print("# #")
term.setCursorPos(X,Y+5)
print("######")
end
if Number==7 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print(" #")
term.setCursorPos(X,Y+2)
print(" # ")
term.setCursorPos(X,Y+3)
print(" # ")
term.setCursorPos(X,Y+4)
print(" # ")
term.setCursorPos(X,Y+5)
print(" # ")
end
if Number==8 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print("# #")
term.setCursorPos(X,Y+2)
print("######")
term.setCursorPos(X,Y+3)
print("# #")
term.setCursorPos(X,Y+4)
print("# #")
term.setCursorPos(X,Y+5)
print("######")
end
if Number==9 then
term.setCursorPos(X,Y)
print("######")
term.setCursorPos(X,Y+1)
print("# #")
term.setCursorPos(X,Y+2)
print("######")
term.setCursorPos(X,Y+3)
print(" #")
term.setCursorPos(X,Y+4)
print(" #")
term.setCursorPos(X,Y+5)
print("######")
end
end
--[[functions in menu]]--
function Change()
if States[selected]==0 then
X=1
else
X=0
end
table.remove(States,selected)
table.insert(States,selected,X)
end
function PrintClock()
Hours=math.floor(os.time())
Minuts=math.floor(60*(os.time()-Hours))
Greatminuts=0
Greathours=0
while Minuts>=10 do
Greatminuts=Greatminuts+1
Minuts=Minuts-10
end
while Hours>=10 do
Greathours=Greathours+1
Hours=Hours-10
end
Numbers(Greathours,32,2)
Numbers(Hours,40,2)
Numbers(Greatminuts,32,10)
Numbers(Minuts,40,10)
end
--[[Menues:]]--
menuA = {
[1] = {text = "White "},
[2] = {text = "Orange "},
[3] = {text = "Magenta "},
[4] = {text = "Light blue "},
[5] = {text = "Yellow "},
[6] = {text = "Lime green "},
[7] = {text = "Pink "},
[8] = {text = "Gray "},
[9] = {text = "Light gray "},
[10] = {text = "Cyan "},
[11] = {text = "Purple "},
[12] = {text = "Blue "},
[13] = {text = "Brown "},
[14] = {text = "Green "},
[15] = {text = "Red "},
[16] = {text = "Black "}
}
--[[print function]]--
function PrintMenu( menu )
for i=1,#menu do
if i == selected then
io.write(">> ")
else
io.write(" ")
end
io.write(menu[i].text)
for H=1,#menu[i].text do
io.write(" ")
end
io.write(States[i])
io.write("n")
end
print(" ",Output)
end
--[[Keydetecter]]--
function Keypressed( key, menu )
if key == 28 then
Change()
elseif key == 200 then
if selected > 1 then
selected = selected - 1
end
elseif key == 208 then
if selected < #menu then
selected = selected + 1
end
end
end
--[[Select]]--
function SelectCurrentItem(menu)
menu[selected].handler()
end
--[[Main]]--
function main()
while running do
term.clear()
term.setCursorPos(1,1)
PrintMenu(menuA)
PrintClock()
os.startTimer(1)
event, key = os.pullEvent()
Keypressed(key,menuA)
Output = 0
X=1
for i=1,16 do
if States[i]==1 then
Output=Output+X
end
X=X*2
end
rs.setBundledOutput(Side, Output)
end
end
--[[Start menu]]--
main()