SCP Reader

September 2020 note: the parser bug where the command params were incorrect should now be fixed, but take note of the issue with the rand2 command (see Issues and Todos) at the bottom of this page.

June 2021 note: corrected an oversight where the output file showed only the first byte in a command parameter; make sure to redownload if needed.

(or: the petzy adventures of your friendly local curatorial shut-in)

The SCP reader is a small program I wrote to break down .scp files into a human-readable format based on what is currently (time of writing May 2020) understood about the file structure (see SCP Research for details). It reads in an scp and outputs a text file with the details. Note that it does not edit the scp, and the purpose of many details is still unknown; this program is intended to help further research into understanding the scp format.

Pictured below is part of the output textfile from the mouse scp:

Part of the output from the mouse .scp

(Want to know more about this stuff? Come join us on the Petz Hacking and Modding Discord!)

http://discord.gg/bFanqDT

You will need some basic understanding of how to navigate a command line terminal to run the reader. A quick search for "command line basics" should give you what you need - all you should need to know is how to move between folders and run programs.

If you don't want to use the command line, there is now a web based version - see below.

Using the Reader

Web based

Extract the SCP you want to read and upload it at the Petz SCP Parser. This will return a text output in your browser.

Web based parser

Command line based

You can download the reader from my Github repo (feel free to fork and improve if you wish). Unzip to whatever location you prefer.

Repo

If you don't already have NodeJS installed, go get it. If you have no idea what that is, don't panic, it's just a framework that allows you to run Javascript from your computer's command line instead of the browser, where it normally runs. If you're not sure about versions, just get the one labelled "Reccomended for Most Users".

https://nodejs.org/

Now, in the command line, navigate to the folder that you unzipped the files to - it should be the one that contains the file reader.js. It'll probably be called 'petz-scp-reader' unless you changed it.

Command prompt in the reader directory

Install the reader by typing 'npm install' into the command line. This shouldn't take long.

Now you're ready to go. I've included several scp files extracted from the game (Petz 4, if you're curious). You can read these in by typing 'node reader.js (name of scp)' into the command line. For example to read the mouse scp, type 'node reader.js mouse.scp'. You should see something like this:

Results of successfully reading an scp

If you don't, check that you installed the reader, that you're in the right directory (it should contain both reader.scp and the file you want to read) and you inputted the command properly.

If you do, everything worked okay! Inside the reader directory you should see a file called 'output'. This is a plain textfile so you can open it in any text editor you choose.

Start of output for mouse.scp

Extracting SCPs from the game

If you want to read in any scps other than the samples, you'll need to extract them yourself. Fortunately LNZ Pro makes that easy. Open up the file that contains the scp you want to read in - this will be either a breedfile, or one of the rez.dll files. Navigate to the scp in the left hand menu, right click, and choose "Save to file"

Saving the mutt scp

Save it to your petz-scp-reader directory:

Saving the mutt scp

You can now run the reader on your extracted scp!

Output for the mutt scp

Issues and Todos

Issues

rand2 command

Due to the way the verb table is structured, rand2 appears to be a separate command. It's actually a parameter of the command that comes before it, with the rand2 parameters being the upper and lower bound for the random number it returns. So if you see something in the output like:

27: playAction2, 0000008E

2F: rand2, 00000001, 00000007

then interpret this as "playaction2(8E, random-number-between-1-and-7)". 8E is the first parameter, the random number is the second.

Extra parameters

Occasionally a number will appear as a parameter, but does not actually do anything. Take this example:

33: sequence2, 0000312C, 00003133

09: cueCode1, stepFootL, 00003134

The second parameter for cueCode1 (00003134) is not valid and the game does not actually do anything with it. The game itself will skip these commands but the parser currently shows them. I am looking into a fix but for now, to check if a parameter is valid, look at the number in the command name - this denotes the amount of parameters the command accepts. In this example we can see that the two parameters after sequence2 are valid because the name "sequence2" indicates it accepts two parameters. However the second parameter for cueCode1 is invalid because cueCode1 already has a parameter (stepFootL), and only accepts one.

Todos

Things I'd like to do sometime:

Back