Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Python file, to be saved in the same folder as videos
- # Requires mpv to be installed (https://mpv.io/installation/)
- # Requires mpv to be accessible from terminal/cmd (on Windows, add mpv folder to PATH :
- # https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho )
- import os, random, time, datetime
- def diceroll(currentval):
- roll = random.randint(1, 6)
- newval = currentval + roll
- if ((currentval < 25) and (newval >= 25)):
- newval = 25
- if ((currentval < 50) and (newval >= 50)):
- newval = 50
- if ((currentval < 75) and (newval >= 75)):
- newval = 75
- if ((currentval < 100) and (newval >= 100)):
- newval = 100
- print("Rolled a " + str(roll))
- print("Position : " + str(newval))
- return newval
- def video(currentval):
- os.system("mpv -msg-level=all=no " +str(currentval) + ".mp4")
- def image():
- #The Intervals folder below is relative to the starting location of this script, but you can replace it with an absolute filepath to anywhere else if you want
- #eg. imageFolder = r"C:\Users\Anon\Documents\Pictures\\"
- imageFolder = r"Intervals\\"
- imageFile = os.listdir(imageFolder)
- random_file = random.choice(imageFile)
- fullImagePath = imageFolder + random_file
- os.system("mpv -fs --image-display-duration=10 " + '"' + fullImagePath + '"')
- def game():
- print("Game start!")
- pos = 1
- video(pos)
- print("")
- while (pos < 100):
- pos = diceroll(pos)
- video(pos)
- if ((pos % 25) != 0):
- print("10 seconds pause")
- image()
- else:
- if pos != 100:
- print("Checkpoint " + str(int(pos/25)))
- print("")
- print("Congratulations, you've cleared the game!")
- random.seed(int(datetime.datetime.now().strftime("%Y%m%d%H%M%S")))
- game()
Advertisement
Add Comment
Please, Sign In to add comment