@Bruce The way I do this is simple, but when it comes to some little specifics they can be (a little) tricky. I have a TON/LOT of animation scripts working for #importing/#including, but the only animation script I cannot run like that is drago.c itself. That's because if I try including it while I have it imported, the log will put a message saying there's a memory leak and that could be too much script to read, I think. Now, I use drago.c for one of the characters only. I will use it for another character later. Also, I will figure out to make drago_actual.c working again later. I made several attempts to make it work but failed.
Here, I import one animation script to a real one.
script.c:
C:
#import "data/scripts/actual/script_actual.c"
And in a real animation script I am using, I include these and some of them have plenty scripts/functions too. Some have small functions. All scripts that I included DO work except drago.c.
script_actual.c:
C:
#include "data/scripts/paus0001.c" //Pause effect (Courtesy of Damon Caskey)
#include "data/scripts/dcancel.c" // Yes, it's #included in this animation script, but it's also #imported from keyall.c
#include "data/scripts/jumpmode.c" //Jump mode (Courtesy of Piccolo for the jumping template, and maxman for creating new jump types from the template) / WARNING: THIS IS VERY IMPORTANT!!!
#include "data/scripts/ani0020.h" //Animation (Courtesy of Damon Caskey)
#include "data/scripts/shadow.c" // Shadow script (Courtesy of msmalik681)
#include "data/scripts/library/basic.h" // Script library (Courtesy of Bloodbane)
#include "data/scripts/library/spawn.h" // I also included parts of the library scripts from Bloodbane and they do work ;)
#include "data/scripts/library/target.h"
#include "data/scripts/aniScp.c" // Tons of scripts from MatMan and they do definitely work, but one single file of it is imported too.
//#include "data/scripts/drago.c" // This is the only animation script I can't run due to some unusual specifics, I think.
If you're wondering dcancel.c being included in animation script and imported from keyall.c, this is because I wanted to include keys to press (as part of animation script(?)).
C:
#import "data/scripts/dcancel.c"
#import "data/chars/misc/continueanim/contkey.c"
//#import "data/scripts/BasicKeycapture.c"
void main(){
daimaoKeyCancel();
continueKey();
}
dcancel.c is an animation script because there's no name for void main() in it. It has a couple of the lines #imported.
C:
#import "data/scripts/common/mathutil.c"
#import "data/scripts/anim/direction.c"
Eh! They're animation scripts too I noticed!
ani0020.h is included in the real one:
C:
#import "data/scripts/actual/ani0020_actual.h"
in ani0020_actual.h file, you have this here.
C:
#include "data/scripts/ani0009.h"
For ani0009.h, same thing I did with ani0020.h, but I don't really have to put it inside script_actual.c file.
If you're also wondering about the use of aniScp.c (animation script from OpenBORStats) working with lots of scripts in it, I started to #import this because it has
plenty functions.
aniScp.c:
Code:
#import "data/scripts/actual/aniScp_actual.c"
Because I cannot use drago.c in script_actual.c file, I use these to include for one character that can use functions in drago.c.
drago.c:
Code:
#include "data/scripts/script.c"
#include "data/scripts/aniScp.c"
Note that the two scripts that I included are all imported as I gave as an example.
For your case, I don't know. It seems like you are confused about the use of directives on specific scripts. Here, I use
@Mr.Q!'s Fight Forever demo as an example for minimizing memory with script. Not sure if I did it with this, but I'm quite sure I did it with my ROD project and yes, it compressed/shrunk its size smaller. I also can conclude that I did the same thing with his FF project.
For example, I had this lib001.c file in the scripts folder and placed specific scripts here in the following without creating a folder for it.
C:
#import "data/scripts/shadow.c"
#import "data/scripts/main_audio.c"
#import "data/scripts/frameland.c"
The easiest thing is renaming it as "file_name_actual.c" and placing it in the named actual subfolder of the scripts folder. However, the next part is tricky because leaving them as is causes a crash in the renamed file. What I did was that I needed to find which one I can include for it to not crash. I chose to #import main_audio.c in lib001.c in the main scripts folder like this here.
lib001.c:
C:
#import "data/scripts/actual/lib001_actual.c"
#import "data/scripts/main_audio.c"
(You can use #import or #include on main_audio.c in lib001.c because I just tested it and both of them work for me. But I prefer using #import since it was originally created for the sounds of hitting objects.)
lib001_actual.c:
Therefore, I leave the other two scripts in lib001_actual.c here.
C:
#import "data/scripts/shadow.c"
#import "data/scripts/frameland.c"
After solving that problem, I figured out where main_audio.c file comes from. It was #imported from main_didhit.c because main_didhit.c is used as didhitscript for a playable character to hit objects for hearing sounds.
This character has main_didhit for hitting obstacles.
Code:
didhitscript data/scripts/main_didhit.c
main_audio.c is #imported in main_didhit.c.
main_didhit.c:
C:
#import "data/scripts/main_audio.c"
Find one that doesn't cause a crash for your animation script(s), and the other that does. Check which files and/or functions you linked to (or from) and inspect where they (directly) come from and where they are directed to. It might sound confusing to you, but you can give it a try. Look out for some specifics and be careful with directing stuff with #include and #import.