Advertisement
Guest User

startup

a guest
Dec 21st, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.83 KB | None | 0 0
  1. mon = peripheral.wrap("right")
  2.  
  3. function Minuteur()
  4.   s = 0
  5.   m = 0
  6.   h = 0
  7.   f = 0
  8.     mon.setBackgroundColor(colors.red)
  9.     mon.setTextColor(colors.green)
  10.     mon.clear()
  11.     rs.setOutput("back",false)
  12.   while f == 0 do
  13.     mon.setCursorPos(3,1)
  14.     mon.write("-")
  15.     mon.setCursorPos(9,1)
  16.     mon.write("-")
  17.     mon.setCursorPos(15,1)
  18.     mon.write("-")
  19.     mon.setCursorPos(3,2)
  20.     mon.write(h)
  21.     mon.setCursorPos(9,2)
  22.     mon.write(m)
  23.     mon.setCursorPos(15,2)
  24.     mon.write(s)
  25.     mon.setCursorPos(3,3)
  26.     mon.write("+")
  27.     mon.setCursorPos(9,3)
  28.     mon.write("+")
  29.     mon.setCursorPos(15,3)
  30.     mon.write("+")
  31.     if h < 10 then
  32.       mon.setCursorPos(4,2)
  33.       mon.write(" h ")
  34.     elseif h > 9 then
  35.       mon.setCursorPos(5,2)
  36.       mon.write(" h")
  37.     end
  38.     if m < 10 then
  39.       mon.setCursorPos(10,2)
  40.       mon.write(" m ")
  41.     elseif m > 9 then
  42.       mon.setCursorPos(11,2)
  43.       mon.write(" m")
  44.     end
  45.     if s < 10 then
  46.       mon.setCursorPos(16,2)
  47.       mon.write(" s ")
  48.     elseif s > 9 then
  49.       mon.setCursorPos(17,2)
  50.       mon.write(" s")
  51.     end
  52.       mon.setTextColor(colors.blue)
  53.       mon.setCursorPos(1,5)
  54.       mon.write("Retour")
  55.       mon.setCursorPos(14,5)
  56.       mon.write("Start")
  57.       mon.setTextColor(colors.green)
  58.       event, side, x, y = os.pullEvent("monitor_touch")
  59.     if x == 3 and y == 1 and h > 0 then
  60.       h = h - 1
  61.     elseif x == 3 and y == 3 and h < 24 then
  62.       h = h + 1
  63.     elseif x == 9 and y == 1 and m > 0 then
  64.       m = m - 1
  65.     elseif x == 9 and y == 3 and m < 60 then
  66.       m = m + 1
  67.     elseif x == 15 and y == 1 and s > 0 then
  68.       s = s - 1
  69.     elseif x == 15 and y == 3 and s < 60 then
  70.       s = s + 1
  71.     elseif x < 6 and y == 5 then
  72.     os.reboot()
  73.     elseif x > 12 and y == 5 then
  74.     f = 1
  75.     end
  76.   end
  77.  
  78.   while true do
  79.     rs.setOutput("back",true)
  80.     mon.setBackgroundColor(colors.green)
  81.     mon.clear()
  82.     mon.setTextColor(colors.red)
  83.     mon.setCursorPos(1,2)
  84.     mon.write(h)
  85.     mon.setCursorPos(5,2)
  86.     mon.write(":")
  87.     mon.setCursorPos(9,2)
  88.     mon.write(m)
  89.     mon.setCursorPos(13,2)
  90.     mon.write(":")
  91.     mon.setCursorPos(17,2)
  92.     mon.write(s)
  93.     if h > 9 then
  94.     mon.setCursorPos(3,2)
  95.     mon.write("  ")
  96.     elseif h < 10 then
  97.     mon.setCursorPos(2,2)
  98.     mon.write("  ")
  99.     end
  100.     if m > 9 then
  101.     mon.setCursorPos(11,2)
  102.     mon.write("  ")
  103.     elseif m < 10 then
  104.     mon.setCursorPos(10,2)
  105.     mon.write("  ")
  106.     end
  107.     if s < 10 then
  108.     mon.setCursorPos(18,2)
  109.     mon.write(" ")
  110.     end
  111.     if s == 0 and m > 0 then
  112.     s = 59
  113.     m = m - 1
  114.     elseif s > 0 then
  115.     s = s - 1
  116.     elseif s == 0 and m > 0 and h > 0 then
  117.     m = m - 1
  118.     s = 59
  119.     elseif s == 0 and m == 0 and h > 0 then
  120.     h = h - 1
  121.     m = 59
  122.     s = 59
  123.     elseif s == 0 and m == 0 and h == 0 then
  124.     os.reboot()
  125.     end
  126.   sleep(1)    
  127.   end
  128. end
  129.  
  130. while true do
  131.   mon.setBackgroundColor(colors.red)
  132.   mon.clear()
  133.   mon.setTextScale(1)
  134.   mon.setCursorPos(5,1)
  135.   mon.setTextColor(colors.black)
  136.   mon.write("Soul Shard")
  137.   mon.setCursorPos(9,5)
  138.   mon.setTextColor(colors.blue)
  139.   mon.write("Minuteur->")
  140.   mon.setCursorPos(8,3)
  141.   mon.setTextColor(colors.green)
  142.   mon.write("Stop")
  143.   event, side, x, y = os.pullEvent("monitor_touch")
  144.   if x > 8 and y == 5 then
  145.     Minuteur()
  146.   else
  147.     rs.setOutput("bottom",true)
  148.     mon.setBackgroundColor(colors.green)
  149.     mon.clear()
  150.     mon.setCursorPos(5,1)
  151.     mon.setTextColor(colors.black)
  152.     mon.write("Soul Shard")
  153.     mon.setTextColor(colors.blue)
  154.     mon.setCursorPos(9,5)
  155.     mon.write("Minuteur->")
  156.     mon.setCursorPos(8,3)
  157.     mon.setTextColor(colors.red)
  158.     mon.write("Run")
  159.     event, side, x, y = os.pullEvent("monitor_touch")
  160.   end
  161.   if x > 8 and y == 5 then
  162.     Minuteur()
  163.   else
  164.     rs.setOutput("bottom",false)
  165.   end
  166. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement