help with a fose function

Post » Sat Apr 30, 2011 12:10 pm

I'm cleaning up the menu system for a mod, which includes some stuff related to keybindings, and I thought I'd use proper etiquette and declare my hotkeys as control keys using setiscontrol. The trouble is, I'm not sure how to use it - it calls for a control code and scancode as parameters. The scancode part is clear enough, its the DX scancode for the key you plan to use, but do I just set the control code to something that isn't in the list of default action control codes (like 28 or 292 or something)? Also, what happens when the user wants to remap the hotkey, do I use a control code of -1 or something (0 is a valid control code, so it can't be that) to clear the old hotkey's "iscontrol" status?
User avatar
Kevan Olson
 
Posts: 3402
Joined: Tue Oct 16, 2007 1:09 am

Post » Sat Apr 30, 2011 10:44 pm

I'm not sure about the first part, SetIsControl that is, but I just wrapped up a http://www.mediafire.com/?ohj4f3zjmdg last night which uses five separate hotkeys and allows remapping af all of them using a hotkey reset token. Much of the code in there might prove useful if you want to take a look. I figure so long as the keys can be remapped, it should be easy enough for a user to see to it that their mods' hotkeys won't overlap.
User avatar
amhain
 
Posts: 3506
Joined: Sun Jan 07, 2007 12:31 pm

Post » Sat Apr 30, 2011 12:20 pm

I messaged the FOSE team, and got this response from Ian Patterson:

It looks like the docs are incorrect. The first parameter is a scan code, the second is an integer (interpreted as a bool) that is true to register the key and false to unregister it. It's only useful so that other mods can check if the key is currently in use via IsControl.


That's about how I would have guessed it would work, but I was too lazy to test it. Even with it used correctly, you can run into some problems - if one mod's hotkey triggers a menu, and you're trying to reassign a hotkey for your mod, there's a chance that that mod's menu will pop up if the user presses that hotkey regardless of whether the other modder flagged it with setiscontrol. It does help with non-menu mode hotkeys though. But yeah, if they read their readmes the user should be able to keep track.

My primary needs mod has 3 reassigneable hotkeys, I think I've got that much down, I just thought it would be a good idea to start using this command. Thanks though.

By the way, I just used your Chicken and Egg resource to lower that mod's file count. Works great.
User avatar
Karine laverre
 
Posts: 3439
Joined: Tue Mar 20, 2007 7:50 am


Return to Fallout 3