[SCRIPT] Rename Ships with Expressions (v1.4 Feb 1 07)

The place to discuss scripting and game modifications for X³: Reunion.

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

Post Reply
User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

[SCRIPT] Rename Ships with Expressions (v1.4 Feb 1 07)

Post by Klyith » Fri, 24. Mar 06, 16:15

Rename Ships with Expressions (RSwE) - Version 1.4
Zip file :: SPK Package

Rename Ships with Expressions is a script to rename ships using variable expressions. This allows you to batch rename ships and produce names that will be both unique and descriptive. There are currently 13 expressions that can be used as "shortcuts" to context-dependent text, 9 clipboard slots, and colors. Besides the expressions you can also use whatever plain text to make the final name.

There are two RSwE commands available. The main command can rename ships selected by class in the entire universe or your current sector, and also to rename a single ship. The second command will rename formations (with options for entire formations or just the ship's followers), ships with a carrier or station as their homebase, or docked ships. This uses a incoming message with the relevant options as buttons.

List of RSwE Expressions
*ON : Old name
*TN : Type Name (Raptor, Nova Raider, Demeter Superfreighter, etc)
*TA : Type Abbreviation (Ra, NR, DS, etc)
*CL : Class Name (M1, M3, TS, etc)
*FP : Formation Position (alpha, beta, etc)
*FL : Formation Leader
*NN : Incrementing unique number
*ZN : Incrementing number with leading zero
*RN : Roman numerals
*SN : Starting number for other number functions
*HB : Home Base
*SC : Ship's current sector
*ID : ID Code
*Y1 - *Y9 : Your text clipboards
Color text :
*KW White *KR Red *KM Magenta *KY Yellow
*KG Green *KC Cyan *KB Blue *KX Normal
*KK Krazy Kolor (random color on each instance & ship)


Example of use: I want to rename five ships (2 Nova Raiders, 1 Mamba, and 2 Buster Vanguards) in a sector. There are also two of my frieghters in that sector. I select "Rename Ships w Expressions" from the General command console of one of those ships. Then I enter 2 for sector-based renaming. I choose "Fighter" from from the Class list, to exclude the freighters. I then enter "*CL-*TA Orion *NN" as the RSwE Name String. The fighters will now be named "M3-NR Orion 1", "M3-NR Orion 2", "M3-Ma Orion 3", "M4-BV Orion 4", and "M4-BV Orion 5".

...
If you like this script and have a request for a new expression you'd like to have, let me know! Funny note: I had the idea for this script in a single flash when I woke up from a afternoon nap. I grabbed a pen and scribbled the first expression list on the back of an envelope.

Code: Select all

Version History
1.0 - First Release
1.1 - Changed command method to only use 2 slots, as recommended by LV
      Bugfix in station renaming
1.2 - Added clipboards & colors
1.3 - Formation & followers renaming
      New expressions based on formation
      Added 2 colors & random colors
      Changed alternate command to use incoming question / callback
1.4 - Changed clipboards to be able to use RSwE expressions themselves
      Rename single ships & target feature
      Strip colors when using the *ON old name expression
      New expressions for starting number and roman numerals
Last edited by Klyith on Fri, 2. Feb 07, 06:44, edited 6 times in total.

fud
Posts: 6989
Joined: Wed, 25. Jan 06, 15:26
x3

Post by fud » Fri, 24. Mar 06, 16:53

Nice. Very Nice. I always thought it was a pain in the ass to name 4-5 would-be UT ships after buying them. Same with buying multiple fighters.

I'll definitely be grabbing this and trying it when I get home.

Cheers.

User avatar
LV
Sith Lord
Posts: 6362
Joined: Wed, 6. Nov 02, 21:31
x3tc

Post by LV » Fri, 24. Mar 06, 19:28

2 things

1. plugin.pdp.rswe.alternate when opening in my browser and has The XML page cannot be displayed after line 11

2. Is there really the need to use 3 slots? (not that your under any pressure to limit them) :)
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

Post by Klyith » Fri, 24. Mar 06, 19:53

LV wrote:1. plugin.pdp.rswe.alternate when opening in my browser and has The XML page cannot be displayed after line 11
Huh, so it does. IE and Firefox. That's quite bizarre. It's straight from the game, so I don't know what's up. The script seems to work fine...

I justed edited frontend and alternate to get rid of the return variable from the calls (which isn't used for anything at the moment), and it didn't help. In fact, both of them went fugly.

Might this be a 1.4 thing, maybe the style sheet needs to be updated? I dunno, I don't do xml.
LV wrote:2. Is there really the need to use 3 slots? (not that your under any pressure to limit them) :)
I was really conflicted over that... I mean, yes, I could wrap it up in one command slot. But it would be really clunky, or else I'd need to get rid of the carrier / station option.

General_19 would be quite "sharable" since it only shows up on carriers anyways. Maybe there should be a way to indicate that in the compatibility list? I could also do a "lite" version for the main list, with a disclaimer about the extra two commands in this thread for my "full" version.

User avatar
al_main
Posts: 1379
Joined: Wed, 6. Oct 04, 10:26
x3

Post by al_main » Fri, 24. Mar 06, 20:24

As you've asked for additional requests of expressions:

Most of my renaming involves renaming like:

Your Argon Nova -> MainTech Nova
Your Teladi Vulture -> Maintech Vulture Frieghter

So the expression i'm requesting would be a player defined comapny name *CO for example

So I could then enter *CO *TN (Or *CO *TN Freighter for my freighters in this example) to get the required renaming.

To save on command slots you could set the company name by entering a special RSwE Name String that would not re-name but just store the company name, entering for example. ***MainTech would not re-name any ships but just store MainTech in a global variable to be used as the text for *CO.

This would make your script even better for re-naming!

AL

User avatar
LV
Sith Lord
Posts: 6362
Joined: Wed, 6. Nov 02, 21:31
x3tc

Post by LV » Fri, 24. Mar 06, 21:44

the offending line is & in your text decription

Code: Select all

RSwE for carriers & stations
your check is for docked or homebased yes?

so why not use if environment == homebase to return homebased ships and if env != homebase apply the docked number unless i'm reading it wrong and you will not need any more than one command slot

User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

Post by Klyith » Fri, 24. Mar 06, 22:23

LV wrote:the offending line is & in your text decription
Aha. But it doesn't cause a problem until later for some reason. Xml is weird.
We should have a thread with warnings about what symbol characters are improper at what times. Already was the much more dangerous ">" bug. Probably it's just a good idea to avoid most symbols in scripts.
LV wrote:your check is for docked or homebased yes?

so why not use if environment == homebase to return homebased ships and if env != homebase apply the docked number unless i'm reading it wrong
Not exactly, I'm just using get from and get owned for those ships, I don't need to check and remove from the entire player ship array.

It's not that I can't put it all in one function, it's that I don't want to. #1 it is difficult to put four or more options in a nuber entry form, you can't label them and the player has to go by memory. #2 it would be totally non-intuitive because the carrier version is much more dependent on what it's being executed by. The THIS becomes much more important... And it's much easier to have a command that only appears on a carrier menu than a gerneral one that exits with error messages if you run it from the wrong console.
LV wrote:and you will not need any more than one command slot
But there is hope, I totally don't need the station command slot. Just reuse the second general one, duh. Rookie mistake, but I'm still learning the ins and outs of assigning commands. I'm about to edit my request in the list thread, and v1b with this change & removal of the "&" bug will be up asap.

User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

Post by Klyith » Fri, 24. Mar 06, 22:41

al_main wrote:As you've asked for additional requests of expressions:
Most of my renaming involves renaming like:
Your Argon Nova -> MainTech Nova
Your Teladi Vulture -> Maintech Vulture Frieghter
Well, as per my example above, you could get that result by entering "MainTech *TN". Any plain text that isn't an expression is preserved and passed into the result name.
al_main wrote:So the expression i'm requesting would be a player defined comapny name *CO for example

So I could then enter *CO *TN (Or *CO *TN Freighter for my freighters in this example) to get the required renaming.
Or are you just looking for something to save typing? If that's the case, then it's certianly possible. Your idea of special entry for player text is a good one, if I add this it will do something of the sort. Though not ***, triple asterisks would give my script a heart attack! :)

User avatar
al_main
Posts: 1379
Joined: Wed, 6. Oct 04, 10:26
x3

Post by al_main » Sat, 25. Mar 06, 01:52

Yeah, as its a regular input i'm looking for something to save typing. (plus i'm sure there are people with company names MUCH longer than MainTech)

The ***"Company name" was just an example to give you an idea for how it could be done and minimise the use of an extra command to input it!!! :)

User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

Post by Klyith » Sat, 25. Mar 06, 03:53

Okay, incremented it to version 1.1 since I happened to find a bug while working on changing the commands. Now it uses only two commands. The main RSwE is available on any ship. The Carrier / Station special is available on the player ship and carriers, but not on stations. So if you want to rename ships associated with a station, you need to do it through your personal ship command console. It's not as tight, but it works.
Happy now, LV? ;)

al_main: Clipboard function will be coming soon. And not just one, multiple clipboards! Other expected features for 1.2: better abbreviations for stations.

User avatar
moggy2
Posts: 4588
Joined: Wed, 6. Nov 02, 21:31
x3ap

Post by moggy2 » Sat, 25. Mar 06, 17:31

Klyith wrote:...
LV wrote:2. Is there really the need to use 3 slots? (not that your under any pressure to limit them) :)
I was really conflicted over that... I mean, yes, I could wrap it up in one command slot. But it would be really clunky, or else I'd need to get rid of the carrier / station option.
...
I disagree. I've had a quick look at the scripts and it seems that it can be done in one script by adding 1 option to the where argument in plugin.pdp.rswe.frontend so it looked like this:
1: where , Var/Number , '1=Universe 2=Environment 3=Homebase 0=Expr List'

Environment here is either a sector if the shipis flying or a station or carrier if it's docked.

User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

Post by Klyith » Sat, 25. Mar 06, 18:37

moggy2 wrote:I disagree. I've had a quick look at the scripts and it seems that it can be done in one script by adding 1 option to the where argument in plugin.pdp.rswe.frontend so it looked like this:
1: where , Var/Number , '1=Universe 2=Environment 3=Homebase 0=Expr List'

Environment here is either a sector if the shipis flying or a station or carrier if it's docked.
Right now "Sector" means "the sector that you or the ship whose console you ran this from is in". I think you might have misintrepreted it, or else I don't see how you are thinking of using environment. It couldn't double up for both sector and ship selection by the player, though that kind of thing works well inside scripts. There's no good way to have an input that can function as a chooser for either ships or sectors. And if it did have a ship selector, it wouldn't do anything half the time.

I mean, this stuff is possible, but it would mean you'd have to read three pages of instructions on exactly how to select different options. My model is all about the best and easiest ways to let the player filter out a set of ships to use the rename on. It has no point if it is as difficult to use RSwE as it is to manually rename the ships in the first place.

Honestly, this is now my final position. I'm using two command slots. If the powers that be in the compatability list don't like that, and thus I am excluded from the list, so be it.

User avatar
moggy2
Posts: 4588
Joined: Wed, 6. Nov 02, 21:31
x3ap

Post by moggy2 » Sat, 25. Mar 06, 19:05

when a ship is flying Environment = Sector
when a ship is docked Environment = DockedAt

you could replace Environement with 2 options Sector and DockedAt, but you certainly don't need a whole new command just to select a player owned station or carrier if you can run the first command on a ship already docked there.

User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

Post by Klyith » Sat, 25. Mar 06, 19:20

moggy2 wrote:when a ship is flying Environment = Sector
when a ship is docked Environment = DockedAt
Yes, I know how the environment variable works. But not all the people who use our scripts know. I don't want to write scritps that only other scripters can figure out how to use. I don't want to write scripts that you have to read giant instruction files to use.
moggy2 wrote:run the first command on a ship already docked there.
That kinda works, but it is totally backwards from a logical point of view. In order to rename ships docked at or homebased on a ship or station, it is logical that you would be selecting the command from that ship or station. Not from the subsidiary ship. Its a parent and child relationship...

User avatar
Klyith
Posts: 575
Joined: Fri, 6. Jan 06, 02:38
x3

Post by Klyith » Thu, 21. Dec 06, 00:14

Version 1.2 -- I'm back!

Added clipboard function:
There are 9 clipboard slots. They may be of use if you have some bits of personal text (such as a company or fleet name) that you apply to many of your ships on a frequent basis. Before you can use it in the naming system, you will need to set the text. This is done as follows:
1) Select "Rename Ships w Expressions" from the console
2) Enter "0"
3) Class is unimportant, select anything
4) Enter "*Y#Your text" -- The # must be a numeral 1-9, followed directly by the text you want in the clipboard.
Now your text will be available in all RSwE functions by using that *Y#.

Added color!
*KW White *KR Red *KY Yellow *KG Green *KB Blue *KX Normal


Next up is changing the carrier / station command to add renaming ships by formation. I think that will be very useful...

Post Reply

Return to “X³: Reunion - Scripts and Modding”