Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local durasi = 60
- local interval = 10
- local cooling = 10
- local jalan = false
- function start()
- local drs = durasi
- local temp =0
- jalan = true
- redstone.setOutput("back",true)
- while drs > 0 do
- term.clear()
- term.setCursorPos(1,1)
- term.write("Sisa Waktu")
- term.setCursorPos(1,2)
- local pbar = drs/durasi *51
- term.setBackgroundColor(colors.green)
- for i=1,51 do
- if i>pbar then
- term.setBackgroundColor(colors.gray)
- end
- term.write(" ")
- end
- term.setBackgroundColor(colors.black)
- if jalan then
- if temp == interval then
- redstone.setOutput("back",false)
- jalan = not jalan
- temp = 0
- end
- else
- if temp == cooling then
- redstone.setOutput("back",true)
- jalan = not jalan
- temp = 0
- end
- end
- if jalan then
- print("")
- io.write(drs)
- print(" Detik")
- drs = drs - 1
- else
- local b = cooling - temp
- print("")
- print("Cooling Nuclear Reactor for "..tostring(b).." s")
- end
- temp = temp + 1
- sleep(1)
- end
- end
- function toggle()
- if jalan then
- redstone.setOutput("back",false)
- else
- redstone.setOutput("back",true)
- end
- jalan = not jalan
- end
- redstone.setOutput("back",false)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.write("Nuclear Reactor Panel")
- term.setCursorPos(1,2)
- term.setBackgroundColor(colors.blue)
- term.write("Durasi : ")
- term.setBackgroundColor(colors.red)
- term.write(" - ")
- term.setBackgroundColor(colors.gray)
- term.write(" ")
- term.write(durasi)
- term.write(" ")
- term.setBackgroundColor(colors.green)
- term.write(" + ")
- term.setBackgroundColor(colors.black)
- term.write(" Detik ")
- term.setCursorPos(1,3)
- term.setBackgroundColor(colors.blue)
- term.write("Interval : ")
- term.setBackgroundColor(colors.red)
- term.write(" - ")
- term.setBackgroundColor(colors.gray)
- term.write(" ")
- term.write(interval)
- term.write(" ")
- term.setBackgroundColor(colors.green)
- term.write(" + ")
- term.setBackgroundColor(colors.black)
- term.write(" Detik ")
- term.setCursorPos(1,4)
- term.setBackgroundColor(colors.blue)
- term.write("Cooling : ")
- term.setBackgroundColor(colors.red)
- term.write(" - ")
- term.setBackgroundColor(colors.gray)
- term.write(" ")
- term.write(cooling)
- term.write(" ")
- term.setBackgroundColor(colors.green)
- term.write(" + ")
- term.setBackgroundColor(colors.black)
- term.write(" Detik ")
- term.setCursorPos(1,6)
- term.setBackgroundColor(colors.green)
- term.write(" ")
- term.setBackgroundColor(colors.black)
- term.write(" ")
- term.setBackgroundColor(colors.orange)
- term.write(" ")
- term.setCursorPos(1,7)
- term.setBackgroundColor(colors.green)
- term.write(" START ")
- term.setBackgroundColor(colors.black)
- term.write(" ")
- term.setBackgroundColor(colors.orange)
- term.write(" TOOGLE ")
- term.setCursorPos(1,8)
- term.setBackgroundColor(colors.green)
- term.write(" ")
- term.setBackgroundColor(colors.black)
- term.write(" ")
- term.setBackgroundColor(colors.orange)
- term.write(" ")
- term.setBackgroundColor(colors.black)
- local event, button, x, y = os.pullEvent("mouse_click")
- --durasi--
- if x>=12 and x<=15 and y == 2 then
- durasi = durasi - 1
- elseif x>=19 and x<=21 and y == 2 then
- durasi = durasi + 1
- elseif x>=15 and x<=18 and y == 2 then
- term.setCursorPos(1,4)
- print("")
- io.write("Edit Durasi : ")
- local a = read()
- durasi = tonumber(a)
- --interval--
- elseif x>=12 and x<=15 and y == 3 then
- interval = interval - 1
- elseif x>=19 and x<=21 and y == 3 then
- interval = interval + 1
- elseif x>=15 and x<=18 and y == 3 then
- term.setCursorPos(1,4)
- print("")
- io.write("Edit Interval : ")
- local a = read()
- interval = tonumber(a)
- --cooling--
- elseif x>=12 and x<=15 and y == 4 then
- cooling = cooling - 1
- elseif x>=19 and x<=21 and y == 4 then
- cooling = cooling + 1
- elseif x>=15 and x<=18 and y == 4 then
- term.setCursorPos(1,4)
- print("")
- io.write("Edit Cooling : ")
- local a = read()
- cooling = tonumber(a)
- elseif x>=1 and x<=7 and y>=6 and y<=8 then
- start()
- elseif x>=10 and x<=17 and y>=6 and y<=8 then
- toggle()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement