[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

Post Reply
Topchris
Posts: 17
Joined: Fri, 13. Jan 06, 16:17

Post by Topchris » Tue, 1. Mar 11, 03:54

THank you medevel :)

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

Post by Medevel » Tue, 1. Mar 11, 17:45

Hey Guys updated today to version 1.7c :D
Fixes in this version:
  • - Fixed the null issue hopefully the last time :).
    - Fixed an issue with repeating text which was not intended.
    - Fixed an issue with the color in messages.
    -- since patch X3TC 3.1 fixed the whole color problem all messages where painted
    -- in the last used color, this was not visible prior patch X3TC 3.1.
    - Fixed some Formation Expressions (e.g *FL) which
    -- could not access the leaders name if the ship was not renamed with the
    -- script. Now it can access all Player-ships.
    - The Expressions-list still listed 2 expressions which where not uptodate:
    -- *PS -> *FS : Pilot Fight Skill
    -- *PM -> *PS : Pilot stats (Morale + Agression level)
As always you can download it from this post here

Greeting Medevel

glenmcd
Posts: 902
Joined: Sat, 16. Oct 10, 11:07
x3tc

Post by glenmcd » Sun, 6. Mar 11, 07:05

What a great idea. I got here from a search because I was wanting an easier way to check in on how full my Nividium rock-collecting ships were getting. In sector view, ships are sorted into alphabetical order. So I figured that if the current / recent cargospace remaining was in the name, that all I'd need to check is the top ship in the list and if it wasn't close to full then look no more. The transporter sorts in alphabetical order if multiple ships are in range, so this would work well for transferring from the ships that need it the most, whether it's Nividium or some other ware.

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

Post by Medevel » Mon, 7. Mar 11, 11:15

hi glenmcd
this is a nice idea and it could be easily added.
But i have a few questions :

first should it show the current usage like '63% cargosspace used' or '27% cargospace free' or both with each in its own expression,

second should we use percent or units, or dynamic like above 1000 units 'percent' and below 1000 units we could use 'units'

third should there be some text like 'CS 27% free' or raw info like '27%'

greeting Medevel

glenmcd
Posts: 902
Joined: Sat, 16. Oct 10, 11:07
x3tc

Post by glenmcd » Mon, 7. Mar 11, 13:41

Medevel wrote:hi glenmcd
this is a nice idea and it could be easily added.
But i have a few questions :

first should it show the current usage like '63% cargosspace used' or '27% cargospace free' or both with each in its own expression,

second should we use percent or units, or dynamic like above 1000 units 'percent' and below 1000 units we could use 'units'

third should there be some text like 'CS 27% free' or raw info like '27%'

greeting Medevel
wow thanks for getting back to me so quick Medevel. Considering what you said, I'd much rather have all of them available. I prefer not to have static (forced) text added on either side of dynamic text, because it makes assumptions of its usage and context. One can always add static text but cannot remove it. I'd also like to be able to display the name of the predominant ware in the cargobay. If that happens to be say 6 x 25MJ Shields, then you know that your MSF is empty :-) If it shows a full cargobay of ECs, you know that's the ship you commanded to head to OTAS Shipyard for fuleing new MSFs. With TLs, it's critical to know which factory it's carrying, and when no factory, how many ECs remain. M8s may tell you how many missiles of some particular type remain. Your M3s might show you how much Energy Bolt Chaingun ammunition remains. And if no ammo then it may drop back to showing say 3 x EBC weapons. Continuing with this focus on the ware taking up the most cargospaces, support a dynamic number with refers to what percentage of the cargobay is used for this ware, compared to maximum possible, given that cargobays nearly always contains other boring stuff such as shields, weapons, missiles and ECs. But these boring things never take up more than 50 percent, and hence will never show in the name, unless the cargobay has nothing "exciting" in it, like 9,124 units of Space Fuel. Some may want text color changes based on cargobay contents, but I'd probably be focussed more on a sorted list. Someone that ships a lot of illegal items for example, might want any ship which is carrying illegal wares to be some unique color. These ships are vulnerable and so deserve closer attention. I never bother with illegal stuff (any more) so this wouldn't get used by me at this time.

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

Post by Medevel » Tue, 8. Mar 11, 16:17

glenmcd wrote:wow thanks for getting back to me so quick Medevel.
Well watching a topic and getting an email, if someone post there,
is a nice feature for lazy people, like me, thanks Egosoft :)
glenmcd wrote:Considering what you said, I'd much rather have all of them available.
I prefer not to have static (forced) text added on either side of dynamic text,
because it makes assumptions of its usage and context.
You are right static forces usage and waste some namespace.
The problem is i cant imagine for what each expression can be used,
and so i have to make expressions strict in usage.
glenmcd wrote:I'd also like to be able to display the name of the
predominant ware in the cargobay.
An example:

Code: Select all

Terran Osaka M2 Destroyer:
10000 Max Cargospace

   6x 2GJ Shields                    6x 222   1332 units used
  24x Point Singularity Projector   24x 200   4800 units used
  24x Starburst Shockwave Cannon    24x  28    672 units used
3196x Energy Cells                3196x   1   3196 units used
-------------------------------------------------------------
                                             10000 units used
as you can see the PSP uses the most space, almost half of Osaka's max space.

So lets say we traveled a few time with our jumpdevice and have 496 EC's left.
the space usage of EC's is now lower than all of the Basic-Equipment.

Now if we have one big Expression, lets call it '*CS', we will never get the EC's
on our M2 Osaka without blacklisting the Basic-Equipment.
But if we blacklisting then we came to a problem with the freedom in X,
X bases on your freedom to equip and use each Ship on which task you like,
you can send a M2 too transport things or use an M5 for fast delivery of low
amount of EC's, you can use a TL as mining-base, as EC's Station , or as
Equipment transporter from you Building-Complex to your HQ where you build
your M2's.

And since we possiply can't make one big command for all the freedom you have in X
we simply need to make commands which are used in specific situations.
lets make some list for better explaining

1. *CE - make it simple somthing like "496/3196 EC's"

2. *CA - Ammunition simple if some weapons are installed with Ammo show else not

3. *CM - Missles same as Ammo just with missles

4. *CF - Factories could be seperated but also can be found in *CT

5. *CT - Transportation the basic of your idea, getting the most space using ware like
135/whateveramount nividium for my Mining-TL

The advantage of more commands to one BIG command is we could use them simultaneous
like CA and CM if we have a battle ship which uses Ammo and Missles
or our M8 with CM and CE so we can see its Missles but also how much EC's
An disadvantage is that we have to name our ships exactly how we like to use them,
but since RSwE supports Clipboards i dont see there any big problem.
glenmcd wrote:But these boring things never take up more than 50 percent,
and hence will never show in the name,
unless the cargobay has nothing "exciting" in it,
like 9,124 units of Space Fuel.
Sure lets say we use CM on our EC's transporting TS we wont see anything in name
since there are no Missles in our TS.
glenmcd wrote:Some may want text color changes based on cargobay contents,
but I'd probably be focussed more on a sorted list.
Colors are nioe and colors are cool but this would be some part of loosing independence,
lets say weapons red, shields blue , EC's green, and illegal stuff yellow.
now there comes userxyz and likes to have illegal stuff red, EC's yellow, and dont care
about weapons, but we cant make some dynamic color on the mood of the user.
So we have to say :"There are color function allready in this script, so if you like
colors use them as they are intended!"

Some last words since this is allready some WallOfText again :)

This script was made to make the naming of ships easier not to name all ships
with the same pattern, since one of the big advantages(in some times also a disadvantage)
in X is the Freedom to do what you like.

And so there are many users which uses the same ships for the same task, BUT NOT ALL!

So we like to make a script for all possible users and not one for some which can use
it in some situations.

I think the whole idea of yours is very nice and has some potencial but it is not
possible to get the usage of the ship when just reading the cargospace usage.
Of course we are not limited to the five commands i listed, these are only examples.

Greetings Medevel
Programming today is a race between software engineers striving to build bigger
and better idiot-proof programs, and the Universe trying to produce bigger and better
idiots. So far, the Universe is winning. -Rich Cook

glenmcd
Posts: 902
Joined: Sat, 16. Oct 10, 11:07
x3tc

Post by glenmcd » Tue, 8. Mar 11, 16:31

hmm, it gets complex really quick doesn't it? It kinda feels like the sort of problem where a scripting language has been used before. Maybe I'm confused but I thought that the support of expressions was in addition to static text? If so, then you (the developer) truly don't have to use any static text at all. Perhaps a batch of handy clipboard strings but these would just make it a bit easier for the new user. I was going to suggest that the code could check for which weapons, shields and missiles were installed at moment and ignore them. Not because they are weapons, but because they are installed in *this* ship at this time. Any weaponry that are installed I'd rather see in a seperate list, not in amongst the cargobay listing every time. Info overload. (this complaint to ES) So in your example ECs would become the only thing of note. But I agree with you that this is becoming rather specific and not attractive for more general usage. The thing I like best about TC is the depth of it. To some this means complicated (the unholy ones) :-)

jiunejai
Posts: 56
Joined: Fri, 4. Mar 11, 09:47

Post by jiunejai » Sun, 5. Jun 11, 11:20

Hi, Medevel. Thx for RSwE, and it's really useful to me.

Could u add a expression for ship's race?
As Raptor shows Terran, Nova Raider shows Argon, etc.

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

Post by Medevel » Sun, 12. Jun 11, 20:19

Hey Guys today I updated to 1.7d
thanks jiunejai that RSwE is very usefull to you, but its not my script.
I just borrowed the code and try to give some support to Loky77, sothat the script doesn't die.
Because I think RSwE is one of the most usefull scripts in X3tc IMHO :)

Fixes in 1.7d:
  • - Fixed double number over 100 in *FN & *ZN
    - Fixed *DN now also for factories
    - Fixed *TC to show the amount of the product might be used in comination of *TP to show the name of the product :)
    - Added a new scriptfile to shorten BIG numbers
    -- 522 485 221 581 335 -> 522 T, 83 694 824 915 931 593 433 -> 83 E
    -- k -> Kilo = 1000^1, M -> Mega = 1000^2, G -> Giga = 1000^3, T -> Tera = 1000^4
    -- P -> Peta = 1000^5, E -> Exa = 1000^6, Z -> Zetta = 1000^7, Y -> Yotta = 1000^8
    - Added a new scriptfile to shorten Names
    -- Energie Cells -> EC, Microchips -> Mi
    - Added *RC expression as requested from jiunejai
    -- *RC adds the base Creator of the ship to its name as example
    -- Nova -> Argon, Raptor -> Split, Baldric -> Terran
    - Added *CS as requested from glenmcd
    -- *CS shows the free Cargo space in units
    - Added *CU as requested from glenmcd
    -- *CU show the ware which uses the most cargospace and its amount
    - Added *CE as requested from glenmcd
    -- *CE show the amount of Energiecells left in cargospace
    - Added *CA as requested from glenmcd
    -- *CA show the amount of ammunition of installed weapons left in cargospace
    - Added *CM as requested from glenmcd
    -- *CM shows the amount of missles left in cargospace, installed missiles leading
    - Changed default naming Templates to use also the new commands
    -- Freighter *CL *TS *NN *TH -> *CL *TS *TH - *CU
    -- Carrier *CL *TS *NN *FL *FP -> *CL *TS *FP - *CA *CM
    -- M2 *CL *TS *NN *FL *FP -> *CL *TS *FP - *CA *CM
    -- M8 *CL *TS *NN *FL *FP -> *CL *TS *FP - *CA *CM
    -- M7 *CL *TS *NN *FL *FP -> *CL *TS *FP - *CA *CM
    -- M6 *CL *TS *NN *FL *FP -> *CL *TS *FP - *CA *CM
    -- Fighter *CL *TS *NN *FL *FP -> *CL *TS *FP - *CA *CM
    -- Satellites *NV -> *NV-*SA
    -- Station *CL *TP *ZN *TC -> *CL *TP *TC - *ZN
As always you can download it from this post here

Greeting Medevel

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

Post by joelR » Sun, 12. Jun 11, 21:41

Thanks for carrying on with this Medevel. This update is fantastic.

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

Post by Medevel » Sat, 18. Jun 11, 18:43

Hey Guys Im back :)
the last days I let X3TC play some time to check, if everything is allright
and this way I encountered an script-hangup.
I was wondering why my ship has still over 50 missiles in the name, but I allready
launched all so I checked my other ships. And also there where the names not uptodate.
I thought I screwed the code and updated a buggy version again, so I started a new game,
scripted some ships and stations and renamed them -> all was working
So next theorie I screwed my save :) but how?
Then I saw that in my save the static renaming was still working only dynamic was screwed
So I looked up the scripts running atm and DN was running over 100 times,
I deactivated DN and killed every process of DN running.
(btw thanks Egosoft that I had to kill every single process manually :evil: )
After that and another cup of coffee I started DN again.
The script started and ran and ran and yeah a second started and well you can
imagine :). Thats when I insert the lines sothat new processes of DN are skipped
because I thought that might be the problem. well it wasnt :)
So I went throught the code commenting and uncommenting until I found the file where
it hangs up, BUT there was no freaking endless loop in the script it should have run flawless. :twisted:
So I let X3 send me messages of the ship which where processed at the problematic code snippet
messages : some TL, some M2 , some TS , My M7 , My M3, My M7 ,My M3 ...
and another 9k messages with My M7 and My M3.
well ... thats awesome ... no idea what screwed this two ships
and after some loads and a few thousands messages (no I didnt read them all)
later it was all clear, I added some code to reset the leadership-flags which are
used to faster readout the leader and the problem was gone.

I also renamed plugin.loky.rswe.getthousands.xml and plugin.loky.rswe.shortenstring.xml to
lib.loky.number.thousand.xml and lib.loky.string.shorten.xml just to mark them as libary.
The old files are obsolet and around 40KB big if you have no serious diskspace problem
you can keep the old files.


Fixes in 1.7e:
  • -> renamed the script-file for shorten names
    -> renamed the script-file for shorten numbers
    -> added fractional parts of the decimal numbers to shortened number like 99.9 k EC
    -- 99999 -> 99.9 k, 99099 -> 99 k not 99.0 k, 100514 -> 100 k is already long enough so no 100.5 k
    -> exported null-protection to external scriptfile
    -> added doublespace-protection
    -> fixed a script-hangup which could ocour when 2 ships got each other flagged as leader
    -- now the flags get reseted with each new dynamic renaming to prevent this hangup!
    -- the error ocoured when i let my M3 follow my M7 to have a smaller ship for docking
    -- so the M3 got the flag "leader -> M7"
    -- now i got a mission to deliver things between small factories so i jumped into the M3
    -- and let my M7 protect the M3 so the M7 got the flag "leader -> M3"!
    -- the script is written that it moves the "leader"-ships infront of the "follower"-ship in the ship list
    -- because we liked to rename the "leader" first to get the right name for the followers
    -- but since both ships are flag as "leader" they switched the place in the list endless.
    -- because of this the script hang up but the game was nearly unaffected so it was not visible but the
    -- names didnt update anymore
    -> added a routine to skip a renaming process when one is still running to avoid double running scripts
    -- SINZA has also influence on script timer.
    -- since RSwE DN runs every 60 seconds, at sinza 1000% it runs every 6 seconds and with lots of ships
    -- the script can take longer than 6 seconds to process all ships
As always you can download it from this post here

Greeting Medevel

Devilize
Posts: 20
Joined: Wed, 1. Jun 11, 03:57
x3tc

Post by Devilize » Tue, 21. Jun 11, 03:12

hey medevel, I love this mod, however, I also love the "Economy and Supply Trader" by Lucike. The problem is that this mod doesn't mesh well with the later with the use of the *DN plugin. I think this is because the EST mod also has a name scheme for your ships along with updates to that scheme.

Unfortuntely the EST doesn't encompass all of the types of ships in the game only the ones pertaining to the mod or this wouldn't be an issue, id simply just use the EST's naming. Since I cannot I was wondering if there was a way to make this compatible with EST mod. Thanks for your time.

EDIT: 2 other mods that work in tandem with EST and made by Lucike are "Commercial Agent" and "Commodity Logistics Software". Both use the same naming methods found in EST.
Two things are necessary to survive in life. 1. Don't share everything you know.

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

Post by Medevel » Tue, 21. Jun 11, 07:21

hey Guys
seems the new versions are coming faster than you can download them :)

today i looked into the *ON expression to make RSwE compatible to other scripts which renames ships or stations :)
before version 1.7f *ON just used the current name of the ship, this could keep the name trailing itself and gets bigger and bigger.
now i let RSwE save 2 new Variable per ship
1. the old name
this variable is set to the current name if the ship is renamed the first time since the update or
if the name of the ship is changed outside of RSwE like other scripts or the trivial "rename ship" command from X3 itself
2. the new name
when the ship was renamed with RSwE the last step is to save this variable, sothat the script can check if the name was changed outside of RSwE

with this alone RSwE should be compatible with every script which renames the ship
as example i used Lucike's Prospector script:
we rename our Ship with RSwE with the expression : '*DN*KK*ON"
now we have an other script as Lucike's scripts, lets say it renames the ship to
'PSC Mistral(Guiding Star) 01 01 Ore/47 M-MDS'
so the next time DN is renaming the ship it checks if the ship was renamed and names it
'PSC Mistral(Guiding Star) 01 01 Ore/47 M-MDS'
there will be a little glitch since RSwE is runnung every minute it can happen that the other script renames the ship
and then you have to wait until RSwE renames the ship too, to have the name you like to have.
this is unavoidable since i dont like to make a script running all the times
and checking if a ship just got renamed, since with increasing ship numbers
this could produce more laggs.

In addition to that i added a new expression *OS
*OS should be used alone or at the end of a renaming string
*OS save the current name of the ship as old name(used by *ON) if used alone so renaming a ship with '*OS'
or it save the new name as old name if used at the end of a renaming string like '*KY*CL *TS *ID*OS'
when using *OS please be sure you use no name content which can change during gameplay
like Sectornames, cargospace, formation, trader level and so on.
just use static values like class, classname ,id or colors

this should help making RSwE DN compatible to other scripts which renames ships.

Changes in 1.7f:
  • -> fixed *ON to avoid name trailing and make it compatible to other scripts which renames ships
    -> added *OS
    -- if *OS is used as sole expression like '*OS' it save the current name of the ship to *ON
    -- if *OS is used at the end of a renaming string like '*KY*CL *TS *ID*OS' it saved the newname of the ship to *ON
As always you can download it from this post here

Greeting Medevel

Devilize
Posts: 20
Joined: Wed, 1. Jun 11, 03:57
x3tc

Post by Devilize » Thu, 23. Jun 11, 23:45

thanks, Medeval.
Two things are necessary to survive in life. 1. Don't share everything you know.

A5PECT
Posts: 4717
Joined: Sun, 3. Sep 06, 02:31
x4

Post by A5PECT » Mon, 4. Jul 11, 20:16

I'm using 1.7f and I'm getting "nulls" when I use the *ZN tag.

The same problem was described by another user two pages back, and I don't think its been fixed yet.
Admitting you have a problem is the first step in figuring out how to make it worse.

Post Reply

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