Creating a wrapper for interception.dll (fixed and working!) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: Creating a wrapper for interception.dll (fixed and working!)

14 Oct 2017, 14:08

Only wanting to be sure there is no missunderstanding, I know without the device its impossible, I dont gonna insist more, sorry:
Actually the flasher is "only" a program which, when I press some buttons (In my case a and k) the whole screen flashes, not only where the cursor is.
I can choose the duration of the flashing, normally is set to (15-60ms depending on the game) But I used it with long durations 1s for testing.

The flasher has nothing to do with coordinates, only is needed to white the screen when shoot so the cursor can go to the aiming spot being or not a dark zone.
This is why with my testings, I need it 15-30 ms before the click depending on the game
Without filtering MOUSE_MOVE works nice as guns are always traking, and the only important thing is when click the screen is white. Thats because I needed to delay the click after the key that launches the flash
The scripts with MOUSE_MOVE filter seems to get the coordinates before the flash, and not when the delayed click. I think its the only possibility, as I tested with long flashes and the behaviour is the same.
Many thanks anyway
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: Creating a wrapper for interception.dll (fixed and working!)

08 Feb 2018, 16:21

Hi! I tested some more and I think I am understanding most of the code now.
But dont matter what I do, if I use MOUSE_MOVE filter, coordinates seem to be intercepted just in the event change moment (press/release), and as the flasher whites the screen from that moment, and crt guns need the screen white to see any screen area, an ofscreen shot is given when pointing a dark area ( mouse.x=0, mouse.y=0).
So the question is, can I get the mouse coords some time before the button gets filtered? while it is down?
Many thanks, I'm alone with this
Necrothreader

Move the mouse

28 Apr 2018, 05:26

I want to simulate mouse movement.

Code: Select all

mouse.x:=-10
send(context, device, mouse, 1)
this does not work.
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: Creating a wrapper for interception.dll (fixed and working!)

29 Apr 2018, 06:38

@Necrothreader, I'm not surprised it doesn't work. You need the ahk interception code either in a library or in your script for a start.

You also need all the variables to have values. i.e. you need context to contain the address of an interception context, you need device to be a valid device, and the mouse variable must be correctly formatted before you can alter its values (i.e. it needs to be in the EXACT same format that interception is expecting, with all data being being both included & accurate for the device it refers to, and also each element must be in the correct position memory wise - it's not a native ahk object, it's an ahk object set up to represent a c++ structure defined by interception).

I suggest you read through the first post and the docs & examples on the Interception site so you have some idea how to use it before proceeding.
Necrothreader

01 May 2018, 02:55

I admit the code i posted was minimalist, i just wanted to get the point across. My claim that it didnt work was wrong. It actually works quite well (save one weird issue). I am not sure why, i made no changes. Here is my code in context.

Code: Select all

load()
context:=create_context()
set_filter(context, "keyboard","KEY_ALL")
set_filter(context, "mouse", "MOUSE_ALL")

while ( receive(context,device:=wait(context),key,mouse,1) >0 )
{
	critical
	if is_keyboard(device)
	{
   		get_keyname(key,name,state)
		ToolTip % "device: " device "`nname:" name "`nstate:" state

		if name=Escape
			break

		if name=A
			key.code:= GetKeySC("Q")

		send(context,device,key,1)
	}
  else if is_mouse(device)
	{
		get_keyname(mouse,name,state)
		ToolTip % "device: " device "`nname:" name "`nstate:" state "`nX: " mouse.x "`nY: " mouse.y
		
		if name=LButton
			mouse.x:=-10
		
		send(context,device,mouse,1)
	}
}
destroy_context(context)
return
When i press left click the mouse moves left as expected. However all following mouse input is turned into (move mouse left) until i press a keyboard button which fixes it.
I really appreciate you getting back to me on this old thread as i likely would not have looked back at the code.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Creating a wrapper for interception.dll (fixed and working!)

01 May 2018, 10:25

Surely get_keyname(mouse,name,state) does not work for movement, as it has no "key name".
Therefore name will not be altered from it's previous value (LButton), so if name=LButton will evaluate true.
Before you press LButton, name is always empty, so the bug will not occur until you press LButton
Put name := "" before get_keyname
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: Creating a wrapper for interception.dll (fixed and working!)

02 May 2018, 03:21

Thinking out load here but do other mouse button inputs also fix it ? - Like evilC said, name is just holding it's previous value.

Name is actually derived from the value of state, however if the state is 0 (which it is for mouse movement) the name isn't updated within the get_keyname() function. You could initialize the "name" variable like evilC suggests, in the short term, while you test, however I'd recommend you test for movement via "if (mouse.state)" prior to calling get_keyname(), in final code, as get_keyname() is irrelevant for movement, and executing unnecessary instructions during movement will only make mouse movement less efficient i.e cause it to lag.

If other mouse buttons don't fix it, then it would be due to the above but also to do with interception not being designed to do two things at once, i.e. LButton down and move in a single instruction, for example when you send after pressing LButton, the mouse.state is 1 but the mouse.x changed also, but mouse.x should only ever change when mouse.state is 0. To compound this, when you release the button, the actual mouse.state (the state within the "mouse" object that is used to perform the send) is 2, the get_keyname() state will be reported as 0. Other mouse buttons use different mouse.state numbers which are > 2. So to be honest, state may ormay not matter with movement, (I'm not sure) but definitely would if you were trying to send buttons, and so I mention it purely in case it truly is keyboard keys only that fix it and other mouse buttons don't.

Sorry if I rambled a bit too much, I'm tired, but hopefully what I said makes sense.
operatg0r
Posts: 11
Joined: 18 Feb 2016, 13:36

Re: Creating a wrapper for interception.dll (fixed and working!)

02 Nov 2018, 12:17

I'm looking to simply send mouse movements in 3D game as mousemove even with #InstallMouseHook does not seem to work. Although I can click around the UI in the game by holding Rightclick and moving the mouse is not working. It's picking up the mouseclick but when I move the mouse it does not pan around over VNC I have to actually move the mouse. Do yall think this could help and if so whats a simple/complete example of just moving the mouse.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Creating a wrapper for interception.dll (fixed and working!)

02 Nov 2018, 14:22

MouseMove will have no effect on most 3d games, as it moves the cursor and most of those games ignore the cursor.
Installing hooks is to do with input, not output
You want to use interception, or send a mouse_event dllcall
operatg0r
Posts: 11
Joined: 18 Feb 2016, 13:36

Re: Creating a wrapper for interception.dll (fixed and working!)

05 Nov 2018, 10:31

Hah. I JUST got everything to work and then I saw you reply. Dude you rock that works !. Dude can I buy you a beer ? also let me know if you like to do a HPR eps. Answer a few questions about Automation/Macros etc.

http://hackerpublicradio.org/

* I had to reboot ... did not see the reboot message running the EXE ...DERP

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CaseyMoon, Google [Bot], imstupidpleshelp, mmflume and 175 guests