Skip to content

Commit

Permalink
update timings
Browse files Browse the repository at this point in the history
  • Loading branch information
nishantbalaji committed Apr 12, 2022
1 parent bb0a485 commit c983cd4
Showing 1 changed file with 11 additions and 27 deletions.
38 changes: 11 additions & 27 deletions TwitchPlays_TEMPLATE.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# e.g. if you get a batch of 50 messages, you can choose to only process the first 10 of them and ignore the others.
# This is helpful for games where too many inputs at once can actually hinder the gameplay.
# Setting to ~50 is good for total chaos, ~5-10 is good for 2D platformers
MAX_QUEUE_LENGTH = 20
MAX_QUEUE_LENGTH = 10
MAX_WORKERS = 100 # Maximum number of threads you can process at a time

last_time = time.time()
Expand All @@ -53,7 +53,7 @@
##########################################################

# An optional count down before starting, so you have time to load up the game
countdown = 10
countdown = 5
while countdown > 0:
print(countdown)
countdown -= 1
Expand All @@ -78,57 +78,41 @@ def handle_message(message):
# I've added some example videogame logic code below:

###################################
# Example GTA V Code
# Pokemon Emulator Code
###################################

# If the chat message is "left", then hold down the left arrow key for 2 seconds
if msg == "left":
HoldAndReleaseKey(LEFT_ARROW, 0.5)
HoldAndReleaseKey(LEFT_ARROW, 0.2)

# If the chat message is "right", then hold down the right arrow key for 2 seconds
if msg == "right":
HoldAndReleaseKey(RIGHT_ARROW, 0.5)
HoldAndReleaseKey(RIGHT_ARROW, 0.2)

# If the chat message is "up", then hold down the up arrow key for 2 seconds
if msg == "up":
HoldAndReleaseKey(UP_ARROW, 0.5)
HoldAndReleaseKey(UP_ARROW, 0.2)

# If the chat message is "down", then hold down the down arrow key for 2 seconds
if msg == "down":
HoldAndReleaseKey(DOWN_ARROW, 0.5)

# Release both the "up" and "down" keys
if msg == "stop":
ReleaseKey(UP_ARROW)
ReleaseKey(DOWN_ARROW)
HoldAndReleaseKey(DOWN_ARROW, 0.2)

# If the chat message is "b", then hold down the Z arrow key for 1 seconds
if msg == "b":
HoldAndReleaseKey(Z, 1)
HoldAndReleaseKey(Z, 0.2)

# If the chat message is "a", then hold down the X arrow key for 1 seconds
if msg == "a":
HoldAndReleaseKey(X, 1)
HoldAndReleaseKey(X, 0.2)

# If the chat message is "y", then hold down the A arrow key for 1 seconds
if msg == "y":
HoldAndReleaseKey(A, 1)
HoldAndReleaseKey(A, 0.2)

# If the chat message is "x", then hold down the S arrow key for 1 seconds
if msg == "x":
HoldAndReleaseKey(S, 1)

# # Press the spacebar for 0.7 seconds
# if msg == "brake":
# HoldAndReleaseKey(SPACE, 0.7)
HoldAndReleaseKey(S, 0.2)

# # Press the left mouse button down for 1 second, then release it
# if msg == "shoot":
# pydirectinput.mouseDown(button="left")
# time.sleep(1)
# pydirectinput.mouseUp(button="left")

####################################
####################################

except Exception as e:
Expand Down

0 comments on commit c983cd4

Please sign in to comment.