Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import random
- import time
- # paths to the controller configuration and the dolphin pipe
- flatbot_pipe_path = "/home/maximillian/.local/share/dolphin-emu/Pipes/flatbot"
- # open or create pipe if none exists
- if not os.path.exists(flatbot_pipe_path):
- os.mkfifo(flatbot_pipe_path)
- dolphin_pipe = os.open(flatbot_pipe_path, os.O_WRONLY | os.O_NONBLOCK)
- iterations = 200
- for k in range(2):
- for i in range(0, iterations + 1):
- for j in range(0, iterations + 1):
- time.sleep(0.01**2)
- # cmd = b"SET C %f %f\n" % (i / iterations, 1)
- # cmd = b"SET C %f %f\n" % (1, i / iterations)
- cmd = ""
- if k == 0:
- cmd = b"SET C %f %f\n" % (j / iterations, i / iterations)
- else:
- cmd = b"SET C %f %f\n" % (i / iterations, j / iterations)
- os.write(dolphin_pipe, cmd)
- os.write(1, cmd)
- # while True:
- # try:
- # rx = random.random()
- # ry = random.random()
- # time.sleep(0.5)
- # input()
- # cmd = b"SET C %f %f\n" % (rx, ry)
- # # cmd = b"SET C %f %f\n" % (0.0, 0.0)
- # # cmd = b"SET C %f\n" % (rx * 100)
- # os.write(dolphin_pipe, cmd)
- # os.write(1, cmd)
- # except KeyboardInterrupt:
- # break
- # close the pipe pointer
- os.close(dolphin_pipe)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement