Nino Posted January 5, 2007 Posted January 5, 2007 (edited) Can someone teach me how to lock the Y-axis so that you can only move left or right while holding down a key of somesort? I can't figure it out how I should begin attempting this, it's for a game(Counter Strike). Many thanks, Nino Edited January 5, 2007 by Nino
BALA Posted January 5, 2007 Posted January 5, 2007 When you say Y axis, do you mean the coordinates of the mouse? [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
xcal Posted January 5, 2007 Posted January 5, 2007 (edited) You'll probably want to put MouseGetPos() in a loop, save it to a $var. Have an inner loop you can toggle on/off with a new MouseGetPos() in a $newvar. Then do something like, If $var[0] <> $newvar[0] Then MouseMove($var[0], $newvar[1], 0). Edited January 5, 2007 by xcal How To Ask Questions The Smart Way
Nino Posted January 5, 2007 Author Posted January 5, 2007 When you say Y axis, do you mean the coordinates of the mouse?Like the center of your screen, and from that point on you can't move up or down only left/right. Maybe desktop resolution plays a role in this?
xcal Posted January 5, 2007 Posted January 5, 2007 (edited) Oh, I got what you wanted to do backwards. You could just reverse what I said above. If you wanted to lock it to the center of the screen, then look in to the @DesktopHeight macro and / that by 2 for the MouseMove() 's Y. edit - it'd look something like this (related to my previous post): If $var[1] <> $newvar[1] Then MouseMove($newvar[0], @DesktopHeight / 2, 0) Edited January 5, 2007 by xcal How To Ask Questions The Smart Way
Nino Posted January 5, 2007 Author Posted January 5, 2007 (edited) HotKeySet("{HOME}", "Lock") Func Lock() $var=0 $newvar=0 If $var[1] <> $newvar[1] Then MouseMove($newvar[0], @DesktopHeight / 2, 0) EndFunc Thanks xcal! EDIT: I suck at arrays. Edited January 5, 2007 by Nino
xcal Posted January 5, 2007 Posted January 5, 2007 (edited) Not quite what I had in mind, but if you got it working for you, cool. HotKeySet('{esc}', 'quit') HotKeySet('{F2}', 'lockx') $lockx = False While 1 While $lockx $pos = MouseGetPos() MouseMove($pos[0], @DesktopHeight / 2, 0) WEnd Sleep(50) WEnd Func lockx() $lockx = Not $lockx EndFunc Func quit() MsgBox(0, '', 'Exiting...', 1) Sleep(1000) Exit EndFunc ;edit - just noticed I had old stuff in there... removed it. Edited January 6, 2007 by xcal How To Ask Questions The Smart Way
Nino Posted January 6, 2007 Author Posted January 6, 2007 Thank you very much for the help xcal! Just have one more question, for this to work in game(Counter Strike), would my desktop resolution have to be the same as my in-game resolution? It seems to have no effect when I am in game and I hit F2. I added a WinWait("Counter Strike") In the While/Wend and that also doesn't seem to have any effect.
xcal Posted January 6, 2007 Posted January 6, 2007 No clue... game prob has some kind of protection. I don't use autoit for games, so can't help you there. How To Ask Questions The Smart Way
Paulie Posted January 6, 2007 Posted January 6, 2007 No clue... game prob has some kind of protection. I don't use autoit for games, so can't help you there.Yes, VAC security will no doubt block any program while in in-game
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now