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 


Simple Mouse Coordinate Monitoring Trainer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 38

Joined: 10 Apr 2015
Posts: 1532

PostPosted: Wed Dec 28, 2016 8:39 am    Post subject: Simple Mouse Coordinate Monitoring Trainer Reply with quote

This is a simple implementation to get mouse coordinate put in a trainer made use CE 6.6 and trainer form made use CE form designer.

Code:
UDF1.show()

show = true
function form_show_hide()
   if show then
       show = false
        UDF1.hide()
    else
       show = true
        UDF1.show()
    end
end
if key1 then key1.destroy(); key1=nil end
key1 = createHotkey(form_show_hide, VK_X)
key1.DelayBetweenActivate = 300
---------------
function changeit1(sender)
  if sender.Checked then
     shellExecute'notepad.exe'
     openProcess'notepad.exe'
  else
     autoAssemble[[alloc(m,64)
createthread(m)
m:
push 0
call exitProcess
ret]]
  end
end
UDF1:show()
---------------
function changeit2(sender)
  if sender.Checked then
     shellExecute'calc.exe'
     openProcess'calc.exe'
  else
     autoAssemble[[alloc(n,64)
createthread(n)
n:
push 0
call exitProcess
ret]]
  end
end
UDF1:show()
--------------
local x, y = getMousePos()
control_setCaption(UDF1.MPos_X,tostring(x))
control_setCaption(UDF1.MPos_Y,tostring(y))
---------------
function Btn_ResetClick(sender)
x=0
y=0
setMousePos({x=0,y=0})
control_setCaption(UDF1.MPos_X,tostring(x))
control_setCaption(UDF1.MPos_Y,tostring(y))
z=createTimer(nil)
z.Interval=100
z.OnTimer=function(z)
--x.destroy()
--y.destroy()
local x, y = getMousePos()
control_setCaption(UDF1.MPos_X,tostring(x))
control_setCaption(UDF1.MPos_Y,tostring(y))
end
z.Enabled=true
end
---------------
function Btn_ExitClick(sender)
closeCE();
return caFree
end


- First time you open the CE trainer, will show you current mouse coordinates
- By clicking "Re - Post" button in the trainer will give you x, y coordinates every time your mouse moving

Possible to adding script if you want prevent mouse not leaving designated areas.

Code:
local x,y = getMousePos()
if x < 500 or x > 1000 or y < 250 or y > 700 then
showMessage("Out of range")
x = 100
y = 100
setMousePos(x,y)
end


Regards


NB :
When use CE 6.6 and in CE Setting "Ask to run lua scripts from table" has checked, but when start CE 6.6 in other time, CE Setting return to
"Always run lua scripts from table". Always like that. Is this a bug ?. How to fix this ?



Capture.JPG
 Description:
 Filesize:  83.12 KB
 Viewed:  6008 Time(s)

Capture.JPG



Cursor Position Monitor.CT
 Description:
Mouse Coordinates Monitoring Tool Ver.1.0

Download
 Filename:  Cursor Position Monitor.CT
 Filesize:  41.94 KB
 Downloaded:  697 Time(s)

Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 123

PostPosted: Thu Dec 29, 2016 5:24 am    Post subject: Reply with quote

thank you for share Razz . I enjoyed this article Razz
Code:
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.OnTimer = function(timer)
  mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP)
end
mytimer.Interval = 500

if myhotkey then
  myhotkey.Destroy()
end
myhotkey = createHotkey(function()
  mytimer.Enabled = not mytimer.Enabled
end, VK_F5)

My code above. Is there any way put your cursor at one certain position. Despite moving the mouse pointer, it remains a place not? Very Happy
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 38

Joined: 10 Apr 2015
Posts: 1532

PostPosted: Thu Dec 29, 2016 8:25 am    Post subject: Reply with quote

Not try, but perhaps like this :

Code:
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.OnTimer = function(timer)

 local x,y = getMousePos()                          -- check mouse coordinate
 if x < 500 or x > 1000 or y < 250 or y > 700 then  -- designated area for mouse cursor post
 setMousePos(800,350)                               -- (x,y) set mouse cursor to the post we want
                                                    -- x,y is a number

 mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP) --- Process right click right at mouse post
end
end
mytimer.Interval = 500

if myhotkey then
  myhotkey.Destroy()
end
myhotkey = createHotkey(function()
  mytimer.Enabled = not mytimer.Enabled
end, VK_F5)
Back to top
View user's profile Send private message
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