Jump to content

How to modernize GRs keyboard


Recommended Posts

I originally had trouble with GR due to all the continuous and contorting key pressing.  But programmable keyboards, game pads, and gaming mice are now common equipment.

This is an example, how to get keyboard toggle with a Logitech G510s.

By toggle I mean continuous movement or action without holding a key down.

Commands ending in ...

T = toggle (simply press once activate)

P = press (press to cancel the above; holding down is the same as the original GR functionality)

* On the mouse, I have a button for go to ground.  It cancels all of the above toggles and drops you.

The screenshots show what the programmable keys layout looks like and how simple this is to implement.  The whole configuration can be done in under an hour.

SNAG-0000a.jpg

SNAG-0000b.jpg

SNAG-0001.jpg

SNAG-0002.jpg

SNAG-0003.jpg

Edited by MarkShot
  • Like 1
Link to comment
Share on other sites

I see someone actually read this.  The Logitech implementation is very simple.

But first, I simply tried to replicate what ARMAx has per a developer video.  Which was to make a double tap of such keys act as a lock, and press down, cancels the lock and/or continues the action.

This code below worked about 95%, but had some oddities in the way GR handles keyboard input.  Try as I might, I could not code around the strangeness.  This was AutoHotKey and if I had succeeded, I would have had something I which could have been turned into an EXE and distributed.  It would have been an awfully cool utility to run next to GR.

The basic logic behind the code below is as follows.  How do I know a press of a WASD+E+Q is a double tap or a press down event?  The solution was to write every key press out to an INI file with a time stamp.  On each press, you read the INI to see whether the current press is within 0.15-0.30 seconds of the previous.  If so, you have a double tap.  If not, you have a single press or pressed down event.

 

#NoTrayIcon
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode 3
SetKeyDelay, 100, -1,

#SingleInstance force
#Persistent
Sleep, 5000
SetTimer, ScriptDone, 100
Return

ScriptDone:
IfWinNotExist,Ghost Recon,
  ExitApp
Return

#IfWinActive,Ghost Recon,

; Forward
  *W::
  {
    IniRead, LastPress, GRkeys.ini, Motion, Forward, 0
    DownNow:=A_TickCount
    Elapsed := DownNow - LastPress
    IniWrite, %DownNow%, GRkeys.ini, Motion, Forward
    If (Elapsed < 300)
    {
      Send {W down}
      If (Elapsed > 150)
      {
        ToggleOn:=1
      }
      Else
      {
        ToggleOn:=0
      }
    }
    Return
  }

  *W Up::
  {
    If !ToggleON
    {
      Send {W up}
    }
    Return
  }

; Back
  *S::
  {
    IniRead, LastPress, GRkeys.ini, Motion, Back, 0
    DownNow:=A_TickCount
    Elapsed := DownNow - LastPress
    IniWrite, %DownNow%, GRkeys.ini, Motion, Back
    If (Elapsed < 300)
    {
      Send {S down}
      If (Elapsed > 150)
      {
        ToggleOn:=1
      }
      Else
      {
        ToggleOn:=0
      }
    }
    Return
  }

  *S Up::
  {
    If !ToggleON
    {
      Send {S up}
    }
    Return
  }

; Left
  *A::
  {
    IniRead, LastPress, GRkeys.ini, Motion, Left, 0
    DownNow:=A_TickCount
    Elapsed := DownNow - LastPress
    IniWrite, %DownNow%, GRkeys.ini, Motion, Left
    If (Elapsed < 300)
    {
      Send {A down}
      If (Elapsed > 150)
      {
        ToggleOn:=1
      }
      Else
      {
        ToggleOn:=0
      }
    }
    Return
  }

  *A Up::
  {
    If !ToggleON
    {
      Send {A up}
    }
    Return
  }

; Right
  *D::
  {
    IniRead, LastPress, GRkeys.ini, Motion, Right, 0
    DownNow:=A_TickCount
    Elapsed := DownNow - LastPress
    IniWrite, %DownNow%, GRkeys.ini, Motion, Right
    If (Elapsed < 300)
    {
      Send {D down}
      If (Elapsed > 150)
      {
        ToggleOn:=1
      }
      Else
      {
        ToggleOn:=0
      }
    }
    Return
  }

  *D Up::
  {
    If !ToggleON
    {
      Send {D up}
    }
    Return
  }

; PLeft
  *Q::
  {
    IniRead, LastPress, GRkeys.ini, Motion, PLeft, 0
    DownNow:=A_TickCount
    Elapsed := DownNow - LastPress
    IniWrite, %DownNow%, GRkeys.ini, Motion, PLeft
    If (Elapsed < 300)
    {
      Send {Q down}
      If (Elapsed > 150)
      {
        ToggleOn:=1
      }
      Else
      {
        ToggleOn:=0
      }
    }
    Return
  }

  *Q Up::
  {
    If !ToggleON
    {
      Send {Q up}
    }
    Return
  }

; PRight
  *E::
  {
    IniRead, LastPress, GRkeys.ini, Motion, PRight, 0
    DownNow:=A_TickCount
    Elapsed := DownNow - LastPress
    IniWrite, %DownNow%, GRkeys.ini, Motion, PRight
    If (Elapsed < 300)
    {
      Send {E down}
      If (Elapsed > 150)
      {
        ToggleOn:=1
      }
      Else
      {
        ToggleOn:=0
      }
    }
    Return
  }

  *E Up::
  {
    If !ToggleON
    {
      Send {E up}
    }
    Return
  }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...