Page 2 of 2
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 12:43 pm
by cavehobbit
parmenio wrote:Is there an API function that gives you the name of the scenario currently being played?
In BA/BA2 I use the following lines in FUNCTION DrawScenarioUI():
Code: Select all
PrintStringLiteral("Scenario Name") ;
PrintStringLiteral(": ") ;
PrintString("IDS_SCENARIO_GNIEW”) ;
PrintStringLiteral("\n") ;
When I tried them in my Gniew scenario nothing happened:
Code: Select all
FUNCTION DrawScenarioUI()
{
StandardScenarioUI("IDS_SCENUI_VC_STANDARD", 1);
PrintStringLiteral("Scenario Name") ;
PrintStringLiteral(": ") ;
PrintString("IDS_SCENARIO_GNIEW”) ;
PrintStringLiteral("\n") ;
}
Could it be because of StandardScenarioUI?
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 1:07 pm
by rbodleyscott
cavehobbit wrote:In BA/BA2 I use the following lines in FUNCTION DrawScenarioUI():
Code: Select all
PrintStringLiteral("Scenario Name") ;
PrintStringLiteral(": ") ;
PrintString("IDS_SCENARIO_GNIEW”) ;
PrintStringLiteral("\n") ;
When I tried them in my Gniew scenario nothing happened:
Code: Select all
FUNCTION DrawScenarioUI()
{
StandardScenarioUI("IDS_SCENUI_VC_STANDARD", 1);
PrintStringLiteral("Scenario Name") ;
PrintStringLiteral(": ") ;
PrintString("IDS_SCENARIO_GNIEW”) ;
PrintStringLiteral("\n") ;
}
Could it be because of StandardScenarioUI?
What you need to do is define a string called (say)
IDS_SCENUI_VC_GNIEW, "Gniew, 1626~~Object - Rout the enemy army by:~a) Routing at least 40% of their troops ~and ",
(The second part being what is in IDS_SCENUI_VC_STANDARD)
Then
Code: Select all
FUNCTION DrawScenarioUI()
{
StandardScenarioUI("IDS_SCENUI_VC_GNIEW", 1);
}
should work.
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 4:25 pm
by parmenio
rbodleyscott wrote:No, because Campaign variables are Ints.
As I've now realised

- no matter it has become a scenario "id"
As a matter of interest, what are you hoping to do using the scenario name? Surely anything that applies to a specific scenario can be put in the scenario script?
I'm toying with the idea of altering some script functions (i.e. the copies of them I have in the campaign DATA folder for example) to provide scenario-specific functionality as well as possible mods based on DiffMode - I've noticed, for example, difficulty is already used to adjust experience and elan.
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 4:56 pm
by rbodleyscott
parmenio wrote:rbodleyscott wrote:No, because Campaign variables are Ints.
As I've now realised

- no matter it has become a scenario "id"
As a matter of interest, what are you hoping to do using the scenario name? Surely anything that applies to a specific scenario can be put in the scenario script?
I'm toying with the idea of altering some script functions (i.e. the copies of them I have in the campaign DATA folder for example) to provide scenario-specific functionality
Well as I said, the best way to do that is to use custom scenario functions called from the main scripts (if they exist) using TryToCallScenarioFunction(). See my post above.
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 6:42 pm
by parmenio
rbodleyscott wrote:Well as I said, the best way to do that is to use custom scenario functions called from the main scripts (if they exist) using TryToCallScenarioFunction(). See my post above.
I should have paid more attention to that previous post

You are, of course, correct - that's a much cleaner way of doing things.
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 8:36 pm
by parmenio
Do the Debug console entries get saved to a file anywhere?
It's almost impossible to catch log entries that I've put in there in the midst of everything else.
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 8:50 pm
by rbodleyscott
Edit: Removed as factual error
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 9:03 pm
by pipfromslitherine
DebugLog command can output strings to the error.log file.
Cheers
Pip
Re: Scripting the AI....
Posted: Mon Feb 02, 2015 9:50 pm
by parmenio
pipfromslitherine wrote:DebugLog command can output strings to the error.log file.
Cheers
Pip
Ah yes - I'd spotted that file which had nothing but "KERNEL MEMORY CHECKING IS **OFF**" in it...
...DebugLog it is.
Thanks.
Re: Scripting the AI....
Posted: Tue Feb 03, 2015 5:52 pm
by parmenio
I've put a bunch of DebugLog calls in my script file but nothing is being written to the error.log file.
Re: Scripting the AI....
Posted: Tue Feb 03, 2015 8:22 pm
by pipfromslitherine
Hmmm. I will check it out. Note that the file is reset each time you run the game.
Cheers
Pip