User blog:Bocajls/Lua

function LedPulse (color, age)

r

s.setBundledOutput ("side", color)

sleep(age)

rs.setBundledOutput ("side", 0)

end

write (" Times ") local t=read

Times = tonumber(t)

write (" color: ") local c=read

write (" seconds ") local a=read

term.clear term.setCursorPos (1,1)

while Times>0 do

LedPulse (c,a)

LedPulse (0,a)

T

imes = Times-1

end

____________________________________________________________________________________________

write (" Password : ")

v = read

i

f v == "kagemand" then

rs.setOutput ("left", true )

write (" Welcome back master ")

sleep(2)

os.reboot

else

write (" Invalid! ")

s

leep (4)

os.reboot

end

______________________________________________________________________________________________

print (" ")

write (" Choose Color: ")

print (" ")

print (" ")

write (" white. ")

write (" orange. ")

print (" ")

w

rite (" magenta. ")

write (" light blue. ")

print (" ")

write (" yellow. ")

write (" lime. ")

print (" ")

write (" pink. ")

write (" gray. ")

print (" ")

write (" light gray. ")

write (" cyan. ")

print (" ")

write (" purple. ")

write (" blue. ")

print (" ")

write (" brown. ")

write (" green. ")

print (" ")

write (" red. ")

write (" black. ")

term.setCursorPos(16,3)

v = read

if v == "white" then

rs.setBundledOutput("back", 1, true)

elseif v == "orange" then

rs.setBundledOutput("back", 2, true)

elseif v == "magenta" then

rs.setBundledOutput("back", 4, true)

elseif v == "light blue" then

rs.setBundledOutput("back", 8, true)

elseif v == "yellow" thenrs

.setBundledOutput("back", 16, true)

elseif v == "lime" then

rs.setBundledOutput("back", 32, true)

e

lseif v == "pink" then

rs.setBundledOutput("back", 64, true)

elseif v == "gray" then

rs.setBundledOutput("back", 128, true)

elseif v == "light gray" then

rs.setBundledOutput("back", 256, true)

elseif v == "cyan" then

rs.setBundledOutput("back", 512, true)

elseif v == "purple" then

rs.setBundledOutput("back", 1024, true)

elseif v == "blue" then

rs.setBundledOutput("back", 2048, true)

elseif v == "brown" then

rs.setBundledOutput("back", 4096, true)

elseif v == "green" then

rs.setBundledOutput("back", 8192, true)

elseif v == "red" then

rs.setBundledOutput("back", 16384, true)

elseif v == "black" then

r

s.setBundledOutput("back", 32768, true)

end

sleep(2)

os.reboot

__________________________________________________________________________________________

while true do

if disk.isPresent("left") then

shell.run("monitor", "right", "time")

sleep(5)

end

term.clear

shell.run("monitor", "right", "clear")

term.setCursorPos(1, 1)

end

Still need some work.

____________________________________________________________________________________________

x = 0

write (" Times: ")

number = tonumber(read)

while x < number do

rs.setOutput ("left", true)

sleep (0.2)

rs.setOutput ("left", false)

sleep (0.2)

x = x+1

end

__________________________________________________________________________________________