Advertisement
ravneravn

casino check in

May 20th, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. w, h = term.getSize()
  2. cashOut = false
  3.  
  4. function cPrint(string, ypos)
  5. term.setCursorPos(w/2 - #string/2, ypos)
  6. term.write(string)
  7. end
  8.  
  9. function welcome()
  10. cPrint("Hello, and welcome to the casino", 6)
  11. cPrint("Please deposit the items", 7)
  12. cPrint("you wish to exchange", 8)
  13. cPrint("Press enter when you are done", 10)
  14.  
  15. while true do
  16. event, key = os.pullEvent("key")
  17. if key == 16 then cashOut = true break
  18. elseif key == 28 then cashOut = false break
  19. end
  20. end
  21. term.clear()
  22. cPrint("Thank you", 6)
  23. if cashOut == true then
  24. cPrint("Please wait while i get your prize", 7)
  25. else
  26. cPrint("please wait while i get your credits", 7)
  27. end
  28. end
  29.  
  30.  
  31. function sendSignal(message)
  32. rednet.open("right")
  33. rednet.send(21, message)
  34. end
  35.  
  36. function receiveSignal()
  37. event = os.pullEvent("rednet_message")
  38. end
  39.  
  40.  
  41. function getCredit()
  42. turtle.turnRight()
  43. turtle.turnRight()
  44. turtle.forward()
  45.  
  46. for i = 1, 5 do
  47. turtle.down()
  48. end
  49.  
  50. turtle.turnRight()
  51. turtle.turnRight()
  52.  
  53. for i = 1, 16 do
  54. turtle.select(i)
  55. turtle.drop()
  56. sleep(1)
  57. end
  58.  
  59. turtle.select(1)
  60.  
  61. sleep(1)
  62.  
  63. if cashOut == true then
  64. sendSignal("cashOut")
  65. else
  66. sendSignal("go")
  67. end
  68.  
  69. receiveSignal()
  70.  
  71. for i = 1, 5 do
  72. turtle.up()
  73. end
  74.  
  75. turtle.forward()
  76.  
  77. for i = 1,3 do
  78. turtle.select(i)
  79. turtle.drop()
  80. end
  81.  
  82. turtle.select(1)
  83. end
  84.  
  85.  
  86.  
  87. -------------- LOOP ----------------
  88.  
  89. while true do
  90. term.clear()
  91. cashOut = false
  92. welcome()
  93. getCredit()
  94. cashout = false
  95. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement