Scripting the AI....

Moderators: rbodleyscott, Slitherine Core, Gothic Labs

cavehobbit
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Tue Dec 07, 2010 2:31 pm
Location: Sweden

Re: Scripting the AI....

Post 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?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28294
Joined: Sun Dec 04, 2005 6:25 pm

Re: Scripting the AI....

Post 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.
Richard Bodley Scott

Image
parmenio
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 105
Joined: Sun Jan 10, 2010 5:41 pm

Re: Scripting the AI....

Post 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.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28294
Joined: Sun Dec 04, 2005 6:25 pm

Re: Scripting the AI....

Post 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.
Richard Bodley Scott

Image
parmenio
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 105
Joined: Sun Jan 10, 2010 5:41 pm

Re: Scripting the AI....

Post 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 :D
You are, of course, correct - that's a much cleaner way of doing things.
parmenio
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 105
Joined: Sun Jan 10, 2010 5:41 pm

Re: Scripting the AI....

Post 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.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28294
Joined: Sun Dec 04, 2005 6:25 pm

Re: Scripting the AI....

Post by rbodleyscott »

Edit: Removed as factual error
Richard Bodley Scott

Image
pipfromslitherine
Site Admin
Site Admin
Posts: 9872
Joined: Wed Mar 23, 2005 10:35 pm

Re: Scripting the AI....

Post by pipfromslitherine »

DebugLog command can output strings to the error.log file.

Cheers

Pip
follow me on Twitter here
parmenio
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 105
Joined: Sun Jan 10, 2010 5:41 pm

Re: Scripting the AI....

Post 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.
parmenio
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 105
Joined: Sun Jan 10, 2010 5:41 pm

Re: Scripting the AI....

Post by parmenio »

I've put a bunch of DebugLog calls in my script file but nothing is being written to the error.log file.
pipfromslitherine
Site Admin
Site Admin
Posts: 9872
Joined: Wed Mar 23, 2005 10:35 pm

Re: Scripting the AI....

Post by pipfromslitherine »

Hmmm. I will check it out. Note that the file is reset each time you run the game.

Cheers

Pip
follow me on Twitter here
Post Reply

Return to “Scenario Design”