Play with a controller : script to control the mouse. Need autohotkey.

1 reply [Last post]
sphrix
sphrix's picture
User offline. Last seen 3 days 7 hours ago. Offline
Joined: 2011-04-07
Posts: 207

Hi everyone !

Recently i came back to hedgewars and i wanted to play with a controller, dont ask why :p

So after some try and some help i have this for you :

First, create a team to use with your controller, you can find a post on the forum with pre-made controls.

Second : you need autohotkey. it creates macro and scripts etc...

Third you need these two scripts :

1.

 
Joy10:: ; right stick button press (not on his axis)
    KeyWait, Joy10, T1     ; Wait 1 seconds
    if (ErrorLevel = 1)
    {
        ;Send, % "#" "d" ;get back to the desktop
        Winactivate, ahk_exe explorer.exe  ; activate explorer.exe, you dont go back to desktop, test as windowed game, not in fullscreen
        ;MsgBox Held
    }
    else
    {
        ;MsgBox Tapped
        run C:\Users\clement\Desktop\JoystickMouse.ahk  ; activate the joystickmouse script. if you have your own version of joymouse script,
                                                        ; add a way to exit it. i did it in my version at the end of the script.
                                                        ; there is a way to do it from here, but i can't make it work,
                                                        ; would need the id process of the ahk script or something else.
    }
return

or : http://pastebin.com/gYTGNRjK
Note, change the path for run C:userffffffffffffJoystickmouse.ahk

save as NAME.ahk

2.
add this :

; you got to press the two button at the same time to exit this script, joy 5&6 (bumpers button) 
joy5::
joy6::
if getkeystate("joy5")
  if getkeystate("joy6")
    ExitApp
return

to this script, at the end : https://autohotkey.com/docs/scripts/JoystickMouse.htm

which give :

http://pastebin.com/BT4PR6hD

Save as JoystickMouse.ahk

Finally :

Run the first script, lets say : Name.ahk

now, use the right stick button, press it, not the x or y axis, press it.

it will open the joymouse script.

Use left stick as a mouse.

Press the bumpers at the same time (LB and RB)
it exit the mouse script.

VoilĂ .

It is not yet perfect,

Feel free to add functionnality to it and share them Smile

the beachs hogs surfin hedgewars

nemo
nemo's picture
User offline. Last seen 3 weeks 1 day ago. Offline
Joined: 2009-01-28
Posts: 1861

In theory we have controller support, although I don't have one to test/fix/verify.
http://hg.hedgewars.org/hedgewars/file/4027903ff3e7/QTfrontend/util/SDLInteraction.cpp#l103

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]