Jump to content

Hotkey binding help


nivea

Recommended Posts

So I am making a dogmeat overhaul mod and I now have almost everything done for a open beta, only thing I can not seem to figure out is how to make my hotkey re-bindable.

 

I have it currently set up to the O key, but I want to make it so users can change this when they want. So I have a dog whistle made that has some menus and sub menu, I would like to add the rebinding part in there some how.

 

Can anyone help me out on this, any tutorials? Scripting is really difficult for me and I am proud of what I have done so far, but I can not seem to find any tutorials on hotkey binding stuff.

Link to comment
Share on other sites

An example from a token based menu system (but don't use SetIsControl).

 

 

 

scn FookHotkeyBindingSCPT

Int bHotkeyBound
Int iHotkey
Int iControl

Begin GameMode

 If bHotkeyBound

  If (FookMenuHotkeyGLOB == 0)
   Set FookMenuHotkeyGLOB to iHotkey

  ElseIf (FookNVGHotkeyGLOB == 0)
   Set FookNVGHotkeyGLOB to iHotkey

  ElseIf (FookCameraShiftRightGLOB == 0)
   Set FookCameraShiftRightGLOB to iHotkey

  ElseIf (FookCameraShiftLeftGLOB == 0)
   Set FookCameraShiftLeftGLOB to iHotkey

  ElseIf (FookCameraZoomInGLOB == 0)
   Set FookCameraZoomInGLOB to iHotkey

  ElseIf (FookCameraZoomOutGLOB == 0)
   Set FookCameraZoomOutGLOB to iHotkey

  ElseIf (FookKHThrowGrenadeHotkeyGLOB == 0)
   Set FookKHThrowGrenadeHotkeyGLOB to iHotkey

  ElseIf (FookKHToggleGrenadeHotkeyGLOB == 0)
   Set FookKHToggleGrenadeHotkeyGLOB to iHotkey

  ElseIf (FookLockOnHotkeyGLOB == 0)
   Set FookLockOnHotkeyGLOB to iHotkey

  ElseIf (FookQATestingGLOB == 0)
   Set FookQATestingGLOB to iHotkey

  EndIf

  RemoveMe

 Else

  Set iHotkey to GetKeyPress 0
  Set iControl to IsControl iHotkey

  If (iHotkey == -1)
   ShowMessage HotkeyBindingStartMESG

  ElseIf iControl
   ShowMessage HotkeyBindingConflictMESG iHotkey

  Else

   Set bHotkeyBound to 1
   SetIsControl iHotkey 1
   ShowMessage HotkeyBindingEndMESG iHotkey

  EndIf

 EndIf

End

 

 

Fallout Script Extender v1 Command Documentation

 

CIPSCIS Detecting Keypresses

Link to comment
Share on other sites

I already used the CIPSCIS Detecting Keypresses tutorial to make my current hotkey, but it does not talk about how to make it so users can change the key option to what they want sadly. The example you gave I would just have to remove the Fook Globals and remove the SetIsControl?

 

Your talking to someone who can barely script at all and knows nothing of hotkeys lol.

Link to comment
Share on other sites

Simpler script.

 

 

 

scn NiveaHotkeyBindingSCPT

Int bHotkeyBound
Int iHotkey
Int iControl

Begin GameMode

RemoveMe

   If bHotKeyBound   ; 5 bind key and remove token

      Set NiveaHotkeyGLOB to iHotkey

      RemoveMe

   Else   ; 1 start detecting key pressed and check if it is a control

      Set iHotkey to GetKeyPress 0
      Set iControl to IsControl iHotkey

      If (iHotkey == -1)   ; 2 show start hotkey binding message
         ShowMessage HotkeyBindingStartMESG

      ElseIf iControl   ; 3 if key pressed is a control show conflict message
         ShowMessage HotkeyBindingConflictMESG iHotkey

      Else   ; 4 if not a control stop detecting and show binding end message

         Set bHotkeyBound to 1
         ShowMessage HotkeyBindingEndMESG iHotkey

      EndIf

   EndIf

End

 

 

Not sure what type of menuing you are using, but the above is meant for a token based menu. Precise Aim by cmal is an example of a quest based menu if that helps.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...