Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- __author__ = 'nikolojedison'
- currentTime = "dawn"
- fire = False
- starttime = time.time()
- def passTime():
- while True:
- dawn()
- time.sleep(60.0 - ((time.time() - starttime) % 60.0))
- day()
- time.sleep(60.0 - ((time.time() - starttime) % 60.0))
- dusk()
- time.sleep(60.0 - ((time.time() - starttime) % 60.0))
- night()
- time.sleep(60.0 - ((time.time() - starttime) % 60.0))
- def main():
- intro()
- passTime()
- def decide(thingToDecide):
- global fire
- global currentTime
- if thingToDecide == "help" or thingToDecide == "Help":
- print("Commands you can use are help, fire, sleep, watch.")
- print("The current time is ", currentTime)
- decideIn = input(">>")
- decide(decideIn)
- elif thingToDecide == "fire" or thingToDecide == "Fire":
- if fire == True:
- decideIn = input("You already started a fire. >>")
- decide(decideIn)
- else:
- decideIn = input("You start a fire. >>")
- fire = True
- decide(decideIn)
- elif thingToDecide == "sleep" or thingToDecide == "Sleep":
- if currentTime == "day" or currentTime == "dawn":
- decideIn = input("It's too bright to sleep. >>")
- decide(decideIn)
- else:
- print("You go to sleep.")
- currentTime == "dawn"
- elif thingToDecide == "watch" or thingToDecide == "Watch":
- if currentTime == "day":
- decideIn = input("You sit and watch the landscape. >>")
- decide(decideIn)
- elif currentTime == "dusk":
- decideIn = input("You watch the sunset. >>")
- decide(decideIn)
- elif currentTime == "dawn":
- decideIn = input("You watch the sunrise. >>")
- decide(decideIn)
- elif currentTime == "night":
- decideIn = input("You watch the stars. >>")
- decide(decideIn)
- else:
- decideIn = input("You exist outside of spacetime. >>")
- decide(decideIn)
- else:
- decideIn = input("I don't understand what you mean. Try again? >>")
- decide(decideIn)
- def intro():
- print("Welcome to timePy, the simple time-based Python RPG.")
- print("Days are about 4 minutes long.")
- print("Commands you can use are help, fire, sleep, watch.")
- def dawn():
- global currentTime
- currentTime = "dawn"
- dawnIn = input("The sun is rising. >>")
- decide(dawnIn)
- def dusk():
- global currentTime
- currentTime = "dusk"
- duskIn = input("The sun is setting. >>")
- decide(duskIn)
- def day():
- global currentTime
- currentTime = "day"
- dayIn = input("The sun has risen. It's day now. >>")
- decide(dayIn)
- def night():
- global currentTime
- currentTime = "night"
- if fire == False:
- nightIn = input("It's dark, and you can barely see. >>")
- decide(nightIn)
- elif fire == True:
- nightIn = input("You can see, but it's boring. >>")
- decide(nightIn)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement