Posted 18 November 2013 - 12:54 PM
I made the following code and it is going to be used for a tower that lights lights at different stages and can be stopped, auto-run, auto-run stopped etc. But on the line that follows function define() the os.pullEvent() isnt working the way i want it to.
*NOTE:*
This code isnt finnished yet so dont critisize
*NOTE:*
This code isnt finnished yet so dont critisize
Spoiler
function main()
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput ("back"), colors.blue))
rs.setBundledOutput("back", colors.combine(rs.getBundledOutput("back"), colors.blue))
sleep(0.2)
rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.blue))
rs.setBundledOutput("back", colors.combine(rs.getBundledOutput("back"), colors.black))
sleep(0.2)
rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.black))
rs.setBundledOutput("back", colors.combine(rs.getBundledOutput("back"), colors.yellow))
sleep(0.2)
rs.setBundledOutput("back", colors.subract(rs.getBundledOutput("back"), colors.yellow))
rs.setBundledOutput("back", colors.combine(rs.getBundledOutput("back"), colors.red))
sleep(0.2)
rs.setBundledOutput("back", colors.subtract(rs.getBundledOutput("back"), colors.red))
rs.setBundledOutput("back", colors.combine(rs.getBundledOutput("back"), colors.grey))
sleep(0.2)
rs.setBundledOutPut("back", colors.subtract(rs.getBundledOutput("back"), colors.grey))
define()
end
function define()
os.pullEvent()
if (event==key) and (p1==16) then
fs.makeDir("stop")
elseif (event==key) and (p1==34) then
main()
elseif (event==key) and (p1==19) then
fs.makeDir("r")
main()
elseif fs.isDir("r") then os.pullEvent(1.75)
if (event==key) then
fs.del("r/")
main()
else
main()
end
elseif (event==key) and (p1==30) then
fs.makeDir("r")
main()
else
sleep(0)
define()
end
end
define()