Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- w, h = term.getSize()
- cashOut = false
- function cPrint(string, ypos)
- term.setCursorPos(w/2 - #string/2, ypos)
- term.write(string)
- end
- function welcome()
- cPrint("Hello, and welcome to the casino", 6)
- cPrint("Please deposit the items", 7)
- cPrint("you wish to exchange", 8)
- cPrint("Press enter when you are done", 10)
- while true do
- event, key = os.pullEvent("key")
- if key == 16 then cashOut = true break
- elseif key == 28 then cashOut = false break
- end
- end
- term.clear()
- cPrint("Thank you", 6)
- if cashOut == true then
- cPrint("Please wait while i get your prize", 7)
- else
- cPrint("please wait while i get your credits", 7)
- end
- end
- function sendSignal(message)
- rednet.open("right")
- rednet.send(21, message)
- end
- function receiveSignal()
- event = os.pullEvent("rednet_message")
- end
- function getCredit()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- for i = 1, 5 do
- turtle.down()
- end
- turtle.turnRight()
- turtle.turnRight()
- for i = 1, 16 do
- turtle.select(i)
- turtle.drop()
- sleep(1)
- end
- turtle.select(1)
- sleep(1)
- if cashOut == true then
- sendSignal("cashOut")
- else
- sendSignal("go")
- end
- receiveSignal()
- for i = 1, 5 do
- turtle.up()
- end
- turtle.forward()
- for i = 1,3 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- end
- -------------- LOOP ----------------
- while true do
- term.clear()
- cashOut = false
- welcome()
- getCredit()
- cashout = false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement