Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read/write RPG Maker editor's clipboard data. #402

Open
elsemieni opened this issue Sep 21, 2020 · 3 comments
Open

Read/write RPG Maker editor's clipboard data. #402

elsemieni opened this issue Sep 21, 2020 · 3 comments

Comments

@elsemieni
Copy link
Member

I don't know if it belongs here or to the editor. However, since it have similarities to LCF data, I will post here.

RPG Maker editor uses a particular binary format when you copy event data. It seems these had some similarities to LCF files. (but obviously, with different headers, data layout and so on). It will be useful that liblcf handles these data in some sort of way (well, there's not files particulary but clipboard data, that can complicate the things, since each OS handle clipboard data in a different way). Maybe it can be abstracted in liblcf by just read/write data (leaving read/write to clipboard to the program that uses liblcf, for not saying Editor).

For analysis, I used CLCL (https://www.nakka.com/soft/clcl/index_eng.html ) for dumping/writing binary data to the clipboard. I'll attach some examples of the obtained clipboard data, from 2k3e:

2k3e_clipboard_data_sample.zip

Map and events:

  • Empty map, copied from MapTree
  • 4x4 map portion, from map
  • Empty event, copied from Map
  • Event with hello world message, copied from Map
  • 2 Message eventCommands, copied from event
  • Empty event page
  • Party start position, from map
  • Vehicle 1 starting position, from map
  • Vehicle 2 starting position, from map
  • Vehicle 3 starting position, from map

Database (all of these have normal and multicopy feature, when available).

  • Actor from database
  • Class from database
  • Skill from database
  • item from database
  • enemy from database
  • troop from database
  • empty battle command page
  • battle eventcommand (Message: "hello world")
  • skill from database
  • state from database
  • animation from database
  • animation frame from animation
  • sprite from animation
  • sprite from animation
  • SE and flash timing from animation
  • animation2 from database
  • terrain from database
  • tilesets from database
  • empty common events from database

One special comment about Event Commands: In english releases, event commands copies more than just binary data, it also put the following in the clipboard, considering 2 Message event commands:

  • Unicode text:
    @> Text: Hello World @> Text: Bye World
  • Locale: (Binary, see evc-locale.bin in zip file).
  • OEM text: (Same as unicode text, but in ANSI).
  • Text: (Same as unicode text).

Then most programs will recognize EventCommand data and will paste it as text (perhaps it's a feature to allow share events in communities?).

I tried to see some of these commands (in a very vague way) and it have some similarities and differences between LCF files. Let me put an example with a Map copied to the clipboard, in conjuntion with it's lmu file:
image

  • I saw there's no a LCF header.
  • There's additional data that usually is not in lmu file, but in lmt.
  • Others?

Also, as closing words; there's a tool made by Cherry called RMEventFactory (http://cherrytree.at/cms/lang/en/download/?did=11) that already handles clipboard event data, allowing batch replacing values, intended for making engines or override default values to make out-of-range commands. However, it is not "compatible" with 2k3e beacuse it recognizes as text instead a maker data (however, if you remove the text by using tools or by pasting it in a older editor and then copying it again, the program can recgonize it without trouble).

@Ghabry
Copy link
Member

Ghabry commented Sep 21, 2020

see also EasyRPG/Editor#120

@CherryDT
Copy link

CherryDT commented Mar 14, 2021

However, it is not "compatible" with 2k3e beacuse it recognizes as text instead a maker data (however, if you remove the text by using tools or by pasting it in a older editor and then copying it again, the program can recgonize it without trouble).

Thanks for pointing that out. Replace eventfactory.dll with this version to fix it: https://cherryshare.at/f/8d7Bbn/eventfactory.dll

(Yeah, I wasn't able to get my old code to compile properly with my current environment so I instead just binary-patched my own tool to fix this.)

Then most programs will recognize EventCommand data and will paste it as text (perhaps it's a feature to allow share events in communities?).

Yes it is, I also wrote that in the helpfile and the changelog for v1.10:

When event script lines are copied to the clipboard, they are now additionally stored in text format.

  • This will allow event scripts to be copied to text editors, web forums, etc.
  • Please note that this does not work the other way round!

@fdelapena
Copy link
Contributor

fdelapena commented Aug 28, 2021

This excellent HSP module by @fermiumbay allows to script event commands using HSP language for convenience. It allows converting from event commands to HSP script and vice-versa. It is useful for game developers, also helps to set values above/below limits with ease and without patching binaries. The module script source code self-documents how to parse the clipboard for all event commands. More information and download:

https://fermiumbay16.jimdofree.com/%E6%8A%80%E8%A1%93/rpg%E3%83%84%E3%82%AF%E3%83%BC%E3%83%AB%E7%94%A8%E8%87%AA%E8%A3%BD%E3%83%84%E3%83%BC%E3%83%AB/rpg%E3%83%84%E3%82%AF%E3%83%BC%E3%83%AB200x-%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E5%91%BD%E4%BB%A4%E3%81%AE%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E5%8C%96%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB/

It requires HSP3 to run. Please note some command parsing could fail on non-Japanese (English translation) event editors because some values are directly parsed from the event command human-readable output.

To learn more about HSP:
Documentation: https://www.onionsoft.net/hsp/v36en/
Prebuilt binaries for Windows: https://github.com/onitama/OpenHSP/releases (it could trigger some false positives on some antivirus like Windows Defender)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants