Advertisement
DanielLaby99

calc

Mar 17th, 2013
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.50 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. sleep(0.1)
  4. term.setCursorPos(10,4)
  5. term.setTextColor(colors.white)
  6. term.setBackgroundColor(colors.blue)
  7. write(" Taschenrechner ")
  8. term.setBackgroundColor(colors.red)
  9. write("X")
  10. term.setBackgroundColor(256)
  11. term.setTextColor(colors.white)
  12. term.setCursorPos(10,5)
  13. print("                 ")
  14. term.setCursorPos(10,6)
  15. print(" ")
  16. term.setBackgroundColor(128)
  17. term.setCursorPos(11,6)
  18. write("               ")
  19. term.setBackgroundColor(256)
  20. write(" ")
  21. term.setCursorPos(10,7)
  22. print("                 ")
  23. term.setCursorPos(10,8)
  24. write(" ")
  25. term.setBackgroundColor(128)
  26. write(" + ")
  27. term.setBackgroundColor(256)
  28. write(" ")
  29. term.setBackgroundColor(128)
  30. write(" - ")
  31. term.setBackgroundColor(256)
  32. write(" ")
  33. term.setBackgroundColor(128)
  34. write(" : ")
  35. term.setBackgroundColor(256)
  36. write(" ")
  37. term.setBackgroundColor(128)
  38. write(" * ")
  39. term.setBackgroundColor(256)
  40. write(" ")
  41. term.setBackgroundColor(256)
  42.  
  43. term.setCursorPos(10,9)
  44. print("                 ")
  45.  
  46.  
  47.  
  48.  
  49. term.setCursorPos(1,2)
  50. term.setBackgroundColor(colors.white)
  51. term.setTextColor(colors.black)
  52.  
  53.  
  54.  
  55.  
  56. a=0
  57. while a==0 do
  58. while true do
  59. local event, button, X, Y = os.pullEvent("mouse_click")
  60. XY = X..","..Y
  61.  
  62. if XY == "10,19" and button == 1 then
  63. shell.run("/Laby/Start")
  64. break
  65. end
  66.  
  67. if XY == "3,19" and button == 1 then
  68. shell.run("/Laby/Start")
  69. break
  70. end
  71.  
  72. if XY == "4,19" and button == 1 then
  73. shell.run("/Laby/Start")
  74. break
  75. end
  76.  
  77. if XY == "5,19" and button == 1 then
  78. shell.run("/Laby/Start")
  79. break
  80. end
  81.  
  82. if XY == "26,4" and button == 1 then
  83. term.setTextColor(colors.white)
  84. shell.run("/Laby/Gast")
  85. break
  86. end
  87.  
  88.  
  89.  
  90.  
  91. term.setBackgroundColor(128)
  92. term.setTextColor(colors.white)
  93. if XY == "12,8" and button == 1 then
  94. term.setCursorPos(12,6)
  95. write("              ")
  96. term.setCursorPos(12,6)
  97. p1=read()
  98. term.setCursorPos(12,6)
  99. write("              ")
  100. term.setCursorPos(12,6)
  101. write("")
  102. p2=read()
  103. ergebnis=p1 + p2
  104. term.setCursorPos(12,6)
  105. write("              ")
  106. term.setCursorPos(12,6)
  107. print(ergebnis)
  108. term.setCursorPos(12,6)
  109. break
  110. end
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117. term.setBackgroundColor(128)
  118. term.setTextColor(colors.white)
  119. if XY == "16,8" and button == 1 then
  120. term.setCursorPos(12,6)
  121. write("              ")
  122. term.setCursorPos(12,6)
  123. p1=read()
  124. term.setCursorPos(12,6)
  125. write("              ")
  126. term.setCursorPos(12,6)
  127. write("")
  128. p2=read()
  129. ergebnis=p1 - p2
  130. term.setCursorPos(12,6)
  131. write("              ")
  132. term.setCursorPos(12,6)
  133. print(ergebnis)
  134. term.setCursorPos(12,6)
  135. break
  136. end
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144. term.setBackgroundColor(128)
  145. term.setTextColor(colors.white)
  146. if XY == "20,8" and button == 1 then
  147. term.setCursorPos(12,6)
  148. write("              ")
  149. term.setCursorPos(12,6)
  150. p1=read()
  151. term.setCursorPos(12,6)
  152. write("              ")
  153. term.setCursorPos(12,6)
  154. write("")
  155. p2=read()
  156. ergebnis=p1 / p2
  157. term.setCursorPos(12,6)
  158. write("              ")
  159. term.setCursorPos(12,6)
  160. print(ergebnis)
  161. term.setCursorPos(12,6)
  162. break
  163. end
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. term.setBackgroundColor(128)
  171. term.setTextColor(colors.white)
  172. if XY == "24,8" and button == 1 then
  173. term.setCursorPos(12,6)
  174. write("              ")
  175. term.setCursorPos(12,6)
  176. p1=read()
  177. term.setCursorPos(12,6)
  178. write("              ")
  179. term.setCursorPos(12,6)
  180. write("")
  181. p2=read()
  182. ergebnis=p1 * p2
  183. term.setCursorPos(12,6)
  184. write("              ")
  185. term.setCursorPos(12,6)
  186. print(ergebnis)
  187. term.setCursorPos(12,6)
  188. break
  189. end
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201. end
  202. end
  203. term.setCursorPos(1,2)
  204. term.setBackgroundColor(colors.white)
  205. term.setTextColor(colors.black)
  206. write("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement