[SCRIPT: Upd 09/02] Rename ships with Expression 1.7 (RSwE) New links

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

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

Loky77
Posts: 110
Joined: Sun, 25. Jan 09, 09:54
x3tc

[SCRIPT: Upd 09/02] Rename ships with Expression 1.7 (RSwE) New links

Post by Loky77 » Sun, 8. Feb 09, 20:56

Rename Ships with Expressions (RSwE)
Based on Klyith work for X3R
  • SPK
    [ external image ]
    This package use Cycrow plug-in manager for the installation or deinstallation.
  • Zip

    [ external image ]
    To Install using the Zip file, just unzip the archive in your X3 directory.
    To Uninstall the script, you have to:
    1. To deactivate the AL plug-in (Gameplay/AL menu)
    2. Save your game
    3. Remove the following files
      in T directory:
      • 7955-L044.xml
      in Script directory:
      • al.loky.rswe.events.xml
      • al.loky.rswe.main.xml
      • al.plugin.loky.rswe.xml
      • lib.loky.number.formation.xml
      • plugin.loky.rswe.defaults.xml
      • plugin.loky.rswe.formations.xml
      • plugin.loky.rswe.frontend.xml
      • plugin.loky.rswe.launcher.xml
      • plugin.loky.rswe.menu.xml
      • plugin.loky.rswe.tool.xml
      • setup.loky.rswe.xml
Concept

This script has been developed to allow quick and powerful renaming functions
to use with your ships and stations. The method of entry means that you can give
names unique to each ship in large batches. Whether you are renaming a small
group or all of your ships in the universe is up to you.

Central to the idea of RSwE are the Expressions. These are like "text short cuts"
which are interpreted by the script to produce context-defined results. When
combined with standard text this allows you to specify names that are both
unique to your ships and customized to your preference. Thus, if you have a group
of three Buster Raiders to rename, entering *CL-*TA Orion *NN will rename them
to M4-BR Orion 1, 2, and 3.


Menu commands
There are 7 RSwE commands available in Rename Ships menu:
  1. Rename current ship
    Rename ship from which the command was launch on
  2. Rename a ship (select from sector)
    Rename a single ship selected from the universe map. A docked ship cannot be
    renamed this way.
  3. Rename all ships in sector
    Rename all ship of a given class (or superclass) in a selected sector. You
    don't have to be in this sector. Docked ships cannot be renamed this way.
  4. Rename all ships in Universe
    Rename all ship of a given class (or superclass) in X3 universe. Docked ships
    WILL be renamed too.
  5. Rename docked ships
    Rename ships docked inside a carrier/station. The carrier/station is not renamed.
  6. Rename all ships with RSwE defaults
    Rename all ships in X3 universe with internal defaults values.
  7. Set clipboard
    Will set one of the clipboard (9 available). You will be able to use them later
    with *Yn expressions.
  8. Help
    Short help sent into your incoming messages.
    You have to close your command console to trigger the sending though.
One note is that while the universe option will rename regardless of state, the
sector option will not rename docked ships. This can be useful as a way to
exclude ships that you don't want to rename.


List of RSwE Expressions
  • *ON : Old name used before you asked for the renaming.
  • *ID : ID Code
  • *HB : Home Base
  • *SC : Current sector
  • *SA : Abbreviation of sector name, like HoL, PP, PR
  • *SR : Abbreviation with Race owner of sector, like A.HoL, P.PP, P.PR
  • *SN : Incrementing sector counter for numbering ship inside
  • *CL : Class Name - M1, M3, TS, etc
  • *TN : Type Name - Raptor, Nova Raider, Demeter Hauler, etc
  • *TS : Type Short - Ship main type + Abbreviation like Nova NR, Dolphin DSF
  • *TA : Type Abbreviation - Ra, NR, DH, etc
  • *TH : Trader Level
  • *PS : Pilot Fight Skill
  • *PM : Pilot Morale and Aggression level
  • *FR : Name of highest leader (in case of consecutive follows), or "Leader" if the
    current ship is the highest Leader
  • *FL : Name of direct Leader
  • *FP : Formation ID, like α1, β1... ,ωn, αn+1 . Also flag the highest leader.
  • *FO : Depth in formation lines (from alpha for all leaders to omega for followers)
  • *FN : Incrementing number with leader zero, plus prefix W if wingman, or L if leader
  • *FI : Ship ID number inside its formation
  • *NN : Incrementing unique number
  • *ZN : Incrementing number with leading zero
  • *NV : Short name for satellites
  • *TP : Product sold by your factory
  • *TC : Number of units of your factory
  • *DN : Store a naming scheme on ships. This scheme will be used by the AL plug-in
    to rename your ship regularly. It must be used at the beginning of the string, without spaces
    after the *DN (unless you wanted some, that's it :) )
  • *Y1 - *Y9 : Your text clipboards (use a single space to empty clipboard in
    the Set clipboard menu)

Colors:
  • *KW White
  • *KR Red
  • *KY Yellow
  • *KG Green
  • *KB Blue
  • *KX Normal
  • *KC Cyan
  • *KM Magenta
  • *KK Random
Currently, due to some hard coded behavior in X3TC, colors are working
differently between incoming messages/log book, and the rest of X3TC UI. You can
still use the color tags provided, but messages will be empty.


Customizing the internal default values:

Default name values for ships:
Those values are set as t id in the text id file 7955, as follow:
1080: Freighters
1081: Carriers
1082: Destroyers
1083: Bombers
1084: Fregates
1085: Corvettes
1086: All fighters
1087: Satellites
1088: Factories
You can change those default settings as you wish, in order to have
a proper list of name, in case something went wrong during your tests.


Note on dynamic renaming:

The dynamic renaming can be activated and deactivated using the AL menu (in Gameplay
menu, last option). This function is provided to help you with some expressions that can
change during your play time, like sector names, skill levels...
Also note that dynamic names are preponderant on any name you can enter manually.
Dynamic names must be cleared if you want to enter another static name, using *DN as name.


Credits:

Klyith wrote the original script
Gazz converted it to X3TC and added some commands
A big thank to both of them.

RSwE :: V 1.7

Changelog:

1.7
  • Added an expression to number ships in each sector (*SN)
  • Added a command to rename docked ship

Note for moders

This script use the Text file/Page ID 7955.
It also uses COMMAND_TYPE_GENERAL_21
Last edited by Loky77 on Tue, 9. Jun 09, 22:46, edited 6 times in total.

User avatar
mostlikely
Posts: 157
Joined: Sat, 29. Nov 03, 23:20
x4

Post by mostlikely » Sun, 8. Feb 09, 22:33

X Plugin Manager says: 'This script is for X2: The Treath and might not work, Would you like to Continue?'

Is this for X3TC and X2?


[Edit]
Your script refers to: READTEX 7951 for colors. ($addstring = read text: page=7951 id=1102)
What script is this from?

Loky77
Posts: 110
Joined: Sun, 25. Jan 09, 09:54
x3tc

Post by Loky77 » Sun, 8. Feb 09, 22:53

It is for X3TC, but I made a mistake in the plug-in packager... Sorry, my bad :oops: .
I put a new version of the script online.

Updated both Zip and SPK due to Text file ID error...

User avatar
mostlikely
Posts: 157
Joined: Sat, 29. Nov 03, 23:20
x4

Post by mostlikely » Sun, 8. Feb 09, 23:40

It works like a charm. =D
Thank you very much!.

russbo
Posts: 862
Joined: Sat, 12. Nov 05, 21:53
x4

Post by russbo » Mon, 9. Feb 09, 07:09

What are the "internal default values?" And any suggestions for renaming ships that are docked (fighters in an M1)? And I'm assuming that if you run this universe wide, it will interfere with Lucike's CAG / EST scripts and their name changes?

Loky77
Posts: 110
Joined: Sun, 25. Jan 09, 09:54
x3tc

Post by Loky77 » Mon, 9. Feb 09, 12:55

mostlikely wrote:It works like a charm. =D
Thank you very much!.
You're welcome :wink:
russbo wrote:What are the "internal default values?" And any suggestions for renaming ships that are docked (fighters in an M1)? And I'm assuming that if you run this universe wide, it will interfere with Lucike's CAG / EST scripts and their name changes?
The internal default values are the values I defined in the text file ID. They are not necessarily the best for everyone, that's why I choose to externalize those values in the file. If you want to customize your default M1 names, look for the line <t id="1081"> in the file 7955-044.xml , and enter your own value. The classes are described at the end of the 1st post.
The little trick is that All fighters includes M5, M4 and M3. They are not separate.

To rename docked ships I only see 2 ways at the moment:
- The universe wide renaming
- Launch the command on each ship, but this will interrupt the current command, and probably undock the ship as well.
I'm going to find a way to do this without so much drawbacks. It is probably safe to say I can launch a command on a Carrier/Station, to rename docked ships without breaking all the current code.
Thank you for the suggestion! :wink: :idea:

Concerning CAG/EST, I'm not using them, so I can't say how much it will interfere. They will be renamed when you launch the command, for sure. Now, to say if it will break something in Lucike's code... I have to spend some time to check CAG and EST code.

fishman99
Posts: 13
Joined: Tue, 25. Dec 07, 11:54
x3tc

Post by fishman99 » Mon, 9. Feb 09, 13:06

Wow, this kicks ass.

Quick request: Is it possible for there to be an option to number them just within their sector. I'm trying to rename all my satellites and instead of giving them all unique numbers, which doesn't help really, I'd much prefer something along the lines of "Satellite 1; Satellite 2...", and have some of those in each sector. Is that possible?

Loky77
Posts: 110
Joined: Sun, 25. Jan 09, 09:54
x3tc

Post by Loky77 » Mon, 9. Feb 09, 14:29

I can try to put an option to do this. It may be a little tricky, but should be feasible.

Until then *NN and *ZN number from 1 all the ships/stations/satellites concerned by the command. So, if you do this sector by sector with those expressions, they will be always renamed from 1 to the number of satellites in the sector. If you have some of them in a lot of sectors, it will be fastidious though...

fishman99
Posts: 13
Joined: Tue, 25. Dec 07, 11:54
x3tc

Post by fishman99 » Mon, 9. Feb 09, 16:22

Unfortunatly doing that for every sector might be a bit too much effort: I've used this and it means I have them in EVERY sector in the game now. And it would be nice to have them all numbered if only so I don't have a million "Your Advanced Satellites" everywhere.

Anyway, thanks Loky and good luck with that :D

Loky77
Posts: 110
Joined: Sun, 25. Jan 09, 09:54
x3tc

Post by Loky77 » Mon, 9. Feb 09, 22:39

I just added the expression to rename ship inside sectors with a new counter for each sector, and the the option to rename docked ships.

Enjoy! :wink:

fishman99
Posts: 13
Joined: Tue, 25. Dec 07, 11:54
x3tc

Post by fishman99 » Wed, 11. Feb 09, 14:31

Thank you so much for that! You're my hero, Loky :mrgreen:

dcarver
Posts: 148
Joined: Sun, 10. Jul 05, 04:31
x4

Post by dcarver » Mon, 16. Feb 09, 02:36

Thanks for doing this! Having the classes of ships color coded is soooo much better.

Couple requests...

1. Can you separate TS and TP?

2. Can I use the menus to select sector/ships and use the default scheme (the one in the 7955-L044.xml) instead of having to type it in? If it doesn't give it a unique number no biggie. Also, Maybe I did something wrong, if I use the clipboard to specify color/number then it just gets the actual text like: *KG*CL *TS...

Thanks again.

Loky77
Posts: 110
Joined: Sun, 25. Jan 09, 09:54
x3tc

Post by Loky77 » Mon, 16. Feb 09, 09:20

@fishman99: I'm pleased this script meets your needs :)

@dcarver: Yup, having the name with our own color is nice. It is a bit painful we can't have the message board working with them :(. I seriously hope we will have some improvement on that issue soon. (<- please! pretty please all mighty developers!! With sugar on top! :mrgreen: !)

To answer your questions:
1. I can add them, sure. I just regrouped them using the class "Freighters" because the "Pirate TS" are not considered when using "TS", which may confuse the user.

2. At the moment, the default renaming is just a way to rename all your ships. I can add another sub menu to select which class will be renamed. It is not a big deal, as the renaming part is done in a single script, the other being only a way to organize the renaming (finding the whole formation, retrieving some specific information...). I'll do something around this suggestion too :)
Concerning the clipboard issue: I'm a bit confused here... If you edit a clipboard, you should see in the menu the naming scheme, with the coded expressions. Then, you will be able to use those clipboards when renaming the ships using the expression *Y1 to *Y9, and see the actual expanded expressions.
for instance:
1. Put *KG*FP *FI*KX in the clipboard 1
2. Put *KM*TS*KX in the clipboard 2
3. You should see *KG*FP *FN*KX on the clipboard 1 line and *KM*TS*KX on the clipboard 2 line
4. Rename a formation using *Y1 *Y2
5. The formation should be renamed with the type of ship in magenta, then its formation name + its position in this formation in green.

I will do further testing tonight to be sure it still works correctly.

Note that when the script find a * in the scheme, it uses the following 2 chars to search for existing expression. If a star is not part of an expression, another expression should not be used in the following 2 chars.
For instance:
*My *TN is a trader level * *TH* is valid and will give something like *My Vulture is a trader level * 12*.
*My *TN is a trader level **TH* will give something like *My Vulture is a trader level **TH*

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 » Tue, 28. Apr 09, 21:05

this is pretty slick.

It'd be nice if you could target a single wing or formation for renaming. I know I can fudge it by having only that group in a sector, but it would be nicer if I could just select them.

Could also do with an expression for adding the wing name

User avatar
Belgarath
Posts: 824
Joined: Wed, 6. Nov 02, 20:31
x4

Post by Belgarath » Sun, 31. May 09, 07:31

I'm unable to download this file from filefront. I don't know why, but the link just takes me to the filefront homepage. Is it possibly hosted elsewhere? If not, would it be possible to email the file to me. I would appreciate it.

Bel
The new PC I just built for myself:
i5-13600k, 32GB DDR5 RAM, RTX 3060 12GB
It'll do until I can upgrade the graphics card.

XxNe0xX
Posts: 163
Joined: Sat, 9. Oct 04, 00:48
x3

Post by XxNe0xX » Wed, 3. Jun 09, 22:58

I have the same problem. I'd appreciate a reupp or an upload to rapidshare or something similar.
Do you like secrets?
Try to find some.....
Goner-Secrets Mod

User avatar
spacefueladdict
Posts: 508
Joined: Thu, 12. Jun 08, 15:42
x3tc

Post by spacefueladdict » Thu, 4. Jun 09, 14:23

XxNe0xX wrote:I have the same problem. I'd appreciate a reupp or an upload to rapidshare or something similar.
Unfortunately i'm getting this problem too, please could you re-do the d/load link loki.

Cheers

SFA

Loky77
Posts: 110
Joined: Sun, 25. Jan 09, 09:54
x3tc

Post by Loky77 » Tue, 9. Jun 09, 22:51

Hello,

Sorry, I delayed a bit the post, because I wanted to post the new version, with the propositions made by moggy2 and dcarver.
I'm currently still facing some issues with the wings, so, I posted the previous version (1.7).

I hope to deliver the next version soon.

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

Post by Medevel » Fri, 19. Jun 09, 19:07

Dear Loky77,
your Script is awesome. Exactly what I need :D .
But I have found a mistake, well sounds more hard then it is 8) .
It begans when I started to train my first Universetrader. When I used him as Sectortrader every thing was still fine.
I named him '*DN*TN *TH' , so that I can easily see which lvl he is, and he showed up with a nice 'Mistral ST 1'.
Everything still fine when he got lvl 10, I made him to a Localtrader to get to lvl 13, and he showed up with 'Mistral LT 10'.
At lvl 13 I turned him into a Universetrader, but he still showed up as 'Mistral LT 13'. I thought I should just wait a moment till the script refresh.
As lvl 14 passed and he still showed up 'LT', I looked up your script.

I needed a couple of minutes to find the problematic lines:

Code: Select all

   $temp = $currentship->is script 'plugin.autotrade.galaxy' on stack of task=0
   if $temp 
    ...
    $addvar = 'UT ' + $temp 
   end
   $temp = $currentship->is script 'plugin.autotrade.sector' on stack of task=0
   if $temp 
    ...
    $addvar = 'ST ' + $temp 
   end
   $temp = $currentship->is script 'plugin.autotrade.local' on stack of task=0
   if $temp 
    ...
    $addvar = 'LT ' + $temp 
   end
I shortened some unimportant lines for the forum

So I saw your Script checked first if the .galaxy script is running, then if .sector and then .local.
At the first view it looked ok. Each trader should run its own script and so the problem should be in the galaxytrader-script.
And when I looked into the galaxytrader-script I thought 'Yeah thats the problem!'.
The script contains only 1 line :

Code: Select all

= [THIS]->call script 'plugin.autotrade.local' : start.sector=null  traderange=null 
:headbang: good for us that they doesn't remove that script at all!

So a Universetrader has 2 scripts running; I also looked this up, first .galaxy and .local.
First I thought too complex, about some if-conditions with the var 'addvar' but then I saw a line in your code ,just a few lines above,
which would made it too complex.
Then I saw that there were no labels, breaks or skips in this part, so I just changed the order:

Code: Select all

   $temp = $currentship->is script 'plugin.autotrade.sector' on stack of task=0
   if $temp 
    ...
    $addvar = 'ST ' + $temp 
   end
   $temp = $currentship->is script 'plugin.autotrade.local' on stack of task=0
   if $temp 
    ...
    $addvar = 'LT ' + $temp 
   end
   $temp = $currentship->is script 'plugin.autotrade.galaxy' on stack of task=0
   if $temp 
    ...
    $addvar = 'UT ' + $temp 
   end
So now your Script check first if Sectortrader, then Localtrader and at last for Universetrader.
And it worked like a charm.

If you like, I can send you the complete lines or the complete file per pn, but I think my text made all clear so that you know where
to change your script.

Greetings Medevel

Vinnie_NL
Posts: 33
Joined: Sat, 12. Nov 05, 19:52
x4

Post by Vinnie_NL » Wed, 1. Jul 09, 20:38

@Medevel
Can you please upload the xml file or send it to the original author so he can include the fix in his script.
I just installed the script and noticed the LT/UT problem but and I looked at your code and see if I can insert these lines into the script editor myself.
But I have no programming experience at all so I'm afraid I mess up my game if I try myself.

Post Reply

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