Advertisement
LukyKrob

Kopaci Stroj

Mar 5th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.25 KB | None | 0 0
  1. term.clear()
  2. term.setBackgroundColor(colors.blue)
  3. term.setTextColor(colors.yellow)
  4. term.clear()
  5. term.setCursorPos(20,8)
  6. print("Kopaci stroj")
  7. term.setTextColor(colors.white)
  8. term.setCursorPos(47,18)
  9. print("4.0")
  10. term.setCursorPos(21,9)
  11. term.setBackgroundColor(colors.lime)
  12. function load()
  13. write(" ")
  14. sleep(0.05)
  15. end
  16. load()
  17. load()
  18. load()
  19. load()
  20. load()
  21. load()
  22. load()
  23. load()
  24. load()
  25. load()
  26. sleep(0.1)
  27. function home()
  28. term.clear()
  29. term.setBackgroundColor(colors.blue)
  30. term.setTextColor(colors.blue)
  31. term.clear()
  32. term.setBackgroundColor(colors.lime)
  33. term.setCursorPos(1,1)
  34. term.clearLine()
  35. term.setCursorPos(20,1)
  36. print("Kopaci stroj")
  37. term.setTextColor(colors.white)
  38. term.setCursorPos(51,1)
  39. print("X")
  40. term.setBackgroundColor(colors.blue)
  41. term.setCursorPos(47,18)
  42. print("4.0")
  43. term.setCursorPos(1,3)
  44. end
  45. g=10
  46. g0=g
  47. function log()
  48. term.setCursorPos(g,14)
  49. term.setBackgroundColor(colors.yellow)
  50. write(" ")
  51. term.setBackgroundColor(colors.blue)
  52. g=g+1
  53. if g == 43 then
  54. g=g0
  55. term.setCursorPos(1,14)
  56. print("        |                                |")
  57. end
  58. end
  59.  
  60. function log4()
  61. for i=1,4 do
  62. log()
  63. end
  64. end
  65.  
  66. --Funkce
  67.  
  68. c=0.6
  69. d=0.2
  70. k=0.4
  71.  
  72. function off()
  73. sleep(1.4)
  74. rs.setBundledOutput("back", 0)
  75. sleep(c)
  76. end
  77.  
  78. function dolu()
  79. rs.setBundledOutput("back", colors.orange)
  80. off()
  81. end
  82.  
  83. function nahoru()
  84. rs.setBundledOutput("back", colors.magenta)
  85. off()
  86. end
  87.  
  88. function dopredu()
  89. rs.setBundledOutput("back", colors.lightBlue)
  90. off()
  91. end
  92.  
  93. function dozadu()
  94. rs.setBundledOutput("back", colors.yellow)
  95. off()
  96. end
  97.  
  98. function doleva()
  99. rs.setBundledOutput("back", colors.lime)
  100. off()
  101. end
  102.  
  103. function doprava()
  104. rs.setBundledOutput("back", colors.pink)
  105. off()
  106. end
  107.  
  108. function kop()
  109. rs.setBundledOutput("back", colors.gray)
  110. sleep(k)
  111. rs.setBundledOutput("back", 0)
  112. end
  113.  
  114. function dopredu16()
  115. for i=1,16 do
  116. dopredu()
  117. sleep(c)
  118. end
  119. end
  120.  
  121. function dozadu16()
  122. for i=1,16 do
  123. dozadu()
  124. sleep(c)
  125. end
  126. end
  127.  
  128. function doleva16()
  129. for i=1,16 do
  130. doleva()
  131. sleep(c)
  132. end
  133. end
  134.  
  135. function doprava16()
  136. for i=1,16 do
  137. doprava()
  138. sleep(c)
  139. end
  140. end
  141.  
  142. function kopat()
  143. sleep(c)
  144. for i=1,116 do
  145. kop()
  146. sleep(d)
  147. dolu()
  148. sleep(d)
  149. end
  150. kop()
  151. for i=1,116 do
  152. sleep(c)
  153. nahoru()
  154. end
  155. sleep(c)
  156. end
  157.  
  158. function c2x2()
  159. log()
  160. kopat()
  161. log4()
  162. log4()
  163. doprava16()
  164. log()
  165. log()
  166. kopat()
  167. log4()
  168. log4()
  169. dopredu16()
  170. log()
  171. log()
  172. kopat()
  173. log4()
  174. log4()
  175. doleva16()
  176. log()
  177. log()
  178. kopat()
  179. log()
  180. log()
  181. end
  182.  
  183. function c4x4()
  184. log()
  185. kopat()
  186. log()
  187. doprava16()
  188. log()
  189. kopat()
  190. log()
  191. doprava16()
  192. log()
  193. kopat()
  194. log()
  195. doprava16()
  196. log()
  197. kopat()
  198. log()
  199. dopredu16()
  200. log()
  201. kopat()
  202. log()
  203. doleva16()
  204. log()
  205. kopat()
  206. log()
  207. doleva16()
  208. log()
  209. kopat()
  210. log()
  211. doleva16()
  212. log()
  213. kopat()
  214. log()
  215. dopredu16()
  216. log()
  217. kopat()
  218. log()
  219. doprava16()
  220. log()
  221. kopat()
  222. log()
  223. doprava16()
  224. log()
  225. kopat()
  226. log()
  227. doprava16()
  228. log()
  229. kopat()
  230. log()
  231. dopredu16()
  232. log()
  233. kopat()
  234. log()
  235. doleva16()
  236. log()
  237. kopat()
  238. log()
  239. doleva16()
  240. log()
  241. kopat()
  242. log()
  243. doleva16()
  244. log()
  245. kopat()
  246. log()
  247. log()
  248. end
  249.  
  250. function c4x8()
  251. c4x4()
  252. dopredu16()
  253. c4x4()
  254. end
  255.  
  256. --Menu
  257.  
  258. home()
  259. print("        +----------+----------+----------+")
  260. print("        |  1 Blok  |  8 Bloku | 16 Bloku |")
  261. print("        |   +    + |   +    + |   +    + |")
  262. print("        | +   +    | +   +    | +   +    |")
  263. print("        |   +    + |   +    + |   +    + |")
  264. print("        +----------+----------+----------+")
  265. print("        +--------+-----+-----+-----+-----+")
  266. print("        |  Kopat | 2x2 | 4x4 | 4x8 |     |")
  267. print("        |    +   |  +  |  +  |  +  |     |")
  268. print("        +--------+-----+-----+-----+-----+")
  269. print("        +--------------------------------+")
  270. print("        |                                |")
  271. print("        +--------------------------------+")
  272. term.setCursorPos(1,14)
  273.  
  274. while true do
  275. term.setCursorPos(1,14)
  276. term.setBackgroundColor(colors.blue)
  277. local event, button, X, Y = os.pullEvent("mouse_click")
  278. X = X..","..Y
  279. if X == "51,1" and button == 1 then
  280. sleep(0.4)
  281. term.setBackgroundColor(colors.black)
  282. shell.run("clear")
  283. break
  284. elseif X == "13,5" and button == 1 then --Dopredu 1
  285. term.setCursorPos(13,6)
  286. term.setBackgroundColor(colors.red)
  287. write(" ")
  288. dopredu()
  289. sleep(0.2)
  290. term.setCursorPos(13,6)
  291. term.setBackgroundColor(colors.blue)
  292. write(" ")
  293. elseif X == "11,6" and button == 1 then --Doleva 1
  294. term.setCursorPos(13,6)
  295. term.setBackgroundColor(colors.red)
  296. write(" ")
  297. doleva()
  298. sleep(0.2)
  299. term.setCursorPos(13,6)
  300. term.setBackgroundColor(colors.blue)
  301. write(" ")
  302. elseif X == "13,7" and button == 1 then --Dozadu 1
  303. term.setCursorPos(13,6)
  304. term.setBackgroundColor(colors.red)
  305. write(" ")
  306. dozadu()
  307. sleep(0.2)
  308. term.setCursorPos(13,6)
  309. term.setBackgroundColor(colors.blue)
  310. write(" ")
  311. elseif X == "15,6" and button == 1 then --Doprava 1
  312. term.setCursorPos(13,6)
  313. term.setBackgroundColor(colors.red)
  314. write(" ")
  315. doprava()
  316. sleep(0.2)
  317. term.setCursorPos(13,6)
  318. term.setBackgroundColor(colors.blue)
  319. write(" ")
  320. elseif X == "18,5" and button == 1 then --Nahoru 1
  321. term.setCursorPos(18,6)
  322. term.setBackgroundColor(colors.red)
  323. write(" ")
  324. nahoru()
  325. sleep(0.2)
  326. term.setCursorPos(18,6)
  327. term.setBackgroundColor(colors.blue)
  328. write(" ")
  329. elseif X == "18,7" and button == 1 then --Dolu 1
  330. term.setCursorPos(18,6)
  331. term.setBackgroundColor(colors.red)
  332. write(" ")
  333. dolu()
  334. sleep(0.2)
  335. term.setCursorPos(18,6)
  336. term.setBackgroundColor(colors.blue)
  337. write(" ")
  338. elseif X == "24,5" and button == 1 then --Dopredu 8
  339. term.setCursorPos(24,6)
  340. term.setBackgroundColor(colors.red)
  341. write(" ")
  342. for i=1,8 do
  343. sleep(0.2)
  344. dopredu()
  345. end
  346. sleep(0.2)
  347. term.setCursorPos(24,6)
  348. term.setBackgroundColor(colors.blue)
  349. write(" ")
  350. elseif X == "22,6" and button == 1 then --Doleva 8
  351. term.setCursorPos(24,6)
  352. term.setBackgroundColor(colors.red)
  353. write(" ")
  354. for i=1,8 do
  355. sleep(0.2)
  356. doleva()
  357. end
  358. sleep(0.2)
  359. term.setCursorPos(24,6)
  360. term.setBackgroundColor(colors.blue)
  361. write(" ")
  362. elseif X == "24,7" and button == 1 then --Dozadu 8
  363. term.setCursorPos(24,6)
  364. term.setBackgroundColor(colors.red)
  365. write(" ")
  366. for i=1,8 do
  367. sleep(0.2)
  368. dozadu()
  369. end
  370. sleep(0.2)
  371. term.setCursorPos(24,6)
  372. term.setBackgroundColor(colors.blue)
  373. write(" ")
  374. elseif X == "26,6" and button == 1 then --Doprava 8
  375. term.setCursorPos(24,6)
  376. term.setBackgroundColor(colors.red)
  377. write(" ")
  378. for i=1,8 do
  379. sleep(0.2)
  380. doprava()
  381. end
  382. sleep(0.2)
  383. term.setCursorPos(24,6)
  384. term.setBackgroundColor(colors.blue)
  385. write(" ")
  386. elseif X == "29,5" and button == 1 then --Nahoru 8
  387. term.setCursorPos(29,6)
  388. term.setBackgroundColor(colors.red)
  389. write(" ")
  390. for i=1,8 do
  391. sleep(0.2)
  392. nahoru()
  393. end
  394. sleep(0.2)
  395. term.setCursorPos(29,6)
  396. term.setBackgroundColor(colors.blue)
  397. write(" ")
  398. elseif X == "29,7" and button == 1 then --Dolu 8
  399. term.setCursorPos(29,6)
  400. term.setBackgroundColor(colors.red)
  401. write(" ")
  402. for i=1,8 do
  403. sleep(0.2)
  404. dolu()
  405. sleep(0.2)
  406. end
  407. term.setCursorPos(29,6)
  408. term.setBackgroundColor(colors.blue)
  409. write(" ")
  410. elseif X == "35,5" and button == 1 then --Dopredu 16
  411. term.setCursorPos(35,6)
  412. term.setBackgroundColor(colors.red)
  413. write(" ")
  414. for i=1,16 do
  415. sleep(0.2)
  416. dopredu()
  417. end
  418. sleep(0.2)
  419. term.setCursorPos(35,6)
  420. term.setBackgroundColor(colors.blue)
  421. write(" ")
  422. elseif X == "33,6" and button == 1 then --Doleva 16
  423. term.setCursorPos(35,6)
  424. term.setBackgroundColor(colors.red)
  425. write(" ")
  426. for i=1,16 do
  427. sleep(0.2)
  428. doleva()
  429. end
  430. sleep(0.2)
  431. term.setCursorPos(35,6)
  432. term.setBackgroundColor(colors.blue)
  433. write(" ")
  434. elseif X == "35,7" and button == 1 then --Dozadu 16
  435. term.setCursorPos(35,6)
  436. term.setBackgroundColor(colors.red)
  437. write(" ")
  438. for i=1,16 do
  439. sleep(0.2)
  440. dozadu()
  441. end
  442. sleep(0.2)
  443. term.setCursorPos(35,6)
  444. term.setBackgroundColor(colors.blue)
  445. write(" ")
  446. elseif X == "37,6" and button == 1 then --Doprava 16
  447. term.setCursorPos(35,6)
  448. term.setBackgroundColor(colors.red)
  449. write(" ")
  450. for i=1,16 do
  451. sleep(0.2)
  452. doprava()
  453. end
  454. sleep(0.2)
  455. term.setCursorPos(35,6)
  456. term.setBackgroundColor(colors.blue)
  457. write(" ")
  458. elseif X == "40,5" and button == 1 then --Nahoru 16
  459. term.setCursorPos(40,6)
  460. term.setBackgroundColor(colors.red)
  461. write(" ")
  462. for i=1,16 do
  463. sleep(0.2)
  464. nahoru()
  465. end
  466. sleep(0.2)
  467. term.setCursorPos(40,6)
  468. term.setBackgroundColor(colors.blue)
  469. write(" ")
  470. elseif X == "40,7" and button == 1 then --Dolu 16
  471. term.setCursorPos(40,6)
  472. term.setBackgroundColor(colors.red)
  473. write(" ")
  474. for i=1,16 do
  475. sleep(0.2)
  476. dolu()
  477. end
  478. sleep(0.2)
  479. term.setCursorPos(40,6)
  480. term.setBackgroundColor(colors.blue)
  481. write(" ")
  482. elseif X == "14,11" and button == 1 then --Kopat (1 Chunk)
  483. term.setCursorPos(14,11)
  484. term.setBackgroundColor(colors.red)
  485. write(" ")
  486. kopat()
  487. sleep(0.2)
  488. term.setCursorPos(14,11)
  489. term.setBackgroundColor(colors.blue)
  490. write("+")
  491. elseif X == "21,11" and button == 1 then --Kopat 2x2
  492. term.setCursorPos(21,11)
  493. term.setBackgroundColor(colors.red)
  494. write(" ")
  495. c2x2()
  496. sleep(0.2)
  497. term.setCursorPos(21,11)
  498. term.setBackgroundColor(colors.blue)
  499. write("+")
  500. elseif X == "27,11" and button == 1 then --Kopat 4x4
  501. term.setCursorPos(27,11)
  502. term.setBackgroundColor(colors.red)
  503. write(" ")
  504. c4x4()
  505. sleep(0.2)
  506. term.setCursorPos(27,11)
  507. term.setBackgroundColor(colors.blue)
  508. write("+")
  509. elseif X == "33,11" and button == 1 then --Kopat 4x8
  510. term.setCursorPos(33,11)
  511. term.setBackgroundColor(colors.red)
  512. write(" ")
  513. c4x8()
  514. sleep(0.2)
  515. term.setCursorPos(33,11)
  516. term.setBackgroundColor(colors.blue)
  517. write("+")
  518. elseif X == "39,11" and button == 1 then --Nic
  519. end
  520. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement