Utilizing *SPARE* slots in .txt files

PC/MAC : Turn based Empire building in the ancient Greek World.

Moderator: Slitherine Core

Post Reply
Mazeppa
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 30
Joined: Sun Aug 12, 2012 10:27 am

Utilizing *SPARE* slots in .txt files

Post by Mazeppa »

Looking at the game files, I've seen quite a lot of them have *spare* slots.

I'm guessing they allow for custom stuff that you could put into?? (e.g. buildings.txt has "spare" slots I'm guessing could allow for new attributes for buildings; armies.txt file has "spare slots" for new units; diptasks, localization etc).


So if I'm right on the idea (spare slots allowing for new custom stuff), how does one implement that or go about it?

E.g. let's say, in buildings.txt file, I want to make the Colossus more interesting than just bonus productivity.. and I want it to improve, say.. the naval combat ability of all units by 100%, I see nowhere in the buildings.txt file that allows me to do that, but it has "spare" slots to add properties on.. is it possible to implement that??

E.g.2: or let's say, in diptasks.txt file, I want to add some of my own diplomatic tasks, and I see "spare" slots in that file.. does that mean, I can add some of my own ideas there?? And seeing that there are "spare" action slots, does this allow me to add some of my own effects (e.g. giving a city to the tribe I'm spying on)?? If so, how??

E.g.3: let's say, in squads.txt file, I see "spare" towards the end of the file, which I'm guessing allows me to have new custom units... so let's say I want to add a special elite heavy infantry for Aeolians (like say.. sacred band), and this squad is identical to the elite hoplite, so it has their skin... would the "spare" slots in squads.txt file allow me to just fill it in there and edit each category to make it playable in the game, or is there more to it?


Tl;dr, is it possible to use the SPARE slots in these txt files to mod the game to our liking and add custom stuff we want? Or is there more to it? In other words, is it more complicated than just filling in those spare slots?

Seeing that this forum hasn't been used in a while, I won't be expecting much answers to my query.
but it'd be nice to get some answers nonetheless. :)
pipfromslitherine
Site Admin
Site Admin
Posts: 9714
Joined: Wed Mar 23, 2005 10:35 pm

Re: Utilizing *SPARE* slots in .txt files

Post by pipfromslitherine »

The older games are certainly not as mod friendly as newer titles. You should in theory be able to add new elements to the files without causing too many problems though.

Cheers

Pip
follow me on Twitter here
Mazeppa
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 30
Joined: Sun Aug 12, 2012 10:27 am

Re: Utilizing *SPARE* slots in .txt files

Post by Mazeppa »

pipfromslitherine wrote: Mon Aug 10, 2020 6:55 pm The older games are certainly not as mod friendly as newer titles. You should in theory be able to add new elements to the files without causing too many problems though.

Cheers

Pip
Thanks for the reply!

Also, it seems editing the localization.txt file and putting that change into the lang.str file seems to be required to implement additions into the game, am I right?? I did a test on making changes using point 3 at the OP post (introducing a new heavy infantry unit for Aeolians), and followed the instructions given by the localization.xls file religiously..

-- Put "Sacred Band" at ids_squadname6, as it had no unit, replacing "@" (edited on white coloured field as instructed)
-- Added a unit description at ids_squadtext6
-- Put "Sacred Band" at ids_squadbatres6
-- Added the same unit description in ids_squadbattledes6

With this done, I assumed this was all that's needed, saving it and exporting the data to the localization.txt file, replacing the original in the modkit, as well as putting Sacred Band in the squad and proxysquad txt files for good measure.

-- Changes implemented on xls file in the modkit, and saved
-- The export copy/pasted to localization.txt (deleting the previous contents in the txt file)
-- Localization.exe file run (convert main text file.exe, as I'm editing Spartan's localization), generating a H file


Right here, I wasn't sure what to do with the H file, as the instructions only ended upto the .exe file... but opening it in a hex editor, it says the Lstrings.H "defines string IDs for game".. but how to put this file into the game is something I'm clueless about, and I'm totally unsure on how to proceed forward... and I was wondering what I'm missing here.


So far, I was able to get the elite hoplite unit for Aeolians, but instead of Sacred Band, it's name was "6", and training that "6" unit and putting it into the world is responsible for making the game crash... so I was pretty sure it was because the lang.str file wasn't changed to respect those additions... but I'm not sure what to do to implement those changes.
pipfromslitherine
Site Admin
Site Admin
Posts: 9714
Joined: Wed Mar 23, 2005 10:35 pm

Re: Utilizing *SPARE* slots in .txt files

Post by pipfromslitherine »

You can't change the .h file, it is compiled into the game, so while you can change the strings, you cannot add or remove strings from the list (the order must remain the same).

Cheers

Pip
follow me on Twitter here
Mazeppa
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 30
Joined: Sun Aug 12, 2012 10:27 am

Re: Utilizing *SPARE* slots in .txt files

Post by Mazeppa »

pipfromslitherine wrote: Tue Aug 11, 2020 3:53 pm You can't change the .h file, it is compiled into the game, so while you can change the strings, you cannot add or remove strings from the list (the order must remain the same).

Cheers

Pip
It looks like I just solved the crashing problem... it seems the battlegfx.txt also needed to be edited, and by inputting the unit into the file, everything works now, and the unit can now be shown on the map. The only problem I'm having though, is that the unit does not display as "sacred band" in the screen, but "6"; also, the description I've added for the unit does not display at all in the game, but is just blanked. :( Here's the image:

https://i.imgur.com/eceO0Vc.png

Logically, I know exactly why the 6 is there. It's because I inputted the sacred band on the 6th ids_squadname on the white field as instructed in the xls file, (as well as on the 6th ids_squadtxt, ids_squadbattledes and ids_squadbatres, neither of which works... squadname and squadbatres displays as 6, and squadtxt and squadbattledes did not display).... The reason I put it on the 6th slot was because it was an unused slot, just like slots 7,8 and 9.

https://i.imgur.com/Jh7mX9y.png

I'm I doing those previous steps correctly? Because idk, it seems kinda right to me :?: .. and regarding the H file, I have no idea where exactly on the game directory I should be placing this file, because the game does not seem to see it.
pipfromslitherine
Site Admin
Site Admin
Posts: 9714
Joined: Wed Mar 23, 2005 10:35 pm

Re: Utilizing *SPARE* slots in .txt files

Post by pipfromslitherine »

The H file is never used. You can discard it. I cannot honestly recall how the system works in Spartan (it was 15 years ago...) but IIRC the lang.str file is the strings data which is built from the localisation.txt file. You should run the text EXE on your new file, then place the lang.str file into your mod.

Cheers

Pip
follow me on Twitter here
Mazeppa
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 30
Joined: Sun Aug 12, 2012 10:27 am

Re: Utilizing *SPARE* slots in .txt files

Post by Mazeppa »

pipfromslitherine wrote: Wed Aug 12, 2020 3:18 pm The H file is never used. You can discard it. I cannot honestly recall how the system works in Spartan (it was 15 years ago...) but IIRC the lang.str file is the strings data which is built from the localisation.txt file. You should run the text EXE on your new file, then place the lang.str file into your mod.

Cheers

Pip
Hey!

Just an update, it looks like I just figured it out, and everything works now! :D

https://i.imgur.com/V0NtlNN.png

What really happened was that I was unaware that a lang.str file was generated on the DATA part of the mod kit when I ran the exe, whilst the H files were generated outside the data file, which explains why I was so stumped here. :) So all I had to do was copy the lang.str file from the modkit's data folder, into the mod folder I made for the game.

Your comment right here helped me A LOT in the thinking process. :)
And hell, even if you couldn't help much, it would've been fine, since it *was* 15 years ago.. xD

But I'm glad to say, everything works as desired now.
So honestly, thanks a lot for the help! :)
pipfromslitherine
Site Admin
Site Admin
Posts: 9714
Joined: Wed Mar 23, 2005 10:35 pm

Re: Utilizing *SPARE* slots in .txt files

Post by pipfromslitherine »

Glad you are up and running!

Cheers

Pip
follow me on Twitter here
Mazeppa
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 30
Joined: Sun Aug 12, 2012 10:27 am

Re: Utilizing *SPARE* slots in .txt files

Post by Mazeppa »

pipfromslitherine wrote: Thu Aug 13, 2020 2:52 pm Glad you are up and running!

Cheers

Pip
Just a small additional question (just one, I promise. :P )

Playing the game as usual, I noticed one small oddity when using my newly created unit for a test battle...
In the battle results screen, all the info for that unit is somehow shifted to the left, like here.

https://i.imgur.com/0IybjhH.png

The Sacred Band unit's battle info are shifted to the left, whilst all the other troop battle info were normal.
What do you think could be the cause of that?
pipfromslitherine
Site Admin
Site Admin
Posts: 9714
Joined: Wed Mar 23, 2005 10:35 pm

Re: Utilizing *SPARE* slots in .txt files

Post by pipfromslitherine »

There is an ugly hack in the game which requires that the strings for this include necessary tabbing. You just need to add a pound symbol - you should see it on some of the other entries in SQUADBATRES

Cheers

Pip
follow me on Twitter here
Post Reply

Return to “Spartan & Gates of Troy”