Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to lock mouse in game window by LUA?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Tue Sep 24, 2019 11:07 pm    Post subject: How to lock mouse in game window by LUA? Reply with quote

In Menu,there is a Lock mouse in game window option.

Now I need to switch this function on and off by pressing keydown.

How should I do this?With LUA script or other way?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Tue Sep 24, 2019 11:15 pm    Post subject: Reply with quote

this code might work:
Code:

MainForm.miLockMouseInGame.Checked=true or false
MainForm.miLockMouseInGame.doClick() --trigger the state

Then put this in a hotkey

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Tue Sep 24, 2019 11:27 pm    Post subject: Reply with quote

Thanks,your code works.

And I have tested mine

Code:

myhook = createD3DHook()
myhook.MouseClip = true


Now the problem is

Does lock mouse in game only work for DX game?

Right now I am playing Noita which is a new game from steam

This game does not work for thoes lock mouse in code.

What shall I do?

I need to run the game in window mode to easily make some CE test.

But when I play I need to use mouse to aim and shoot.

And It always click outside game window and stop the game.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Wed Sep 25, 2019 3:55 am    Post subject: Reply with quote

It uses the d3d game handle to figure out which window to keep the mouse inside of the game\

it uses the windws api ClipCursor for this

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites