• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
June 14, 2021, 10:56:27 pm

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen/RetroArch is recommended for playing/testing, pSX is recommended for debugging.


FFTPatcher scripting with IronPython

Started by Raijinili, February 13, 2021, 12:38:18 am

Raijinili

Who is this for?

Python programmers who want to make a lot of repetitive changes, or want to help make repetitive changes. However, anyone who wants to learn Python can use this as a goal in mind.


What is this?

This intro will look a bit jargony, but please bear with me.

FFTPatcher is written in C#, compiled for .NET. What that means for us is, you can use its internal code in other Microsoft CLR languages.

Python is known as a popular beginner programming language, but also powerful enough to continue using for professional programmers, especially in scientific and numerical analysis.

IronPython is an interpreter for the Python programming language which runs on CLR. That means an IronPython program can load code in from FFTPatcher, and then execute it. Instead of navigating through the program itself, you write code, and then run it to make or change a patch.


What can be done with this?

Fundamentally, anything that FFTPatcher Suite can do, IronPython can do, but harder!

Programming has a few advantages over doing things manually:
- Repetitive work. A program doesn't get bored, so you could, for example, increase all monster Moves by 1 with just a few lines, rather than clicking through dozens of monsters.
- All your mistakes in one place! Instead of making a single typo in a file, you can make a typo in a script, and that typo will be repeated in all the files.
- Make your mod as a script. You can see all your changes in a single text file (or multiple files, if you choose to organize it that way), instead of clicking through tabs to find all changes you've made.
- Automated checks. You can make a script that ensures all gear have a reasonable cost for its power (as defined by you).
- More-direct manipulation. I believe it is possible to write a script that merges two existing FFTPatches and spits out another.
- Composability. Merging two scripts is probably easier than merging two of your patches manually. You can also break your mod up into multiple parts BECAUSE you know how easy it is to combine them.
- Reusable components. Load a library and tell it to replace all the "Dragon"s in the game to "Derpon"s.
- Version control! This topic spans many books, but think of it as branching savestates for your work. FFTPatcher creates patches in XML, but they're compressed and don't play well with version control. Version control isn't just for programmers. Here's an article for writers on using Git.


How do I start?

First, download FFTPatcher. Currently, we require version .493 or higher, because there were significant changes in the internals of the program, and we're playing with its internals.

Second, download the latest IronPython here. Unfortunately, as of this writing, IronPython hasn't caught up with Python 3, so we're stuck using Python 2.


Third, ??? <to be written>

Finally, join us on the FFH Discord, in the #fftpython channel. This is an educational channel, so make sure to stick to the topic.
  • Modding version: Other/Unknown