#๐ why dose moving the mouse through code not move the mouse in game? and how do I fix this?
49 messages ยท Page 1 of 1 (latest)
@tranquil sentinel
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
here is a vidio of this
and heres the code:
import keyboard._mouse_tests
import pytchat #https://pypi.org/project/pytchat/
import time
import keyboard #https://pypi.org/project/keyboard/
import mouse #https://pypi.org/project/mouse/
from screeninfo import get_monitors #https://pypi.org/project/screeninfo/
#example:
#https://www.youtube.com/live/XtagNPBFPZw
#===================
#URL = "XtagNPBFPZw"
running = True
screen_size = tuple
URL = "XtagNPBFPZw"
#commands
walking commands
WALK_COMMAND = "walk"
WALK_BACK_COMMAND = "back"
SPRINT_COMMAND = "sprint"
turning commands
TURN_LEFT_COMMAND = "left"
TURN_RIGHT_COMMAND = "right"
#initialising
chat = pytchat.create(video_id=URL)
for m in get_monitors():#prints every monitor
print(str(m))
if m.is_primary == True:
screen_size = [m.width, m.height]
#if running and livestream is going
while running:
while chat.is_alive():
current_mouse_position = mouse.get_position()
c = chat message
for c in chat.get().sync_items():
print(f"{c.datetime} [{c.author.name}]- {c.message}")#prints time, auther, and message to the consol
walking commands
if WALK_COMMAND.lower() in str(c.message).lower():#if "walk" is in message
keyboard.press("w")
time.sleep(2)
keyboard.release("w")
if WALK_BACK_COMMAND.lower() in str(c.message).lower():#if "walk" is in message
keyboard.press("s")
time.sleep(2)
keyboard.release("s")
if SPRINT_COMMAND.lower() in str(c.message).lower():#if "walk" is in message
keyboard.press("shift")
turning commands
if TURN_LEFT_COMMAND.lower() in str(c.message).lower():#if "walk" is in message
mouse.move(screen_size[0] / 2 ,screen_size[1] / 2, True, 0)
mouse.move(screen_size[0] / 4 ,0, False, 2)
Does walk work?
it just presses down the w key for about 2 seconds same thing for back but it just holds the s key (it dose work)
Do you know the screen size and screen width? If you do try replacing screen_size[0] and screen_size[1] with the actual values
Also I found this function
mouse.move_relative(dx, dy)
Like try instead of mouse.move(screen_size[0] / 2 ,screen_size[1] / 2, True, 0) and mouse.move(screen_size[0] / 4 ,0, False, 2)
Try mouse.move_relative(-10, 0)
@tranquil sentinel
K, tell me if it works
mouse.move_relative dosent seem to exist in the mouse module
so for the mouse.move functions, what are the parameters?
and replaceing the variables with acual values dose nuthing
*nuthing defferent
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
!code
Can you screen shot, when you do mouse.move(,) a box with the documentation should pop up, screenshot that
(x value , y value, absolute, duration)
x and y are any, duration is intager, and absolute is bool
that dident work
Whats the error?
the mose dose move so there is no error it just dosent move the cammera ingame
Wait so the mouse moves but the camera in game doesnt move?
yea
what should I use then?
I looked on google, mouse is the best option but if it still doesnt work
its probably a thing with anticheat
If u really want to
U have to look into in game code
cause anti cheat
sry
prob find a online tutorial, sry
for some reason the mouse module dident work becouse phasmophobia uses directX but this defferent module dose work for directX (https://pypi.org/project/PyDirectInput/)
if u want i can help u look into this later
no it works now but thanks
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.