Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local text = "Please Select the Amount"
- local text2 = "You wish to withdraw."
- rednet.open("back")
- local option1 = ("50")
- local option2 = ("25")
- local option3 = ("20")
- local option4 = ("10")
- local option5 = ("5")
- --local option6 = ("1")
- local test = "Insert Card"
- os.loadAPI("bapi")
- local function insert()
- term.setCursorPos(51 - #test, 19)
- write(test)
- end
- local options = {
- [1] = { p = 50, x = 20, y = 7, color = 1 },
- [2] = { p = 25, x = 20, y = 8, color = 1 },
- [3] = { p = 20, x = 20, y = 9, color = 1 },
- [4] = { p = 10, x = 29, y = 7, color = 1 },
- [5] = { p = 5, x = 30, y = 8, color = 1 }--,
- --[6] = { p = 1, x = 30, y = 9, color = 1 }
- }
- bapi.connect()
- --verify("Test","T")
- while true do
- term.setCursorPos(6,7)
- shell.run("draw")
- term.clear()
- term.setCursorPos(51/2 - #text/2,1)
- write(text)
- term.setCursorPos(51/2 - #text2/2,2)
- write(text2)
- print()
- for i = 1, #options do
- term.setTextColor(colors.blue)
- term.setCursorPos(options[i].x,options[i].y)
- print(options[i].p)
- print()
- end
- event, side, x, y = os.pullEventRaw()
- if event == "mag_swipe" then
- if side == "astaffcard" then
- break
- end
- elseif event == "mouse_click" then
- if x > 0 and x < 0 and y == 0 then
- sleep(0)
- term.setTextColor(colors.white)
- elseif x > 20 and x < 27 and y == 7 then
- -- rednet.send(47,"Option1")
- term.setCursorPos(51 - #test, 19)
- insert()
- local _,data = os.pullEventRaw("mag_swipe")
- local suc, err = bapi.transact(data, "void", 50) -- 1 is how much to withdraw
- if suc then
- rednet.send(47, "10")
- end
- sleep(1)
- term.setTextColor(colors.white)
- elseif x > 20 and x < 27 and y == 8 then
- term.setCursorPos(51 - #test, 19)
- insert()
- local _,data = os.pullEventRaw("mag_swipe")
- local suc, err = bapi.transact(data, "void", 25) -- 1 is how much to withdraw
- if suc then
- rednet.send(47, "5")
- end
- sleep(1)
- term.setTextColor(colors.white)
- elseif x > 20 and x < 27 and y == 9 then
- term.setCursorPos(51 - #test, 19)
- insert()
- local _,data = os.pullEventRaw("mag_swipe")
- local suc, err = bapi.transact(data, "void", 20) -- 1 is how much to withdraw
- if suc then
- rednet.send(47, "4")
- end
- sleep(1)
- term.setTextColor(colors.white)
- elseif x > 29 and x < 36 and y == 7 then
- term.setCursorPos(51 - #test, 19)
- insert()
- local _,data = os.pullEventRaw("mag_swipe")
- local suc, err = bapi.transact(data, "void", 10) -- 1 is how much to withdraw
- if suc then
- rednet.send(47, "2")
- end
- sleep(1)
- term.setTextColor(colors.white)
- elseif x > 29 and x < 36 and y == 8 then
- term.setCursorPos(51 - #test, 19)
- insert()
- local _,data = os.pullEventRaw("mag_swipe")
- local suc, err = bapi.transact(data, "void", 5) -- 1 is how much to withdraw
- if suc then
- rednet.send(47, "1")
- end
- sleep(1)
- term.setTextColor(colors.white)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement