Jump to content

Creating Mouse Movements Ingame


kforsey
 Share

Recommended Posts

I am currently trying to create a program for a game called Nox which was made in the year 2000 so it is a bit out of date. If I attempt to use the function mousemove it will move my cursor to one corner of the screen and wont follow where i tell it to go. Say I told it to go to X 500 Y 500, it would jsut randomly go to a corner of the screen. Anyone know what could be causing this and how I could fix it.

Thanks and any help would be appreciated.

Link to comment
Share on other sites

Can you post the code?

It sends the EXACT messages your mouse would send if it were in game, so it's probably your code :lmao:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

i think some fullscreen games use a fake mouse...

#include <GUIConstants.au3>
HotKeySet("{ESC}","quit")
Opt("GUIOnEventMode", 1)


Global $size[3] , $mid[3] , $fake_mouse[3]
$size[1] = @DesktopWidth
$size[2] = @DesktopHeight
$mid[1] = Int($size[1] / 2)
$mid[2] = Int($size[2] / 2)

$win = GUICreate( "", $size[1], $size[2], 0, 0, $WS_POPUPWINDOW ,$WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
$fake_mouse[0] = GUICtrlCreateButton("Fake mouse",0,0,75,25)

GuiCtrlSetOnEvent($fake_mouse[0],"quit")
GUISetState(@SW_SHOW)
MouseMove($mid[1],$mid[2],0)

While 1
    Sleep(10)
    $pos = MouseGetPos()
    $fake_mouse[1] = $fake_mouse[1] - ($mid[1] - $pos[0])
    $fake_mouse[2] = $fake_mouse[2] - ($mid[2] - $pos[1])
    MouseMove($mid[1],$mid[2],0)
    If $fake_mouse[1] > $size[1] Then
        $fake_mouse[1] = $size[1]
    ElseIf $fake_mouse[1] < 0 Then
        $fake_mouse[1] = 0
    EndIf
    
    If $fake_mouse[2] > $size[2] Then
        $fake_mouse[2] = $size[2]
    ElseIf $fake_mouse[2] < 0 Then
        $fake_mouse[2] = 0
    EndIf
    GUICtrlSetPos($fake_mouse[0],$fake_mouse[1],$fake_mouse[2])
WEnd


func quit()
    Exit
EndFunc

Edit:new script

fake_mouse.au3

Edited by UP NORTH
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...