Advertisement
Guest User

casino.b2

a guest
Dec 5th, 2015
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local computer = require("computer")
  2. local robot = require("robot")
  3. local component = require("component")
  4. local sides = require("sides")
  5. local redstone = component.redstone
  6. local term = require("term")
  7. io.write("how many % to win:")
  8. x = io.read()
  9. if x ~= 0 then
  10.   ver = 100 / x
  11. elseif x == 0 then
  12.   ver = 0
  13. end
  14. function scan()
  15. redstone.setOutput(sides.back,0)
  16.  alm = robot.compareTo(16)
  17.  co = robot.count()
  18.  robot.suck()
  19.  if alm == true and co > 0 and ver ~= 0 then
  20.      robot.dropDown()
  21.      rand = math.random(ver)
  22.      print(rand)
  23.      if rand == 1 then
  24.       redstone.setOutput(sides.back,15)
  25.       os.sleep(1)
  26.       redstone.setOutput(sides.back,0)
  27.      elseif rand ~= 1 then
  28.       computer.beep(2000, 0.7)
  29.  elseif alm == true and co > 0 and ver == 0 then
  30.     robot.dropDown()
  31.     rand = 0
  32.     print(rand)
  33.     computer.beep(2000, 0.7)
  34.  end
  35. end
  36. end
  37. while true do
  38.   red = redstone.getInput(sides.right)
  39.   if red > 0 then
  40.     scan()
  41.   end
  42. --end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement