Author Topic: Soldier Statstrings - Any way to get the numeric value? (SOLVED - Inelegantly)  (Read 7526 times)

Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
(SOLVED with some experimentation)

Here's the final code for any particular stat, 0-99.  With even 2 digit full numbers you will be limited to about 7 stats on any screen and that completely removes any Soldier Name and limits you to single letter Stat ID letter. Without a way to auto change/populate the ruleset, I don't see this as worthy of publishing as a full mod.

Code: [Select]
# TIME UNITS 10's 
  - string: "T"
    tu: [0, ~]
  - string: "1"
    tu: [10, 19]
  - string: "2"
    tu: [20, 29]
  - string: "3"
    tu: [30, 39]
  - string: "4"
    tu: [40, 49]
  - string: "5"
    tu: [50, 59]
  - string: "6"
    tu: [60, 69]
  - string: "7"
    tu: [70, 79]
  - string: "8"
    tu: [80, 89]
  - string: "9"
    tu: [90, 99]
   
# TIME UNITS Ones

  - string: "0"
    tu: [10, 10]
  - string: "1"
    tu: [11, 11]
  - string: "2"
    tu: [12, 12]
  - string: "3"
    tu: [13, 13]
  - string: "4"
    tu: [14, 14]
  - string: "5"
    tu: [15, 15]
  - string: "6"
    tu: [16, 16]
  - string: "7"
    tu: [17, 17]
  - string: "8"
    tu: [18, 18]
  - string: "9"
    tu: [19, 19]
   
  - string: "0"
    tu: [20, 20]
  - string: "1"
    tu: [21, 21]
  - string: "2"
    tu: [22, 22]
  - string: "3"
    tu: [23, 23]
  - string: "4"
    tu: [24, 24]
  - string: "5"
    tu: [25, 25]
  - string: "6"
    tu: [26, 26]
  - string: "7"
    tu: [27, 27]
  - string: "8"
    tu: [28, 28]
  - string: "9"
    tu: [29, 29]
   
  - string: "0"
    tu: [30, 30]
  - string: "1"
    tu: [31, 31]
  - string: "2"
    tu: [32, 32]
  - string: "3"
    tu: [33, 33]
  - string: "4"
    tu: [34, 34]
  - string: "5"
    tu: [35, 35]
  - string: "6"
    tu: [36, 36]
  - string: "7"
    tu: [37, 37]
  - string: "8"
    tu: [38, 38]
  - string: "9"
    tu: [39, 39]

  - string: "0"
    tu: [40, 40]
  - string: "1"
    tu: [41, 41]
  - string: "2"
    tu: [42, 42]
  - string: "3"
    tu: [43, 43]
  - string: "4"
    tu: [44, 44]
  - string: "5"
    tu: [45, 45]
  - string: "6"
    tu: [46, 46]
  - string: "7"
    tu: [47, 47]
  - string: "8"
    tu: [48, 48]
  - string: "9"
    tu: [49, 49]

  - string: "0"
    tu: [50, 50]
  - string: "1"
    tu: [51, 51]
  - string: "2"
    tu: [52, 52]
  - string: "3"
    tu: [53, 53]
  - string: "4"
    tu: [54, 54]
  - string: "5"
    tu: [55, 55]
  - string: "6"
    tu: [56, 56]
  - string: "7"
    tu: [57, 57]
  - string: "8"
    tu: [58, 58]
  - string: "9"
    tu: [59, 59]
   
  - string: "0"
    tu: [60, 60]
  - string: "1"
    tu: [61, 61]
  - string: "2"
    tu: [62, 62]
  - string: "3"
    tu: [63, 63]
  - string: "4"
    tu: [64, 64]
  - string: "5"
    tu: [65, 65]
  - string: "6"
    tu: [66, 66]
  - string: "7"
    tu: [67, 67]
  - string: "8"
    tu: [68, 68]
  - string: "9"
    tu: [69, 69]
   
  - string: "0"
    tu: [70, 70]
  - string: "1"
    tu: [71, 71]
  - string: "2"
    tu: [72, 72]
  - string: "3"
    tu: [73, 73]
  - string: "4"
    tu: [74, 74]
  - string: "5"
    tu: [75, 75]
  - string: "6"
    tu: [76, 76]
  - string: "7"
    tu: [77, 77]
  - string: "8"
    tu: [78, 78]
  - string: "9"
    tu: [79, 79]

  - string: "0"
    tu: [80, 80]
  - string: "1"
    tu: [81, 81]
  - string: "2"
    tu: [82, 82]
  - string: "3"
    tu: [83, 83]
  - string: "4"
    tu: [84, 84]
  - string: "5"
    tu: [85, 85]
  - string: "6"
    tu: [86, 86]
  - string: "7"
    tu: [87, 87]
  - string: "8"
    tu: [88, 88]
  - string: "9"
    tu: [89, 89]

  - string: "0"
    tu: [90, 90]
  - string: "1"
    tu: [91, 91]
  - string: "2"
    tu: [92, 92]
  - string: "3"
    tu: [93, 93]
  - string: "4"
    tu: [94, 94]
  - string: "5"
    tu: [95, 95]
  - string: "6"
    tu: [96, 96]
  - string: "7"
    tu: [97, 97]
  - string: "8"
    tu: [98, 98]
  - string: "9"
    tu: [99, 99]



==================

Started trying my hunch below and I have it working for 50-59, just need to do all the typing unless someone has a more elegant solution:

Code: [Select]
statStrings:
# 10's 
  - string: "T"
    tu: [0, ~]
  - string: "1"
    tu: [10, 19]
  - string: "2"
    tu: [20, 29]
  - string: "3"
    tu: [30, 39]
  - string: "4"
    tu: [40, 49]
  - string: "5"
    tu: [50, 59]
  - string: "6"
    tu: [60, 69]
  - string: "7"
    tu: [70, 79]
  - string: "8"
    tu: [80, 89]
  - string: "9"
    tu: [90, 99]
  - string: "10"
    tu: [100, ~]
# Ones   
  - string: "0"
    tu: [50, 50]
  - string: "1"
    tu: [51, 51]
  - string: "2"
    tu: [52, 52]
  - string: "3"
    tu: [53, 53]
  - string: "4"
    tu: [54, 54]
  - string: "5"
    tu: [55, 55]
  - string: "6"
    tu: [56, 56]
  - string: "7"
    tu: [57, 57]
  - string: "8"
    tu: [58, 58]
  - string: "9"
    tu: [59, 59]

------------------------

Hello All,

I have searched the forum and also the wiki for examples of StatStrings in order to attempt to use my original setup from my DOSbox install of UFO: Enemy Unknown/UFO Defence

I see how the OpenXCOM current ruleset is arranged but I don't see how I can get what I would like without several pages of entries.

Here is what I use in DOSbox with orig XCOMUtil.cfg  It gives a prefix and then the numeric number (total Value divided by 10 per XCOMutil) for namestat: /T7B5s5F5r5P1p8

T t:0-255
# t
B b:0-255
# b
s s:0-255
# s
F f:0-255
# f
r r:0-255
# r
P k:0-255
# k
p q:0-255
# q

An example at UFOpaedia shows this using orig XCOMUtil w/o the '#' character but I'm not sure how it would be translated to OpenXCOM code w/o several nested/consecutive blocks for each soldier stat.

2 s:20-29
3 s:30-39
4 s:40-49
5 s:50-59
6 s:60-69
7 s:70-71

0 s:20-20
1 s:21-21
2 s:22-22
3 s:23-23
4 s:24-24
5 s:25-25
6 s:26-26
7 s:27-27
8 s:28-28
9 s:29-29.....


Since I can't see if the "#" symbol is active in the current code, I found this that looks like something close but I think this would take several different blocks to work and I don't know if they would work together if at all.  And it is still ranges and not the single number.  I guess I could just make all the extra lines for smaller ranges if that would work?  Or could I copy the example above into the same layout for individual digits.

 - string: "a"
   firing: [0, ~]
 - string: "0"
   firing: [0, 49]
 - string: "1"
   firing: [50, 57]
 - string: "2"
   firing: [58, 65]
 - string: "3"
   firing: [66, 73]
 - string: "4"
   firing: [74, 81]
 - string: "5"
   firing: [82, 89]
 - string: "6"
   firing: [90, 97]
 - string: "7"
   firing: [98, 105]
 - string: "8"

Using these two above, is this the format that is needed?

 - string: "T"
   tu: [0, ~]
 - string: "1"
   tu: [10, 19]
 - string: "2"
   tu: [20, 29]
 - string: "3"
   tu: [30, 39]
 - string: "4"
   tu: [40, 49]
 - string: "5"
   tu: [50, 59]
 - string: "6"
   tu: [60, 69]
 - string: "7"
   tu: [70, 79]
 - string: "8"
   tu: [80, 89].......

Followed by:

- string: "0"
   tu: [10, 10]
 - string: "1"
   tu: [11, 11]
 - string: "2"
   tu: [12, 12]
 - string: "3"
   tu: [13, 13]
 - string: "4"
   tu: [14, 14]
 - string: "5"
   tu: [15, 15]
 - string: "6"
   tu: [16, 16]
 - string: "7"
   tu: [17, 17]


Would that pattern work for each STAT ?  Do I have to list the individual numbers nested within the "tens" instead of after?
 

I may just not be seeing the simple solution to this and would appreciate any help.

Thanks


« Last Edit: September 27, 2017, 09:22:01 pm by spoidex »

Offline SteamXCOM

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Not sure what you are trying to do, OPENXCOM does open old Geoscape saves of the original game and seems to transfer soldier stats unless I'm missing something.

It even starts counting for the soldier medals if you are running that mod

One thing I discovered from an old save I was about to run a 2 mil deficit.
OpenXCOm has all the maintenance across all the bases on whatever screen your looking at in BASE INFORMATION>MONTHLY COSTS
The original game you have to go thru each screen and add them up to get the total maintenance which in my case was 2 mil more than what I was bringing in .

Apparently I did not understand math the screens at the time and  hired a shipload of scientists which now I'll have to fire

Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Quote
OPENXCOM does open old Geoscape saves of the original game and seems to transfer soldier stats unless I'm missing something.

This is for starting a new game for a new install for my grandson.

When I turn on Statstrings for a new install, it is going to use the Standard copy of C:\Program Files (x86)\OpenXcom\standard\XcomUtil_Statstrings.rul, is what I thought it would do.

Meaning if I want my old custom statstrings I have to modify inside the OpenXCOM .rul format?

Are you saying that if i copy an old DOSBox save game and open it in OPENXcom, it will rewrite the XcomUtil_Statstrings.rul to match those saved statstrings?  Or is it just going to ignore the saved statstrings after the name (which in the case of my saved game has only Rank Abbreviation from Xcomutil and the custom statstrings, I erase the names when starting on DOSBox XCOM).

My old version of Xcomutil custom statstrings used the '#' code so it was always only a single number (total/10).  But the UFOpaedia entry for statstrings doesn't even mention the '#' code.

So I decided to see if I could use OpenXcom statstrings format to get the actual full stat number.  I was hoping there was maybe a more succinct option or a function that I hadn't found already to write this into XcomUtil_Statstrings.rul.

Did I make that understandable or just more confusing, sorry, I am just a plinker and not a coder at all.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
You do not have to modify the standard copy, it is even considered bad practice since you run the risk of losing your changes when installing a new version.

If you want your own version just copy the XcomUtil_Statstrings.rul  to your personal mod-folder and adapt that version. Ingame you can activate this personal mod (be sure to put it somewhere near the lower end of the list to ensure it takes preference over any other statstring version from other mods).

As for your question about the dosbox saves.
I do believe the converter only takes the soldiers values (stats, name , etc). It can only take over your current stat-rules if dosbox version 'hardcode' it in the name field of the soldier (in that case it is considered part of the soldiers name). Unfortunately i am not knowledgeable enough in the original XcomUtils-statstrings to give you a definitive answer on that.
What i do now is that the converter will never overwrite the XcomUtils_Statstrings.rul file.

Regarding you personal statstrings
If you want the full number i believe you are on the correct path. But i'm not sure if the game is able to show the full string when it becomes to long (a risk you run when displaying the precise value).
Unless YAML anchors work (no idea if it does  here) i do not think there will be a more elegant solution for you.
Wat is wrong anyway with your stat/10 from your mentioned # code? That one you already implemented using only the:
Code: [Select]
# 10s section, there is no need for an elaborate
Code: [Select]
#ones part if you only want high level overview.

Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Thanks for the info, as soon as I finish the code I'll definitely move it to a mod.

As far as the custom stats, its just a personal desire to finally switch from /10 to the actual stat, since the UFOpaedia examples already had a Template for it, I just had to convert that into OpenXcom code.

It's all working so far up to 99, I just need to tweak the 100's.

I'm trying several mods that appear to offer more than 100 max in stats:

Final Mod Pack
SoldiersExtendedXCOM1
Soldier Specialization

One or more of those may be redundant as far as higher Soldier Stats.  What is the highest level of Soldier Stats you have seen in mods that you have tried?

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
...
It's all working so far up to 99, I just need to tweak the 100's.
...
Wow that is an impressive amount of work (assuming you're using the solution from your original post) .. kudos

I cannot really answer on the highest stats i've seen. Most i've seen were close to vanilla.

Just a thought though ...
 if anything is higher than 100 your probably in a domain where the law of diminishing returns shines.
* Either go as far as the mods you are currently playing (use ruleset dive to find out the limits)
* Or use something that says 100+ (or a version that replaces the least significant stat with an x or *).

I know it is not really what you were after, but there is nothing in the code that prevents modders to go bonkers with stats like 9999.
By limiting your highest number you need a lot less work for something that in essence does not relay much more information to the user.

Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Yeah it was just copying and replacing blocks of text, luckily Notepad++ allows to replace all in a selected block so I just had to change one number each block.

I like the idea of truncating after 199, thanks, one of the mods is already in the 100's but its just a new start so I don't know yet how high it goes, I'll check those rulsets.

Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Well I have all the Stats I need for 0-99 done and I'm still working on the syntax for the 100's to use with the various extended Soldier Stats mods.

I am going in and out of game to check my success and noticed something that doesn't happen with DosBox Xcomutil.

I normally delete the Soldier Name in the Soldier Tab and only have the Statstrings when I play.  In DosBox this leaves the StatStrings visible in each individual soldiers' window.

But in OpenXcom when I reload the game the name field is blank and there are no StatStrings shown there.  In all the other Soldier related Screens (Equip Craft - Crew), the StatStrings are still there.

Is there a code change I need to make or is there a switch in options I need to change to get the StatStrings back showing on the individual Soldier Tab?


Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
And I just came across one more data point that I can't find.

I'm modding part of this to see if my Grandson will get hooked on like I did.

I know he will like the Soldier Names as much or more as the statstings.

Does anyone know the maximum allowed Soldier Name length in the various screens?

In order to use my custom statstrings and keep full names (no shortening) I am going to edit the name lists to only allow names short enough to fit along with my statstrings.

Thanks

Offline SteamXCOM

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Not sure what the  hard limit on the number of characters is, there is however a practical limit as to what some screens will display.
When doing the Lightning Variants I had to rearrange the  suffix of  crafts  the so the important part of it  could display on one of the screens else I could not tell which Lightning  was  being selected in that screen.

XCOMutil altered Geosacpe.exe and sometimes some other gamefiles which may or may not display in your save.  If it is a constant, then it may stay in GEOSCAPE, if unique then it seems to be found in the save and be transferred to  OpenXCOM unless another data file supercedes it.

For example I changed the price of some items via hexediting in the original game and they did not survive the OPENXCOM save because OPENXCOM does not use Geoscape and has it own files it draws  price data from.  Since the original graphic  tiles are used from the game, some MCD tile edits made on maps via some program where not seen in MCDeditor,   did though,  carry over from the transition.

There is a mod included with Openxcom util   "XcomUtil_Statstrings" described as
# See https://www.ufopaedia.org/index.php?title=Statstrings
# These are the default statStrings from XcomUtil.
# Melee has been added as a value that can be reported by statstrings.  Use "melee:" as the criteria.
# Psionic Training has been added as a value that can be reported by statstrings.  Use "psiTraining:" as the criteria, values will be ignored.

I gather you know about that mod and it is  different from what you are trying to do . I wish you good fortune in creating your mod as already you have put a lot of effort into it.  The Soldier Names statstings you envision must be important in getting your grandson to better appreciate this old game.  Once done, I  also look forward to seeing it posted!!!

Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Thanks,

It looks like I will have two separate mods.  One with full stat values that I play myself, where I delete the Soldier Names at start because they will crop almost all names beyond 5-6 characters.

And a second I will give to my grandson's install, using only 4 letter names, first and last, and only using single number for range of stats (10-19. 20-29 etc).

I still am working on getting full values for 100's to use with the extra soldier stat mods, lots of trial and error.

And I have now trained myself not to forget that the Common/Standard files may also exist in other mods that I need to check before I pull hair out wondering why I'm still not seeing my mod changes. Is there any Mod Overwrite order system? Is that the purpose of the move up/down switches in Mod selection tab?

Offline SteamXCOM

  • Colonel
  • ****
  • Posts: 150
    • View Profile
The last mods in the are supposed to supercede any changes in mods higher up on the list, the arrows will help in that.
You may wish to do another install of Openxcom only for your mod testing to avoid another mod affecting your changes, as sometimes you forget and have it activated below yours.

Offline spoidex

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Well I have completed basic code that will display full 2-digit stats up to 99.  I have given up on going past 99 for any of the mods that allow for more than 99 because it will simply not allow more than a few 3-digit stats on any display because of display limits.

The code is just a bunch of manual typing of blocks for each desired stat, with the limit being roughly 7 stats if using more than a few capital letters for readability.  You might get one or two more if you use all small letters for the stat ID.

This is strictly for my own use as I don't have a need for Soldier Names, and I mourn the loss of T54B55s40F60r52P50p as much as Joe Miller.

You can change which stats you use just by mass-replace a block with the proper stat string letter(s).

I don't think this is worth publishing for a few reasons:

1.  At some point depending on the number of stats, it will truncate the entire line on most screens, not allowing any Soldier Names or other text ID in that location.

2.  I don't know how to or if there is code function that would allow an interface to allow for a GUI selection for which stats to place into the mod, which means anyone wishing different stats would always have to manually block replace the text, with the chance of editing errors depending on the editor used.  Even with NP++ and Yaml settings it was very easy to make a mistake in a single space or character.

So I leave the code here if there is any desire to incorporate it for personal use or any other mods that might be able to use it.

Thanks for all the help from the real coders here, eventually I'll learn enough to really make a contribution.

Code: [Select]
# TIME UNITS 10's 
  - string: "T"
    tu: [0, ~]
  - string: "1"
    tu: [10, 19]
  - string: "2"
    tu: [20, 29]
  - string: "3"
    tu: [30, 39]
  - string: "4"
    tu: [40, 49]
  - string: "5"
    tu: [50, 59]
  - string: "6"
    tu: [60, 69]
  - string: "7"
    tu: [70, 79]
  - string: "8"
    tu: [80, 89]
  - string: "9"
    tu: [90, 99]
   
# TIME UNITS Ones

  - string: "0"
    tu: [10, 10]
  - string: "1"
    tu: [11, 11]
  - string: "2"
    tu: [12, 12]
  - string: "3"
    tu: [13, 13]
  - string: "4"
    tu: [14, 14]
  - string: "5"
    tu: [15, 15]
  - string: "6"
    tu: [16, 16]
  - string: "7"
    tu: [17, 17]
  - string: "8"
    tu: [18, 18]
  - string: "9"
    tu: [19, 19]
   
  - string: "0"
    tu: [20, 20]
  - string: "1"
    tu: [21, 21]
  - string: "2"
    tu: [22, 22]
  - string: "3"
    tu: [23, 23]
  - string: "4"
    tu: [24, 24]
  - string: "5"
    tu: [25, 25]
  - string: "6"
    tu: [26, 26]
  - string: "7"
    tu: [27, 27]
  - string: "8"
    tu: [28, 28]
  - string: "9"
    tu: [29, 29]
   
  - string: "0"
    tu: [30, 30]
  - string: "1"
    tu: [31, 31]
  - string: "2"
    tu: [32, 32]
  - string: "3"
    tu: [33, 33]
  - string: "4"
    tu: [34, 34]
  - string: "5"
    tu: [35, 35]
  - string: "6"
    tu: [36, 36]
  - string: "7"
    tu: [37, 37]
  - string: "8"
    tu: [38, 38]
  - string: "9"
    tu: [39, 39]

  - string: "0"
    tu: [40, 40]
  - string: "1"
    tu: [41, 41]
  - string: "2"
    tu: [42, 42]
  - string: "3"
    tu: [43, 43]
  - string: "4"
    tu: [44, 44]
  - string: "5"
    tu: [45, 45]
  - string: "6"
    tu: [46, 46]
  - string: "7"
    tu: [47, 47]
  - string: "8"
    tu: [48, 48]
  - string: "9"
    tu: [49, 49]

  - string: "0"
    tu: [50, 50]
  - string: "1"
    tu: [51, 51]
  - string: "2"
    tu: [52, 52]
  - string: "3"
    tu: [53, 53]
  - string: "4"
    tu: [54, 54]
  - string: "5"
    tu: [55, 55]
  - string: "6"
    tu: [56, 56]
  - string: "7"
    tu: [57, 57]
  - string: "8"
    tu: [58, 58]
  - string: "9"
    tu: [59, 59]
   
  - string: "0"
    tu: [60, 60]
  - string: "1"
    tu: [61, 61]
  - string: "2"
    tu: [62, 62]
  - string: "3"
    tu: [63, 63]
  - string: "4"
    tu: [64, 64]
  - string: "5"
    tu: [65, 65]
  - string: "6"
    tu: [66, 66]
  - string: "7"
    tu: [67, 67]
  - string: "8"
    tu: [68, 68]
  - string: "9"
    tu: [69, 69]
   
  - string: "0"
    tu: [70, 70]
  - string: "1"
    tu: [71, 71]
  - string: "2"
    tu: [72, 72]
  - string: "3"
    tu: [73, 73]
  - string: "4"
    tu: [74, 74]
  - string: "5"
    tu: [75, 75]
  - string: "6"
    tu: [76, 76]
  - string: "7"
    tu: [77, 77]
  - string: "8"
    tu: [78, 78]
  - string: "9"
    tu: [79, 79]

  - string: "0"
    tu: [80, 80]
  - string: "1"
    tu: [81, 81]
  - string: "2"
    tu: [82, 82]
  - string: "3"
    tu: [83, 83]
  - string: "4"
    tu: [84, 84]
  - string: "5"
    tu: [85, 85]
  - string: "6"
    tu: [86, 86]
  - string: "7"
    tu: [87, 87]
  - string: "8"
    tu: [88, 88]
  - string: "9"
    tu: [89, 89]

  - string: "0"
    tu: [90, 90]
  - string: "1"
    tu: [91, 91]
  - string: "2"
    tu: [92, 92]
  - string: "3"
    tu: [93, 93]
  - string: "4"
    tu: [94, 94]
  - string: "5"
    tu: [95, 95]
  - string: "6"
    tu: [96, 96]
  - string: "7"
    tu: [97, 97]
  - string: "8"
    tu: [98, 98]
  - string: "9"
    tu: [99, 99]