It would be SUPER useful to be able to set unique IDs for Game Keys.

I love Game Keys, because I think they can make TTS a lot faster/better to use if we make the right scripted tools. The big problem is that, currently, bindings for Game Keys use the label of the Game Keys and are saved in a mod's JSON files (AFAIK).

While this is good for mods since players can set binding once and be good for any future use of that mod, it's very limiting for scripted tools! Right now, dropping a scripted tool that uses Game Keys into a mod will add those Game Keys to the menu, but they remain unbinded, even if you'd bound them to certain keys before. That means that we can't make a tool that a player drops in from their Saved Objects, and can use immediately, they HAVE to rebind everything. That makes certain types of tools not worth the effort of using them when they could be very useful if those bindings stuck to that Saved Object.

The way to fix this would be to add a parameter to addHotkey() that lets you set a unique ID for that Game Keys. The parameter would be optional and would just be any string that the person scripting wants. TTS would write down that unique ID string and any binding the player sets in a JSON file, and every time that a script uses that same unique ID, TTS would pre-fill that binding with the key the player entered.


For example, I make addHotkey("End my turn", endPlayersTurn, false, "EndingThePlayersTurn") and bind it to P. Now every time any script makes an addHotkey(...., ..., ...., "EndingThePlayersTurn"), that hotkey will have P bound in the Game Keys menu (unless the player changes it later).


Since we can set any string we want as a unique ID, the odds of 2 of them matching is very low if the strings are pretty long, and even if they do it's not really a problem and one that is easy for the person who made the scripted tool to fix. And thanks to that ID, everytime the player drops in their tool, they have the binding they last set already in, and can just start using the tool immediately.

I really really hope this gets added to TTS, because I think it would make for very powerful functionality, especially if combined with the other Game Keys suggestions I made here:
HTML Code:
https://forums.tabletopsimulator.com/showthread.php?8718-Hotkeys-conflicts-and-overrides-for-Game-Keys