Mod Support Devlog 3: Creating Console Commands
Hey, it's me again
, Let's try to keep up this devlog weekly posting
I have finished working on the console module to allow mods to create custom commands.
The downside of this is that I had to change the way commands were created to support mod commands, which has resulted in
many commands that I had previously created
being missing now (like the teleport command), but at least modders can create commands without too much trouble, just a script call, I'll have to bring them back, but it's not a priority now.
While I was doing this, I have made some improvements to the console, some of them are purely aesthetic and others are necessary to avoid problems in the future.
As you can see, the console window can show text with colors on the screen, also, the window size is now bigger, so the output text is clearer.
The help command (man) has been modified to support mods
I have also made a modification to allow you to type long commands in the console input, previously, when the length of the command exceeded the width of the window, it was cut off, now you can type long commands and you can actually see what you are typing.
Now to the code part
The code needed to create commands is much simpler than the one needed to create mod settings, you can take a look in the spoiler below.
You can define the command logic to run inside a block or declare a new module and create the functions there, which is tidier, it's up to you.
All the arguments that are sent to the command when called, are strings, that means, you will have to interpret the string and cast it to the type you need, to avoid having to copy and paste code, the mod has a module (Utils) that you can use to perform this cast (Utils.convert_to), you can check it out on the
cmd3 function in the code above.
The console module also allows text to be written in its output buffer, the text will be split by each newline character ("\n") into a new line.
All commands (optionally) can have information, this information is automatically used by the help command (
man) to display it on the console.
You are not obliged to set the information of each command (
#set_info) but it is a good practice, to know how to use it.
In order to avoid modders overwriting the vanilla commands,
all mod commands will be added once all sana revamped commands are created, so they all will appear in that order on the manual, as you can see on this pic
That's it for now
For the next devlog, I was planning to work on the localisation module to allow mods to add their translations and modify the current ones, but I think I'll leave that for the one after the next and get to work on adding support for game pictures, which I started working on today.
I want to allow modders to modify
all pictures shown in-game without overwriting the vanilla pics, combine this with the sex framework animations and you will be able to change the whole game art, without touching the RPG Maker editor at all or worrying about breaking the game by overwriting something by mistake or whatever.