User Tools

Site Tools


development:technical-details:patches:key-patch

Key Patch

The Key Patch, also known as Ineluki Key Patch or as Tastenpatch, is a patch made by Ineluki for earlier versions of RPG Maker 2000.

It allows executing scripts through the Play SE command, and returns data through the Control Variables: MIDI Ticks command. Scripts are stored as sounds with .script.wav extension (the format of .script.wav is similar to INI files).

The patch also allows playing MP3 (and theoretically also WMA) files by creating text files with .link.wav extension (a feature that was carried over from the older MP3 patch by Ineluki). Since this procedure is not managed by the game engine, music continues to play even if another track is started without correctly terminating the last one.

If FFDShow or something similar is installed, it may spam new symbols to task bar with every new file played until Harmony resets or game is closed.

The Key Patch is able to break system stability when starting a game if it gets prevented by a firewall to monitor key inputs.

Since it allows to execute arbitrary exe files, it opened a way for a lot of smaller utilities.

Download: https://cherrytree.at/cms/download/2004/01/20/dl-3-inelukis-key-patch.html

The TestGame-2003 includes test cases for the Key Patch, which can be used as references if needed:

The original patch came with the Keypatch Demo program (playable online here), which includes an user manual document in German: while the demo can be used to test the patch, it was released before the release of the patch, and, as to prevent it from being stolen, includes an access control measure which disables features from the patch were the Keypatch Demo altered/were the executable put into the folder of another game.

A Key Patch game includes 3 files: a RPG_RT.exe, a harmony.dll and an oldharmony.dll files. When testing a game, make sure those files are present. A game is recognised as a Key Patch game if a file named harmony.dll is present in the folder of the game, or if the KeyPatch flag is set through the EasyRPG.ini file or through command line.

If you need to pick an Ineluki executable and Harmony.dll files to test the patch, you can grab those from Rutipa's Quest 9: Alpha, as those do not have the access control measure and include the latest properties of the patch.

Games using it:

MP3 Patch

Current implementation issues: EasyRPG Player issue #3611

The Key Patch includes the changes made by the MP3 Patch, also made by Ineluki. As the version used of RPG Maker 2000 did not had mp3 support, this was the only way for some games to call and play mp3 files.

If a .link.wav music or sound file is called through the Play Music or Play SE command, the program will read the first line of the file as the path to the file to play, and the second line can specify if the file should loop or not.

It can be written as follows:

audio.link.wav
audio.mp3
loop

Here, the file audio.mp3 located in the same folder than audio.link.wav will be played in loop.

Audio files played that way are handled differently:

  • There is no difference between playing a .link.wav through the Play Music or Play SE command
  • A normal music can be combined with a .link.wav audio, with the normal music applying the parameters set through any Play Music .link.wav command
  • Several .link.wav can be played at the same time
  • .link.wav can only be stopped by letting them finish if the loop parameter is not set, or by playing a music or sound file named (OFF)
  • .link.wav are not affected by the sound buffer
  • Those files ignore any fade parameter, and ignore the commands Control Variables: MIDI Ticks and Conditional Branch: BGM has completed a loop

The EasyRPG Player partially supports this patch by forwarding audio calls to be played as either regular music or sound files. As such, the weird behaviours from the patch as well as the loop feature are not encountered.

As some games used .link.wav files without using the patch (for instance for games that originally started on the Key Patch and were later moved to a different version without renaming the files), the EasyRPG Player checks if the file is bigger than 499 bytes: if so, the file will be played as regular audio file.

Commands

General information

Syntax

Current implementation issues: EasyRPG Player issues #3615, #3619, #3624; calling a command from another file is not supported

A Key Patch command is called when a .script.wav file is called by a Play SE command. When this is done, the code written in the .script.wav file will be executed.

A standard .script.wav command can be formatted like this:

example.script.wav
[Execute]
;Just a comment to show that comments can be put in .script.wav files
Action=WriteToLog
Text=Write me to the log
next=World

[Bye]
Action=EnableMouseSupport
Enable=false
next=

[World]
Action=AddOutPut
Value=9999999
next=Bye

Case sensitivity is not important for the formatting. If a line does not include expected content, it will be treated as a comment. Comments are usually written by starting the line with a ; character.

The content in brackets represents the name of the command to execute. The first command to execute is the always the one named Execute. After this, the next command to execute is the one pointed by the line next=, and so on. Here, Execute will trigger, followed by World and finishing by Bye. If the next= section of a command is empty or missing, the execution of the script is terminated.

A command starts by declaring which action it is in the Action=, with other lines serving as parameters for the command.

The next section can be used to call the section of another file: for instance, next=midi_ticks_output.script.wav;Execute will call the section Execute of the file midi_ticks_output.script.wav.

Key list

Current implementation issues: EasyRPG Player issues #3608, #3622

The following keys are able to be used with the patch for the commands RegisterKeyDownEvent, RegisterKeyUpEvent, RegisterCheatEvent and RemoveBlockedKeys. As the patch was made with a German audience in mind, the keys are named in German and follow the logic of the German QWERTZ keyboard.

Internal key name corresponds to the name that needs to be written in the script.wav file, while Key corresponds to which key needs to be pressed.

Underlined keys are currently not supported by the EasyRPG Player.

Internal key name Key
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
0 0
^ ^
ß ß (Eszett)
´ ´
(Tab) Tab
(Esc) Escape
(Strg) Ctrl
(BackSpace) Backspace
(Space) Space
(Alt) Alt
< <
, ,
. .
- -
+ +
# #
(Enter) Enter
(F1) F1
(F2) F2
(F3) F3
(F4) F4
(F5) F5
(F6) F6
(F7) F7
(F8) F8
(F9) F9
(F10) F10
(F11) F11
(F12) F12
(CapsLock) Caps lock
(NumLock) Num lock
(ScrollLock) Scroll lock
(Einfg) Insert
(Pos1) Home (Pos1)
(Entf) Delete
(Ende) End
(BildHoch) Page up
(BildRunter) Page down
(Runter) Down
(Links) Left
(Rechts) Right
(Hoch) Up
Num(*) Numpad *
Num(-) Numpad -
Num(+) Numpad +
Num(5) Numpad 5
Num(0) Numpad 0
q q
w w
e e
r r
t t
z z
u u
i i
o o
p p
a a
s s
d d
f f
g g
h h
j j
k k
l l
y y
x x
c c
v v
b b
n n
m m
ä ä
ö ö
ü ü

The following keys are only supported by some versions of the patch, and behave differently: they are only tracked as part of a key press script (a key release script will ignore them), and they will do the press or release status depending on which one(s) you pick.

Internal key name Key
(LShift runter) Left shift (press)
(RShift runter) Right shift (press)
(LShift hoch) Left shift (release)
(RShift hoch) Right shift (release)

Output list

Some of the commands will write values to an output list. When using the command Control Variables: MIDI Ticks and that the command has been set to output mode through the MidiTickFunction, the value written to the variable will instead be the oldest value still present in the output list, and the output list will advance in the list by as many values than values written.

If the output list no longer has any written value, the value -1 will be returned.

For instance, if the command AddOutPut was used to add the values 123 and 456 to the output list, using Control Variables: MIDI Ticks while it is set to output mode will write the value 123. If it is used again, it will write the value 456, and if it is used a third time, it will write the value -1 as the output list is empty.

MidiTickFunction

The command MidiTickFunction dictates which mode should the command Control Variables: MIDI Ticks use, and if its output list should be used.

It can be written as follows:

midi_ticks_output.script.wav
[Execute]
Action=MidiTickFunction
Command=output
next=

The field Command accepts the following values:

  • original: Using Control Variables: MIDI Ticks will return MIDI Ticks (default behaviour; this does not alter the output list)
  • output: Using Control Variables: MIDI Ticks will return the last value from the output list, and advance the output list by as many values written
  • clear: Clear the remaining values of the output list (the clear will work independently of the current mode

AddOutPut

The command AddOutPut can be used to add a value to the output list. The command Control Variables: MIDI Ticks does not need to be set to output list mode for it to work.

It can be written as follows:

add_output.script.wav
[Execute]
Action=AddOutPut
Value=2000
next=

Value corresponds to the value that will be added to the output list (here, 2000).

EnableKeySupport

The command EnableKeySupport can be used to either enable or disable the keyboard features provided by the patch.

It can be written as follows:

key_on.script.wav
[Execute]
Action=EnableKeySupport
Enable=True
next=

The field Enable accepts the following values:

  • True: RegisterKeyDownEvent, RegisterKeyUpEvent and RegisterCheatEvent will work and will be able to add values to the output list
  • False: RegisterKeyDownEvent, RegisterKeyUpEvent and RegisterCheatEvent will no longer work and will no longer be able to add values to the output list (note that they will still be tracked and will resume their processing once keys are reenabled)

RegisterKeyDownEvent

Current implementation issues: EasyRPG Player issue #3616; BlockKey is not supported

The command RegisterKeyDown can be used to track keys and add values to the output list if a key is pressed. The keyboard needs to be enabled through the EnableKeySupport command for it to work, and the keys will be constantly tracked while enabled.

It can be written as follows:

key_down.script.wav
[Execute]
Action=RegisterKeyDownEvent
Key=(Enter)
Value=1999
next=

Here, if the keyboard is enabled, pressing Enter will add the value 1999 to the output list.

Additionally, it is possible to add the argument BlockKey=True before the line next= to mention that a function key should no longer exhibit its normal behaviour.

key_down_block.script.wav
[Execute]
Action=RegisterKeyDownEvent
Key=(F4)
Value=404
next=

Here, if the keyboard is enabled, pressing F4 will add the value 404 to the output list, and pressing F4 to change the window mode or Alt + F4 to close the game will no longer work.

RegisterKeyUpEvent

Current implementation issues: EasyRPG Player issue #3616; BlockKey is not supported

The command RegisterKeyUp can be used to track keys and add values to the output list if a key is released. he keyboard needs to be enabled through the EnableKeySupport command for it to work, and the keys will be constantly tracked while enabled.

It can be written as follows:

key_up.script.wav
[Execute]
Action=RegisterKeyUpEvent
Key=(Esc)
Value=1998
next=

Here, if the keyboard is enabled, after pressing the Escape key, releasing it will add the value 1998 to the output list.

Additionally, it is possible to add the argument BlockKey=True before the line next= to mention that a function key should no longer exhibit its normal behaviour.

key_up_block.script.wav
[Execute]
Action=RegisterKeyUpEvent
Key=(F5)
Value=405
next=

Here, if the keyboard is enabled, after pressing F5, releasing it will add the value 405 to the output list, and pressing F5 to change the window size will no longer work.

RegisterCheatEvent

Current implementation issues: EasyRPG Player issue #3621; BlockKeys is not supported

The command RegisterCheatEvent can be used to add a value to the output list if a specific string, known as cheat, is typed. The keyboard needs to be enabled through the EnableKeySupport command for it to work, and the keys will be constantly tracked while enabled. Outside of Enter, function are ignored for the text to type.

It can be written as follows:

register_cheat_event_easyrpg.script.wav
[Execute]
Action=RegisterCheatEvent
Cheat=EasyRPG
Value=62006
next=

Here, if the keyboard is enabled, typing easyrpg will add the value 62006 to the output list.

Additionally, it is possible to add the argument BlockKeys=True (BlockKeys plural here) before the line next= to mention that the letters in the Cheat field should no longer exhibit their normal behaviour.

FIXME What does BlockKeys do here, as the Cheat field cannot contain a function key?

RemoveBlockedKeys

The command RemoveBlockKeys allows to unblock the keys set through the BlockKeys property of the registerCheatEvent command, as well as the BlockKey property of the RegisterKeyDownEvent and RegisterKeyUpEvent commands.

It can be written as follows:

remove_blocked_keys.script.wav
[Execute]
Action=RemoveBlockedKeys
Keys=ABCDN
next=

Here, it will unblock all of the keys from the ABCDN Keys field.

It is also possible to add SystemKey=True to make the Keys field be interpreted as a single key, as to be able to write the name of a command made of several characters.

remove_system_blocked_key.script.wav
[Execute]
Action=RemoveBlockedKeys
Keys=(F12)
SystemKey=true
next=

Here, it will unblock the F12 key.

This command is not supported by the EasyRPG Player.

EnableMouseSupport

Current implementation issues: EnableMouseSupport (Automatic) not supported

The command EnableMouseSupport can be used to either enable or disable the mouse features provided by the patch.

It can be written as follows:

enable_mouse.script.wav
[Execute]
Action=EnableMouseSupport
Enable=true
ID=-11
next=

The field Enable accepts the following values:

  • True: EnableMouseSupport (Automatic), GetMousePosition will work and will be able to add values to the output list, while the mouse behaviours set through SetMouseAsReturn and SetMouseWheelAsKeys will be able to be used
  • False: EnableMouseSupport (Automatic), GetMousePosition will no longer work and will no longer be able to add values to the output list, while the mouse behaviours set through SetMouseAsReturn and SetMouseWheelAsKeys will no longer be able to be used

If Enable is set to True, the ID entry will be used, and its value will be written to the output list whenever EnableMouseSupport is used.

Here, the mouse will be enabled, and whenever GetMousePosition will be used, the value -11 will be added to the output list.

When enabling the mouse, it is also possible to set the automatic property, which can be written like this:

enable_mouse_automatic.script.wav
[Execute]
Action=EnableMouseSupport
Enable=true
ID=-21
Automatic=true
next=

Here, every 500ms, the values -21, X coordinate of the mouse, Y coordinate of the mouse and mouse button pressed (see GetMousePosition) will be added to the output list.

GetMousePosition

Current implementation issues: EasyRPG Player issues #3615, #3623

The command GetMousePosition can be used to track the mouse coordinates, if the mouse is enabled.

It can be written as follows:

get_mouse_position.script.wav
[Execute]
Action=GetMousePosition
next=

Using it while the mouse is enabled will add the following values to the output list in this order when called:

  • ID value set in the EnableMouseSupport command
  • X coordinate of the mouse
  • Y coordinate of the mouse
  • Mouse button pressed (0 is no button, 1 is left mouse button, 2 is right mouse button, 3 is left mouse and right mouse buttons at the same time)

SetMouseAsReturn

Current implementation issues: EasyRPG Player issue #3622

The command SetMouseAsReturn can be used to alter the behaviour of the mouse buttons. If the mouse is disabled, the command will still work but the mouse buttons will not be able to be used until the mouse is reenabled.

It can be written as follows:

set_mouse_as_return_left.script.wav
[Execute]
Action=SetMouseAsReturn
Value=Left
next=

The field Value accepts the following values:

  • None: The left and right buttons of the mouse will not be assigned to any action
  • Left: The left button of the mouse will be considered as an interaction key press if the mouse is enabled
  • Right: The right button of the mouse will be considered as an interaction key press if the mouse is enabled
  • Both: Pressing both buttons of the mouse at the same time will be considered as an interaction key press if the mouse is enabled

SetMouseWheelAsKeys

Current implementation issues: EasyRPG Player issue #3622

The command SetMouseWheelAsKeys can be used to alter the behaviour of the mouse wheel. If the mouse is disabled, the command will still work but the mouse wheel will not be able to be used until the mouse is reenabled.

It can be written as follows:

set_mouse_wheel_as_keys_up_down.script.wav
[Execute]
Action=SetMouseWheelAsKeys
Value=UpDown
next=

The field Value accepts the following values:

  • None: The mouse wheel will not do anything
  • LeftRight: If the mouse is enabled, using mouse wheel up will be considered as a left key press while using mouse wheel down will be considered as a right key press
  • UpDown: If the mouse is enabled, using mouse wheel up will be considered as an up key press while using mouse wheel down will be considered as a down key press

ExecProgram

Current implementation issues: EasyRPG Player issue #3613

FIXME Document the non-Type parameters.

The command ExecProgram can be used to execute a program.

It can be written as follows:

executeprogram.script.wav
[Execute]
Action=ExecProgram
command=program
next=

Here, a program named `program` will be attempted to be executed.

The command also allows to specify the document type, which, if set, will forward the document or file to open to the OS.

executedocument.script.wav
[Execute]
Action=ExecProgram
Type=document
command=https://easyrpg.org/
next=

Here, the URL https://easyrpg.org/ will be attempted to be opened by the web browser of the machine.

If https://easyrpg.org/ was replaced by harmony.log, for instance, the file harmony.log of the game would have been attempted to be opened by a program of the machine supporting the log format, such as a text editor.

Due to the nature of the command and how it was used (often to start another program that will read and alter values in the memory of the RPG_RT.exe program), EasyRPG Player does not support the command and cannot directly support it.

Instead, the Player has an hardcoded behaviour to execute when a program named exitgame or taskkill is called, which will force the Player to close. Any other program call will just display a warning.

Saves.script.wav

Current implementation issues: EasyRPG Player issue #3620

As to emulate the call of a program through ExecProgram which should count the amount of save files, present for instance in the game Harvest Moon: A New Life, if a file with the name Saves.script.wav is attempted to be called, the EasyRPG Player will add to the output list the save count value (0 if no save file exists, 1 if at least 1 save file exists), and will ignore the content of the Saves.script.wav file.

WriteToLog

Current implementation issues: EasyRPG Player issue #3618

The command WriteToLog allows to send a message to be written in the harmony.log file.

It can be written as follows:

writetolog.script.wav
[Execute]
Action=WriteToLog
Text=Hello World! I'm a log text!
next=

Here, the line Hello World! I'm a log text! will be written in the harmony.log file.

Using this command in the EasyRPG Player will instead forward the message to the EasyRPG logs.

SetDebugLevel

The command SetDebugLevel allows to set the level of verbosity to use for the harmony.log file.

It can be written as follows:

set_debug_level_0.script.wav
[Execute]
Action=SetDebugLevel
Level=0
next=

Level can be set to either 0, 1, 2, or 3, each value corresponding to a different level of verbosity.

This command is not supported by the EasyRPG Player (the Player does not use this kind of logging system, and the content of the harmony.log file is not used by games).

mcicommand

FIXME Document more concrete uses of the command.

The command mcicommand can be used to call MCI Commands.

An example command can be seen below:

mcicommandmp3.script.wav
[Execute]
Action=mcicommand
command=open "%path%\..\Music\Opening2_MP3.mp3" alias mp3
next=play mp3

[play mp3]
Action=mcicommand
command=play mp3
next=

Here, the file Opening2_MP3.mp3 gets opened and played by the game.

This command is not supported by the EasyRPG Player, nor is it planned to: it is platform dependent and is not used by games, due to not having a lot of documentation and not being stable command for the engine.

References and further reading

development/technical-details/patches/key-patch.txt · Last modified: by carbonara

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki