Note: This Lua mod is targeted at Payday: The Heist modders, whether they are Lua scripters, modelers, or any other roles. If this does not describe your role or intent, you can ignore this mod as it will be unlikely to benefit your needs.
This rudimentary mod is intended to be used as a tool to reveal the string_ids used by the game. But why would anyone ever want to do this? The reason is that OVK's naming conventions typically combine the internal name of the item in question with another string to form an identifier for a particular translated string (which usually looks nothing like the string_id that references it). For example, the string_id debug_test_raycast_weapon corresponds to AMCAR-4 Carbine. Or debug_suburbia and debug_apartment, which correspond to Counterfeit and Panic Room, respectively. Counterintuitive naming? Indeed. But that's what this mod is here to address.
Unless you are already familiar with the internal names of most of the components in the game (and there's hundreds of them), you are eventually going to run into situations where you have an internal name but have absolutely no idea which item it corresponds to, or vice versa. Sure, you could find it by trial-and-error, or you could simply use this mod to reveal it and minimize wasted time.
Even if you specialize solely in GUI stuff and don't usually have to deal with internal names, you can still benefit from this mod as well since the string_ids are of different lengths when compared to the final strings, which makes them suitable for testing GUI control layouts by simulating text length differences across different languages, or text overflow since many string_ids are fairly long. After all, it's much faster to hit a keybind and force a GUI refresh than it is to restart the game or go to a level and return. This mod also makes it possible to extract a given string_id for use in your own mod, if a suitable translation already exists within the game.
Dependencies
- Harfatus' Hook (a.k.a. the original Lua hook) - at least version 3.2.1 (or you will crash)
HoxHud P9.1.7 provides version 3.2.2 of the hook.
Note: Do not use version 3.2.3 (post-Crimefest 2015) as it fails to hook the necessary C++ functions.
- Extract the contents of the zip archive to your PD:TH folder (i.e. where payday_win32_release.exe is located). This should create the lib/Lua/ folder structure if it does not already exist.
- Edit PD2Hook.yml and add a new keybind:
- [VK_OEM_1, lib/Lua/StringIDRevealer/toggle.lua]
where VK_OEM_1 corresponds to a virtual-key code constant (the semicolon key on a US layout keyboard, in this case). - To activate the mod, simply press the key before you open the GUI panel that has the item of interest. If you have already opened the GUI panel before pressing the key, go back (i.e. close that GUI panel) and re-open it again - the string_ids should now be visible.
I don't have a PD2Hook.yml file, what should I do?
Create an empty text file and rename it to PD2Hook.yml
Here's a template to get you started:
Config:
OutputMode: 0
OutputFile: PD2Hook.log
PrintOffsets: false
ExtraCols: 0
ExtraRows: 0
KeyBindings:
# https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731.aspx
- [VK_OEM_1, lib/Lua/StringIDRevealer/toggle.lua]
PostRequireScripts:
PersistScripts:
Open the file in Notepad, then copy-paste the above lines into it and save it.
Oh BLT, where art thou?
Wait, I don't need to add any PostRequireScripts or PersistScripts lines at all?
Yes, that is correct - this mod will automatically register the scripts for use as long as the folder structure remains undisturbed. The only thing you need to configure is the keybind, which has been detailed above.
Known Issues
- Pressing the bound key has no effect in the pause menu during a singleplayer game
This is an issue due to the way Harfatus' Hook works - keybinds are not executed when the game state is paused and are instead queued for execution upon resumption. I am not aware of a fix for this issue, but a workaround is to press the key before opening the menu.
0.0.1:
Initial release