Modified from OnToggleSigns() [playerInput.ws], with a bit of trickery, but can be repurposed to perform custom functions.
Of course, you could just do this in mouse software or autohotkey without needing to compile scripts.
It would also be much simpler if IK_MouseZU (up) and IK_MouseZD (down) were separate keys instead of an axis. Although, I suppose you must retain the axis for scrollbar context functions, or maybe not. Actually, now that I think about it... I haven't tested this in that context, but it works for OnToggleSigns(); similar context.
In hindsight, although not as simple, setup matching 'input_overlap' tags in input.xml for whichever 2 keybinds you want to be able to bind 'mousewheel' to? Awkward since you could just bind any key to them both.
Of course, you could just do this in mouse software or autohotkey without needing to compile scripts.
It would also be much simpler if IK_MouseZU (up) and IK_MouseZD (down) were separate keys instead of an axis. Although, I suppose you must retain the axis for scrollbar context functions, or maybe not. Actually, now that I think about it... I haven't tested this in that context, but it works for OnToggleSigns(); similar context.
Standard config files for key bindings:theInput.RegisterListener( this, 'OnToggleSwords, 'ToggleSwords' );
...
event OnToggleSwords( action : SInputAction )
{
var tolerance : float;
tolerance = 2.5f;
// wheel down
if( action.value < -tolerance )
{
action.value = -action.value; // set value positive to detect button press
action.aName = 'SteelSword'; // replace with an actionName
OnCommSteelSword(action); // replace with actionEventName
}
// wheel up
else if( action.value > tolerance )
{
action.aName = 'SilverSword'; // replace with an actionName
OnCommSilverSword(action); // replace with actionEventName
}
}
Add localization text for keybinds menu if desired, and update input.settings with BASE_DRAW_SWORDS_KEYBOARD as well. Set previous IK_MouseZ to IK_None if already bound to 'ToggleSigns', or unbind it using the menu.ref: input.xml
ie: <Var builder="Input" id="ToggleSwords" displayName="modName_localString" displayType="INPUTPC" actions="ToggleSwords"/>
ref: input_qwerty.ini
ref: [BASE_DRAW_SWORDS_KEYBOARD]
ie: IK_MouseZ=(Action=ToggleSwords)
In hindsight, although not as simple, setup matching 'input_overlap' tags in input.xml for whichever 2 keybinds you want to be able to bind 'mousewheel' to? Awkward since you could just bind any key to them both.
Last edited: