Talk:Village/@comment-24.112.18.99-20130726040227/@comment-9531161-20130726044910

Well, I just kind of waved my hands and it all worked. I call it magic.

Lol really all you have to do is preload all the junk you want to save together, then give a special string when saving. You also have to remove all the "load spu" stuff in your program, since they'll always be loaded. This mystical string is a sequence of 5 hexadecimal characters, which when interpretted as binary tell the SAVE command which preloaded things you want to save along with your program. So, this string: "12345" in binary looks like:

0001-0010-0011-0100-0101

Where each group of 4 bits is a single character in the string. I'm only going to go over sprites (since they're the easiest and that's what you hopefully wanted), so let's take a look. The last 2 groups of bits (0100 and 0101) represent which SPUs we want to save with our program. These are read right to left, so the 0 bit on the very left of 01000101 means "SPU7" and the 1 bit all the way on the right of 01000101 means "SPU0". A 1 means you want to save that SPU along with the program. So in our example of the last 8 bits being 01000101, we're saving SPU0, SPU2, and SPU6 with our program. Remember that before you save as a package, you have to load these sprite sheets into their respective locations. For instance, if you have a sprite sheet named "DUDE" that you want to save as SPU6 with your program, you'd have to issue the command LOAD "SPU6:DUDE" before using the special save command. Let's use Village as an example: I've got SPUs 0,1,2,4,5, and 6 filled right now. So the bits look like:

0111-0111 (remember, they're "backwards", so those two 0s are SPU7 and SPU3 when read left to right). I'm not going to save anything else, so all those other bits I talked about are just going to be 0, so all the bits look like:

0000-0000-0000-0111-0111

Now I just convert each of these 5 clumps into hexadecimal. If you don't know how to do this, use the Windows calculator and set it to programmer mode. Then change the calculator to "binary mode" and enter your 4 bit sequence (like 0111), then change back to hexadecimal mode. It should display the hex code for that number. Luckily, I just know how to do it in my head, so I'll just do that now:

00077

Now that I know my special sequence, I'll go ahead and preload all my SPUs. Just do this in the regular console. Finally, get rid of the LOAD "SPU" stuff in your program and type the command:

SAVE "VILLAGEP", "00077"

It's always a good idea to save the package as a different name for a couple of reasons. One is if you mess up, you haven't just ruined all your code. Another is that if you edit a program that's been saved as a package and then try to save it regularly, it'll depackage and save just the program portion.

I guess it's actually a little complicated, but once you successfully do it the first time, you'll get it.