New account registration is temporarily disabled.

[RMVX] EDIT A REGISTRY KEY FROM A SCRIPT CALL

Posts

Pages: 1
Yo!

So I'm working on a way to configure controls from a menu in the game, as opposed to forcing the player to open the Game Properties window with F1. I've essentially figured out everything from the UI side of things, including displaying the correct button and keyboard prompts based on the binary data from the ButtonAssign file in the registry. But there's one thing I haven't managed to do, and it's kind of a crucial component.

Namely, I have no idea how to actually change the Registry file itself, or write to the registry, so to speak. Does anyone know how to do this with RGSS2?

I have a few scripts that have helped me to get started, I'll link them below. Just having a hard time actually understanding them.

I used this script as a base to figure out what the settings are in the ButtonAssign file, but ended up trimming down quite a bit of code and simplifying it for the purposes of my own game. It looks like this is at least capable of READING files from the registry. I just have no idea how do the same trick in reverse.

And I've used this script to figure out how to write to .ini files, and even create them from scratch if they don't exist. I feel like this is pretty close to doing what I need to do, I'm just not sure how to potentially alter this to write a .reg file in the registry, instead of a .ini file to the games root folder.

I could also be dumb, and this might not be possible in RMVX. So far, everything I've attempted to do has been possible with enough effort and ingenuity, so I think it's more my own limitations, rather than the limitations of the engine, but at this point I'm stumped. Any ideas?

EDIT: I found something else that seems to be helpful, and I've been working with this, but again I'm having a hard time understanding it. Maybe it can help someone else though? Here's what I found.

EDIT EDIT: Okay, I think I'm close. I think I need to use RegSetKeyValueA to actually change the binary data in the registry, but for some reason it doesn't seem to be working. My code has stopped crashing the game, which is nice, but it doesn't really seem to be doing anything either. I think the data format that I'm trying to pass through isn't quite right, but I'm not sure. This is what I've been trying to make use of so far.
Pages: 1