Okay, I guess I'm at least exploring the feasibility of this.
The goal is that, when the player selects an item from their inventory, one of the options (alongside drop, throw, use, etc.) is "Set Hotkey". When selected, the player is prompted for a key to bind to the item, and a keymap is created that uses the item (as per its default interaction) when pressed.
Doing this properly requires two things: first, the basic UI, and second, the ability to select an item based on its name rather than the slot it is in or the inscription it has. The UI in principle should be straightforward, I think; there's already UI for creating keymaps, so this would just be an alternate approach to the same. As for selecting items based on name, I think what needs to happen is that we create a "control code" that can be intercepted whenever the player is prompted for a menu selection, and which lets them type in a string which is matched against the items in the menu. For example, if the control code character is @, then typing "@Phase" and hitting Enter should select Phase Door scrolls, assuming that the entered string is not ambiguous. If it is ambiguous, simplest thing to do is just to error out.
Once this works, the next step is to also allow it for spellbooks. I'm honestly not entirely sure what the best way to go about doing that is. We currently have two different commands for interacting with spellbook contents. We could add a third command; that feels kind of clunky though. We could make it so holding Shift while selecting a spell becomes the "create hotkey" for spells, but that's hacky. Opinions?
The goal is that, when the player selects an item from their inventory, one of the options (alongside drop, throw, use, etc.) is "Set Hotkey". When selected, the player is prompted for a key to bind to the item, and a keymap is created that uses the item (as per its default interaction) when pressed.
Doing this properly requires two things: first, the basic UI, and second, the ability to select an item based on its name rather than the slot it is in or the inscription it has. The UI in principle should be straightforward, I think; there's already UI for creating keymaps, so this would just be an alternate approach to the same. As for selecting items based on name, I think what needs to happen is that we create a "control code" that can be intercepted whenever the player is prompted for a menu selection, and which lets them type in a string which is matched against the items in the menu. For example, if the control code character is @, then typing "@Phase" and hitting Enter should select Phase Door scrolls, assuming that the entered string is not ambiguous. If it is ambiguous, simplest thing to do is just to error out.
Once this works, the next step is to also allow it for spellbooks. I'm honestly not entirely sure what the best way to go about doing that is. We currently have two different commands for interacting with spellbook contents. We could add a third command; that feels kind of clunky though. We could make it so holding Shift while selecting a spell becomes the "create hotkey" for spells, but that's hacky. Opinions?
Comment