includes order
Moderators: Slitherine Core, BA Moderators
includes order
It seems that a functions included in a file "E_FUNCTIONS.BSF" placed in the scenario folder, can't be called from an Action unit (DATA/BATTLE/SCRIPTS).
If placed in DATA/SCRIPTS and added as include in $DEFAULT then the standard FUNCTIONS is needed and... well the question is, which is the order?
If placed in DATA/SCRIPTS and added as include in $DEFAULT then the standard FUNCTIONS is needed and... well the question is, which is the order?
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: includes order
The include search order is:
<current>
<campaign>/data/battle/scripts
<campaign>/data/scripts
data/battle/scripts
data/scripts
Cheers
Pip
<current>
<campaign>/data/battle/scripts
<campaign>/data/scripts
data/battle/scripts
data/scripts
Cheers
Pip
follow me on Twitter here
Re: includes order
Thank you,.
I'm sorry for my incompetence but, <current> means <campaign>/scenarios ?
I'm sorry for my incompetence but, <current> means <campaign>/scenarios ?
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: includes order
<current> is the folder that the original script that is being loaded is in.
Cheers
Pip
Cheers
Pip
follow me on Twitter here
Re: includes order
But when is the scenarioName.bsf loaded?, is the first one?
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: includes order
Scripts are loaded in various orders. The scenario script is loaded quite early in the battle startup.
Cheers
Pip
Cheers
Pip
follow me on Twitter here
Re: includes order
But first o later than the units actions scripts?pipfromslitherine wrote:Scripts are loaded in various orders. The scenario script is loaded quite early in the battle startup.
Cheers
Pip
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: includes order
How would that affect the include order, or am I misunderstanding the problem?
Cheers
Pip
Cheers
Pip
follow me on Twitter here
Re: includes order
It's probably I don't explain well, I'll try.
In a new unitActionScript I created a function [myFunction].
All works ok.
Then, I believe that function will be useful for other purposes in the future.
I use to place the general functions in "E_FUNCTIONS.BSF" placed next to the scenarioName.BSF <campaign>/scenarios.
The [include "E_FUNCTIONS.BSF"] is placed at the beginning of the scenarioName.bsf
As I assumed the double check of the compiler or runtime: first loading everything, second checking calls, relations, double definitions, etc. I hope it will work, but the compiler say: "Failed to find variable [myFunction]. Did you forget…"
So the order should be important.
In a new unitActionScript I created a function [myFunction].
All works ok.
Then, I believe that function will be useful for other purposes in the future.
I use to place the general functions in "E_FUNCTIONS.BSF" placed next to the scenarioName.BSF <campaign>/scenarios.
The [include "E_FUNCTIONS.BSF"] is placed at the beginning of the scenarioName.bsf
As I assumed the double check of the compiler or runtime: first loading everything, second checking calls, relations, double definitions, etc. I hope it will work, but the compiler say: "Failed to find variable [myFunction]. Did you forget…"
So the order should be important.
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: includes order
Ah - well the other script won't find anything in the scenarios folder unless the script itself is being loaded from there. Move the E_FUNCTIONS file to the local DATA/SCRIPTS folder and they should both be able to find it.
Cheers
Pip
Cheers
Pip
follow me on Twitter here
Re: includes order
It doesn't work. You need to put the include in $default.BSD and in the scenario.BSF, and I'm not sure about putting the same include in two different places.pipfromslitherine wrote:Ah - well the other script won't find anything in the scenarios folder unless the script itself is being loaded from there. Move the E_FUNCTIONS file to the local DATA/SCRIPTS folder and they should both be able to find it.
Cheers
Pip
I know you're out the office until next year, we will retake this later.
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: includes order
Yes - the two scripts are not related. So both will need an include statement at the top of them.
Cheers
Pip
Cheers
Pip
follow me on Twitter here