TechManDylan

CCplinko

Apr 30th, 2026 (edited)
18
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.80 KB | None | 0 0
  1. -- Plinko Turtle Casino
  2. -- ComputerCraft / CC:Tweaked style program
  3. -- Designed for Advanced Monitor wall, 3 tall x 7 wide
  4. -- Uses a turtle as the diamond bank/payout machine
  5. -- Uses speaker if available
  6.  
  7. --------------------------------------------------
  8. -- CONFIG
  9. --------------------------------------------------
  10.  
  11. local DIAMOND_ID = "minecraft:diamond"
  12.  
  13. local TEXT_SCALE = 0.5
  14.  
  15. local MIN_BET = 1
  16. local MAX_BET_AMOUNT = 999
  17.  
  18. local CASINO_MENU_PROGRAM = "casino"
  19. local CASINO_BANK_FILE = "casino_bank_base.txt"
  20.  
  21. local PLINKO_ROWS = 8
  22. local DROP_DELAY = 0.28
  23.  
  24. -- Total payout multipliers.
  25. -- Example: bet 10 on 2x pays 20 total.
  26. -- 0x loses.
  27. local SLOT_MULTIPLIERS = {
  28. 5, 2, 1, 1, 0, 1, 1, 2, 5
  29. }
  30.  
  31. --------------------------------------------------
  32. -- PERIPHERALS
  33. --------------------------------------------------
  34.  
  35. local mon = peripheral.find("monitor")
  36.  
  37. if not mon then
  38. error("No monitor found. Attach/wrap an advanced monitor wall.")
  39. end
  40.  
  41. local speaker = nil
  42.  
  43. for _, name in ipairs(peripheral.getNames()) do
  44. local p = peripheral.wrap(name)
  45. if p then
  46. if type(p.playNote) == "function" or type(p.playSound) == "function" then
  47. speaker = p
  48. break
  49. end
  50. end
  51. end
  52.  
  53. mon.setTextScale(TEXT_SCALE)
  54. mon.setBackgroundColor(colors.green)
  55. mon.setTextColor(colors.white)
  56. mon.clear()
  57.  
  58. local W, H = mon.getSize()
  59.  
  60. --------------------------------------------------
  61. -- UTILS
  62. --------------------------------------------------
  63.  
  64. local function clamp(v, a, b)
  65. if v < a then return a end
  66. if v > b then return b end
  67. return v
  68. end
  69.  
  70. local function writeAt(x, y, text, fg, bg)
  71. if bg then mon.setBackgroundColor(bg) end
  72. if fg then mon.setTextColor(fg) end
  73. mon.setCursorPos(x, y)
  74. mon.write(text)
  75. end
  76.  
  77. local function fillBox(x, y, w, h, bg)
  78. if w <= 0 or h <= 0 then return end
  79.  
  80. mon.setBackgroundColor(bg)
  81.  
  82. for yy = y, y + h - 1 do
  83. if yy >= 1 and yy <= H then
  84. mon.setCursorPos(x, yy)
  85. mon.write(string.rep(" ", math.max(0, math.min(w, W - x + 1))))
  86. end
  87. end
  88. end
  89.  
  90. local function centerText(x, y, w, text, fg, bg)
  91. text = tostring(text)
  92.  
  93. if #text > w then
  94. text = string.sub(text, 1, w)
  95. end
  96.  
  97. local pad = math.floor((w - #text) / 2)
  98. writeAt(x + pad, y, text, fg, bg)
  99. end
  100.  
  101. local function drawButton(x, y, w, h, label, bg, fg)
  102. fillBox(x, y, w, h, bg)
  103. local cy = y + math.floor(h / 2)
  104. centerText(x, cy, w, label, fg or colors.white, bg)
  105. end
  106.  
  107. local function inBox(px, py, box)
  108. return px >= box.x and px < box.x + box.w and py >= box.y and py < box.y + box.h
  109. end
  110.  
  111. local function money(n)
  112. return tostring(math.floor(n or 0))
  113. end
  114.  
  115. local function formatMultiplier(m)
  116. if m == 0.5 then return "0.5x" end
  117. return tostring(m) .. "x"
  118. end
  119.  
  120. --------------------------------------------------
  121. -- DIAMOND BANKING
  122. --------------------------------------------------
  123.  
  124. local function countDiamonds()
  125. local total = 0
  126.  
  127. for slot = 1, 16 do
  128. local d = turtle.getItemDetail(slot)
  129. if d and d.name == DIAMOND_ID then
  130. total = total + d.count
  131. end
  132. end
  133.  
  134. return total
  135. end
  136.  
  137. local function selectDiamondSlot()
  138. for slot = 1, 16 do
  139. local d = turtle.getItemDetail(slot)
  140.  
  141. if d and d.name == DIAMOND_ID and d.count > 0 then
  142. turtle.select(slot)
  143. return true
  144. end
  145. end
  146.  
  147. return false
  148. end
  149.  
  150. local function pullDiamondsFromAboveUntil(amountNeeded)
  151. local tries = 0
  152.  
  153. while countDiamonds() < amountNeeded and tries < 64 do
  154. tries = tries + 1
  155.  
  156. local pulled = turtle.suckUp(64)
  157.  
  158. if not pulled then
  159. break
  160. end
  161.  
  162. sleep(0.05)
  163. end
  164.  
  165. return countDiamonds() >= amountNeeded
  166. end
  167.  
  168. local function dropDiamondsDown(amount)
  169. local remaining = amount
  170.  
  171. while remaining > 0 do
  172. if not selectDiamondSlot() then
  173. return false, amount - remaining
  174. end
  175.  
  176. local d = turtle.getItemDetail()
  177.  
  178. if not d or d.name ~= DIAMOND_ID then
  179. return false, amount - remaining
  180. end
  181.  
  182. local toDrop = math.min(remaining, d.count)
  183. local ok = turtle.dropDown(toDrop)
  184.  
  185. if not ok then
  186. return false, amount - remaining
  187. end
  188.  
  189. remaining = remaining - toDrop
  190. sleep(0.03)
  191. end
  192.  
  193. return true, amount
  194. end
  195.  
  196. local function loadBankBase()
  197. if fs.exists(CASINO_BANK_FILE) then
  198. local f = fs.open(CASINO_BANK_FILE, "r")
  199. if f then
  200. local raw = f.readAll()
  201. f.close()
  202.  
  203. local n = tonumber(raw)
  204. if n and n >= 0 then
  205. return n
  206. end
  207. end
  208. end
  209.  
  210. return countDiamonds()
  211. end
  212.  
  213. local bankBase = loadBankBase()
  214.  
  215. local function saveBankBase()
  216. local f = fs.open(CASINO_BANK_FILE, "w")
  217. if f then
  218. f.write(tostring(math.floor(bankBase)))
  219. f.close()
  220. end
  221. end
  222.  
  223. saveBankBase()
  224.  
  225. --------------------------------------------------
  226. -- SOUND
  227. --------------------------------------------------
  228.  
  229. local function playNoteSafe(instrument, volume, pitch)
  230. if not speaker then return end
  231.  
  232. instrument = instrument or "harp"
  233. volume = volume or 1
  234. pitch = pitch or 12
  235.  
  236. if type(speaker.playNote) == "function" then
  237. local ok = pcall(function()
  238. speaker.playNote(instrument, volume, pitch)
  239. end)
  240.  
  241. if ok then
  242. return
  243. end
  244. end
  245.  
  246. if type(speaker.playSound) == "function" then
  247. pcall(function()
  248. speaker.playSound("note.harp", volume, 1)
  249. end)
  250. end
  251. end
  252.  
  253. local function soundClick()
  254. playNoteSafe("hat", 0.8, 12)
  255. end
  256.  
  257. local function soundTick()
  258. playNoteSafe("hat", 0.7, math.random(8, 18))
  259. end
  260.  
  261. local function soundWin()
  262. playNoteSafe("bell", 1, 16)
  263. sleep(0.08)
  264. playNoteSafe("bell", 1, 20)
  265. sleep(0.08)
  266. playNoteSafe("bell", 1, 24)
  267. end
  268.  
  269. local function soundBigWin()
  270. playNoteSafe("bell", 1, 16)
  271. sleep(0.06)
  272. playNoteSafe("bell", 1, 20)
  273. sleep(0.06)
  274. playNoteSafe("bell", 1, 24)
  275. sleep(0.06)
  276. playNoteSafe("bell", 1, 28)
  277. end
  278.  
  279. local function soundLoss()
  280. playNoteSafe("bass", 1, 6)
  281. sleep(0.12)
  282. playNoteSafe("bass", 1, 4)
  283. end
  284.  
  285. --------------------------------------------------
  286. -- GAME STATE
  287. --------------------------------------------------
  288.  
  289. math.randomseed(os.epoch and os.epoch("utc") or os.clock() * 100000)
  290.  
  291. local hitBoxes = {}
  292.  
  293. local betAmount = 1
  294. local currentBet = 0
  295.  
  296. local dropping = false
  297. local chipRow = 0
  298. local chipSlot = 5
  299. local lastSlot = nil
  300. local lastMultiplier = nil
  301. local lastPayout = nil
  302.  
  303. local message = "Set bet amount, then press DROP CHIP."
  304. local confirmMode = nil
  305.  
  306. local drawAll
  307.  
  308. local function availableCredits()
  309. local current = countDiamonds()
  310. local credits = current - bankBase - currentBet
  311.  
  312. if credits < 0 then
  313. credits = 0
  314. end
  315.  
  316. return credits
  317. end
  318.  
  319. --------------------------------------------------
  320. -- BET CONTROLS
  321. --------------------------------------------------
  322.  
  323. local function changeBetAmount(delta)
  324. if dropping or confirmMode then
  325. message = "Cannot change bet while chip is dropping."
  326. soundLoss()
  327. return
  328. end
  329.  
  330. betAmount = betAmount + delta
  331. betAmount = clamp(betAmount, MIN_BET, MAX_BET_AMOUNT)
  332.  
  333. message = "Bet amount set to " .. betAmount .. " diamond(s)."
  334. soundClick()
  335. end
  336.  
  337. local function resetBetAmount()
  338. if dropping or confirmMode then
  339. message = "Cannot reset bet while chip is dropping."
  340. soundLoss()
  341. return
  342. end
  343.  
  344. betAmount = 1
  345. message = "Bet amount reset to 1 diamond."
  346. soundClick()
  347. end
  348.  
  349. --------------------------------------------------
  350. -- CASH OUT / MENU
  351. --------------------------------------------------
  352.  
  353. local function resetRoundForExitOrCashout()
  354. currentBet = 0
  355. dropping = false
  356. chipRow = 0
  357. chipSlot = 5
  358. end
  359.  
  360. local function cashOutCredits()
  361. if dropping then
  362. message = "Cannot cash out while chip is dropping."
  363. soundLoss()
  364. return
  365. end
  366.  
  367. local amount = availableCredits()
  368.  
  369. if amount <= 0 then
  370. message = "No unbet credits to cash out."
  371. soundLoss()
  372. return
  373. end
  374.  
  375. local ok, dropped = dropDiamondsDown(amount)
  376.  
  377. if ok then
  378. message = "Cashed out " .. dropped .. " diamond(s) below."
  379. soundWin()
  380. else
  381. message = "Cash out blocked! Dropped " .. dropped .. "/" .. amount .. "."
  382. soundLoss()
  383. end
  384.  
  385. saveBankBase()
  386. end
  387.  
  388. local function requestCashOut()
  389. if dropping or currentBet > 0 then
  390. confirmMode = "cashout"
  391. message = "Confirm cash out. Active drop/bet will be cleared."
  392. soundLoss()
  393. return
  394. end
  395.  
  396. cashOutCredits()
  397. end
  398.  
  399. local function exitToMenuNow()
  400. resetRoundForExitOrCashout()
  401. confirmMode = nil
  402. saveBankBase()
  403.  
  404. mon.setBackgroundColor(colors.black)
  405. mon.setTextColor(colors.white)
  406. mon.clear()
  407.  
  408. if shell then
  409. if fs.exists(CASINO_MENU_PROGRAM) then
  410. shell.run(CASINO_MENU_PROGRAM)
  411. elseif fs.exists(CASINO_MENU_PROGRAM .. ".lua") then
  412. shell.run(CASINO_MENU_PROGRAM .. ".lua")
  413. else
  414. print("Casino menu not found.")
  415. print("Expected: " .. CASINO_MENU_PROGRAM)
  416. end
  417. end
  418.  
  419. error("Exited to casino menu", 0)
  420. end
  421.  
  422. local function requestExit()
  423. if dropping or currentBet > 0 then
  424. confirmMode = "exit"
  425. message = "Confirm menu. Active drop/bet will be cleared."
  426. soundLoss()
  427. return
  428. end
  429.  
  430. exitToMenuNow()
  431. end
  432.  
  433. --------------------------------------------------
  434. -- PAYOUT
  435. --------------------------------------------------
  436.  
  437. local function payPlayer(amount, outcomeMessage, soundFunc)
  438. local unbetCredits = availableCredits()
  439.  
  440. if amount <= 0 then
  441. message = outcomeMessage or "No payout."
  442. if soundFunc then soundFunc() end
  443. return
  444. end
  445.  
  446. message = outcomeMessage .. " Paying " .. amount .. " diamonds."
  447. if soundFunc then soundFunc() end
  448.  
  449. local enough = pullDiamondsFromAboveUntil(amount)
  450.  
  451. if enough then
  452. local ok, dropped = dropDiamondsDown(amount)
  453.  
  454. if ok then
  455. message = outcomeMessage .. " Paid " .. dropped .. " diamonds below."
  456. else
  457. message = "Payout blocked! Dropped " .. dropped .. "/" .. amount
  458. end
  459. else
  460. local available = countDiamonds()
  461. local _, dropped = dropDiamondsDown(available)
  462. message = "HOUSE EMPTY! Paid only " .. dropped .. "/" .. amount .. "."
  463. end
  464.  
  465. local after = countDiamonds()
  466. bankBase = after - unbetCredits
  467.  
  468. if bankBase < 0 then
  469. bankBase = 0
  470. end
  471.  
  472. saveBankBase()
  473. end
  474.  
  475. local function houseKeepsBet()
  476. bankBase = bankBase + currentBet
  477. saveBankBase()
  478. end
  479.  
  480. --------------------------------------------------
  481. -- PLINKO LOGIC
  482. --------------------------------------------------
  483.  
  484. local function calculatePayout(bet, multiplier)
  485. return math.floor(bet * multiplier)
  486. end
  487.  
  488. local function startDrop()
  489. if dropping then return end
  490.  
  491. if betAmount < MIN_BET then
  492. message = "Bet amount must be at least " .. MIN_BET .. "."
  493. soundLoss()
  494. return
  495. end
  496.  
  497. if availableCredits() < betAmount then
  498. message = "Not enough credits. Need " .. betAmount .. " diamond(s)."
  499. soundLoss()
  500. return
  501. end
  502.  
  503. currentBet = betAmount
  504. dropping = true
  505. chipRow = 0
  506. chipSlot = 5
  507. lastSlot = nil
  508. lastMultiplier = nil
  509. lastPayout = nil
  510.  
  511. message = "Dropping chip..."
  512. drawAll()
  513. sleep(0.2)
  514.  
  515. for row = 1, PLINKO_ROWS do
  516. chipRow = row
  517.  
  518. local moveRight = math.random(0, 1) == 1
  519.  
  520. if moveRight then
  521. chipSlot = chipSlot + 1
  522. else
  523. chipSlot = chipSlot - 1
  524. end
  525.  
  526. chipSlot = clamp(chipSlot, 1, #SLOT_MULTIPLIERS)
  527.  
  528. soundTick()
  529. drawAll()
  530. sleep(DROP_DELAY)
  531. end
  532.  
  533. dropping = false
  534.  
  535. local multiplier = SLOT_MULTIPLIERS[chipSlot] or 0
  536. local payout = calculatePayout(currentBet, multiplier)
  537.  
  538. lastSlot = chipSlot
  539. lastMultiplier = multiplier
  540. lastPayout = payout
  541.  
  542. if payout > 0 then
  543. local msg = "Landed on " .. formatMultiplier(multiplier) .. "!"
  544. if multiplier >= 5 then
  545. payPlayer(payout, msg, soundBigWin)
  546. else
  547. payPlayer(payout, msg, soundWin)
  548. end
  549. else
  550. houseKeepsBet()
  551. message = "Landed on 0x. You lose."
  552. soundLoss()
  553. end
  554.  
  555. currentBet = 0
  556. drawAll()
  557. end
  558.  
  559. --------------------------------------------------
  560. -- DRAWING
  561. --------------------------------------------------
  562.  
  563. local function resetHitBoxes()
  564. hitBoxes = {}
  565. end
  566.  
  567. local function addHit(id, x, y, w, h)
  568. table.insert(hitBoxes, {
  569. id = id,
  570. x = x,
  571. y = y,
  572. w = w,
  573. h = h
  574. })
  575. end
  576.  
  577. local function drawFrame()
  578. fillBox(1, 1, W, H, colors.green)
  579. fillBox(1, 1, W, 1, colors.black)
  580. centerText(1, 1, W, "PLINKO | DIAMOND CASINO", colors.lime, colors.black)
  581. end
  582.  
  583. local function drawLeftInfoPanel()
  584. local x = 2
  585. local y = 3
  586. local w = 38
  587. local h = 15
  588.  
  589. fillBox(x, y, w, h, colors.black)
  590. centerText(x, y, w, "GAME INFO", colors.yellow, colors.black)
  591.  
  592. writeAt(x + 2, y + 2, "Credits: " .. money(availableCredits()), colors.lime, colors.black)
  593. writeAt(x + 2, y + 3, "Current Bet: " .. money(currentBet), colors.yellow, colors.black)
  594. writeAt(x + 2, y + 4, "Bet Amount: " .. money(betAmount), colors.orange, colors.black)
  595. writeAt(x + 2, y + 5, "Diamonds In Turtle: " .. money(countDiamonds()), colors.white, colors.black)
  596. writeAt(x + 2, y + 6, "House Bank Base: " .. money(bankBase), colors.lightGray, colors.black)
  597.  
  598. if lastMultiplier then
  599. writeAt(x + 2, y + 8, "Last Slot: " .. tostring(lastSlot), colors.lightGray, colors.black)
  600. writeAt(x + 2, y + 9, "Last Multi: " .. formatMultiplier(lastMultiplier), colors.lightGray, colors.black)
  601. writeAt(x + 2, y + 10, "Last Payout: " .. money(lastPayout), colors.lightGray, colors.black)
  602. else
  603. writeAt(x + 2, y + 8, "Last Slot: --", colors.lightGray, colors.black)
  604. writeAt(x + 2, y + 9, "Last Multi: --", colors.lightGray, colors.black)
  605. writeAt(x + 2, y + 10, "Last Payout: --", colors.lightGray, colors.black)
  606. end
  607.  
  608. fillBox(x + 1, y + 12, w - 2, 2, colors.gray)
  609. writeAt(x + 2, y + 12, string.sub(message, 1, w - 4), colors.white, colors.gray)
  610. end
  611.  
  612. local function boardBounds()
  613. local leftEdge = 43
  614. local rightEdge = W - 2
  615.  
  616. if leftEdge > rightEdge then
  617. leftEdge = 2
  618. rightEdge = W - 2
  619. end
  620.  
  621. return leftEdge, rightEdge, rightEdge - leftEdge + 1
  622. end
  623.  
  624. local function slotColor(multiplier)
  625. if multiplier == 0 then
  626. return colors.red, colors.white
  627. elseif multiplier == 1 then
  628. return colors.gray, colors.white
  629. elseif multiplier == 2 then
  630. return colors.yellow, colors.black
  631. elseif multiplier == 5 then
  632. return colors.lime, colors.black
  633. else
  634. return colors.orange, colors.black
  635. end
  636. end
  637.  
  638. local function drawPlinkoBoard()
  639. local left, _, areaW = boardBounds()
  640.  
  641. local boardW = math.min(areaW, 88)
  642. local boardX = left + math.floor((areaW - boardW) / 2)
  643. local boardY = 4
  644. local boardH = H - 18
  645.  
  646. if boardH < 18 then
  647. boardH = 18
  648. end
  649.  
  650. fillBox(boardX, boardY, boardW, boardH, colors.black)
  651. centerText(boardX, boardY, boardW, "DROP ZONE", colors.yellow, colors.black)
  652.  
  653. local centerX = boardX + math.floor(boardW / 2)
  654. local pegStartY = boardY + 3
  655. local rowGapY = 2
  656. local pegGapX = 6
  657.  
  658. for row = 1, PLINKO_ROWS do
  659. local pegs = row + 1
  660. local totalPegW = (pegs - 1) * pegGapX
  661. local startX = centerX - math.floor(totalPegW / 2)
  662. local y = pegStartY + (row - 1) * rowGapY
  663.  
  664. for i = 1, pegs do
  665. local x = startX + (i - 1) * pegGapX
  666. writeAt(x, y, "*", colors.lightGray, colors.black)
  667. end
  668. end
  669.  
  670. if dropping then
  671. local y = pegStartY + math.max(0, chipRow - 1) * rowGapY - 1
  672. local slotCount = #SLOT_MULTIPLIERS
  673. local slotAreaW = math.min(boardW - 4, slotCount * 9)
  674. local slotStartX = boardX + math.floor((boardW - slotAreaW) / 2)
  675. local slotW = math.floor(slotAreaW / slotCount)
  676. local x = slotStartX + (chipSlot - 1) * slotW + math.floor(slotW / 2)
  677.  
  678. writeAt(x, y, "O", colors.yellow, colors.black)
  679. end
  680.  
  681. local slotCount = #SLOT_MULTIPLIERS
  682. local slotAreaW = math.min(boardW - 4, slotCount * 9)
  683. local slotStartX = boardX + math.floor((boardW - slotAreaW) / 2)
  684. local slotW = math.floor(slotAreaW / slotCount)
  685. local slotY = boardY + boardH - 4
  686.  
  687. centerText(boardX, slotY - 2, boardW, "MULTIPLIERS", colors.white, colors.black)
  688.  
  689. for i, mult in ipairs(SLOT_MULTIPLIERS) do
  690. local x = slotStartX + (i - 1) * slotW
  691. local bg, fg = slotColor(mult)
  692.  
  693. if lastSlot == i then
  694. bg = colors.purple
  695. fg = colors.white
  696. end
  697.  
  698. drawButton(x, slotY, slotW - 1, 3, formatMultiplier(mult), bg, fg)
  699. end
  700. end
  701.  
  702. local function drawActionRow()
  703. local y = H - 13
  704. local h = 3
  705. local gap = 2
  706. local btnW = 22
  707.  
  708. local buttons = {
  709. {"DROP", "DROP CHIP", colors.lime, colors.black},
  710. {"EXIT_MENU", "MENU", colors.gray, colors.white}
  711. }
  712.  
  713. local totalW = #buttons * btnW + (#buttons - 1) * gap
  714. local x = math.floor((W - totalW) / 2)
  715.  
  716. for i, b in ipairs(buttons) do
  717. local id, label, bg, fg = b[1], b[2], b[3], b[4]
  718. local bx = x + (i - 1) * (btnW + gap)
  719. drawButton(bx, y, btnW, h, label, bg, fg)
  720. addHit(id, bx, y, btnW, h)
  721. end
  722. end
  723.  
  724. local function drawBottomBetControls()
  725. local panelW = math.min(W - 6, 124)
  726. local x = math.floor((W - panelW) / 2)
  727. local y = H - 9
  728. local panelH = 8
  729.  
  730. fillBox(x, y, panelW, panelH, colors.black)
  731. centerText(x, y, panelW, "BET CONTROLS | CURRENT BET AMOUNT: " .. betAmount, colors.yellow, colors.black)
  732.  
  733. local gap = 1
  734. local smallW = math.floor((panelW - 4 - gap * 2) / 3)
  735.  
  736. drawButton(x + 1, y + 1, smallW, 2, "+1", colors.lime, colors.black)
  737. addHit("BETAMT:+1", x + 1, y + 1, smallW, 2)
  738.  
  739. drawButton(x + 1 + smallW + gap, y + 1, smallW, 2, "+5", colors.lime, colors.black)
  740. addHit("BETAMT:+5", x + 1 + smallW + gap, y + 1, smallW, 2)
  741.  
  742. drawButton(x + 1 + (smallW + gap) * 2, y + 1, smallW, 2, "+10", colors.lime, colors.black)
  743. addHit("BETAMT:+10", x + 1 + (smallW + gap) * 2, y + 1, smallW, 2)
  744.  
  745. drawButton(x + 1, y + 3, smallW, 2, "-1", colors.orange, colors.black)
  746. addHit("BETAMT:-1", x + 1, y + 3, smallW, 2)
  747.  
  748. drawButton(x + 1 + smallW + gap, y + 3, smallW, 2, "-5", colors.orange, colors.black)
  749. addHit("BETAMT:-5", x + 1 + smallW + gap, y + 3, smallW, 2)
  750.  
  751. drawButton(x + 1 + (smallW + gap) * 2, y + 3, smallW, 2, "-10", colors.orange, colors.black)
  752. addHit("BETAMT:-10", x + 1 + (smallW + gap) * 2, y + 3, smallW, 2)
  753.  
  754. local halfW = math.floor((panelW - 3) / 2)
  755.  
  756. drawButton(x + 1, y + 5, halfW, 3, "RESET AMT", colors.gray, colors.white)
  757. addHit("BETAMT:RESET", x + 1, y + 5, halfW, 3)
  758.  
  759. drawButton(x + 2 + halfW, y + 5, halfW, 3, "CASH OUT", colors.yellow, colors.black)
  760. addHit("ACTION:CASHOUT", x + 2 + halfW, y + 5, halfW, 3)
  761. end
  762.  
  763. local function drawConfirmScreen()
  764. resetHitBoxes()
  765. fillBox(1, 1, W, H, colors.black)
  766.  
  767. if confirmMode == "exit" then
  768. centerText(1, 4, W, "CONFIRM RETURN TO GAME MENU", colors.yellow, colors.black)
  769.  
  770. if dropping then
  771. centerText(1, 7, W, "A chip is currently dropping.", colors.white, colors.black)
  772. centerText(1, 9, W, "Leaving will cancel the drop and clear the bet back to credits.", colors.lightGray, colors.black)
  773. elseif currentBet > 0 then
  774. centerText(1, 7, W, "You have a " .. currentBet .. " diamond bet staged.", colors.white, colors.black)
  775. centerText(1, 9, W, "Leaving will clear that bet back into your credits.", colors.lightGray, colors.black)
  776. end
  777.  
  778. centerText(1, 11, W, "No diamonds will be paid out or removed.", colors.lightGray, colors.black)
  779.  
  780. elseif confirmMode == "cashout" then
  781. centerText(1, 4, W, "CONFIRM CASH OUT", colors.yellow, colors.black)
  782.  
  783. if dropping then
  784. centerText(1, 7, W, "A chip is currently dropping.", colors.white, colors.black)
  785. centerText(1, 9, W, "Cash out will cancel the drop and clear the bet back to credits.", colors.lightGray, colors.black)
  786. elseif currentBet > 0 then
  787. centerText(1, 7, W, "You have a " .. currentBet .. " diamond bet staged.", colors.white, colors.black)
  788. centerText(1, 9, W, "Cash out will clear the bet back into credits first.", colors.lightGray, colors.black)
  789. end
  790.  
  791. centerText(1, 11, W, "Then all player credits will drop below the turtle.", colors.lightGray, colors.black)
  792. end
  793.  
  794. local btnW = 32
  795. local btnH = 5
  796. local gap = 6
  797. local totalW = btnW * 2 + gap
  798. local startX = math.floor((W - totalW) / 2)
  799. local y = 16
  800.  
  801. drawButton(startX, y, btnW, btnH, "CANCEL", colors.lime, colors.black)
  802. addHit("CONFIRM_CANCEL", startX, y, btnW, btnH)
  803.  
  804. if confirmMode == "exit" then
  805. drawButton(startX + btnW + gap, y, btnW, btnH, "MENU - CLEAR BET", colors.red, colors.white)
  806. addHit("CONFIRM_YES", startX + btnW + gap, y, btnW, btnH)
  807. elseif confirmMode == "cashout" then
  808. drawButton(startX + btnW + gap, y, btnW, btnH, "CASH OUT ALL", colors.yellow, colors.black)
  809. addHit("CONFIRM_YES", startX + btnW + gap, y, btnW, btnH)
  810. end
  811. end
  812.  
  813. drawAll = function()
  814. if confirmMode then
  815. drawConfirmScreen()
  816. return
  817. end
  818.  
  819. resetHitBoxes()
  820. drawFrame()
  821. drawLeftInfoPanel()
  822. drawPlinkoBoard()
  823. drawActionRow()
  824. drawBottomBetControls()
  825. end
  826.  
  827. --------------------------------------------------
  828. -- INPUT
  829. --------------------------------------------------
  830.  
  831. local function handleConfirmTouch(x, y)
  832. for _, box in ipairs(hitBoxes) do
  833. if inBox(x, y, box) then
  834. if box.id == "CONFIRM_CANCEL" then
  835. confirmMode = nil
  836. message = "Action cancelled."
  837. soundClick()
  838. drawAll()
  839. return true
  840.  
  841. elseif box.id == "CONFIRM_YES" then
  842. if confirmMode == "exit" then
  843. resetRoundForExitOrCashout()
  844. confirmMode = nil
  845. saveBankBase()
  846. exitToMenuNow()
  847. return true
  848.  
  849. elseif confirmMode == "cashout" then
  850. resetRoundForExitOrCashout()
  851. confirmMode = nil
  852. saveBankBase()
  853. cashOutCredits()
  854. drawAll()
  855. return true
  856. end
  857. end
  858. end
  859. end
  860.  
  861. return false
  862. end
  863.  
  864. local function handleTouch(x, y)
  865. if confirmMode then
  866. handleConfirmTouch(x, y)
  867. return
  868. end
  869.  
  870. if dropping then
  871. return
  872. end
  873.  
  874. for _, box in ipairs(hitBoxes) do
  875. if inBox(x, y, box) then
  876. local id = box.id
  877.  
  878. if id == "BETAMT:+1" then
  879. changeBetAmount(1)
  880. elseif id == "BETAMT:+5" then
  881. changeBetAmount(5)
  882. elseif id == "BETAMT:+10" then
  883. changeBetAmount(10)
  884. elseif id == "BETAMT:-1" then
  885. changeBetAmount(-1)
  886. elseif id == "BETAMT:-5" then
  887. changeBetAmount(-5)
  888. elseif id == "BETAMT:-10" then
  889. changeBetAmount(-10)
  890. elseif id == "BETAMT:RESET" then
  891. resetBetAmount()
  892. elseif id == "DROP" then
  893. startDrop()
  894. elseif id == "ACTION:CASHOUT" then
  895. requestCashOut()
  896. elseif id == "EXIT_MENU" then
  897. requestExit()
  898. end
  899.  
  900. drawAll()
  901. return
  902. end
  903. end
  904. end
  905.  
  906. --------------------------------------------------
  907. -- STARTUP
  908. --------------------------------------------------
  909.  
  910. drawAll()
  911.  
  912. while true do
  913. local e, side, x, y = os.pullEvent()
  914.  
  915. if e == "monitor_touch" then
  916. handleTouch(x, y)
  917. elseif e == "peripheral" or e == "peripheral_detach" then
  918. drawAll()
  919. end
  920. end
Advertisement
Comments
  • Vennuron
    10 days
    # CSS 0.84 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
Add Comment
Please, Sign In to add comment