timia2109

ClockWorks

Nov 1st, 2012
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.40 KB | None | 0 0
  1. -- Clock , Alarm, Count, TCount, infos, clread, ifcl
  2. -- Variablen : h,m,s,h1,m1,s1,vnr,ch,choose,a1,infos1,rs,mo,ha,ma,sa,md
  3. -- When you copy something for your app, please mention me
  4. -- ClockWorks by timia2109 :D
  5. -- 205 lines of Code to read it use Notepad++ :D
  6. vnr = 0.1
  7. name = "ClockWorks"
  8.  
  9. function start()
  10.  cl()
  11.  print("timia2109s ClockWorks")
  12.  write("V")print(vnr)
  13.  print("When you find a bug please report")
  14.  print("Sorry for my bad english :(")
  15.  print("")
  16.  print("")
  17.  print("====================")
  18.  print("Choose the Tool")
  19.  print("1 = Clock")
  20.  print("2 = Alarm clock(DOSN´T WORK)")
  21.  print("3 = Countdown")
  22.  print("4 = Time counter")
  23.  print("9 = Changelog + more")
  24.  print("====================")
  25.  choose = read()
  26.  ch = choose+0
  27.  if ch == 1 then
  28.   clock()
  29.  end
  30.  if ch == 2 then
  31.   Alarm()
  32.  end
  33.  if ch == 3 then
  34.   Count()
  35.  end
  36.  if ch == 4 then
  37.   TCount()
  38.  end
  39.  if ch == 9 then
  40.   infos()
  41.  end
  42. end
  43.  
  44. function TCount()
  45.  h = 0
  46.  m = 0
  47.  s = 0
  48.  while true do
  49.   cl()
  50.   print("I count since")
  51.   write(h)write(":")write(m)
  52.   write(":")write(s)
  53.   s = s+1
  54.   if s > 59 then
  55.    s = 0
  56.    m = m+1
  57.   end
  58.   if m > 59 then
  59.    m = 0
  60.    h = h+1
  61.   end
  62.  sleep(1)
  63.  end
  64. end
  65.  
  66. function Count()
  67.  print("How much Hours?")
  68.  h1 = read()
  69.  print("How much Minutes?")
  70.  m1 = read()
  71.  print("How much Secounds")
  72.  s1 = read()
  73.  print("On what side is the Redstone? Or 0 if none")
  74.  rs = read()
  75.  h = h1+0
  76.  m = m1+0
  77.  s = s1+0
  78.  a1 = h+m+s
  79.  shell.run("clear")
  80.  while true do
  81.   cl()
  82.   print("Counting down")
  83.   write("When 0 then redstone ")print(rs)
  84.   write(h)write(":")write(m)
  85.   write(":")write(s)
  86.   s = s-1
  87.   a1 = a1-1
  88.   if s == 0 then
  89.    if m > 0 then
  90.     s = 59
  91.     m = m-1
  92.    end
  93.   end
  94.   if m == 0 then
  95.    if h > 0 then
  96.     m = 59
  97.     h = h-1
  98.    end
  99.   end
  100.  sleep(1)
  101.  if h == 0 then
  102.   if m == 0 then
  103.    if s == 0 then
  104.     cl()
  105.     if not rs == 0 then
  106.      rs.setOutput(rs,true)
  107.     end
  108.     print("End")
  109.     write(h1)write(":")write(m1)
  110.     write(":")write(s1)
  111.    end
  112.   end
  113.  end
  114. end
  115. end
  116.  
  117. function infos()
  118.  cl()
  119.  print("ClockTools")
  120.  print("by timia2109")
  121.  write("Version")print(vnr)
  122.  print("New in 0.1")
  123.  print("First version")
  124.  term.setCursorPos(1,17)
  125.  print("USED TO MADE NOTEPAD++")
  126.  print("WRITE 0 to go back")
  127. end
  128.  
  129. function cl()
  130.  term.clear()
  131.  term.setCursorPos(1,1)
  132. end
  133.  
  134. function clock()
  135. cl()
  136. md = 0
  137. clread()
  138.  while true do
  139.   s = s+1
  140.   ifcl()
  141.   cl()
  142.   print("Clock by timia2109")
  143.   write(h)write(":")write(m)write(":")write(s)
  144.   sleep(1)
  145.   end
  146. end
  147.  
  148. function clread()
  149.  print("You must give me the current time!")
  150.  print("what hour are?")
  151.  h1 = read()
  152.  print("what minute are?")
  153.  m1 = read()
  154.  print("what second are?")
  155.  s1 = read()
  156.  if md == 1 then
  157.   print("what hour the alert are?")
  158.   ha = read()
  159.   print("what minute the alert are?")
  160.   ma = read()
  161.   print("what secound the alert are?")
  162.   sa = read()
  163.  end
  164.  h = h1+0
  165.  m = m1+0
  166.  s = s1+0
  167. end
  168.  
  169. function ifcl()
  170.  if s == 60 then
  171.   s = 0
  172.   m = m+1
  173.  end
  174.  if m == 60 then
  175.   m = 0
  176.   h = h+1
  177.  end
  178.  if h == 24 then
  179.   h = 0
  180.  end
  181.  if md == 1 then
  182.   if h == ha then
  183.    if m == ma then
  184.     if s == sa then
  185.      write("IT IS NOW")write(h)write(":")write(m)write(":")write(s)
  186.     end
  187.    end
  188.   end
  189.  end
  190. end
  191.  
  192. function Alarm()
  193.  md = 1
  194.  clread()
  195.  while true do
  196.   s = s+1
  197.   ifcl()
  198.   cl()
  199.   print("Clock by timia2109")
  200.   write(h)write(":")write(m)write(":")write(s)
  201.   sleep(1)
  202.  end
  203. end
  204.  
  205. start()
Advertisement
Add Comment
Please, Sign In to add comment