Jump to content

Locking Y Axis


Nino
 Share

Recommended Posts

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? :P I can't figure it out how I should begin attempting this, it's for a game(Counter Strike).

Many thanks,

Nino

Edited by Nino
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by xcal
Link to comment
Share on other sites

HotKeySet("{HOME}", "Lock")



Func Lock()
    $var=0
    $newvar=0
   If $var[1] <> $newvar[1] Then MouseMove($newvar[0], @DesktopHeight / 2, 0) 
EndFunc

Thanks xcal! :P

EDIT: I suck at arrays.

Edited by Nino
Link to comment
Share on other sites

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 by xcal
Link to comment
Share on other sites

Thank you very much for the help xcal! :P

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.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...