a_alien

mony

May 6th, 2021
627
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function split(inputStr, sep)
  2.     if sep == nil then
  3.         sep = "%s"
  4.     end
  5.     local t = {}
  6.     for str in string.gmatch(inputStr, "([^"..sep.."]+)") do
  7.         table.insert(t, str)
  8.     end
  9.     return t
  10. end
  11.  
  12. while true do
  13.     item = turtle.getItemDetail()
  14.     if item.name == "minecraft:diamond" then
  15.         file = io.open("disk/bal", "r")
  16.         coins = tonumber(split(file:read())[2])
  17.         file:close()
  18.         file = io.open("disk/bal", "w")
  19.         file:write("bal "..tostring(coins+1))
  20.         file:flush()
  21.         file:close()
  22.         turtle.drop()
  23.     else
  24.         turtle.dropUp()
  25.     end
  26. end
RAW Paste Data