Advertisement
Guest User

test9

a guest
Jul 24th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.69 KB | None | 0 0
  1. term.clear()
  2. term.setTextColor(colors.cyan)
  3. term.setCursorPos(1,1)
  4. print("GazzOS V.7 - Market-Exchange")
  5. term.setTextColor(colors.white)
  6. --rednet.open("right")
  7. local deposit = peripheral.wrap("diamond_0")
  8. local one = peripheral.wrap("diamond_1")
  9. local top = peripheral.wrap("monitor_11")
  10. mouseWidth = 0
  11. mouseHeight = 0
  12. local m = peripheral.wrap("back")
  13. m.clear()
  14. m.setCursorPos(1,1)
  15. w,h=m.getSize()
  16. print(w)
  17. print(h)
  18. bal = 0
  19. function checkcash()
  20. local stack = one.getStackInSlot(1)
  21. if stack and stack["id"] == 30257 then print("Copper Token")
  22. bal = bal + one.getStackInSlot(1)["qty"]
  23. elseif stack and stack["id"] == 30258 then print("Silver Token")
  24. bal = bal + one.getStackInSlot(1)["qty"] * 64
  25. else print("Empty")
  26. end
  27. local stack = one.getStackInSlot(2)
  28. if stack and stack["id"] == 30257 then print("Copper Token")
  29. bal = bal + one.getStackInSlot(2)["qty"]
  30. elseif stack and stack["id"] == 30258 then print("Silver Token")
  31. bal = bal + one.getStackInSlot(2)["qty"] * 64
  32. else print("Empty")
  33. end
  34. local stack = one.getStackInSlot(3)
  35. if stack and stack["id"] == 30257 then print("Copper Token")
  36. bal = bal + one.getStackInSlot(3)["qty"]
  37. elseif stack and stack["id"] == 30258 then print("Silver Token")
  38. bal = bal + one.getStackInSlot(3)["qty"] * 64
  39. else print("Empty")
  40. end
  41. local stack = one.getStackInSlot(4)
  42. if stack and stack["id"] == 30257 then print("Copper Token")
  43. bal = bal + one.getStackInSlot(4)["qty"]
  44. elseif stack and stack["id"] == 30258 then print("Silver Token")
  45. bal = bal + one.getStackInSlot(4)["qty"] * 64
  46. else print("Empty")
  47. end
  48. local stack = one.getStackInSlot(5)
  49. if stack and stack["id"] == 30257 then print("Copper Token")
  50. bal = bal + one.getStackInSlot(5)["qty"]
  51. elseif stack and stack["id"] == 30258 then print("Silver Token")
  52. bal = bal + one.getStackInSlot(5)["qty"] * 64
  53. else print("Empty")
  54. end
  55. local stack = one.getStackInSlot(6)
  56. if stack and stack["id"] == 30257 then print("Copper Token")
  57. bal = bal + one.getStackInSlot(6)["qty"]
  58. elseif stack and stack["id"] == 30258 then print("Silver Token")
  59. bal = bal + one.getStackInSlot(6)["qty"] * 64
  60. else print("Empty")
  61. end
  62. local stack = one.getStackInSlot(7)
  63. if stack and stack["id"] == 30257 then print("Copper Token")
  64. bal = bal + one.getStackInSlot(7)["qty"]
  65. elseif stack and stack["id"] == 30258 then print("Silver Token")
  66. bal = bal + one.getStackInSlot(7)["qty"] * 64
  67. else print("Empty")
  68. end
  69. local stack = one.getStackInSlot(8)
  70. if stack and stack["id"] == 30257 then print("Copper Token")
  71. bal = bal + one.getStackInSlot(8)["qty"]
  72. elseif stack and stack["id"] == 30258 then print("Silver Token")
  73. bal = bal + one.getStackInSlot(8)["qty"] * 64
  74. else print("Empty")
  75. end
  76. local stack = one.getStackInSlot(9)
  77. if stack and stack["id"] == 30257 then print("Copper Token")
  78. bal = bal + one.getStackInSlot(9)["qty"]
  79. elseif stack and stack["id"] == 30258 then print("Silver Token")
  80. bal = bal + one.getStackInSlot(9)["qty"] * 64
  81. else print("Empty")
  82. end
  83. local stack = one.getStackInSlot(10)
  84. if stack and stack["id"] == 30257 then print("Copper Token")
  85. bal = bal + one.getStackInSlot(10)["qty"]
  86. elseif stack and stack["id"] == 30258 then print("Silver Token")
  87. bal = bal + one.getStackInSlot(10)["qty"] * 64
  88. else print("Empty")
  89. end
  90. local stack = one.getStackInSlot(11)
  91. if stack and stack["id"] == 30257 then print("Copper Token")
  92. bal = bal + one.getStackInSlot(11)["qty"]
  93. elseif stack and stack["id"] == 30258 then print("Silver Token")
  94. bal = bal + one.getStackInSlot(1)["qty"] * 64
  95. else print("Empty")
  96. end
  97. local stack = one.getStackInSlot(12)
  98. if stack and stack["id"] == 30257 then print("Copper Token")
  99. bal = bal + one.getStackInSlot(12)["qty"]
  100. elseif stack and stack["id"] == 30258 then print("Silver Token")
  101. bal = bal + one.getStackInSlot(12)["qty"] * 64
  102. else print("Empty")
  103. end
  104. top.setCursorPos(40,1)
  105. top.write("      ")
  106. top.setCursorPos(40,1)
  107. top.write(bal)
  108. print(bal)
  109. end
  110. --DurrDurr--
  111. function charge()
  112. deposit.condenseItems()
  113. if rost < 128 then
  114. deposit.pushItem("east",1,rost,1)
  115. rost = rost - 64
  116. deposit.pushItem("east",2,rost,2)
  117. rs.setOutput("left", true)
  118. sleep(.8)
  119. rs.setOutput("left", false)
  120. elseif rost < 192 then
  121. deposit.condenseItems()
  122. deposit.pushItem("east",1,rost,1)
  123. rost = rost - 64
  124. deposit.pushItem("east",2,rost,2)
  125. rost = rost - 64
  126. deposit.pushItem("east",3,rost,3)
  127. rost = rost - 64
  128. rs.setOutput("left", true)
  129. sleep(.8)
  130. rs.setOutput("left", false)
  131. elseif rost > 192 then
  132. deposit.condenseItems()
  133. deposit.pushItem("east",1,rost,1)
  134. rost = rost - 64
  135. deposit.pushItem("east",2,rost,2)
  136. rost = rost - 64
  137. deposit.pushItem("east",3,rost,3)
  138. rost = rost - 64
  139. deposit.pushItem("east",4,rost,4)
  140. rost = rost - 64
  141. rs.setOutput("left", true)
  142. sleep(.8)
  143. rs.setOutput("left", false)
  144. elseif rost < 64 then
  145. deposit.pushItem("east",1,rost,1)
  146. rs.setOutput("left", true)
  147. sleep(.8)
  148. rs.setOutput("left", false)
  149. end
  150. end
  151. --Durr--
  152. function clean()
  153. AmmountDiamond = 9 - 9
  154. AmmountWood = 9 - 9
  155. AmmountCopper = 9 - 9
  156. AmmountLapis = 9 - 9
  157. AmmountRedstone = 9 - 9
  158. AmmountTin = 9 - 9
  159. AmmountOsmium = 9 - 9
  160. AmmountIron = 9 - 9
  161. AmmountGold = 9 - 9
  162. newBal = 9 - 9
  163. end
  164. function onestackw()
  165. rs.setBundledOutput("right", colors.lightGray)
  166. sleep(.2)
  167. rs.setBundledOutput("right", 0)
  168. sleep(.2)
  169. end
  170. function twostackw()
  171. onestackw()
  172. onestackw()
  173. end
  174. function fourstackw()
  175. twostackw()
  176. twostackw()
  177. end
  178. function onestacko()
  179. rs.setBundledOutput("right", colors.pink)
  180. sleep(.2)
  181. rs.setBundledOutput("right", 0)
  182. sleep(.2)
  183. end
  184. function twostacko()
  185. onestacko()
  186. onestacko()
  187. end
  188. function fourstacko()
  189. twostacko()
  190. twostacko()
  191. end
  192. function onestackl()
  193. rs.setBundledOutput("right", colors.lime)
  194. sleep(.2)
  195. rs.setBundledOutput("right", 0)
  196. sleep(.2)
  197. end
  198. function twostackl()
  199. onestackl()
  200. onestackl()
  201. end
  202. function fourstackl()
  203. twostackl()
  204. twostackl()
  205. end
  206. function onestackt()
  207. rs.setBundledOutput("right", colors.lightBlue)
  208. sleep(.2)
  209. rs.setBundledOutput("right", 0)
  210. sleep(.2)
  211. end
  212. function twostackt()
  213. onestackt()
  214. onestackt()
  215. end
  216. function fourstackt()
  217. twostackt()
  218. twostackt()
  219. end
  220. function onestackr()
  221. rs.setBundledOutput("right", colours.magenta)
  222. sleep(.2)
  223. rs.setBundledOutput("right", 0)
  224. sleep(.2)
  225. end
  226. function twostackr()
  227. onestackr()
  228. onestackr()
  229. end
  230. function fourstackr()
  231. twostackr()
  232. twostackr()
  233. end
  234. function onestackc()
  235. rs.setBundledOutput("right", colours.yellow)
  236. sleep(.2)
  237. rs.setBundledOutput("right", 0)
  238. sleep(.2)
  239. end
  240. function twostackc()
  241. onestackc()
  242. onestackc()
  243. end
  244. function fourstackc()
  245. twostackc()
  246. twostackc()
  247. end
  248. function onestackg()
  249. rs.setBundledOutput("right", colours.orange)
  250. sleep(.2)
  251. rs.setBundledOutput("right", 0)
  252. sleep(.2)
  253. end
  254. function twostackg()
  255. onestackg()
  256. onestackg()
  257. end
  258. function fourstackg()
  259. twostackg()
  260. twostackg()
  261. end
  262. function onestack()
  263. rs.setBundledOutput("right", colours.white)
  264. sleep(.2)
  265. rs.setBundledOutput("right", 0)
  266. sleep(.2)
  267. end
  268. function twostack()
  269. onestack()
  270. onestack()
  271. end
  272. function fourstack()
  273. twostack()
  274. twostack()
  275. end
  276. function doiron()
  277. if AmmountIron < 63 then
  278. print("No Iron")
  279. elseif AmmountIron < 65 then
  280. onestack()
  281. elseif AmmountIron < 129 then
  282. onestack()
  283. onestack()
  284. elseif AmmountIron < 193 then
  285. twostack()
  286. onestack()
  287. elseif AmmountIron < 257 then
  288. twostack()
  289. twostack()
  290. elseif AmmountIron < 321 then
  291. fourstack()
  292. onestack()
  293. elseif AmmountIron < 384 then
  294. fourstack()
  295. twostack()
  296. elseif AmmountIron < 449 then
  297. fourstack()
  298. twostack()
  299. onestack()
  300. elseif AmmountIron < 513 then
  301. fourstack()
  302. fourstack()
  303. elseif AmmountIron < 577 then
  304. fourstack()
  305. fourstack()
  306. onestack()
  307. elseif AmmountIron < 641 then
  308. fourstack()
  309. fourstack()
  310. twostack()
  311. elseif AmmountIron < 705 then
  312. fourstack()
  313. fourstack()
  314. twostack()
  315. onestack()
  316. elseif AmmountIron < 769 then
  317. fourstack()
  318. fourstack()
  319. fourstack()
  320. elseif AmmountIron < 833 then
  321. fourstack()
  322. fourstack()
  323. fourstack()
  324. onestack()
  325. elseif AmmountIron < 897 then
  326. fourstack()
  327. fourstack()
  328. fourstack()
  329. twostack()
  330. elseif AmmountIron < 961 then
  331. fourstack()
  332. fourstack()
  333. fourstack()
  334. twostack()
  335. onestack()
  336. elseif AmmountIron < 1025 then
  337. fourstack()
  338. fourstack()
  339. fourstack()
  340. fourstack()
  341. end
  342. end
  343. function docopper()
  344. if AmmountCopper < 63 then
  345. print("No Copper")
  346. elseif AmmountCopper < 65 then
  347. onestackc()
  348. elseif AmmountCopper < 129 then
  349. onestackc()
  350. onestackc()
  351. elseif AmmountCopper < 193 then
  352. twostackc()
  353. onestackc()
  354. elseif AmmountCopper < 257 then
  355. twostackc()
  356. twostackc()
  357. elseif AmmountCopper < 321 then
  358. fourstackc()
  359. onestackc()
  360. elseif AmmountCopper < 384 then
  361. fourstackc()
  362. twostackc()
  363. elseif AmmountCopper < 449 then
  364. fourstackc()
  365. twostackc()
  366. onestackc()
  367. elseif AmmountCopper < 513 then
  368. fourstackc()
  369. fourstackc()
  370. elseif AmmountCopper < 577 then
  371. fourstackc()
  372. fourstackc()
  373. onestackc()
  374. elseif AmmountCopper < 641 then
  375. fourstackc()
  376. fourstackc()
  377. twostackc()
  378. elseif AmmountCopper < 705 then
  379. fourstackc()
  380. fourstackc()
  381. twostackc()
  382. onestackc()
  383. elseif AmmountCopper < 769 then
  384. fourstackc()
  385. fourstackc()
  386. fourstackc()
  387. elseif AmmountCopper < 833 then
  388. fourstackc()
  389. fourstackc()
  390. fourstackc()
  391. onestackc()
  392. elseif AmmountCopper < 897 then
  393. fourstackc()
  394. fourstackc()
  395. fourstackc()
  396. twostackc()
  397. elseif AmmountCopper < 961 then
  398. fourstackc()
  399. fourstackc()
  400. fourstackc()
  401. twostackc()
  402. onestackc()
  403. elseif AmmountCopper < 1025 then
  404. fourstackc()
  405. fourstackc()
  406. fourstackc()
  407. fourstackc()
  408. end
  409. end
  410. function dogold()
  411. if AmmountGold < 31 then
  412. print("No Gold")
  413. elseif AmmountGold < 32 then
  414. onestackg()
  415. elseif AmmountGold < 64 then
  416. onestackg()
  417. onestackg()
  418. elseif AmmountGold < 97 then
  419. twostackg()
  420. onestackg()
  421. elseif AmmountGold < 129 then
  422. twostackg()
  423. twostackg()
  424. elseif AmmountGold < 161 then
  425. fourstackg()
  426. onestackg()
  427. elseif AmmountGold < 193 then
  428. fourstackg()
  429. twostackg()
  430. elseif AmmountGold < 225 then
  431. fourstackg()
  432. twostackg()
  433. onestackg()
  434. elseif AmmountGold < 257 then
  435. fourstackg()
  436. fourstackg()
  437. elseif AmmountGold < 289 then
  438. fourstackg()
  439. fourstackg()
  440. onestackg()
  441. elseif AmmountGold < 321 then
  442. fourstackg()
  443. fourstackg()
  444. twostackg()
  445. elseif AmmountGold < 353 then
  446. fourstackg()
  447. fourstackg()
  448. twostackg()
  449. onestackg()
  450. elseif AmmountGold < 385 then
  451. fourstackg()
  452. fourstackg()
  453. fourstackg()
  454. elseif AmmountGold < 417 then
  455. fourstackg()
  456. fourstackg()
  457. fourstackg()
  458. onestackg()
  459. elseif AmmountGold < 449 then
  460. fourstackg()
  461. fourstackg()
  462. fourstackg()
  463. twostackg()
  464. elseif AmmountGold < 481 then
  465. fourstackg()
  466. fourstackg()
  467. fourstackg()
  468. twostackg()
  469. onestackg()
  470. elseif AmmountGold < 513 then
  471. fourstackg()
  472. fourstackg()
  473. fourstackg()
  474. fourstackg()
  475. end
  476. end
  477. function doredstone()
  478. if AmmountRedstone < 63 then
  479. print("No Redstone")
  480. elseif AmmountRedstone < 65 then
  481. onestackr()
  482. elseif AmmountRedstone < 129 then
  483. onestackr()
  484. onestackr()
  485. elseif AmmountRedstone < 193 then
  486. twostackr()
  487. onestackr()
  488. elseif AmmountRedstone < 257 then
  489. twostackr()
  490. twostackr()
  491. elseif AmmountRedstone < 321 then
  492. fourstackr()
  493. onestackr()
  494. elseif AmmountRedstone < 384 then
  495. fourstackr()
  496. twostackr()
  497. elseif AmmountRedstone < 449 then
  498. fourstackr()
  499. twostackr()
  500. onestackr()
  501. elseif AmmountRedstone < 513 then
  502. fourstackr()
  503. fourstackr()
  504. elseif AmmountRedstone < 577 then
  505. fourstackr()
  506. fourstackr()
  507. onestackr()
  508. elseif AmmountRedstone < 641 then
  509. fourstackr()
  510. fourstackr()
  511. twostackr()
  512. elseif AmmountRedstone < 705 then
  513. fourstackr()
  514. fourstackr()
  515. twostackr()
  516. onestackr()
  517. elseif AmmountRedstone < 769 then
  518. fourstackr()
  519. fourstackr()
  520. fourstackr()
  521. elseif AmmountRedstone < 833 then
  522. fourstackr()
  523. fourstackr()
  524. fourstackr()
  525. onestackr()
  526. elseif AmmountRedstone < 897 then
  527. fourstackr()
  528. fourstackr()
  529. fourstackr()
  530. twostackr()
  531. elseif AmmountRedstone < 961 then
  532. fourstackr()
  533. fourstackr()
  534. fourstackr()
  535. twostackr()
  536. onestackr()
  537. elseif AmmountRedstone < 1025 then
  538. fourstackr()
  539. fourstackr()
  540. fourstackr()
  541. fourstackr()
  542. end
  543. end
  544. function dotin()
  545. if AmmountTin < 63 then
  546. print("No Tin")
  547. elseif AmmountTin < 65 then
  548. onestackt()
  549. elseif AmmountTin < 129 then
  550. onestackt()
  551. onestackt()
  552. elseif AmmountTin < 193 then
  553. twostackt()
  554. onestackt()
  555. elseif AmmountTin < 257 then
  556. twostackt()
  557. twostackt()
  558. elseif AmmountTin < 321 then
  559. fourstackt()
  560. onestackt()
  561. elseif AmmountTin < 384 then
  562. fourstackt()
  563. twostackt()
  564. elseif AmmountTin < 449 then
  565. fourstackt()
  566. twostackt()
  567. onestackt()
  568. elseif AmmountTin < 513 then
  569. fourstackt()
  570. fourstackt()
  571. elseif AmmountTin < 577 then
  572. fourstackt()
  573. fourstackt()
  574. onestackt()
  575. elseif AmmountTin < 641 then
  576. fourstackt()
  577. fourstackt()
  578. twostackt()
  579. elseif AmmountTin < 705 then
  580. fourstackt()
  581. fourstackt()
  582. twostackt()
  583. onestackt()
  584. elseif AmmountTin < 769 then
  585. fourstackt()
  586. fourstackt()
  587. fourstackt()
  588. elseif AmmountTin < 833 then
  589. fourstackt()
  590. fourstackt()
  591. fourstackt()
  592. onestackt()
  593. elseif AmmountTin < 897 then
  594. fourstackt()
  595. fourstackt()
  596. fourstackt()
  597. twostackt()
  598. elseif AmmountTin < 961 then
  599. fourstackt()
  600. fourstackt()
  601. fourstackt()
  602. twostackt()
  603. onestackt()
  604. elseif AmmountTin < 1025 then
  605. fourstackt()
  606. fourstackt()
  607. fourstackt()
  608. fourstackt()
  609. end
  610. end
  611. function dolapis()
  612. if AmmountLapis < 63 then
  613. print("No Lapis")
  614. elseif AmmountLapis < 65 then
  615. onestackl()
  616. elseif AmmountLapis < 129 then
  617. onestackl()
  618. onestackl()
  619. elseif AmmountLapis < 193 then
  620. twostackl()
  621. onestackl()
  622. elseif AmmountLapis < 257 then
  623. twostackl()
  624. twostackl()
  625. elseif AmmountLapis < 321 then
  626. fourstackl()
  627. onestackl()
  628. elseif AmmountLapis < 384 then
  629. fourstackl()
  630. twostackl()
  631. elseif AmmountLapis < 449 then
  632. fourstackl()
  633. twostackl()
  634. onestackl()
  635. elseif AmmountLapis < 513 then
  636. fourstackl()
  637. fourstackl()
  638. elseif AmmountLapis < 577 then
  639. fourstackl()
  640. fourstackl()
  641. onestackl()
  642. elseif AmmountLapis < 641 then
  643. fourstackl()
  644. fourstackl()
  645. twostackl()
  646. elseif AmmountLapis < 705 then
  647. fourstackl()
  648. fourstackl()
  649. twostackl()
  650. onestackl()
  651. elseif AmmountLapis < 769 then
  652. fourstackl()
  653. fourstackl()
  654. fourstackl()
  655. elseif AmmountLapis < 833 then
  656. fourstackl()
  657. fourstackl()
  658. fourstackl()
  659. onestackl()
  660. elseif AmmountLapis < 897 then
  661. fourstackl()
  662. fourstackl()
  663. fourstackl()
  664. twostackl()
  665. elseif AmmountLapis < 961 then
  666. fourstackl()
  667. fourstackl()
  668. fourstackl()
  669. twostackl()
  670. onestackl()
  671. elseif AmmountLapis < 1025 then
  672. fourstackl()
  673. fourstackl()
  674. fourstackl()
  675. fourstackl()
  676. end
  677. end
  678. function doosmium()
  679. if AmmountOsmium < 63 then
  680. print("No Osmium")
  681. elseif AmmountOsmium < 65 then
  682. onestacko()
  683. elseif AmmountOsmium < 129 then
  684. onestacko()
  685. onestacko()
  686. elseif AmmountOsmium < 193 then
  687. twostacko()
  688. onestacko()
  689. elseif AmmountOsmium < 257 then
  690. twostacko()
  691. twostacko()
  692. elseif AmmountOsmium < 321 then
  693. fourstacko()
  694. onestacko()
  695. elseif AmmountOsmium < 384 then
  696. fourstacko()
  697. twostacko()
  698. elseif AmmountOsmium < 449 then
  699. fourstacko()
  700. twostacko()
  701. onestacko()
  702. elseif AmmountOsmium < 513 then
  703. fourstacko()
  704. fourstacko()
  705. elseif AmmountOsmium < 577 then
  706. fourstacko()
  707. fourstacko()
  708. onestacko()
  709. elseif AmmountOsmium < 641 then
  710. fourstacko()
  711. fourstacko()
  712. twostacko()
  713. elseif AmmountOsmium < 705 then
  714. fourstacko()
  715. fourstacko()
  716. twostacko()
  717. onestacko()
  718. elseif AmmountOsmium < 769 then
  719. fourstacko()
  720. fourstacko()
  721. fourstacko()
  722. elseif AmmountOsmium < 833 then
  723. fourstacko()
  724. fourstacko()
  725. fourstacko()
  726. onestacko()
  727. elseif AmmountOsmium < 897 then
  728. fourstacko()
  729. fourstacko()
  730. fourstacko()
  731. twostacko()
  732. elseif AmmountOsmium < 961 then
  733. fourstacko()
  734. fourstacko()
  735. fourstacko()
  736. twostacko()
  737. onestacko()
  738. elseif AmmountOsmium < 1025 then
  739. fourstacko()
  740. fourstacko()
  741. fourstacko()
  742. fourstacko()
  743. end
  744. end
  745. function dowood()
  746. if AmmountWood < 63 then
  747. print("No Wood")
  748. elseif AmmountWood < 65 then
  749. onestackw()
  750. elseif AmmountWood < 129 then
  751. onestackw()
  752. onestackw()
  753. elseif AmmountWood < 193 then
  754. twostackw()
  755. onestackw()
  756. elseif AmmountWood < 257 then
  757. twostackw()
  758. twostackw()
  759. elseif AmmountWood < 321 then
  760. fourstackw()
  761. onestackw()
  762. elseif AmmountWood < 384 then
  763. fourstackw()
  764. twostackw()
  765. elseif AmmountWood < 449 then
  766. fourstackw()
  767. twostackw()
  768. onestackw()
  769. elseif AmmountWood < 513 then
  770. fourstackw()
  771. fourstackw()
  772. elseif AmmountWood < 577 then
  773. fourstackw()
  774. fourstackw()
  775. onestackw()
  776. elseif AmmountWood < 641 then
  777. fourstackw()
  778. fourstackw()
  779. twostackw()
  780. elseif AmmountWood < 705 then
  781. fourstackw()
  782. fourstackw()
  783. twostackw()
  784. onestackw()
  785. elseif AmmountWood < 769 then
  786. fourstackw()
  787. fourstackw()
  788. fourstackw()
  789. elseif AmmountWood < 833 then
  790. fourstackw()
  791. fourstackw()
  792. fourstackw()
  793. onestackw()
  794. elseif AmmountWood < 897 then
  795. fourstackw()
  796. fourstackw()
  797. fourstackw()
  798. twostackw()
  799. elseif AmmountWood < 961 then
  800. fourstackw()
  801. fourstackw()
  802. fourstackw()
  803. twostackw()
  804. onestackw()
  805. elseif AmmountWood < 1025 then
  806. fourstackw()
  807. fourstackw()
  808. fourstackw()
  809. fourstackw()
  810. end
  811. end
  812. function default()
  813. newBal = 0
  814.  cash = 0
  815. clean()
  816. m.clear()
  817. m.setBackgroundColour((colours.black))
  818. top.clear()
  819. top.setBackgroundColour((colours.blue))
  820.  top.setCursorPos(1,1)
  821. top.write("Cart Balance:")
  822.  top.setCursorPos(27,1)
  823. top.write("Your balance:"..cash)
  824.  top.setBackgroundColour((colours.black))
  825. m.setBackgroundColour((colours.blue))
  826.  m.setCursorPos(63, 2)
  827. m.write("Purchase?")
  828.  m.setCursorPos(65,18)
  829. m.write("Clear")
  830. m.setCursorPos(63,19)
  831. m.write("Cash-Back")
  832.  m.setCursorPos(2,1)
  833. m.write("-3 Copper-")
  834.  m.setCursorPos(2,2)
  835. m.write("Iron 64x")
  836.  m.setCursorPos(2,4)
  837. m.write("Gold 32x")
  838.  m.setCursorPos(2,6)
  839. m.write("Redstone 64x")
  840.  m.setCursorPos(2,8)
  841. m.write("Tin 64x")
  842.  m.setCursorPos(2,10)
  843. m.write("Copper 64x")
  844.  m.setCursorPos(2,12)
  845. m.write("Lapis 64x")
  846.  m.setCursorPos(2,14)
  847. m.write("Osmium 64x")
  848.  m.setCursorPos(2,16)
  849. m.write("Diamond 8x")
  850.  m.setCursorPos(2,18)
  851. m.write("Oak Log 64x")
  852.  m.setBackgroundColour((colours.black))
  853. end
  854.  top.clear()
  855.  m.clear()
  856.  m.setBackgroundColour((colours.blue))
  857.  m.setCursorPos(23,9)
  858.  m.write("Insert Cash, Press start.")
  859.  m.setCursorPos(33,10)
  860.  m.write("START.")
  861.  m.setTextScale(1)
  862.  m.setBackgroundColour((colours.black))
  863.  
  864. function checkClickPosition()
  865.   if mouseWidth > 64 and mouseWidth < 71 and mouseHeight == 18 then
  866.   default()
  867.   rs.setOutput("left", true)
  868.   sleep(.5)
  869.   rs.setOutput("left", false)
  870.   elseif mouseWidth > 63 and mouseWidth < 71 and mouseHeight == 2 then
  871.   AmmountGoldMath = AmmountGold *2
  872.   AmmountDiamondMath = AmmountDiamond * 8
  873.   yourcostbeforefirst = AmmountDiamondMath + AmmountWood + AmmountCopper + AmmountLapis + AmmountRedstone + AmmountTin + AmmountOsmium + AmmountIron + AmmountGoldMath
  874.   yourcostbefore = yourcostbeforefirst /3
  875.   youcost = yourcostbefore /7
  876.   yourcost = math.floor(youcost)
  877.   print(youcost)
  878.   rost = yourcost
  879.   charge()
  880.   m.setCursorPos(63,2)
  881.   m.setBackgroundColour((colours.lime))
  882.   m.write("Purchase?")
  883.   m.setBackgroundColour((colours.blue))
  884.   m.setCursorPos(57,3)
  885.   m.write("Costs:"..yourcost)
  886.   checkcash()
  887.   elseif bal > yourcost then
  888.   doiron()
  889.   docopper()
  890.   dogold()
  891.   doosmium()
  892.   dolapis()
  893.   dowood()
  894.   dotin()
  895.   doredstone()
  896.   cashleft = bal - yourcost
  897.   top.setCursorPos(40,1)
  898.   top.write(cashleft)
  899.  
  900.   elseif mouseWidth > 13 and mouseHeight < 18 and mouseHeight == 10 then
  901.   m.setCursorPos(33,10)
  902.   m.setBackgroundColour((colours.lime))
  903.   m.write("START.")
  904.   rs.setOutput("left",true)
  905.   sleep(1)
  906.   rs.setOutput("left", false)
  907.   m.setBackgroundColour((colours.black))
  908.   m.clear()
  909.   default()
  910. elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
  911.     m.setCursorPos(2,2)
  912.     m.setBackgroundColour((colours.lime))
  913.     m.write("Iron 64x")
  914.     newBal = newBal + 3
  915.    top.setCursorPos(14,1)
  916.    top.write(newBal)
  917.      m.setBackgroundColour((colours.black))
  918.     top.setCursorPos(1,2)
  919.     AmmountIron = AmmountIron + 64
  920.     top.write("Iron:"..AmmountIron)
  921.     top.setBackgroundColour((colours.black))
  922.    
  923.  elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 14 then
  924.  m.setCursorPos(2,14)
  925.  m.setBackgroundColour((colours.lime))
  926.  m.write("Osmium 64x")
  927.  newBal = newBal + 3
  928.  top.setCursorPos(14,1)
  929.  top.write(newBal)
  930.  m.setBackgroundColour((colours.black))
  931.  top.setCursorPos(17,4)
  932.  AmmountOsmium = AmmountOsmium + 64
  933.  top.write("Osmium:"..AmmountOsmium)
  934.  top.setBackgroundColour((colours.black))
  935.  elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 12 then
  936.  m.setCursorPos(2,12)
  937.  m.setBackgroundColour((colours.lime))
  938.  m.write("Lapis 64x")
  939.  newBal = newBal + 3
  940.  top.setCursorPos(14,1)
  941.  top.write(newBal)
  942.  m.setBackgroundColour((colours.black))
  943.  AmmountLapis = AmmountLapis + 64
  944.  top.setCursorPos(17,3)
  945.  top.write("Lapis:"..AmmountLapis)
  946.  top.setBackgroundColour((colours.black))
  947.  elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 10 then
  948.  m.setCursorPos(2,10)
  949.  m.setBackgroundColour((colours.lime))
  950.  m.write("Copper 64x")
  951.  newBal = newBal + 3
  952.  top.setCursorPos(14,1)
  953.  top.write(newBal)
  954.  m.setBackgroundColour((colours.black))
  955.  AmmountCopper = AmmountCopper + 64
  956.  top.setCursorPos(17,2)
  957.  top.write("Copper:"..AmmountCopper)
  958.  top.setBackgroundColour((colours.black))
  959.  elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 8 then
  960.  m.setCursorPos(2,8)
  961.  m.setBackgroundColour((colours.lime))
  962.  m.write("Tin 64x")
  963.  newBal = newBal + 3
  964.  top.setCursorPos(14,1)
  965.  top.write(newBal)
  966.  m.setBackgroundColour((colours.black))
  967.  top.setCursorPos(1,5)
  968.  AmmountTin = AmmountTin + 64
  969.  top.write("Tin:"..AmmountTin)
  970.  top.setBackgroundColour((colours.black))
  971.    elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 6 then
  972.   m.setCursorPos(2,6)
  973.   m.setBackgroundColour((colours.lime))
  974.   m.write("Redstone 64x")
  975.   newBal = newBal + 3
  976.   top.setCursorPos(14,1)
  977.   top.write(newBal)
  978.   m.setBackgroundColour((colours.black))
  979.   top.setCursorPos(1,4)
  980.   AmmountRedstone = AmmountRedstone + 64
  981.   top.write("Redstone:"..AmmountRedstone)
  982.   top.setBackgroundColour((colours.black))
  983.    elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 16 then
  984.   m.setCursorPos(2,16)
  985.   m.setBackgroundColour((colours.lime))
  986.   AmmountDiamond= AmmountDiamond + 8
  987.   m.write("Diamond 8x")
  988.   newBal = newBal + 3
  989.   top.setCursorPos(14,1)
  990.   top.write(newBal)
  991.   top.setCursorPos(29,2)
  992.   top.write("Diamond:"..AmmountDiamond)
  993.   top.setBackgroundColour((colours.black))
  994.     elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 18 then
  995.   m.setCursorPos(2,18)
  996.   m.setBackgroundColour((colours.lime))
  997.   AmmountWood = AmmountWood + 64
  998.   m.write("Oak Log 64x")
  999.   newBal = newBal + 3
  1000.   top.setCursorPos(14,1)
  1001.   top.write(newBal)
  1002.   m.setBackgroundColour((colours.black))
  1003.   --top.setCursorPos(1,3)
  1004.   top.setCursorPos(17,5)
  1005.   top.write("Oak Log:"..AmmountWood)
  1006.   top.setBackgroundColour((colours.black))
  1007.   elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
  1008.     m.setCursorPos(2,4)
  1009.     m.setBackgroundColour((colours.lime))
  1010.     AmmountGold = AmmountGold + 32
  1011.     m.write("Gold 32x")
  1012.    newBal = newBal + 3
  1013.     top.setCursorPos(14,1)
  1014.     top.write(newBal)
  1015.     --moneyN()
  1016.     m.setBackgroundColour((colours.black))
  1017.     top.setCursorPos(1,3)
  1018.     top.write("Gold:"..AmmountGold)
  1019.     top.setBackgroundColour((colours.black))
  1020.    end
  1021. end
  1022. repeat
  1023.   event,p1,p2,p3 = os.pullEvent()
  1024.    if event=="monitor_touch" then
  1025.      mouseWidth = p2
  1026.      mouseHeight = p3
  1027.      checkClickPosition()
  1028.      end
  1029.    until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement