[Mod] Advanced Renaming (updated 2020-07-11)

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

daBeschi
Posts: 76
Joined: Mon, 28. Jan 19, 14:04
x4

Re: [Mod] Advanced Renaming (updated 2019-02-02)

Post by daBeschi » Fri, 8. Feb 19, 15:42

Hi,

Thank you very much for this mod! I loved it in X3-R and now again.
I play in german and have an issue with the "type"-expression. It doesn't matter if i type "/type+" or "/type0", I ever get the "type+"-expression (e.g. "Merkur Angreifer"). Maybe it refers to ID-2017 "/type"?

I wish that the Script could count subordinates by Mission, class and or type (e.g. M-miners from 1 to x, L-Miners from 1 to x ...) ...

Greetings daBeschi

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-02-02)

Post by UniTrader » Fri, 8. Feb 19, 16:08

i just re-checked: expression for Ship Type without Variant is definietly /type0 and /type+ is for the full name. there is also a /type- expression which does the same as /type+ currently, planned for a shortened Type Name variant, but i miss some script functinality to do this in a common manner..
The Entry you mentoined is a leftover from the Rebirth Version (or better an automatic update/change i did back then).
The issue you see might be related to referencing stuff in a generic lang file.. try to copy the t/0001.xml into a t/0001-l049.xml - this should resolve this. (i assume it doesnt find the correct language variation name in the lookup because i use the generic lang file, and therefore cannot remove it from the type name properly)

Regarding the idea with the more specific Subrdinates count: i might look into it, but not sure if counting them based on job is feasible..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

daBeschi
Posts: 76
Joined: Mon, 28. Jan 19, 14:04
x4

Re: [Mod] Advanced Renaming (updated 2019-02-02)

Post by daBeschi » Fri, 8. Feb 19, 17:47

Hi,

The issue is resolved.

The short way would be to use a counter per Job/class/whatever while going trough all subordinates, but this becomes a really big mess. Maybe arrays can help, but I'm not sure how they are implemented. On the other side could it be handy to choose between just all subordinats, class, purpose, purpose+class and so on.
... Maybe with multiselect of ships and right-click-command, so the user decides which ships to count ... I'm just thinking laud :gruebel:

Greetings daBeschi

Horux
Posts: 314
Joined: Tue, 1. Apr 08, 20:13
x4

Re: [Mod] Advanced Renaming (updated 2019-02-02)

Post by Horux » Mon, 11. Feb 19, 21:57

Hi,
unfortunaly Your mod interferces with 2.0 UI. It is no more possible to see Crew level.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-02-02)

Post by UniTrader » Mon, 11. Feb 19, 22:06

forgot to announce it: i wont support any beta Versions, like the current 2.0. To get my desired Functionality i have to replace quite a bit of the menu_map.xml (thats where the ranaming is handled), and i dont really want to update this every few Days. Sorry about that.

If you can live without the Name Editing part you could remove the lines 402 to 2330 in the utrenaming.lua to get the rest of the functions though. this should interfere with far less stuff. (and when you are at it - Line 5 to 380 are also not needed in that case)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Horux
Posts: 314
Joined: Tue, 1. Apr 08, 20:13
x4

Re: [Mod] Advanced Renaming (updated 2019-02-02)

Post by Horux » Mon, 11. Feb 19, 22:13

That is completly ok. I just wanted to inform You.... Ok I hoped You already knew it.
I was just checking the compatibility of my used mods and then I found out, that this is not working.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-02-02)

Post by UniTrader » Wed, 27. Feb 19, 22:26

Just Updated for 2.0

As usual Beta Versions (like the current 2.10) wont be supported cause these update too frequently for me.

I also included some other small changes/fixes:
=> Fixed Script-defined Expressions API
=> Removed unneeded and outdated Lang files - when using German or French please delete the t folder before updating
=> Added Notification if the Player Faction Tag Mod is also active, since function of both Overlaps
=> All Player Objects with the default name will be changed to custom default name when its first detected on game load
=> Leaving Object Name empty will set it to custom default Name
=> Made some guesses Fix to apply Default Name to Capped Ships (untested)
=> Added some custom Ship Variants for Type Name shortening
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-02-27)

Post by UniTrader » Tue, 19. Mar 19, 20:29

Just checked 2.20 - no changes in the menu_map.lua, therefore no update required :)

i will introduce a function in the next Version which should make this Mod compatible with all future Versions (except some very unlikely changes happen), but with reduced functionality with untested Versions*



* namely the Editable names wont work anymore
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Bravari
Posts: 42
Joined: Mon, 15. Jun 09, 20:00
x4

Re: [Mod] Advanced Renaming (updated 2019-02-27; compatible with 2.20)

Post by Bravari » Sun, 24. Mar 19, 00:15

Ok assume I am an idiot and please explain this to me:

I want all trade ships made by my Wharf to come out named like this:

M Trade 1, 2, 3, 4 etc

What do I type to make this happen?

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-02-27; compatible with 2.20)

Post by UniTrader » Sun, 24. Mar 19, 01:42

The first part is simple:
put this in the custom file (t/0001.xml the seperate includerd mod ut_advanced_renaming_user )

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<language>
<page id="5554302" title="UT Advanced Renaming" descr="Object Name Dynamic Expressions and Internally used Text" voice="no">
  <t id="1" comment="Setting:  Version Number of the Custom Expressions File - change this Entry to update the Result on all Objects upon loading a Savegame">0</t>
  <t id="2" comment="Setting:  Safe Expression converted into English? (default no, set to yes if you want to transfer your Save from another language than english to a Game in another Language)">no</t>
  <t id="3" comment="Name Template for Stations (will be applied when Plot is created or changed if there is no Advanced name set yet, leave empty to not use this)"></t>
  <t id="4" comment="Name Template for XL Ships (will be applied when built, leave empty to not use this)">/class /purpose #</t>
  <t id="5" comment="Name Template for L Ships (will be applied when built, leave empty to not use this)">/class /purpose #</t>
  <t id="6" comment="Name Template for M Ships (will be applied when built, leave empty to not use this)">/class /purpose #</t>
  <t id="7" comment="Name Template for S Ships (will be applied when built, leave empty to not use this)">/class /purpose #</t>
  <t id="8" comment="Name Template for XS Ships (will be applied when built, leave empty to not use this)">/class /purpose #</t>
</page>
........rest of the file beginning with <page="***** .......
The second part i have marked above with # has to be done manually currently because thats basically a feature request :D => Ship Sequence/Serial numbers. will Add that in next Non-just-for-compatibility Version.

Probably will work use Expressions like this:

%seqall => overall sequence number
%seqsize => sequence number of ship size
%seqpurp => sequence number of ship purpose
%seqsizpurp => sequence number of ship size/purpose combi
%seqtype => sequence number of ship type (variants are seperate types)
These Sequence Numbers will be saved for the Ship and used when any sequence number is used (sorry, not multiple sequence numbers in the same name for now)
%seqdel => Remove previous Sequence number to get a new one (expression will be removed from the name completely as confirmation; it is possible to add a new sequence number in the same name to get the next one)
%seqresetall \
%seqresetsize \
%seqresetpurp \
%seqresetsizpurp => Reset the Sequence number and start over at 1
%seqresettype /
(%seqforce123# => Force a certain sequence number for future use - currently not possible because of missing string functions in X4)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-02-27; compatible with 2.20)

Post by UniTrader » Fri, 5. Apr 19, 11:31

Just for Information:

Mod is compatible with Version 2.21 since the menu_map.lua is unchanged. Also im working on Aforementoined function for serial Numbers (yea, i know im slow), and will update soon ;)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-02-27; compatible with 2.20)

Post by UniTrader » Fri, 12. Apr 19, 21:48

ok, just added previously mentoined functionality and some other, minor, changes:

=> Added Check for Game Version in lua and if the version is unknown only use less intrusive changes (improves compatibility, but in unrecognized Versions the Names will be empty on renaming)
-> recognized Versions: 2.00 (334398), 2.20 (339509), 2.21 (341463)
-> This should make it Compatible with the current 2.5 Beta (didnt look into it yet), with minimally reduced functionality
=> Added Sequence Numbers, with the limitation that each object can have only one which will stay until deleted, even if the type is changed.
-> Available Sequence numbers:
/seqall > Counter for all Ships, no seperation between type or class
/seqtype > Counter for each Ship Type (Variations count as seperate Type)
/seqsize > Counter for each Ship Size Class (L, XL etc)
/seqpurp > Counter for Ship Purpose Class (Trade, Fight, Mine, Build)
/seqclass > Counter for Size+Purpose combination

-> Control Codes (will be removed entirely after being performed)
/seqdel > Delete currently assigned Sequence Number to get a new one
/seqresetall
/seqresettype
/seqresetsize . . . > Remove current Sequence Number of that type and start over at 1 (already assigned Numbers will stay)
/seqresetpurp
/seqresetclass


=> NOTE: currently the new Strings/Expressions is Coded into the Script directly. I will externalize it with the following Version (i just wanted to push this to get a look into the 2.5 Beta)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-04-12)

Post by UniTrader » Sat, 13. Jul 19, 12:50

Just updated the Mod for same function in 2.50, but for some reason the editable name doesnt work anymore.. still made it based on 2.50 files
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Daering
Posts: 1
Joined: Fri, 16. Aug 19, 12:58

Re: [Mod] Advanced Renaming (updated 2019-07-13)

Post by Daering » Fri, 16. Aug 19, 13:14

I just make a registration (long time around, just stalking and reading) to say Thank You for bringing one of my favorite XR mod to X:F.

Can't express well enough* how I am thankfull to you and all other moders, for your hard work and efford to make our expirience in X universe better.

*well, I can't express it in a good way too, because my English sux, obviously, so please, don't mind my Engl.

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Re: [Mod] Advanced Renaming (updated 2019-07-13)

Post by argon_emperor » Thu, 19. Sep 19, 12:28

Great mod, makes renaming stuff so much easier (especially with the options for defaults)

However, I use /type+ /seqtype, and sometimes I get a 'null', instead of a number on the first of a type. So far had it on my starting ship (both an Elite Vanguard and Eclipse Vanguard), a Nemesis Sentinel, a Stork Vanguard, and a Mammoth Vanguard. At first I thought maybe it was the Vanguards were being an issue, but the Nemesis Sentinel threw that off, and have gotten several other Vanguards with no issue. Any idea on what's causing that?

EDIT: And the next Eclipse Vanguard I claimed somehow went to 5. After then doing /seqdel and then /seqresettype (which I had already tried several times), suddenly they started going in order. So it went weird for some random reason there
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-07-13)

Post by UniTrader » Thu, 19. Sep 19, 16:27

some reproduction steps would be great. Alternatively a logfile is also helpful so I can see what exactly happens.

you can create one by adding '-logfile debuglog.txt' as startup Parameter, and to log a ships Renaming Process add 'DEBUG' Somewhere in the name. All following Naming actions for this ship should be printed in detail to the Log (even if you remove the expression).
You can find the Log next to your Savegame folder in your Documents.

After you are done you can disable the Logging for a ship by putting 'DEBUG OFF' somewhere in the name (it will be removed entirely as confirmation)


Anyway when I'm at home I will try to reproduce myself.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Re: [Mod] Advanced Renaming (updated 2019-07-13)

Post by argon_emperor » Fri, 20. Sep 19, 05:00

Okay, just triggered it again on an Odysseus Sentinel, added the DEBUG and tried again, still gives null instead of a number, tried twice, got the following error in the debug log:

Code: Select all

[=ERROR=] 36065.16 Error in AI script order.trade.perform on entity 0x2080a62: Property lookup failed: $targetobject.isblacklisted
* $targetobject == null
* Expression: $targetobject.isblacklisted.{blacklisttype.objectactivity}.{$blacklistgroup}.{this.assignedcontrolled}
[General] 36065.16 ======================================
[General] 36174.98 ======================================
[=ERROR=] 36174.98 Error in MD cue md.UT_CAC_Object_Name_Managment.NameUpdate_FromLua<inst:48e3b47>: Failed to set null.$current_id to value 3
* Expression: $object.pilot.$current_id
[General] 36174.98 ======================================
[General] 36174.98 ======================================
[=ERROR=] 36174.98 Error in MD cue md.UT_CAC_Object_Name_Managment.NameUpdate_FromLua<inst:48e3b47>: Property lookup failed: $object.pilot.$current_id
* $object.pilot == null
* Expression: $object.pilot.$current_id
[General] 36174.98 ======================================
[General] 36213.08 ======================================
[=ERROR=] 36213.08 Error in MD cue md.UT_CAC_Object_Name_Managment.NameUpdate_FromLua<inst:48edd27>: Failed to set null.$current_id to value 4
* Expression: $object.pilot.$current_id
[General] 36213.08 ======================================
[General] 36213.08 ======================================
[=ERROR=] 36213.08 Error in MD cue md.UT_CAC_Object_Name_Managment.NameUpdate_FromLua<inst:48edd27>: Property lookup failed: $object.pilot.$current_id
* $object.pilot == null
* Expression: $object.pilot.$current_id
[General] 36213.08 ======================================
I have the custom renaming extension in there active as well for default naming, which for all of them are the same, set to "DCSF /type+ /seqtype" (without quotation marks)

After waiting a few minutes, and doing the /seqdel/seqresettype (which I had tried before adding the DEBUG in), it then renamed it with the correct number.
Not sure if that's enough info, and still have no idea why it seems to trigger randomly with some ships and then others work perfectly fine the first go. About the only thing I can maybe think of that's common between the null ones are they were either boarded, or claimed quickly after bailing.
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-07-13)

Post by UniTrader » Fri, 20. Sep 19, 11:49

ok, I think I know what's causing this now. I store the sequence number with the pilot and if you rename while there is no pilot in place it can't store the ID and subsequently not read it for putting it in the name. Will change that soon. sadly no way to recover already lost sequence numbers.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

argon_emperor
Posts: 1225
Joined: Mon, 12. Dec 05, 07:41
x4

Re: [Mod] Advanced Renaming (updated 2019-07-13)

Post by argon_emperor » Fri, 20. Sep 19, 12:16

Ahh, so probably best to wait on the default naming for a bit till you get round to changing that, and just stick with a user defined one to quickly rename after putting a pilot in. Glad I could be of some help finding a situation it didn't quite work as expected... Though not so glad that I've caused you extra work XD

Honestly though, this mod already helps make my life so much easier with renaming ships, such a pain otherwise >.<
[ external image ]
***modified***
"You can get more of what you want with kind words and a gun, than you can with just kind words" - Al Capone

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: [Mod] Advanced Renaming (updated 2019-07-13)

Post by UniTrader » Sun, 22. Sep 19, 20:12

i just made the needed changes but for lack of an existing save with this issue i didnt get around to test yet.
You can find the Updated Version on Github for now, will make a package when i tested it.
https://github.com/UniTrader/ut_advanced_renaming => Clone or Download => Download ZIP
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Post Reply

Return to “X4: Foundations - Scripts and Modding”