• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

RPGM PSM_SHOW_POPUP, translating RPG Maker MV, and you

crap

Newbie
Oct 8, 2017
37
54
You may recognize the plugin call PSM_SHOW_POPUP if you've tried to translate (machine or otherwise) certain RPG Maker MV games. If you don't, here's the lowdown:

This call is for a plugin named FTKR_PopupSpriteMessage.js. The PSM_SHOW_POPUP call with its associated arguments (the main one: text, and position, etc) are used to show text anywhere on the screen. There is also PSM_SHOW_POPUP_B which is the same thing but has more options: color, size, font changes, and importantly: offsetWait. That last argument is an integer, and it is processed as follows:
  1. if it is greater than 0, process the text one character at a time with a delay between each character (delay determined by the "count" argument)
  2. if it is exactly 0, process the text one character at a time with no delay (used for per-character color, size, etc changes) (this is what PSM_SHOW_POPUP defaults to)
  3. if it is less than 0, process all the text at once.
Processing characters one at a time is fine and all, but it leads to a lot of spam if you're using a hooker -> clipboard method. So to fix that, we just need to set offsetWait to less than 0, like -1. Here is the easiest place to do it, from FTKR_PopupSpriteMessage.js (from about line 530 in the file I have):
You don't have permission to view the spoiler content. Log in or register now.
Neat.

Next is the text argument. You may have noticed if you're translating one of these games and you try to add spaces to the text in a PSM_SHOW_POPUP call in e.g. CommonEvents, you'll end up with errors or non-functional popups. This is because normal space characters tell the plugin to move to the next argument; all the things after the space(s) get parsed as arguments (or ignored). If you want to include a space that doesn't break the game, you need to get creative and use something like or, as noted in the instructional comments of FTKR_PopupSpriteMessage.js:
You don't have permission to view the spoiler content. Log in or register now.
Ok, great, you know how to use spaces in your translation now, but it's still awkward to hit \_ - especially while translating. Also, the comment is wrong - you actually need to enter \\_ or the game may not load at all. How can we get around this issue? With ! Specifically an .AHK script that looks something like this:
You don't have permission to view the spoiler content. Log in or register now.
Once you have AHK installed, copy paste that into an .AHK file, compile it and run it! While the script is running, press f12 to toggle the key swap on/off; while it's toggled on, press spacebar and you'll get \\_ instead, so you can translate games that use this plugin more easily. Note that if f12 doesn't work for you as a toggle shortcut you can change it: . If you want to , the big three are: ! for alt; ^ for control; + for shift. For example, if you wanted control+p to be your toggle, you'd put ^p:: in place of the f12:: - just remember to compile and run again if you change it.

Attached are the .AHK script and FTKR_PopupSpriteMessage.js with the modification shown. Paste the .js file into your games ~/www/js/plugins/ folder and replace the one in there. The .AHK script should run from any folder once you have AHK installed and the script compiled. For the .js file, you may want to just update the one you have as there are multiple versions, some of which probably fixed bugs or something.

note: I have heard of truly awful anti-cheat software that will flag any AutoHotkey script as a hack. To be safer, exit the script entirely (right click icon in taskbar) before you start something with anti-cheat.
 
Last edited: