For supporting other OXPs and preventing conflicts (and to allow easy changes by players), the way I've done it is:-
For players. If there is a station you would like to name, either because its your home system or you just don't like the name assigned to it: Open the OXP's script.js file with a text editor. Type the name of the station you want to rename into Find. (This must be exactly as you saw the name in game). Type the name you want to give the station into Replace. Click Replace All. Save the script file. The next time you load Oolite in your personal game the stations name (or names) you changed will now be the names you gave to those Stations.
For OXPers, If you want to change the name of a station you can do this by one line in your script which tells Random Station Names not to name that station. Random Station names will then be switched off for the station you have specified. The station will not have any name assined to it and it will have whatever name the OXPer wants to give it.
Random Station names includes a procedural generator which can be turned on. When in devolopment mode it will not name any stations. Instead it will ask for a word list or lists to enter into the generator. It will then generate 256 names using the word list given and store these as a string in your save file. So to use Random Station Names in your own OXP all you need to do is think up some words you would like to use that will fit your station style, turn on Random Stations Development Mode (on the F4 OXP Config Screen).When you've done your word list, type 'em in. Fire up Oolite and the generator will generate 256 names for you. You would need in your script:-
Copy and Paste the 256 names generated into the pool between the [].
You then need to add:-
Code: Select all
if(ship.hasRole("my_station_role")) ship.displayName = ship.displayName+": "+mystationpool[system.ID&255];
If your station has a beacon and you would like the name of your station to also appear on the ASC then also add:
if(ship.hasRole("my_station_role")) ship.beaconLabel = "MY STATION NAME: "+mystationpool[system.ID&255];
I think going this way would have the advantage to other OXPers of:-
1) Your OXP is not depended on any other OXP being installed. Your stations will be named even if the player does not have Random Station Names installed.
2) Your station is named in a style you've chosen and suitable to your station.
3) Your stations will always have the same names regardless of whatever other station OXP the player may have.
4) The names of your stations will be the same for all players of the game. So you can if you like in mission text refer to the name of the station and it will be correct.
5) You get the fun of naming your creation.
The reason the OXP generates batchs of 256 is that this is this is the number of systems in each galaxy. So even if your OXP added a station to every system in the game all your stations would be named. You can also specify galaxy if you wanted every station to have a different name then you roll the dice for 8 pools if you like. Random Station Names OXP, naming 12,000 odd stations is only 177k, so using this method will give all your stations a unique name you have chosen and only adds a few k to your OXPs download file.
Using the generator also means that you don't have to faff around working out where the stations you want to name are. And if you later change the number of stations or where they appear, it doesn't matter as everyone of your stations will be assigned a unique and persitant name from your array as you have a name for every system in the game. If your oxp doesn't generate a station at that particular system then the name will not be used. But if it does then it will be.
How varied your names will be depends on how many words you used. A simple 4 x 4 gives 16 combinations. 8 x 8 gives 64, 16 x 16 gives 256, 32 x 32 gives 1,024. How many words and combination lists you want to enter is up to you. If your OXP only adds a handfull of stations to the game then a simple 16 words will be enough to give your stations unique names. You can also nest, so you could generate 512 combinations with three lists of 8 words. All of your stations would have unique names, but as you used only 24 words in total they will all be kinda similar. If you want a more complex effect then a 16 x 16 x 16 gives 4,096 combinations. But as you are substituting a name from each list on each roll your stations will all feel more unique. If your OXP is only adding a few stations you might chose to just make up the names yourself and type them in manually to the pool. This will also work. You don't have to have 256 names if you don't want to. Just typing in 32 names into your pool would give every station a unique name up to 32 but would then loop back to the first name. So if you added a simple array of 32 hand crafted names but your OXP adds a station to every system, your name list would still work, but 8 of the 256 stations your OXP is adding per Galaxy would have the same name.
This is how I've been writing this OXP. For example, their is a certain station added by anarchies oxp the inhabitants are somewhat secretive. So I added 32 words meaning sneaky underhand etc and combined them with 32 names of animals known for being sneaky. That generates 1,024 combinations. Having thought up 64 words I typed them into the generator and fired up Oolite. 256 names were dropped into my test commander's save file. I then C&Ped them into my script. Only 256 are outputted to the name array. This station only appears at about 25 systems per galaxy. So I am more or less guaranteed a unique name per station. IF there is a repetation then its not a major issue that somewhere in the 256 systems of G8 their is a system where the Hacker Outpost has the same name as one somewhere at a system in G1, as this won't be noticed. If you are feeling particularly OCD about it and you want to make sure there are no duplications, the list of 512 words in your script file is something you can proof read and if you spot a duplication just type in a hand written name instead.
Thinking up 64 words was quite fun and didn't take very long and gave me names like:- var hackerpool = ["Uncanny Cat", "Creeping Fox", "Cloaked Raven", "Illusionary Serpent", "Creeping Cat", "Glass Genius", "The Invisible Stoat", and so on].
As all the OXP is actually doing is procdurally generating from the words you give it. Shipbuilders can also use it to generate names for there ships which are unique to their style of ship if they wish to. If you type station type words in then it will generate names approprate to stations. But if you type ship type words in it will generate names approprate to ships.
I will include a general naming key for OXPers to use if they like. But the general key will generate (of necessarity) names that are somewhat generic as the name has to work with any type of station. Adding the general key to your station will give all your stations a unique name. But they will be in the same style as those of another OXP also using the same generak naming key. Ships are added by the role "trader" "pirate" etc. Stations however are added by the role "Station" or the unique role given by the OXP's writer. So the code in Random Ship Names can assing appropate names. Although as humans we know the style of a particular station, there is no way for the code to detect wheather a station is the home of a bunch of Mad Money Lending Monks, a Taxi Service, a wretched hive of scum and villany or a military base. This is why in naming the existing stations I've gone with the pool method and assigned a unique pool to each type of station.
The suggested method therefore will be the "home brew" pool method. The OXPs descriptions file contains all the word lists I've used. So other OXPers can poke around the names lists and custom build a template for their OXP using my word list or use their own custom lists. Random Station Names will do the donkey work of generating the names for your station. Leaving the other OXPer to do the fun bit of thinking up some words to name their station in a style they have chosen.