Problems with Mods after v1.5.40 update

Post Reply
Adebar
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Oct 14, 2014 10:39 pm
Location: HRR

Problems with Mods after v1.5.40 update

Post by Adebar »

rbodleyscott wrote: Wed Jan 26, 2022 11:00 am (Added to this post by RBS as I cannot insert a post above the posts transferred from the thread where they were off-topic)
Some mods won't work correctly in v1.5.40 until they have been updated.

This is mostly because the new parser is stricter than the old one, and will not allow extraneous extra ")"s at the ends of lines.

Though, as usual after an update, some mods with modded scripts may also fall foul of other changes to the vanilla scripts, which may make their modded scripts invalid - e.g. a change in the number of parameters that a function expects.
rbodleyscott wrote: Sat Jan 22, 2022 7:53 am The latest parser in the game engine is intolerant of extraneous ")" at the end of statements. The old parser used to ignore these, hence they slipped through un-noticed.
Sorry if that is not the adequate place to bring this up:

The same error appears with the custom Pyrrhus the Eagle campaign which can be downloaded from within the game - and causes a CTD.

Image

I experience CTDs with the same error message ("Context: FUNCTION IsKeil(me)" etc.) with two of my custom scenarios (unpublished).

Have invested much time and work in these scenarios - is there an easy way to fix this problem?
Image

IC XC
NI KA
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28044
Joined: Sun Dec 04, 2005 6:25 pm

Re: Rise of AI Global Mod v3.1/v3.0

Post by rbodleyscott »

Adebar wrote: Tue Jan 25, 2022 9:25 pm
rbodleyscott wrote: Sat Jan 22, 2022 7:53 am The latest parser in the game engine is intolerant of extraneous ")" at the end of statements. The old parser used to ignore these, hence they slipped through un-noticed.
Sorry if that is not the adequate place to bring this up:

The same error appears with the custom Pyrrhus the Eagle campaign which can be downloaded from within the game - and causes a CTD.

Image

I experience CTDs with the same error message ("Context: FUNCTION IsKeil(me)" etc.) with two of my custom scenarios (unpublished).

Have invested much time and work in these scenarios - is there an easy way to fix this problem?
Yes. Remove the second ) at the end of the

block_size = percent * GetAttrib(me, "UnitSize"));

line, in the modded version of CombatTools.BSF in the custom "campaign" folder.

Then run the scenario again. If that reveals any further ) errors, do the same for whatever function the error message throws up - in the modded scripts in the scenario "campaign" folder.
Richard Bodley Scott

Image
Adebar
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Oct 14, 2014 10:39 pm
Location: HRR

Re: Rise of AI Global Mod v3.1/v3.0

Post by Adebar »

Thanks for the info, Richard!

There seem to be more problems with the campaign scripts, error messages continue to pop up like this:

Image

Hope that Desicat will fix his campaign if he finds the time.

Checking my scenarios now. I wish the new parser would behave a bit more ... tolerant. :wink:

EDIT:

Have checked my customs scens: The modded combattool files are causing the problems there too. Removing the files solves that.
Image

IC XC
NI KA
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28044
Joined: Sun Dec 04, 2005 6:25 pm

Re: Rise of AI Global Mod v3.1/v3.0

Post by rbodleyscott »

Adebar wrote: Wed Jan 26, 2022 8:11 amHave checked my customs scens: The modded combattool files are causing the problems there too. Removing the files solves that.
Why were the modded script files in there if you didn't need their mods?

If you do need them, back them up, copy the files from the current vanilla build, then re-add the mods.

I am wondering why the Pyrrhos the Eagle campaign and Pyrrhos at Sparta scenario needed modded scripts. You could try simply removing all of the modded scripts from it.
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28044
Joined: Sun Dec 04, 2005 6:25 pm

Re: Rise of AI Global Mod v3.1/v3.0

Post by rbodleyscott »

On a quick compare, I found two mods in the Pyrrhos CombatTools.bsf.

There may, of course, be more.

In GetImpactPOA()

Code: Select all

	// Scythed Chariots
	if (IsUnitSquadType(me, "Scythed_Chariots") == 1)
		{
			if (enemy == -1)
				{
					if (print == 1)
						{
							any_printed = 1;
							PrintStringIndexedX(1, test, "IDS_SQUADTYPE", 17);
							PrintStringLiteralX(1, test, ": ");
							PrintStringX(1, test, "IDS_UI_INFO_IMPACT_SPARTAN_HEROS");
							PrintStringLiteralX(1, test, "\n");
						}

					increment = 250;  // average vs horse and foot
					POA += increment;
				}
			else
The mod is IDS_UI_INFO_IMPACT_SPARTAN_HEROS

Code: Select all

// Returns 1 if unit is baggage, otherwise 0
FUNCTION IsBaggage(id)
{
	int ret;
	
	ret = 0;
	
	GetUnitTypeString(GetUnitTypeIndex(id));	
	if (StringCompareLeft(GetWorkString(),"Hospital_Cart",7) == 1)
		{
			ret = 1;
		}
	
	return ret;
}
The mod is

"Hospital_Cart" instead of "Baggage"
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28044
Joined: Sun Dec 04, 2005 6:25 pm

Problems with Mods after v1.5.40 update

Post by rbodleyscott »

Some mods won't work correctly in v1.5.40 until they have been updated.

This is mostly because the new parser is stricter than the old one, and will not allow extraneous extra ")"s at the ends of lines.

Though, as usual after an update, some mods with modded scripts may also fall foul of other changes to the vanilla scripts, which may make their modded scripts invalid - e.g. a change in the number of parameters that a function expects.
Richard Bodley Scott

Image
Adebar
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Oct 14, 2014 10:39 pm
Location: HRR

Re: Rise of AI Global Mod v3.1/v3.0

Post by Adebar »

rbodleyscott wrote: Wed Jan 26, 2022 10:41 am Why were the modded script files in there if you didn't need their mods?
Funny enough, I have no idea. :mrgreen:

Did the scenarios years ago, therefore I can´t recall all the details of the design process. My guess is that ages ago someone did some awesome small mod using those files that I incorporated in the scens and I completely suppressed their existence afterwards.
Image

IC XC
NI KA
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 927
Joined: Tue Nov 29, 2016 6:12 am

Re: Problems with Mods after v1.5.40 update

Post by Schweetness101 »

is this line in AI.bsf supposed to be commented out:
cost = CheckFallBackPossible(me, x2, y2, 0); // v1.3.57 change. Fallback
or am I messing something up by even having that? it's in the field of glory base ai.bsf, not a mod one.
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28044
Joined: Sun Dec 04, 2005 6:25 pm

Re: Problems with Mods after v1.5.40 update

Post by rbodleyscott »

Schweetness101 wrote: Mon Feb 07, 2022 1:45 am is this line in AI.bsf supposed to be commented out:
cost = CheckFallBackPossible(me, x2, y2, 0); // v1.3.57 change. Fallback
or am I messing something up by even having that? it's in the field of glory base ai.bsf, not a mod one.

Code: Select all

//														cost = CheckFallBackPossible(me, x2, y2);
														cost = CheckFallBackPossible(me, x2, y2, 0); // v1.3.57 change. Fallback
Only the first of these two lines is commented out. The reason is because an extra parameter was added to the CheckFallBackPossible() function in v1.3.57 - which was almost certainly before you developed your mod.

The correct version is:

Code: Select all

cost = CheckFallBackPossible(me, x2, y2, 0); // v1.3.57 change. Fallback
A comment at the end of a line does not comment out the line.
Richard Bodley Scott

Image
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 927
Joined: Tue Nov 29, 2016 6:12 am

Re: Problems with Mods after v1.5.40 update

Post by Schweetness101 »

right yeah I was confused why it seemed to have two calls to the same function where the second would just reset the value of cost, so i was wondering if one of them needed // at the beginning of the line, but what's weird is that 4 parameter version seems to be giving me errors and I think the mod only calls it in that one place, maybe I am redefining it somewhere.
Last edited by Schweetness101 on Mon Feb 07, 2022 10:35 pm, edited 1 time in total.
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 927
Joined: Tue Nov 29, 2016 6:12 am

Re: Problems with Mods after v1.5.40 update

Post by Schweetness101 »

so the error I get is:
Image

which is weird as that's what the vanilla, not the mod file, looks like, and the mod does overwrite AI.bsf, so maybe it's not picking up the mod version of AI.bsf? Weirdly, if I just comment out the 4 parameter line, then it works. Dunno why it's expecting 3 parameters in the mod when this didn't cause an issue before.

also, shouldn't the 3 parameter one on the previous line in vanilla cause an error if it's supposed to have 4 parameters? or does it assume a default value for non included parameters?
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 927
Joined: Tue Nov 29, 2016 6:12 am

Re: Problems with Mods after v1.5.40 update

Post by Schweetness101 »

oh it's because of this change in tools.bsf:
// Checks whether fall back is possible
// Returns true cost of fallback if it is possible, otherwise -2;
// v1.5.37 change - ignore ZOCs if breakoff.
//FUNCTION CheckFallBackPossible(me, tilex, tiley)
FUNCTION CheckFallBackPossible(me, tilex, tiley, breakoff) // v1.5.37 change
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28044
Joined: Sun Dec 04, 2005 6:25 pm

Re: Problems with Mods after v1.5.40 update

Post by rbodleyscott »

Schweetness101 wrote: Mon Feb 07, 2022 9:42 pm oh it's because of this change in tools.bsf:
// Checks whether fall back is possible
// Returns true cost of fallback if it is possible, otherwise -2;
// v1.5.37 change - ignore ZOCs if breakoff.
//FUNCTION CheckFallBackPossible(me, tilex, tiley)
FUNCTION CheckFallBackPossible(me, tilex, tiley, breakoff) // v1.5.37 change
Ah, right, seems that v1.3.57 in the comment in the other place is a typo for v1.5.37. Hence probably after you did the mod.
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28044
Joined: Sun Dec 04, 2005 6:25 pm

Re: Problems with Mods after v1.5.40 update

Post by rbodleyscott »

Schweetness101 wrote: Mon Feb 07, 2022 9:34 pm right yeah I was confused why it seemed to have two calls to the same function where the second would just reset the value of cost, so i was wondering if one of them needed // at the beginning of the line, but what's weird is that 4 parameter version seems to be giving me errors and I think the mod only calls it in that one place, maybe I am redefining it somewhere.
The first call is commented out, so isn't called.
Richard Bodley Scott

Image
Post Reply

Return to “Field of Glory II: Modding”