[SCRIPT] Rename ships with Expression 3.4.1 (RSwE) X3:TC/AP Compatible [11/01/2015]

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Post Reply
Medevel
Posts: 106
Joined: Thu, 17. Jun 04, 14:40
x3tc

Post by Medevel » Thu, 31. May 12, 15:20

Stormsorter wrote:Loving it so far but one personal annoyance. So far all I have done is make one clipboard entry "*DN *KOCompany name" and ad it to the front of all defaults. I then used the rename all with defaults option. The first thing I noticed was whenever I got a new ship and used "rename selected ship/station with defaults" it would become number 1 instead of a new highest number for its class. Then when *DN updates the *ZN numbers for the class group they get mixed up. A simple example would be I have 5 TS's and get a new one, but instead of getting the #6 when DN updates it becomes #3 and the previous #3 becomes #6.
Would it be difficult to add a static number option that worked per class or even better per model or am I just overlooking one? Of course it would need a sister option to fill the lowest missing number with a new ship when one gets destroyed.
The numbers that are given to the ships are not static, as you allready
found out, they are given by the number of ships processed.
as example you have 5 TS numbered, the first TS processed gets the one,
the third get the three and the fifth gets the five.
The order of processing the ships is the order they are packed in the
ship-array by the command

Code: Select all

get ship array: of race {Player} class/type=$class
this command give me a list of all ships the user has, then i filter the
ones out which should not be renamed and send the remaining to
the renaming process.
the order of the ships inside the list are given by the command, i never
found out a defined order, it seems a semi-random kind of process,
maybe the ship idcode has influence on the order but can't confrim that.
to make a static list I would need to save the last known number, and
sort the shiplist by that order.
this would not be too hard but it has a flaw which i need to compensate.
so lets play with the 5 TS again

we rename them from 1-5, but then we remove the number two, and add
a new TS.
If we got lucky the new one gets the number two, now we add
the old number 2 again to group, so now we have two 2's and it would
bring my sorting functon in an infinite loop, which we only can avoid if
we set which one stays number 2 and which one have to draw a new
number.
you might ask why it would end in an infinite loop?
well lets say the order of the ships is 1 4 2 2 3 5
if i start at the beginning and move each number to it place the computer
will do it like this
first number 1 allready on place -> 142235
second number 4 to place four -> 122435
third number 2 to place two -> 122435
fourth number 4 to place four ->122435
fifth number 3 to place three -> 123245
sixth number 5 to place five -> 123254
so after one sorting we get 123254 since you CAN THINK you would
have sorted 123452 but the computer CAN NOT so there we got a flaw,
we could run it again and we would get 122345 which is good for this
short number of ships but lets say we have 256 ships in disorder, i doubt
it would be enough to sort it twice. so we have to let the computer go
back in the list to point where it put the last number if it was smaller then
the current position.
so in my example with 1 4 2 2 3 5
the computer would work like this
first position allready on place -> 142235 next number 1+1 -> 2
second position 4 to place four -> 122435 number higher than position next number 2+1 -> 3
third position 2 to place two -> 122435 number lower than position goback and next number 2+1 -> 3
third position 2 to place two -> 122435 number lower than position goback and next number 2+1 -> 3
third position 2 to place two -> 122435 number lower than position goback and next number 2+1 -> 3 and so on

we could say the older ship should get the two and the newer
ship should draw a new number, but i found no function regarding the
age of the ship.
so we say if the number at the position got the same number as
one we want to move there we could delete one of the numbers and add it to the end of the list.

But then there is still the chance that the current number two is send
to the end of the list instead of the added number two, which is what you
complained about :) and you would ask me why the static lists still change.

So if you could not follow everything i wrote above i would summarize it like this:
I could add a semi-static list which should not change BUT which can
change in certain situations! :)


if you like i can add it like that would not be too hard :)
Greetings Medevel

Stormsorter
Posts: 3
Joined: Fri, 18. May 12, 20:31

Post by Stormsorter » Fri, 1. Jun 12, 02:10

No worries, semi-static wouldn't help me. I just got use to static numbers for my ships when manually naming them a few years ago in X3R. I'll just have to find and get use to a new system. With all the options in your script and all the new stuff in and available for TC/AP I'm sure I'll find a better way. I just haven't played much yet since starting again last week.

gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator » Mon, 30. Jul 12, 21:56

Hey there,

short question about your implementation of custom command
<t id="1555">COMMAND_RSWE_MENU</t>


How the hell did you manage to get this working?
I tried adding custom commands in the high id ranges 6000+ and in 1400-2000 and my commands never show up. only for id 1555 it would work, which means stealing your slot.

Do I have to enable those custom command slots somehow?

Even changing your t-file to another id breaks functionality, like e.g.:
<t id="1556">COMMAND_RSWE_MENU</t>


edit:
never mind.

Code: Select all

add ship custom command: id=1555
looking through your setup script gave me the answer :)

Mycu
Posts: 408
Joined: Fri, 28. Sep 12, 08:30
x4

Post by Mycu » Fri, 28. Sep 12, 08:39

It seems that the problem with empty/blank messages if the ship has a coloured name is still there ...
I use AP 2.5.1 and RSWE 2.9

Does anyone use RSWE with AP and has the same problem?

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Fri, 28. Sep 12, 13:45

Mycu wrote:It seems that the problem with empty/blank messages if the ship has a coloured name is still there ...
I use AP 2.5.1 and RSWE 2.9

Does anyone use RSWE with AP and has the same problem?
I dont have that problem.

Brinnie
Posts: 800
Joined: Mon, 5. Jun 06, 08:26
x3tc

Post by Brinnie » Fri, 28. Sep 12, 22:19

Mycu wrote:It seems that the problem with empty/blank messages if the ship has a coloured name is still there ...
I use AP 2.5.1 and RSWE 2.9

Does anyone use RSWE with AP and has the same problem?

I use this script with AP and I use coloured names for my ships (multicoloured even at times), so far I have not come across this problem.




*************
EDIT
*************


Is there a way to edit/store the defaults list *Y00 to *Y99 in windows?
I would like to make my list with something like notepad/wordpad for the sake of practicality.

Mycu
Posts: 408
Joined: Fri, 28. Sep 12, 08:30
x4

Post by Mycu » Sun, 30. Sep 12, 22:17

OK, I've discovered where the problem is... it's not about the colour.

If you use square brackets [] when naming your ship - you will receive empty messages.

And by the way - RSwE is a fantastic piece of work :)

Medevel
Posts: 106
Joined: Thu, 17. Jun 04, 14:40
x3tc

Post by Medevel » Wed, 24. Oct 12, 19:55

Mycu wrote:OK, I've discovered where the problem is... it's not about the colour.
If you use square brackets [] when naming your ship - you will receive empty messages.
And by the way - RSwE is a fantastic piece of work :)
Sorry wasn't here for a long time now, and stopped working on RSWE for
the time being. But i will look into this problem, i am also thinking of
rewriting RSWE from scratch, but i am not sure atm.
Brinnie wrote:Is there a way to edit/store the defaults list *Y00 to *Y99 in windows?
I would like to make my list with something like notepad/wordpad for the sake of practicality.
There is a way for the "default naming" of the classes, but not for the
clipboards. The presets for the "default naming" are stored in the T-file,
and you could editing them, but this way these files are lost during
update, if not done manually ( the very hard way you need to determine
the changes i made in this file, with the update or your presets or my update are lost),
thats why i made it possible to save the presets for "default naming"
ingame while adapting the clipboard-system. Now you must know that the
clipboards are only stored ingame, i could give them an preset in the
T-file, which you then can edit. But these will be only avaible with the
next version, i am not sure when this will be done.
Also the last post was some time back, so i am not sure if there is still an interest.

Edit:If someone is interested, the square
brackets are used in message commands like [autor] or [green] that is
why shipnames with these brackets will cause an blank message because
X can not interpret the code inside the brackets. Maybe i can find a
workaround, but if not DON'T use them in names :)

Greetings

Brinnie
Posts: 800
Joined: Mon, 5. Jun 06, 08:26
x3tc

Post by Brinnie » Wed, 24. Oct 12, 20:56

No worries, it is not something that I need to do, I just wondered if it was possible that's all.

The script is very useful in my opinion and I cannot believe that there is no interest in it.
I am more inclined to think that the reason why you have not got a lot of feedback recently is mainly because the script does what it is supposed to do very well, so you have satisfied customers who do not have need for assistance.

I will not be playing the game without it.

Thanks.

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Wed, 24. Oct 12, 22:49

The issue with brackets [ and ] is a vanilla issue. I dont believe there is a workaround.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Thu, 25. Oct 12, 04:30

Medevel wrote:the clipboards are only stored ingame, i could give them an preset in the T-file, which you then can edit.
That would be awesome, Medevel.

Also please consider an option to write defaults and clipboards to a log file in the format for the t file. This would serve as a save-and-reload capability for the script options.

I love RSWE, but it is a hassle to start a new game, figure out the old clipboards, and re-enter them. Save-and-reload would make RSWE the perfect naming script!

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Thu, 25. Oct 12, 05:16

DrBullwinkle wrote:
Medevel wrote:the clipboards are only stored ingame, i could give them an preset in the T-file, which you then can edit.
That would be awesome, Medevel.

Also please consider an option to write defaults and clipboards to a log file in the format for the t file. This would serve as a save-and-reload capability for the script options.

I love RSWE, but it is a hassle to start a new game, figure out the old clipboards, and re-enter them. Save-and-reload would make RSWE the perfect naming script!
+1

Medevel
Posts: 106
Joined: Thu, 17. Jun 04, 14:40
x3tc

Post by Medevel » Thu, 25. Oct 12, 19:54

DrBullwinkle wrote:Also please consider an option to write defaults and clipboards to a log file in the format for the t file. This would serve as a save-and-reload capability for the script options.
I love RSWE, but it is a hassle to start a new game, figure out the old clipboards, and re-enter them. Save-and-reload would make RSWE the perfect naming script!
Writing to a logfile is not a problem allready found the right commands like
write to logfile # <Var/Number> append = <Var/Number> value = <Value>
reading it ingame seems not possible, but since it isn't the goal, the current
features of X support this idea.
Now i need to experiment with the outputs but i doubt i can export a
complete copy of the T-file, so that you only have to rename the logfile.
But i guess i will make something like this:
T-file code:

Code: Select all

<t id="666">Some nice Preset</t>
and output to logfile:

Code: Select all

<t id="666">Your exported Preset</t>
so you only need to find and replace the lines

Greetings

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Thu, 25. Oct 12, 19:59

Medevel wrote:i need to experiment with the outputs but i doubt i can export a
complete copy of the T-file
I am sure that you can output the entire t file, if you desire.

This technique has been used in other scripts. Bounce's wall file comes to mind as an example.

Medevel
Posts: 106
Joined: Thu, 17. Jun 04, 14:40
x3tc

Post by Medevel » Sun, 28. Oct 12, 17:03

Hey Guys,
i looked into the bracket problem and it seems there will be no workaround
Orfevs wrote:Square brackets
Using square brackets ('[' and ']') in a message, such as ship/station name or otherwise used to outline something - will render the message empty! Sent from "unknown".

This because these brackets are supposed to contain codes. When the code is unrecognized, a.k.a "[My Awesome Buster]", the message will be fubar - since that was hardly a recognizable code.

In X3TC versions prior to v3.1, colors with escape codes acted in the same manner, but this has been remedied.
source
but allready got a new version out hopefully bugfree, not much testing done :)

changes in v.3.0
  • added *HS for HomeSectors used in some scripts like MK3 Trader
  • added *TL for TraderLevel without the Missions like ST LT UT
  • rewriten code and several bug fixes(didnt keep track of them)
  • added an option to export a fresh t-file with your edited presets
    (ingame like Defaults and Clipboard) to the logfile log08860.txt
  • added an option for AutoNaming
    This option is by default off
    If on every Ship which has not been renamed by RSwE will be renamed
    by its class-default
  • added clipboard presets to the T-File
    to empty a clipboard preset use a single space
As always have fun and report any bugs you find :)

Brinnie
Posts: 800
Joined: Mon, 5. Jun 06, 08:26
x3tc

Post by Brinnie » Sun, 28. Oct 12, 19:01

A new version.

Lovely!


I have downloaded it already.
What do you advice to do? I have the previous version (spk) installed. Should I remove that one first, save and install this new one?
Just remove and install without loading or saving?
Install on top of the previous version?


Thanks for your work.

Medevel
Posts: 106
Joined: Thu, 17. Jun 04, 14:40
x3tc

Post by Medevel » Sun, 28. Oct 12, 19:15

In my experience it is always the best option to make a new save, uninstall the previous version, install the new version and then reload the save to if everything is working fine. this way you can alway go back if the new verstion is not working right.

Greetings

Brinnie
Posts: 800
Joined: Mon, 5. Jun 06, 08:26
x3tc

Post by Brinnie » Sun, 28. Oct 12, 19:35

Thanks for the advice.
I will do that.



*******
UPDATE
*******


Sorry to bother you again with trivial questions.

I have installed the new version and everything is fine but I have tried to edit the clipboard with notepad, so I could do my custom names 01 to 99 in windows.
I can save a lot of time by doing so using cut/copy and paste, however when I do that and load the game up, everything to do with the script returns a text error.
Am I using the wrong program to edit, should use wordpad instead of notepad or do I need to use different encoding options when saving?

Medevel
Posts: 106
Joined: Thu, 17. Jun 04, 14:40
x3tc

Post by Medevel » Thu, 1. Nov 12, 11:28

can you upoad your edited file?
it seems you made some syntax error, maybe forgot to close an xml tag.
Edit: Btw the encoding you can read in the first line of the
t-file

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
Edit 2: I could recommend Notepad++ cause i am using it also alot

Greetings

Brinnie
Posts: 800
Joined: Mon, 5. Jun 06, 08:26
x3tc

Post by Brinnie » Thu, 1. Nov 12, 11:43

I tried a few times with different names and once with copy and paste directly from the exported log, always with the same error result.
As soon as I make the slightest edit and save the file I have the problem, I remove the edit and the error goes away.

I will post the exact error message, I am sure I will get it again :) on my next attempt

I will try again , with notepad ++ paying attention to the format, and I will let you know how it goes.


Thanks.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”