Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. local coinCount = 0 --coins inserted
  2.  
  3. function tenTimer() --starts 10 min timer and then turns rs on right side for 1 sec then turns rs off
  4. rs.setOutput("top", true)
  5. sleep(5)
  6. rs.setOutput("top", false)
  7. os.startTimer(600)
  8. rs.setOutput("right", true)
  9. sleep(1)
  10. rs.setOutput("right", false)
  11. end
  12.  
  13. function twentyTimer() --starts 20 min timer and then turns rs on right side for 1 sec then turns rs off
  14. rs.setOutput("top", true)
  15. sleep(5)
  16. rs.setOutput("top", false)
  17. os.startTimer(1200)
  18. rs.setOutput("right", true)
  19. sleep(1)
  20. rs.setOutput("right", false)
  21. end
  22.  
  23. function thirtyTimer() --starts 30 min timer and then turns rs on right side for 1 sec then turns rs off
  24. rs.setOutput("top", true)
  25. sleep(5)
  26. rs.setOutput("top", false)
  27. os.startTimer(1800)
  28. rs.setOutput("right", true)
  29. sleep(1)
  30. rs.setOutput("right", false)
  31. end
  32. local ten = 1
  33. local twenty = 2
  34. local thirty = 3
  35.  
  36. print("How Much Time Would You Like To Buy?")
  37. print("1 Gold Coin = 10 Minutes.")
  38. print("You May ONLY Buy Up To 30 Minutes.")
  39. print("Enter Number Of Gold Coins:")
  40. write("$")
  41.  
  42. goldCoins = read() -- i want it to ask the user to input gold coins, quanitity of 1-3
  43.  
  44. while true do
  45. local event, p1 = os.pullEvent()
  46. if event == "redstone" then --if redstone pulse
  47. coinCount = coinCount + 1 --then add 1 to coinCount
  48. if goldCoins == coinCount and coinCount == ten then --if coinCount, coins they inserted, is equal to goldCoins, how many they said, then start 10 minute timer
  49. tenTimer()
  50. elseif goldCoins == coinCount and coinCount == twenty then --if coinCount, coins they inserted, is equal to goldCoins, how many they said, then start 20 minute timer, This is where my code seems to error "" bios:14: [string "startup"]:50: '=' expected ""
  51. twentyTimer()
  52. elseif goldCoins == coinCount and coinCount == thirty then --if coinCount, coins they inserted, is equal to goldCoins, how many they said, then start 30 minute timer
  53. thirtyTimer()
  54. else --if nothing is true then break
  55. break
  56. end
  57. end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement