includes order

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

includes order

Post by enric »

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?
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: includes order

Post by pipfromslitherine »

The include search order is:

<current>
<campaign>/data/battle/scripts
<campaign>/data/scripts
data/battle/scripts
data/scripts

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: includes order

Post by enric »

Thank you,.
I'm sorry for my incompetence but, <current> means <campaign>/scenarios ?
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: includes order

Post by pipfromslitherine »

<current> is the folder that the original script that is being loaded is in.

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: includes order

Post by enric »

But when is the scenarioName.bsf loaded?, is the first one?
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: includes order

Post by pipfromslitherine »

Scripts are loaded in various orders. The scenario script is loaded quite early in the battle startup.

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: includes order

Post by enric »

pipfromslitherine wrote:Scripts are loaded in various orders. The scenario script is loaded quite early in the battle startup.

Cheers

Pip
But first o later than the units actions scripts?
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: includes order

Post by pipfromslitherine »

How would that affect the include order, or am I misunderstanding the problem?

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: includes order

Post by enric »

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.
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: includes order

Post by pipfromslitherine »

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
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: includes order

Post by enric »

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
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.

I know you're out the office until next year, we will retake this later.
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: includes order

Post by pipfromslitherine »

Yes - the two scripts are not related. So both will need an include statement at the top of them.

Cheers

Pip
follow me on Twitter here
Post Reply

Return to “Battle Academy 2: Modders Corner”