Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Recommended Posts

Posted

I've wrote an ahk script which should hopefully help you out bkenobi, basically it'll let you control the menu list by moving a mouse up or down (or hopefully in your case turn the steering wheel)

It turned out to be alot harder than I thought it but it seems to be working for me with the mouse I have connected to my cabinet though I've no real use for it myself as I don't have steering wheel... I just fancied a challenge tonight :)

A few things you should note:-

Every 100 milliseconds I take the current mouse position and compare it to the right centre of the screen and then reset the mouse cursor to the center right of the screen again so that it's ready for the next reading... the disadvantage of this is if you acutally have to click something it's impossible as the mouse keeps jumping back to the center of the screen but the advantage is that you can scroll through an infinite list as your never bound to the top and bottom of the screen... because this can make the pc impossible to use in Windows and other apps I have it set so it should only work within GameEx and as a fail safe if things go tits up press WindowsKey+X to exit the script

Have a play about with the 25 value after 'sensitive :=' increasing it means you'll need to move the mouse further for it to work

I have it set to send the UP Arrow and the Down Arrow so you'll need to have GameEx set the same or modify the 4 send commands

Let me know how you get on

Stu

#SingleInstance force
WinWaitActive, GameEx

SetKeyDelay, 25, 25

sensitive := 25

SysGet, ScreenWidth, 78
SysGet, ScreenHeight, 79

#Persistent
SetTimer, WatchCursor, 100
return

WatchCursor:
IfWinActive, GameEx
{
MouseGetPos, xpos, ypos

difference := ScreenHeight/2-ypos

if difference-sensitive>0
{
Send {Blind}{Up DownTemp}
Send {Blind}{Up Up}
}
if difference+sensitive<0
{
Send {Blind}{Down DownTemp}
Send {Blind}{Down Up}
}

DllCall("SetCursorPos", int, ScreenWidth, int, ScreenHeight/2)

return
}

return

#x::ExitApp

Posted

Wow, thanks Stu! :wub: I'll have a look this evening.

My script actually looks a lot like this but I added a couple features like mouse acceleration and a deadzone. I also wanted both left/right and up/down to control things the same, so I set the larger movement to control the position. Unfortunately, mine didn't work so I'll definetly use this one (I may modify yours or add the stuff that makes yours work into mine and upload the results if you don't mind).

Posted
I've wrote an ahk script which should hopefully help you out bkenobi, basically it'll let you control the menu list by moving a mouse up or down (or hopefully in your case turn the steering wheel)

It turned out to be alot harder than I thought it but it seems to be working for me with the mouse I have connected to my cabinet though I've no real use for it myself as I don't have steering wheel... I just fancied a challenge tonight :)

A few things you should note:-

Every 100 milliseconds I take the current mouse position and compare it to the right centre of the screen and then reset the mouse cursor to the center right of the screen again so that it's ready for the next reading... the disadvantage of this is if you acutally have to click something it's impossible as the mouse keeps jumping back to the center of the screen but the advantage is that you can scroll through an infinite list as your never bound to the top and bottom of the screen... because this can make the pc impossible to use in Windows and other apps I have it set so it should only work within GameEx and as a fail safe if things go tits up press WindowsKey+X to exit the script

Have a play about with the 25 value after 'sensitive :=' increasing it means you'll need to move the mouse further for it to work

I have it set to send the UP Arrow and the Down Arrow so you'll need to have GameEx set the same or modify the 4 send commands

Let me know how you get on

Stu

#SingleInstance force
WinWaitActive, GameEx

SetKeyDelay, 25, 25

sensitive := 25

SysGet, ScreenWidth, 78
SysGet, ScreenHeight, 79

#Persistent
SetTimer, WatchCursor, 100
return

WatchCursor:
IfWinActive, GameEx
{
MouseGetPos, xpos, ypos

difference := ScreenHeight/2-ypos

if difference-sensitive>0
{
Send {Blind}{Up DownTemp}
Send {Blind}{Up Up}
}
if difference+sensitive<0
{
Send {Blind}{Down DownTemp}
Send {Blind}{Down Up}
}

DllCall("SetCursorPos", int, ScreenWidth, int, ScreenHeight/2)

return
}

return

#x::ExitApp

wow this sounds awesome. i was waiting for someone to write a script for this. it would be great with my trackball. now for my stupid question... where do i insert that script?

Posted
wow this sounds awesome. i was waiting for someone to write a script for this. it would be great with my trackball. now for my stupid question... where do i insert that script?

Its an autohotkey script, you need to download autohotkey to use it. Enable the script or compiled exe in the launch on startup don't wait entry on the tweaks performance page of the config. You may also use a program called process.exe to close it when GameEx closes with this command, C:\Process.exe -k (script name here).exe or (script name here).ahk.

Jay T

Posted
Wow, thanks Stu! :wub: I'll have a look this evening.

My script actually looks a lot like this but I added a couple features like mouse acceleration and a deadzone. I also wanted both left/right and up/down to control things the same, so I set the larger movement to control the position. Unfortunately, mine didn't work so I'll definetly use this one (I may modify yours or add the stuff that makes yours work into mine and upload the results if you don't mind).

Yeah do what you want with it just post it here so everyone else can get the benifit of it too

I think the bit you were missing is to send a key to GameEx you need to use

Send {Blind}{KeyName DownTemp}
Send {Blind}{KeyName Up}

It took a while for me to work it out myself

Stu

Posted

Yup, that was the problem. I tried a bunch of things, but GameEx continued to ignore the input. This was the same problem I was having when I tried to setup multiple inputs for P1 & P2 before. Anyway, I've updated my script to include those statements and it works great.

If anyone else wasnts to use a mouse/spinner/trackball/steering wheel in GameEx, this code should work. All you have to do is edit the DeadZone, SpeedTrigger, and CursorWatchSpeed values to suit. Oh, I also added a reference to nomousy.exe to hide the mouse cursor which was mentioned in this thread. That isn't really necessary when the mouse is disabled in GameEx, though, so it's commented out.

CoordMode, Mouse, Screen
SetKeyDelay, -1


SysGet, ScreenWidth, 78
SysGet, ScreenHeight, 79

x_center:=250 ;Starting x position
y_center:=250 ;Starting y position

SpeedThreshold:=100 ;Threshold speed where slow and fast scrolling is determined
DeadZone:=15 ;Minimum movement deadzone
CursorWatchSpeed:=25;How much delay between cursor position checks


#Persistent
SetTimer, WatchCursor, %CursorWatchSpeed%
return


WatchCursor:
IfWinActive GameEx
{
;run nomousy.exe /hide;Hide mouse cursor if visible

MouseGetPos, xpos, ypos
DeltaX:=x_center-xpos
DeltaY:=y_center-ypos

;Only allow the most active axis to control GameEx menu
if abs(DeltaX)>abs(DeltaY)
{
DominantAxis:=X
Delta:=DeltaX
}
else
{
DominantAxis:=Y
Delta:=DeltaY
}

if (abs(Delta) < DeadZone)
{
;No Movement
}
else if (abs(Delta) < SpeedThreshold)
{
;Normal Movement
if (Delta<0)
{
if DominantAxis = X
{
Send {Blind}{Up DownTemp}
Send {Blind}{Up Up}
}
else
{
Send {Blind}{Down DownTemp}
Send {Blind}{Down Up}
}
}
else
{
if DominantAxis = X
{
Send {Blind}{Down DownTemp}
Send {Blind}{Down Up}
}
else
{
Send {Blind}{Up DownTemp}
Send {Blind}{Up Up}
}
}
}
else
{
;Fast Movement
if (Delta<0)
{
if DominantAxis = X
{
Send {Blind}{PgUp DownTemp}
Send {Blind}{PgUp Up}
}
else
{
Send {Blind}{PgDn DownTemp}
Send {Blind}{PgDn Up}
}
}
else
{
if DominantAxis = X
{
Send {Blind}{PgDn DownTemp}
Send {Blind}{PgDn Up}
}
else
{
Send {Blind}{PgUp DownTemp}
Send {Blind}{PgUp Up}
}
}
}

;Reinitialize mouse position for next step
DllCall("SetCursorPos", int, x_center, int, y_center)
}
;IfWinNotActive, GameEx
;{
; run nomousy.exe
;}
return


;Esc::
;{
; run nomousy.exe
; sleep (1000)
; ExitApp
}

Posted

glad you finally got it sorted bkenobi a spinner and trackball are on my list of future purchases for my cabinet but that will mean a whole new control pannel layout rethink :)

Stu

Posted

Just a quick note. If you have EnableDirectInput turned on (apparently for SlikStik users) then this won't function. Turn it off and everything will work fine.

Guest
This topic is now closed to further replies.
×
×
  • Create New...