@@LearnCodeByGaming what would be a recommended approach to record mouse movements in FPS games? im having a problem where the script thinks that the mouse is always at the center of the screen.
@@ninjedi6710 Faced with a similar problem. The cursor coordinates are determined centered (x=960, y=540), but the application reads them as (0, 0). This would not be a problem, but move(0, 0) transmits some wrong signal and activates the camera movement. Due to an error with zero translation in coordinates, the camera can only move diagonally. If you have a similar problem and you have found a solution, I would be grateful if you let me know.
I got bored of playing games “the normal way” and I wanted to automate the boring stuff . Suddenly stumbled upon one of your videos one day , now i’m learning python (day 6)
In Windows 8.1 pyautogui.keyDown('alt') pyautogui.keypress('tab') Time.sleep(1) pyautogui.keyUp('alt') This is not working for switching the windows Please help me to solve this problem I also try hotkey Please tell me the solution if anyone knows 🙏🙏
Dude you are awesome! I spent a couple weeks wracking my brain on how to improve my simple bots and this was exactly what I needed! Keep up the good work.
Dude thank you so much! Now I can create my evil robot of destruction in minecraft. The cost will be many lives because of this. You have given me... ULTIMATE POWER!! Seriously thanks I was stuck! Edit: also there is not a hotkey command but I can just use keyDown and keyUp fine
@@LearnCodeByGaming i play a 3d game called "planet of cubes" i havent tested it on other 3d games but any clicking command from pydirectinput is read as holding, but when i open my inventory its all good. My theory is that is outdated
Thanks a lot! I have a long story with this, so this was incredibly useful for me! I have tried to create simple macros for some video games about a year ago and i have tried a lot of different macro applications, different input libraries for python and NONE of them worked for any game, but what was even stranger to me is that all the inputs worked for in-game chat or any other text boxes. So i thought that all the inputs i was sending DO work, but for so little amount of time that the game could only handle them with text boxes. And this led me to spending hours and hours trying to figure out why the librarys can't hold keys but only press them for so little. And only now i found this incredibly simple, but amazingly useful video. Thank you a lot once again!
For anyone that still has problems try the following: 1)- Open CMD as Administrator 2) - Open game up as administrator 3) - Run the py file 4) - focus on the game window, and watch the magic happen. Hope this helped :) (please don't make spamming/scamming chat bots thats not cool man)
Our saviour! I've been trying to set up a simple macro to automate video games so when I'm not able to play I can run my macro on a raspberry pi. While in my attempt to do this I noticed that mouse interactions would only work if I was moving the mouse around. Thank you so much!
A big shout out to you in 2023! Thanks for helping me keep building a solution to use a coin acceptor over arduino. As my arduino can definitely not be flashed to hid so that it sends direct keyboard presses, I linked it to python where I ask it to send a key press that should insert a coin credit in mame. Problem is that the default keyboard library in python is not direct input based. This library helped a lot and then instructing mame.ini to use direct input finally made mame recognize python command. All of this would have been much simpler with arduino Leonardo but I didnt want to give up until I played with coding and thought of solutions with my arduino uno. Thanks.
First of all: Great Work!! But I would like to ask you if there is a way to send keystrokes to an inactive window with a handle or something, so I can use this in background.
Thank you!! You're a genius!! I'm from Russia. I have been looking for a solution to the problem for a long time and there was no information about it. But I came across your video! I've stumbled upon gold!! thank you very much for making such an addition to the library!!! You're the best! Subscribe and like! You deserve more!
Very well explained and done :) I tried to use this for a game called metin2 but it still didn't work tho :( any ideas why? I tried rocket league and it works just fine. Thank you for the content
Any idea if this will help avoid detection in games? (namely, League of legends) Also can I just say how much I love this channel, I recently watched all of your Albion Online videos and it was the first time I've genuinely enjoyed watching a programming tutorial.
That helps a lot! Thank you A question that i have is: How does a anti cheat program recognize cheats and can a anti cheat program in a game recognize PyAutoGui?
do you know how i can get the mouse functions to work with looking around minecraft bedrock? ive tried using both pyautogui and pydirectinput but they dont seem to work
thanks a lot dude :), this helps me a lot. Anyway i'm new to python and i want to ask about the mouse input. Can i use float type number as the input instead of int ?
How can I perform a click action while a directx game is running? I tried pyautogui, pydirectinput, pywinauto, autoit. None of the above modules were able to click anywhere on the both game or desktop or browser while the directx game is running.
I have a question. Your library seems to work with the game Rainbow Six Siege, but the mouse movement is erratic no matter what values I put for the movement. Do you know why this might be the case? I think it might have to do with the game grabbing the mouse to the screen. I'm not sure how to go about a work-around.
I tried this library for fallout:new vegas which is a directx 9 game, as well as running the script from an administrator command prompt, however no mouse movements or keyboard inputs would work. Do you know anything else that would work?
I love these videos but i wanted to ask you a question you might know a lot about. So I know that some people say that programs or anti cheats can detect a program using code to send keystrokes or button presses. What makes clicking the mouse button yourself over just having a program do it? Like is it true it's really more detectable that way?
I've been using "mouse" python library for a while to move cursor programmatically; and I recently stumbled upon the issue that it does not get recognized by video games such as call of duty ... I noticed in the morning that "mouse" library uses the same mouse events utilized by PyAutoGUI; So I modified my code to use your library instead and i am currently in the testing process .. I hope it works
Yes you can. The only issue I know of is if you press arrow keys at the same time as an alphanumeric key, it acts like shift is being held down. I plan to correct that at some point, but it's still a bug right now.
@@LearnCodeByGaming I am confused of how to did this. can you show me?, thanks a lot. when I write it like this, they got pressed in series. pydirectinput.keyDown('k') pydirectinput.keyDown('u') time.sleep(2.00) pydirectinput.keyUp('k') pydirectinput.keyUp('u')
@@AhmedKamel-ol6qv I think I misunderstood your original question. PyDirectInput isn't able to send multiple keyDown (or keyUp) inputs at exactly the same time. You can do it if you drop down to using ctypes.windll.user32.SendInput directly.
@@LearnCodeByGaming Thanks a lot for your help. I am trying to build my first game Bot using Reinforcement Learning to play Pro Evolution Soccer. I have almost fair background in python, but i am quit familiar with RL as part of my research in Transportation. your videos helped me in my first steps. wish you all the best.
hi I am creating an automation tool to move the mouse which can adjust the camera position in a game created by `UE engine`. Trying to use `pydirectinput` and `pywinauto` to control the mouse, but if moving the mouse to a coordinate which has a negative number like: ``` pydirectinput.moveTo(-100,540) or pywinauto.mouse.move(coords=(-100,540)) ``` the camera position in the game will not be changed. wt should I do
Hello I have a problem, when I press a key, it don't work ingame, but when I try it in a notepad it work. I used pyautogui and pydirectinput. Neither worked
I'm going to criticize the pip in this comment just to be distinct from the other thread. I have noticed the "write" function is quite slow in comparison to autogui's version. On top of that the interval function doesnt really function at all. Idk if this is known but it would be cool to communicate via a bot using this version of pyautogui
@@LearnCodeByGaming just as an addon, from what I can see, the write function works fine without direct input, I have been able to switch seamlessly between your library and pyautogui's type function seamlessly
Hey, so I tried to use both pyautogui and pydirectinput but neither of them are working for Halo 5 Forge on PC. It detects the mouse movement and the pydirectinput.press() method works for keyboard inputs but the leftClick() method doesn't work in the game, it only moves the mouse around but the clicks are not registering in neither module. What should I do?
Hi! First of all thank you for the tutorials, they are really helpful. I have a question tho. Can some game have their own cursor position different from the your actual cursor position? I'm asking because I'm making a bot for a game that recenters the cursor everytime I move it in game, and the thing is if I use pydirectinput.move(x,y) it moves it inside the game but at very random positions, not where I intend it to move. Also another interesting thing is after i run the function once, it moves to a random position, but then if I move around in game with the cursor(to change its position) and run the function again, the cursor doesn't move at all, like it thinks it's already there. Only if I give it different coordinates it will move again to a random position. If you got any idea what's going on, please let me know! Thanks!
este beste are you trying to use it in a first person shooter? I am trying in a first person shooter and I am having the same problem. The cursor doesnt move to where it is supposed to... if you find any solution let me know pls
Hello! So move(x, y) does relative movement from your current mouse position. You might be looking for moveTo(x, y) to go to an absolute position on your screen. There's also moveRel(x, y) which is just another name for move(x, y). Hope that helps! Sorry it's not the best naming conventions, I'm following the function names set by PyAutoGUI.
@@LearnCodeByGaming All of the functions dont seem to work properly in an fps environment. I think its because the game calculates the distance between the before-and-after coordinates then moves the camera, and when combined with the fact that you cant see the absolute cursor position, makes it look like weird, random movement. Any thoughts on a work-around?
i've tried both pyautogui and pydirectinput to make my click my mouse in football manager 2009 and it doesnt want to work for some reason... i do see mouse being move but the click doesnt want to work
Thank you so much, this pretty much worked for me but some cases don't. For the Teamfight Tactic game, the keyboard event works like a charm but when I try to /ff (surrender), a new window appears and let me choose to accept quit or not and after that mouse function is fire to click accept button, it's done click, but seem like the game isn't taking that input from mouse, how can I fix it? The CMD and game run as Administrator.
If this solution didn't work out for you. Try to give the python script you run an ADMINISTRATOR right. This made the pyDirectInput / or even PyAutoGUI work for me. def run_as(required_command, required_password): shell = client.Dispatch("WScript.shell") shell.Run(f"runas /user:administrator {required_command}") time.sleep(1) shell.SendKeys(f"{required_password} ", 0) run python command via cmd only. Powershell doesn't work for me (not granted the admin permission). Happy botting :)
I know I'm years late, but I'm VERY thankful for PyDirectInput! Is there any way for PyDirectInput to take controllers into account? Only one other library appears to attempt to have controller input be taken into account (vgamepad) but that's also only virtual inputs and so there is no DirectX input for gamepads.
Hey ! first and foremost, thanks for the series, i really enjoyed it ! also i couldnt register mouse or keyboard clicks on a game called ragnarok (iro), any idea why? (running the IDE in admin mode and using pydirectinput)
Glad you enjoyed it! Sorry I wish I had some other idea why it might not be working for that game, but I really can't say. You've already tried everything I would suggest. It's a hard problem to debug because you don't get any error messages to work with.
Hello, I tried to create a BOT in python for my game in LDPLAYER 9 (an Android emulator), but pyautogui and pydirect work on my windows but not on my emulator how to solve this probleme?
Dude literally nowhere else explained why pyautogui doesn't work sometimes. You are my hero. Literally I'm so glad I finally found this.
Glad to help!
@@LearnCodeByGaming hello friend please Luigi I'm Italian I don't understand English would you give me a hand? to install the program?
@@luigiesposito2481 hi did you use Google translate to type that ( out of curiosity 👀 )
@@LearnCodeByGaming what would be a recommended approach to record mouse movements in FPS games?
im having a problem where the script thinks that the mouse is always at the center of the screen.
@@ninjedi6710 Faced with a similar problem. The cursor coordinates are determined centered (x=960, y=540), but the application reads them as (0, 0). This would not be a problem, but move(0, 0) transmits some wrong signal and activates the camera movement.
Due to an error with zero translation in coordinates, the camera can only move diagonally.
If you have a similar problem and you have found a solution, I would be grateful if you let me know.
I got bored of playing games “the normal way” and I wanted to automate the boring stuff . Suddenly stumbled upon one of your videos one day , now i’m learning python (day 6)
Awesome, have fun!
@@LearnCodeByGaming pydirectinput kind of skips the duration function, please can you fix it?????
my god it took forever to find what was wrong
You are the greatest human ever.
lol, thanks!
DANG DUDE IT WORKS, TY SO MUCH!
In Windows 8.1
pyautogui.keyDown('alt')
pyautogui.keypress('tab')
Time.sleep(1)
pyautogui.keyUp('alt')
This is not working for switching the windows
Please help me to solve this problem
I also try hotkey
Please tell me the solution if anyone knows 🙏🙏
@@mrweb9087 try pyautogui.hotkey(‘alt’, ‘tab’) function, it works, I use it since hotkey isn’t implemented in pydirectinput
@@lorenzo1479 thanks✨
Dude you are awesome! I spent a couple weeks wracking my brain on how to improve my simple bots and this was exactly what I needed! Keep up the good work.
Dude thank you so much! Now I can create my evil robot of destruction in minecraft. The cost will be many lives because of this. You have given me... ULTIMATE POWER!! Seriously thanks I was stuck!
Edit: also there is not a hotkey command but I can just use keyDown and keyUp fine
Haha, glad to help! Yeah it doesn't have any other way to do key combos right now.
@@LearnCodeByGaming i play a 3d game called "planet of cubes" i havent tested it on other 3d games but any clicking command from pydirectinput is read as holding, but when i open my inventory its all good. My theory is that is outdated
Thanks a lot! I have a long story with this, so this was incredibly useful for me! I have tried to create simple macros for some video games about a year ago and i have tried a lot of different macro applications, different input libraries for python and NONE of them worked for any game, but what was even stranger to me is that all the inputs worked for in-game chat or any other text boxes. So i thought that all the inputs i was sending DO work, but for so little amount of time that the game could only handle them with text boxes. And this led me to spending hours and hours trying to figure out why the librarys can't hold keys but only press them for so little. And only now i found this incredibly simple, but amazingly useful video. Thank you a lot once again!
New to python, and this tutorial is very easy and very helpful. Thank you very much!
ty so much man i had to do press and hold for an amount of time before and now the presses=number of presses works which saved me a lot of lines
Awesome, glad to help!
For anyone that still has problems try the following:
1)- Open CMD as Administrator
2) - Open game up as administrator
3) - Run the py file
4) - focus on the game window, and watch the magic happen.
Hope this helped :)
(please don't make spamming/scamming chat bots thats not cool man)
still not working
Worked for me.
It also worked when I ran my IDE (PyCharm) as administrator.
Thank you so much I already wanted to give up on finding libraries. You're the best
Ty king
i wanr to spam myself previously not working now a 2nd chance
YES! Thank you! This has made my Factorio repetitive task application/script work perfectly, you sir are a star, I shall be following you from now on!
automating in an automation game, genius XD ... though it does not work in some steam game still.
I liked 20+ on the comments to express my emotion to this effort. The world is better with the people like you!
This is awesome. I installed it with pip in pyCharm and tested it out. Worked first try. Now to start automating!
Glad to hear it!
You prevented me from getting a migraine, thank you so much!
Our saviour! I've been trying to set up a simple macro to automate video games so when I'm not able to play I can run my macro on a raspberry pi. While in my attempt to do this I noticed that mouse interactions would only work if I was moving the mouse around. Thank you so much!
After all this struggle with not using pyautogui or similar libraries in the game, your solution worked. Thank you so much. You are great man.
click api is not working, did u use this api?
Thanks! Discord wasn't recognizing any custom keybinds I set (in the discord settings) when using pyautogui, but using your pydirectinput works!
Genuinely thank you so much! I had been trying to fix an issue for ages and nowhere else said why pyautogui wasn't working
whoa thank you so much i was struggle with this for fkn *4 hours*
Glad to help!
It took me 5 hours
You just saved me a lot of headache! Thank you :)
You should have more subscribers sir, your content is top-notch.
You seem like a genuinely nice guy.
Thanks, I try to be!
To anyone who is having problems because your code only runs the first time, be sure that you are also doing a keyUp when your doing a keyDown.
Idk if you still read through this but THANKS. I always had problem with keyboard input and this library just WORKS. Thank you so much
Thanks to this movie, I succeeded to automate “Lightning Dodger” that is famous extremely-hard side quest of Final Fantasy X. ありがとう😊
Thx for creating pydirectinput. Its working great!
Found no other video that solves this problem . Thank u very much
Glad it works for you
BROOO! YOUR LIB IS WORKING! GOOD JOB!!!! THANK YOU!
Just launch your scripts with Administrator.
Glad you got it working!
man, you're awesome! i admire you professionalism!
Dude you're the best human in the world, you just save a brazilian life and time.
BRO I M GOING TO CRY THANK YOU SOOOO MUCH YOU ARE A LIFE SAVER.
Thanks man! youve earned your 1000th sub!
Thanks!!!
You're a genius, my hero, thank you so much, it works perfectly
A big shout out to you in 2023! Thanks for helping me keep building a solution to use a coin acceptor over arduino. As my arduino can definitely not be flashed to hid so that it sends direct keyboard presses, I linked it to python where I ask it to send a key press that should insert a coin credit in mame. Problem is that the default keyboard library in python is not direct input based. This library helped a lot and then instructing mame.ini to use direct input finally made mame recognize python command. All of this would have been much simpler with arduino Leonardo but I didnt want to give up until I played with coding and thought of solutions with my arduino uno. Thanks.
First of all: Great Work!!
But I would like to ask you if there is a way to send keystrokes to an inactive window with a handle or something, so I can use this in background.
Hi thanks! I'm working on a video about that right now actually. Should be out in about a week.
I have the same question, really looking forward to your video!
do you mind to share the basic idea so that I can try it first?
@@LearnCodeByGaming hi teacher~~~where can I find the tutor viedo you makes~~~thank~~very a lot !!!
One of the best video again mate👍👍👍
Thanks as always!
Thank you!! You're a genius!! I'm from Russia. I have been looking for a solution to the problem for a long time and there was no information about it. But I came across your video! I've stumbled upon gold!! thank you very much for making such an addition to the library!!! You're the best! Subscribe and like! You deserve more!
Thank you Ben! I am almost sure but i just had to ask are you a developer by career?
I am! I've been doing it for 12 years, and since last year I've been working as an independent consultant.
tysm! i tried ALOT of libs and none of them worked, but this one did :)
i was trying to do wave auto skip for TDS in Roblox
THANK YOU, i have an esp32 and im making a capacitive touch usb controller for someone and this is the only program to work with the snes9 emulator !
Muito obrigado, passei horas tentando arrumar isso e não achava solução em lugar nenhum, estava nas ultimas tentativas antes de desistir.
Bom dia, ainda funciona pra voce? pra mim ainda não funciona...
Pode me dizer por favor qual foi a solução?
mansood bhai tum bhuut accha kaam kartteh ho
wow this is what i looking for upto now. it works perfectly thanks so much. subscribed before text. thanks a lot
wow, thanks a lot! I'm really glad I found this
Thanks for making pydirectinput you rock
You are an absolute legend tysm!
Super Helpful! You the man
omg thank you so much man after hours of searching for solutions i found this❤
Very well explained and done :) I tried to use this for a game called metin2 but it still didn't work tho :( any ideas why? I tried rocket league and it works just fine. Thank you for the content
Any idea if this will help avoid detection in games? (namely, League of legends)
Also can I just say how much I love this channel, I recently watched all of your Albion Online videos and it was the first time I've genuinely enjoyed watching a programming tutorial.
That helps a lot! Thank you
A question that i have is: How does a anti cheat program recognize cheats and can a anti cheat program in a game recognize PyAutoGui?
Great library! Thank you!
do you know how i can get the mouse functions to work with looking around minecraft bedrock? ive tried using both pyautogui and pydirectinput but they dont seem to work
have you found a solution?
brother this is good work, thank you for sooo much!
holy thanks! you the only one who helped me
Thanks! That actually works!
Bro thank you, I was getting same problem and wondering "whhhhyyyyy?"
thanks a lot dude :), this helps me a lot. Anyway i'm new to python and i want to ask about the mouse input. Can i use float type number as the input instead of int ?
How can I perform a click action while a directx game is running?
I tried pyautogui, pydirectinput, pywinauto, autoit.
None of the above modules were able to click anywhere on the both game or desktop or browser while the directx game is running.
I have a question. Your library seems to work with the game Rainbow Six Siege, but the mouse movement is erratic no matter what values I put for the movement. Do you know why this might be the case? I think it might have to do with the game grabbing the mouse to the screen. I'm not sure how to go about a work-around.
FINALLY I FOUND WHAT I WAS LOOKING FOR
I wish I could donate money to you man this was so helpful
I tried this library for fallout:new vegas which is a directx 9 game, as well as running the script from an administrator command prompt, however no mouse movements or keyboard inputs would work. Do you know anything else that would work?
I love these videos but i wanted to ask you a question you might know a lot about.
So I know that some people say that programs or anti cheats can detect a program using code to send keystrokes or button presses.
What makes clicking the mouse button yourself over just having a program do it? Like is it true it's really more detectable that way?
I've been using "mouse" python library for a while to move cursor programmatically; and I recently stumbled upon the issue that it does not get recognized by video games such as call of duty ... I noticed in the morning that "mouse" library uses the same mouse events utilized by PyAutoGUI; So I modified my code to use your library instead and i am currently in the testing process .. I hope it works
Thanks you ^^ lifesaver :D
Glad it works for you!
Thank you for the pieces of information.
Awesome work men!! I appreciate it.
You saved my day!!! Thank you very much!!!
YOU ARE A GENIUS
your save my life bro, thanks
Thank you very much! I wish I had seen this video earlier
Thanks for the great work. Can I input more than key simultaneously?
Yes you can. The only issue I know of is if you press arrow keys at the same time as an alphanumeric key, it acts like shift is being held down. I plan to correct that at some point, but it's still a bug right now.
@@LearnCodeByGaming I am confused of how to did this. can you show me?, thanks a lot. when I write it like this, they got pressed in series.
pydirectinput.keyDown('k')
pydirectinput.keyDown('u')
time.sleep(2.00)
pydirectinput.keyUp('k')
pydirectinput.keyUp('u')
@@AhmedKamel-ol6qv I think I misunderstood your original question. PyDirectInput isn't able to send multiple keyDown (or keyUp) inputs at exactly the same time. You can do it if you drop down to using ctypes.windll.user32.SendInput directly.
@@LearnCodeByGaming Thanks a lot for your help. I am trying to build my first game Bot using Reinforcement Learning to play Pro Evolution Soccer. I have almost fair background in python, but i am quit familiar with RL as part of my research in Transportation. your videos helped me in my first steps. wish you all the best.
@@AhmedKamel-ol6qv Awesome that sounds sweet, wishing you the best too!
works very well with The witcher 3. problems with french keyboard though
hi
I am creating an automation tool to move the mouse which can adjust the camera position in a game created by `UE engine`. Trying to use `pydirectinput` and `pywinauto` to control the mouse, but if moving the mouse to a coordinate which has a negative number like:
```
pydirectinput.moveTo(-100,540) or pywinauto.mouse.move(coords=(-100,540))
```
the camera position in the game will not be changed. wt should I do
thanks, this helped me out a lot!
Great work. 🙏
Hello I have a problem, when I press a key, it don't work ingame, but when I try it in a notepad it work. I used pyautogui and pydirectinput. Neither worked
Well, I was trying to auto a task on Nemu Player, a Emulator for cellphone, but none pyAutoGUI, pyDirectInput or pyWin32 worked.
Thank you for the video! Saved my day! 😆
Is there any library that will send inputs to controllers? Like moving left stick up..
I'm going to criticize the pip in this comment just to be distinct from the other thread. I have noticed the "write" function is quite slow in comparison to autogui's version. On top of that the interval function doesnt really function at all. Idk if this is known but it would be cool to communicate via a bot using this version of pyautogui
Thanks for letting me know, I'll look into it, and thanks for trying out PyDirectInput!
@@LearnCodeByGaming np, love the support for other games already
@@LearnCodeByGaming just as an addon, from what I can see, the write function works fine without direct input, I have been able to switch seamlessly between your library and pyautogui's type function seamlessly
With pydirect input i keep getting the error no module called pydirectinput?
Hey, so I tried to use both pyautogui and pydirectinput but neither of them are working for Halo 5 Forge on PC. It detects the mouse movement and the pydirectinput.press() method works for keyboard inputs but the leftClick() method doesn't work in the game, it only moves the mouse around but the clicks are not registering in neither module. What should I do?
Have game like counter strike nexon studio, there not work your lib) and i try win32 is the same, can i trigger real output from mouse&
Oh My God. Thanks very much.
Brazil : )
so uh how do we make the mouse have a duration on relative movement? I tried the normal way but it is instant not relative
Hi! First of all thank you for the tutorials, they are really helpful. I have a question tho. Can some game have their own cursor position different from the your actual cursor position? I'm asking because I'm making a bot for a game that recenters the cursor everytime I move it in game, and the thing is if I use pydirectinput.move(x,y) it moves it inside the game but at very random positions, not where I intend it to move. Also another interesting thing is after i run the function once, it moves to a random position, but then if I move around in game with the cursor(to change its position) and run the function again, the cursor doesn't move at all, like it thinks it's already there. Only if I give it different coordinates it will move again to a random position. If you got any idea what's going on, please let me know! Thanks!
este beste are you trying to use it in a first person shooter? I am trying in a first person shooter and I am having the same problem. The cursor doesnt move to where it is supposed to... if you find any solution let me know pls
Hello! So move(x, y) does relative movement from your current mouse position. You might be looking for moveTo(x, y) to go to an absolute position on your screen. There's also moveRel(x, y) which is just another name for move(x, y). Hope that helps! Sorry it's not the best naming conventions, I'm following the function names set by PyAutoGUI.
@@crazycalias6380 Hi! Try using moveTo() instead of move().
@@LearnCodeByGaming i was using moveTo, sry I said move by mistake
@@LearnCodeByGaming All of the functions dont seem to work properly in an fps environment. I think its because the game calculates the distance between the before-and-after coordinates then moves the camera, and when combined with the fact that you cant see the absolute cursor position, makes it look like weird, random movement. Any thoughts on a work-around?
i've tried both pyautogui and pydirectinput to make my click my mouse in football manager 2009 and it doesnt want to work for some reason... i do see mouse being move but the click doesnt want to work
Your a saviour!!
Thank you so much, this pretty much worked for me but some cases don't.
For the Teamfight Tactic game, the keyboard event works like a charm but when I try to /ff (surrender), a new window appears and let me choose to accept quit or not and after that mouse function is fire to click accept button, it's done click, but seem like the game isn't taking that input from mouse, how can I fix it?
The CMD and game run as Administrator.
Thanks for the video, is there anyway to do this on an ipad, to control mouse and keyboard? thanks
Thanks, works nicely
tnks man, do you have some option for linux? pyautogui does not work moveTo method for me
If this solution didn't work out for you. Try to give the python script you run an ADMINISTRATOR right.
This made the pyDirectInput / or even PyAutoGUI work for me.
def run_as(required_command, required_password):
shell = client.Dispatch("WScript.shell")
shell.Run(f"runas /user:administrator {required_command}")
time.sleep(1)
shell.SendKeys(f"{required_password}
", 0)
run python command via cmd only. Powershell doesn't work for me (not granted the admin permission).
Happy botting :)
Great video, I was wondering can you do some videos on game bots for web browser games?
Thanks! Is there a particular game or website you'd like to see a tutorial for?
@@LearnCodeByGaming The web browser game is called lords and knights.
@@LearnCodeByGaming Could you make a bot on Idle champions? It's a free game on steam.
@@brandonproductions2575 I'll check it out.
@@LearnCodeByGaming Thank you
I know I'm years late, but I'm VERY thankful for PyDirectInput! Is there any way for PyDirectInput to take controllers into account? Only one other library appears to attempt to have controller input be taken into account (vgamepad) but that's also only virtual inputs and so there is no DirectX input for gamepads.
Hey ! first and foremost, thanks for the series, i really enjoyed it ! also i couldnt register mouse or keyboard clicks on a game called ragnarok (iro), any idea why? (running the IDE in admin mode and using pydirectinput)
Glad you enjoyed it! Sorry I wish I had some other idea why it might not be working for that game, but I really can't say. You've already tried everything I would suggest. It's a hard problem to debug because you don't get any error messages to work with.
LOL, actually came here for the same reason, playing ragnarok and it doesn't receive the inputs, I don't know why. Did you find out why?
@Learn Code By Gaming please try to do it in ragnarok online
bro, your job is great and help a lot~!
Hello,
I tried to create a BOT in python for my game in LDPLAYER 9 (an Android emulator), but pyautogui and pydirect work on my windows but not on my emulator how to solve this probleme?
Great stuff!!!!