Advertisement
Alakazard12

withdraw

Jul 30th, 2014
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. local text = "Please Select the Amount"
  2. local text2 = "You wish to withdraw."
  3. rednet.open("back")
  4. local option1 = ("50")
  5. local option2 = ("25")
  6. local option3 = ("20")
  7. local option4 = ("10")
  8. local option5 = ("5")
  9. --local option6 = ("1")
  10. local test = "Insert Card"
  11. os.loadAPI("bapi")
  12. local function insert()
  13. term.setCursorPos(51 - #test, 19)
  14. write(test)
  15. end
  16. local options = {
  17. [1] = { p = 50, x = 20, y = 7, color = 1 },
  18. [2] = { p = 25, x = 20, y = 8, color = 1 },
  19. [3] = { p = 20, x = 20, y = 9, color = 1 },
  20. [4] = { p = 10, x = 29, y = 7, color = 1 },
  21. [5] = { p = 5, x = 30, y = 8, color = 1 }--,
  22. --[6] = { p = 1, x = 30, y = 9, color = 1 }
  23. }
  24.  
  25.  
  26. bapi.connect()
  27.  
  28.  
  29. --verify("Test","T")
  30.  
  31.  
  32. while true do
  33.  
  34. term.setCursorPos(6,7)
  35. shell.run("draw")
  36. term.clear()
  37. term.setCursorPos(51/2 - #text/2,1)
  38. write(text)
  39. term.setCursorPos(51/2 - #text2/2,2)
  40. write(text2)
  41. print()
  42.  
  43. for i = 1, #options do
  44. term.setTextColor(colors.blue)
  45. term.setCursorPos(options[i].x,options[i].y)
  46. print(options[i].p)
  47. print()
  48. end
  49.  
  50. event, side, x, y = os.pullEventRaw()
  51. if event == "mag_swipe" then
  52. if side == "astaffcard" then
  53. break
  54. end
  55. elseif event == "mouse_click" then
  56. if x > 0 and x < 0 and y == 0 then
  57. sleep(0)
  58. term.setTextColor(colors.white)
  59. elseif x > 20 and x < 27 and y == 7 then
  60. -- rednet.send(47,"Option1")
  61. term.setCursorPos(51 - #test, 19)
  62. insert()
  63. local _,data = os.pullEventRaw("mag_swipe")
  64. local suc, err = bapi.transact(data, "void", 50) -- 1 is how much to withdraw
  65. if suc then
  66. rednet.send(47, "10")
  67. end
  68. sleep(1)
  69. term.setTextColor(colors.white)
  70. elseif x > 20 and x < 27 and y == 8 then
  71. term.setCursorPos(51 - #test, 19)
  72. insert()
  73. local _,data = os.pullEventRaw("mag_swipe")
  74. local suc, err = bapi.transact(data, "void", 25) -- 1 is how much to withdraw
  75. if suc then
  76. rednet.send(47, "5")
  77. end
  78. sleep(1)
  79. term.setTextColor(colors.white)
  80. elseif x > 20 and x < 27 and y == 9 then
  81. term.setCursorPos(51 - #test, 19)
  82. insert()
  83. local _,data = os.pullEventRaw("mag_swipe")
  84. local suc, err = bapi.transact(data, "void", 20) -- 1 is how much to withdraw
  85. if suc then
  86. rednet.send(47, "4")
  87. end
  88. sleep(1)
  89. term.setTextColor(colors.white)
  90. elseif x > 29 and x < 36 and y == 7 then
  91. term.setCursorPos(51 - #test, 19)
  92. insert()
  93. local _,data = os.pullEventRaw("mag_swipe")
  94. local suc, err = bapi.transact(data, "void", 10) -- 1 is how much to withdraw
  95. if suc then
  96. rednet.send(47, "2")
  97. end
  98. sleep(1)
  99. term.setTextColor(colors.white)
  100. elseif x > 29 and x < 36 and y == 8 then
  101. term.setCursorPos(51 - #test, 19)
  102. insert()
  103. local _,data = os.pullEventRaw("mag_swipe")
  104. local suc, err = bapi.transact(data, "void", 5) -- 1 is how much to withdraw
  105. if suc then
  106. rednet.send(47, "1")
  107. end
  108. sleep(1)
  109. term.setTextColor(colors.white)
  110. end
  111. end
  112. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement