Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. -- Change camount to set how many prizes to give out.
  2. -- if you are using this on a multiplayer server
  3. -- add a way to stop them being able to access the terminal(add a script to make un-terminatable)
  4. camount = 10
  5. shell.run("clear",1)
  6. mon = peripheral.wrap("top")
  7. mon.clear()
  8. mon.setCursorPos(1,1)
  9. mon.write(" INSERT")
  10. mon.setCursorPos(1,2)
  11. mon.write(" GOLD")
  12. mon.setCursorPos(1,3)
  13. mon.write(" TO")
  14. mon.setCursorPos(1,4)
  15. mon.write(" PLAY")
  16.  
  17. function won()
  18. sleep(2)
  19. mon = peripheral.wrap("right")
  20. mon.clear()
  21. mon.setCursorPos(3,1)
  22. mon.setBackgroudnColor(colors.black)
  23. mon.setTextColor(colors.lime)
  24. mon.write(" WON!")
  25. end
  26.  
  27. function loss()
  28. sleep(2)
  29. mon = peripheral.wrap("right")
  30. mon.clear()
  31. mon.setCursorPos(3,1)
  32. mon.setBackgroudnColor(colors.black)
  33. mon.setTextColor(colors.red)
  34. mon.write(" LOST")
  35. end
  36.  
  37. function slots()
  38. result1 = math.random(1,5)
  39. result1 = result1 - ".0"
  40.  
  41. result2 = math.random(1,5)
  42. result2 = result2 - ".0"
  43.  
  44. result3 = math.random(1,5)
  45. result3 = result3 - ".0"
  46.  
  47. term.setCursorPos(25,5)
  48.  
  49. mon = peripheral.wrap("right")
  50. mon.clear()
  51.  
  52. mon.setCursorPos(3,2)
  53.  
  54. if (result1 == 1) then
  55. mon.setBackgroudnColor(colors.pink)
  56. mon.setTextColor(colors.pink)
  57. mon.write(" ")
  58. else if (result1 == 2) then
  59. mon.setBackgroudnColor(colors.yellow)
  60. mon.setTextColor(colors.yellow)
  61. mon.write(" ")
  62. else if (result1 == 3) then
  63. mon.setBackgroudnColor(colors.cyan)
  64. mon.setTextColor(colors.cyan)
  65. mon.write(" ")
  66. else if (result1 == 4) then
  67. mon.setBackgroudnColor(colors.red)
  68. mon.setTextColor(colors.red)
  69. mon.write(" ")
  70. else if (result1 == 5) then
  71. mon.setBackgroudnColor(colors.lightBlue)
  72. mon.setTextColor(colors.lightBlue)
  73. mon.write(" ")
  74. end
  75. mon.setBackgroudnColor(colors.black)
  76. mon.setTextColor(colors.white)
  77. mon.write(" ")
  78.  
  79. if (result2 == 1) then
  80. mon.setBackgroudnColor(colors.pink)
  81. mon.setTextColor(colors.pink)
  82. mon.write(" ")
  83. else if (result2 == 2) then
  84. mon.setBackgroudnColor(colors.yellow)
  85. mon.setTextColor(colors.yellow)
  86. mon.write(" ")
  87. else if (result2 == 3) then
  88. mon.setBackgroudnColor(colors.cyan)
  89. mon.setTextColor(colors.cyan)
  90. mon.write(" ")
  91. else if (result2 == 4) then
  92. mon.setBackgroudnColor(colors.red)
  93. mon.setTextColor(colors.red)
  94. mon.write(" ")
  95. else if (result2 == 5) then
  96. mon.setBackgroudnColor(colors.lightBlue)
  97. mon.setTextColor(colors.lightBlue)
  98. mon.write(" ")
  99. end
  100. mon.setBackgroudnColor(colors.black)
  101. mon.setTextColor(colors.white)
  102. mon.write(" ")
  103.  
  104. if (result3 == 1) then
  105. mon.setBackgroudnColor(colors.pink)
  106. mon.setTextColor(colors.pink)
  107. mon.write(" ")
  108. else if (result3 == 2) then
  109. mon.setBackgroudnColor(colors.yellow)
  110. mon.setTextColor(colors.yellow)
  111. mon.write(" ")
  112. else if (result3 == 3) then
  113. mon.setBackgroudnColor(colors.cyan)
  114. mon.setTextColor(colors.cyan)
  115. mon.write(" ")
  116. else if (result3 == 4) then
  117. mon.setBackgroudnColor(colors.red)
  118. mon.setTextColor(colors.red)
  119. mon.write(" ")
  120. else if (result3 == 5) then
  121. mon.setBackgroudnColor(colors.lightBlue)
  122. mon.setTextColor(colors.lightBlue)
  123. mon.write(" ")
  124. end
  125. mon.setBackgroudnColor(colors.black)
  126. mon.setTextColor(colors.white)
  127.  
  128. if result1 == result2 and result2 == result3 then
  129. print("Winner")
  130. win()
  131. cpayout = 0
  132. while cpayout < 3 do
  133. redstone.setOutput("left",true)
  134. sleep(0.2)
  135. redstone.setOutput("left",false)
  136. sleep(0.2)
  137. cpayout = cpayout +1
  138. end
  139. os.reboot()
  140. else
  141. print("Lost.")
  142. loss()
  143. sleep(2)
  144. os.reboot()
  145. end
  146.  
  147. end
  148.  
  149. local rRunning = true
  150.  
  151. while rRunning do
  152. sleep(0.5)
  153. local rEvent, param = os.pullEvent()
  154. if rEvent == "redstone" then
  155. if redstone.getInput("right") then
  156. if redstone.getInput("right") == true then
  157. slots()
  158. else
  159. shell.run("clear",1)
  160. end
  161. end
  162. end
  163. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement