Random Station Names OXP (Development Thread)

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

Sorry to revive an old thread. But after working on and off on this, finally have a working OXP!

In the end I decided just to hand write the names for the 2048 main stations and use the procedural generator to create the names for the OXP stations. At present I've only put the code in to name the main stations. But it works! And I can use the same method to name the OXP stations.

All names stay persistant and as the OXP only loads the names for the stations in the system you are currently in, its only a few K being load up when you make a jump or start the game, so can't see any performance hit. I'll play test it a bit and I need to add the code to name the OXP stations, but I'll realease a working version in January.

The OXP test Alpha is still up on the Manager, would someone mind deleting it?

Below is the working code:-

The Stations orbiting the Core Worlds are now: Lave: Avalonia Avenged, Riedquart: The Red Baron, Zaonce: Nostalgia for Infinity, Tionisla: Danse Macabre, Leesti: Sitting Duck, Diso: Dark Moon, Reorte: Vogon Poetry, Orerve: Rogue Quasar

Happy Christmas

Code: Select all

"use strict";
this.name = "RandomStationNames";
this.author = "LittleBear";
this.copyright = "2020 LittleBear";
this.description = "World script for Random Station Names OXP";
this.licence = "CC BY-NC-SA 4.0";

//  On Start Up run all the Station Naming Functions so the stations in the system the player is currently in are named.
this.startUpComplete = function ()
{
this.$renameMainStation();
}

//  Also run all the Station Naming Functions when a Hyperspace Jump is made in order that the Stations in the system just entered are also named.
this.shipExitedWitchspace = function ()
{
this.$renameMainStation();
}


this.$renameMainStation = function $renameMainStation ()
{
//  This Function names all the 2,048 Main Stations in the game.
// The array called main holds 2,048 unique names which are used to name all the Main Stations in the game.
// The arrays are read by System Number, which is advanced by 256 per Galaxy.
// The names are all stored in one array, but enties 1 to 256 are used for Galaxy 1, 257 to  512 for Galaxy 2 and so on.
// Only the name for the system the player is currently in is loaded, so only a few K of memory is actually used.

var main = ["Hand of Glory", "Technological Magic", "Petrified Cockatrice", "Bear Market", "and so on with 2048 names];

var ms = system.mainStation;
if (galaxyNumber === 0) var mainGrid = Math.floor(system.ID+0);
if (galaxyNumber === 1) var mainGrid = Math.floor(system.ID+256);
if (galaxyNumber === 2) var mainGrid = Math.floor(system.ID+512);
if (galaxyNumber === 3) var mainGrid = Math.floor(system.ID+768);
if (galaxyNumber === 4) var mainGrid = Math.floor(system.ID+1024);
if (galaxyNumber === 5) var mainGrid = Math.floor(system.ID+1280);
if (galaxyNumber === 6) var mainGrid = Math.floor(system.ID+1536);
if (galaxyNumber === 7) var mainGrid = Math.floor(system.ID+1792);
 if (!ms || !ms.isValid) return;
if (!ms.shipUniqueName) ms.shipUniqueName = ms.shipUniqueName+""+main[mainGrid&2047];

}

Last edited by LittleBear on Fri Dec 25, 2020 12:55 am, edited 2 times in total.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5001
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Random Station Names OXP

Post by Cholmondely »

Well done, O blessed beseecher of the bar and beatific benefactor and bestower of the bedightments of Oolite!

I look very much forwards to trying out the fruits of your labours!

And ... a Merry Christmas to thee and thine!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

Getting there with this, but I've got stuck on the right syntax. The Main Stations are all done and named. So I'm now setting up the code to name the OXP stations. I don't really need to use a variable, but I'm using one to test the syntax. At the moment I've got as code:-

Code: Select all

this.shipSpawned = function(ship)
{
    if(ship.hasRole === "blackmonk_monastery") var bm = this.ship;
	        bm.displayName = bm.name+""+monkpool[system.ID&255];
}
I don't really need the variable as I could just do it in one line with:-

Code: Select all

this.shipSpawned = function(ship)
{
    if(ship.hasRole === "blackmonk_monastery") this.ship.displayName = this.ship.name+""+monkpool[system.ID&255];
}
But I'm using the Variable to test if Oolite is detecting the station. Although my commander is parked up and saved at a Black Monk Monastary, I'm getting the error of bm undefinied. So I know the problem is with the method I'm using to detect the station. I had looked at the Random Ship Names code and this ought to work. But it doesn't. The Monk Station is being spawned, but I'm doing somthing wrong with the ship.has.Role bit. Same thing happend if I change the var to just a number or a string.

Does anyone know how I should phrase this to detect the Station?
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Random Station Names OXP

Post by spara »

I might be totally off here. but have you tried using ship.displayName instead of this.ship.displayName?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

Think either one is okay. For the main stations (which are working) I've got:-

Code: Select all

var ms = system.mainStation; // Checks that a Main Station is actually present. The only time it wouldn't be is on a mis-jump where the player is in Intersteller Space.
if (!ms || !ms.isValid) return; // If there is no Main Station present then don't run the function.

// Checks for Galaxy so the correct part of the array to name the stations in that Galaxy is read.
if (galaxyNumber === 0) var mainGrid = Math.floor(system.ID+0); 
if (galaxyNumber === 1) var mainGrid = Math.floor(system.ID+256);
if (galaxyNumber === 2) var mainGrid = Math.floor(system.ID+512);
if (galaxyNumber === 3) var mainGrid = Math.floor(system.ID+768);
if (galaxyNumber === 4) var mainGrid = Math.floor(system.ID+1024);
if (galaxyNumber === 5) var mainGrid = Math.floor(system.ID+1280);
if (galaxyNumber === 6) var mainGrid = Math.floor(system.ID+1536);
if (galaxyNumber === 7) var mainGrid = Math.floor(system.ID+1792);

// Names the Main Station with the name for that station contained in the array.
// Numbering for system.ID starts at 0 so the last name in the array is number 2047 rather than 2048.
ms.shipUniqueName = ms.shipUniqueName+""+main[mainGrid&2047];

For the OXP stations I'm using a pool of 256 names which are then use to name by systemID. monkpool is a list like this:-

var monkpool = ["Clerical Mace", "Tome of Debt", "Debtor's Rosary", "Joy of Debt", "Purity of Poverty", "Piety of Penury", "Flail of Repayment", "Abbot of Avarice", "Exorcism of Solvency", "and so on with 256 names"]

So any Monk Station at Planet 0 is named Clerical Mace, any at planet 1 is named Debtor's Rosary and so on. As I'm using a procedural generator its faily quick to generate 256 names in an approparte stye and then hand check it for any duplications or ones that don't look that good.

My plan is to have a list of commands one for each type of OXP station, linked to a custom list. I built the generator in descriptions and have a command to dump 256 names to my save file each time I dock, which I can then just C&P into an array in the script file. The tricky bit was doing the generator!

The trouble is, when I did the main stations I could just use system.mainStation to identify the station to be named. For OXPs I need to find them by role. That should be straight forward as I just need to look in the OXP and do a test for its role. But its the test for role bit that I'm definatley doing somthing wrong with, but can't work out what it is.

I've tried just using:-

if(ship.hasRole === "blackmonk_monastery") ms.shipUniqueName = ms.shipUniqueName+""+main[mainGrid&2047];

I know that works in terms of setting the name as, so I'm as sure as a can be that its the first bit of if(ship.hasRole === "blackmonk_monastery") thats wrong as its not detected that Black Monk Station I'm docked at.
Last edited by LittleBear on Mon Dec 28, 2020 2:37 pm, edited 1 time in total.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Random Station Names OXP

Post by spara »

If I understand you correctly, ship.hasRole === "blackmonk_monastery" returns true. To my understanding that means that "ship" handler points to the correct object and when querying that object with "hasRole", it returns the correct string for comparison. Just to make sure, does this one also fail:

Code: Select all

this.shipSpawned = function(ship)
{
    if(ship.hasRole === "blackmonk_monastery") ship.displayName = ship.name+""+monkpool[system.ID&255];
}
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

Tried that. Latest Log is not reporting any errors in my script and the black monk station is being spawned as latest log is showing

15:07:15.419 [LogEvents]: Black Monk Monastery 29250 spawned at 0 km

But no name added to station.

I'm pretty sure its the role check that's wrong as it must be returning false otherwise the station would have been named. But I'm stumped as to whats wrong with it.

If anyone fancies given this a test, I've put the code for the whole script file below. The OXP is just the script file so if you c&p it and put it in a Script Folder it'll run as it is currently running for me.

To keep the length of this post down, only Galaxy 1 main stations will be named if you run the script below (but I know that bit works). It should also name all black monk stations in all galaxys. But that's where I;m stuck.

Code: Select all

use strict";
this.name = "RandomStationNames";
this.author = "LittleBear";
this.copyright = "2021 LittleBear";
this.description = "World Script for Random Station Names OXP";
this.version = "1.00";
this.licence = "CC BY-NC-SA 4.0";

//  Version 1.0. Released XX January 2021.

//  On Start Up name the Main Station for the system the player is in.
//  Also name any OXP stations present.

this.startUpComplete = function ()
{
this.$renameMainStation();  // Names all the Main Stations in the game.
this.$renameMonkStations(); //  If Black Monks is installed and the player is in a system where a Black Monk station is then the Station is named. If not then the function does nothing.

}

//  On making a hyperspace or galatic hyperspace jump name the Main Station for the System the player has just entered. 
//  Also name any OXP stations present.

this.shipExitedWitchspace = function ()
{
this.$renameMainStation(); 
this.$renameMonkStations(); //  If Black Monks is installed and the player is in a system where a Black Monk station is then the Station is named. If not then the function does nothing.

}

// All stations except the Main Station are classified as 'ships', If the player has no OXP stations installed then none of the OXP station naming functions are run.
// Each type of OXP station is checked to see if it is present. If it is then it is given a name from the array associated with that station.
// So if Black Monks is installed (for example) and the player is in a system where a Black Monk Station is present it will be assigned a name from the array called "monkpool".
// All OXP stations are checked for (as of the release date).
// For OXPs released after the Random Station Names OXP, the Random Station names OXP can name your station if you would like it to.
// The last entry checks for any station which includes as a role "random_station_names_name_this_station".
// If you include that role in your list of roles in the Shipdata file for your station, then it will be named by Random Station Names from the array called "generalpool".
// If however your OXP Station is not on the list of specific stations and you don't include the role "random_station_names_name_this_station" in your shipdata.plist then Random Station Names will not name it.

// Whenever an OXP station is spawned name it.

this.shipSpawned = function(ship)
{
    if(ship.hasRole === "blackmonk_monastery") ship.displayName = ship.name+""+monkpool[system.ID&255];
}

this.$renameMainStation = function $renameMainStation ()
{
//  This Function names all the 2,048 Main Stations in the game using the Array called main. (Number of Names in Array: 2,048)
//  The array is read by System Number, which is advanced by 256 per Galaxy so that all the names are used without repetition..
//  The names are all stored in one array, but enties 1 to 256 are used for Galaxy 1, 257 to 512 for Galaxy 2 and so on.
//  Only the name for the main station of the system the player is currently in is loaded, so only a few K of memory is actually used.

var main = ["Hand of Glory", "Technological Magic", "Petrified Cockatrice", "Bear Market", "Vestigial Flame", "Code of Honour", "Fire Storm", "Avalonia Avenged", "Arc of Descent", "Rough Diamond", "Unbreakable Oath", "Wild Rosemary", "The Mad Hatter", "Surfing Bird", "Pit Viper", "Scales of Justice", "Balance of Power", "Knight's Bridge", "Eye of Newt", "Smoke Weaver", "Arsenal of Freedom", "Symbiotic Relationship", "The Qin Shi Hyang", "Shades of Gray", "Vailed Shadow", "Rags to Riches", "Future Tense", "Cunning Plan", "Displacement Tactic", "Primeval Moonlight", "Proving Ground", "Ultimate Finesse","Scarborough Fair", "State of Flux", "Lore Master", "Justice for All", "Halls of Valhalla", "Notre Dame", "Matter of Perspective", "Vogon Poetry", "Wind Walker", "Sacred Flame", "Prime Factor", "The Hasan Ibn Ali", "Obsidian Order", "Rule of Law", "The Red Baron", "Riddling Sphinx", "Timely Intervention", "Fareie Fire", "Gnostic Ascension", "Slanted Moonbeam", "Pale Nova", "Sleep of the Just'", "Bearded Devil", "Sitting Duck", "Dark Mantle", "The Kublai Khan", "Dutch Auction", "Quality of Life" , "Last Laugh", "Rallying Call", "Alcyonia Lacus", "Old Faithful","Light Bringer", "Pillars of Creation", "Just In Time", "Silver Blaze", "Angular Momentum", "Spoils of War", "Sweet Sorrow", "Star Fox", "Galactica Actual", "Twinkling Star", "Sacred Ground", "Alter Ego", "Voodoo Child", "Human Nature", "Rolling Thunder", "Worst Case Scenario", "Silver Cocoon", "Rising Storm ", "Random Thoughts", "Better than Life", "Mortal Coil", "Eleventh Hour", "The Nelson Mandela", "Deadly Poet", "Social Inertia", "Zodiacal Light ", "Pale Captain", "Waking Moments", "Absolution Day", "Ghost of Winter", "Star Shepheard", "Veiled Lady","Galactic Prince", "Queen of Shadows", "Fiscal Policy", "Out of Time", "Anger Management", "Infinite Regress", "Phaseolus Lunatus", "Latent Image", "Farewell to Arms", "Dark Nebula", "Truculent Tachyon", "Morning Star", "The Grigori Rasputin", "Soul of Discretion", "Shades of Morality", "Gregarious Gecko", "Fair Haven", "Waxing Power", "Consumer Confidence", "Incandescent Aurora", "Standing Vigil", "Sympathetic Devil", "Welsh Dragon", "Natural Law", "Nine Dancers", "Deadly Goat", "Emperor of Dust", "Travelling Hopefully", "Danse Macabre", "Beyond a Joke", "Flawed Logic", "Terran Goddess","Equitable Exchange", "Nostalgia for Infinity", "Trojan Horse", "Cooler King", "Dramatis Personae", "Promised Land", "Kindness of Strangers", "Rules of Acquisition", "Wakeful Dormouse", "Reluctant Dragon ", "Eternal Sceptic", "Tranquillity Base", "Oracle of Delphi", "Loss Adjuster", "Second Sight", "Snickering Hyena", "Golden Comet", "Total Perspective", "Small Mercies", "Dark Moon", "Return to Grace", "Cultured Jester", "Babylon Rising", "Dawn of Time", "Android Mother", "Force of Nature", "Quick Thinking", "Avenging Hellfire", "Quantum of Eden", "Eye of the Beholder", "Scorpion Departing", "Break from Reality","First Strike Policy", "Perfect Sphere", "Glint of Laser Light", "Paradise Lost", "All Good Things", "Band of Gold", "Unvarnished Truth", "Lone Star", "Business as Usual", "Call to Arms", "Furious Purpose", "Stone Medusa", "Utopia Reclaimed", "Corporate Subterfuge", "Cunning Plan", "Hidden Funds", "Black Rain", "Highland Mist", "Rings of Saturn", "Angel of Islington", "The Alex Ryder", "Transfigured Night", "Virtuous Vulture", "Crimson Quasar", "Statistical Probability", "Errand of Mercy", "The Kofi Annan", "Blue Giant", "Eye of Jupiter", "Ascent of Man", "Troubadour in Impiety", "Change of Heart","Merchant of Venice", "General Relativity", "Shadow of Doubt", "Sea of Tranquillity", "Blue Moon", "Taj Mahal", "Pale Moonlight", "Handsome Devil", "Troublesome Truth", "Field of Fire", "Mercurial Jewel", "Jealous God", "Trick or Treat", "Forgotten Glory", "Honoured Dead", "Wolf in the Fold", "Tapestry of Fate", "Motionless Marionette", "Jack of the Lantern", "Red October", "Hopeless Romantic", "Gentleman's Agreement", "Piece of the Action", "Mischief Night", "Handful of Stardust", "Awkward Moment", "Wink of an Eye", "Doppler Effect", "Azure Star", "Puff Adder", "Undying Hope", "Weeping Angel","Drowned God", "Edible Goat", "The John Christopher", "Iron Curtain", "Risen Sun", "The Joseph Brant", "Reformed Devil", "Silent Running", "Disposable Income", "The Drew Wagar", "Beyond the Pale", "Fractured Sanity", "Earth Mother", "Iron Lady", "Forbidden City", "Darting Viper", "Garden of Bones", "Dark Queen", "Prudent King", "Coiled Cobra", "Baron Greenback", "Soaring Condor", "Frontier Justice", "The Red Baron", "Argent Moon", "Magnum Opus", "Mind Flayer", "Summer Rain", "Occam's Razor", "Thin Ice", "The Harry Houdini", "Serpentine Queen", 

// The Name below is unused but is included for De-Bugging purposes (See the Readme File for Details).

"Sanity Check"];

// Code to read the main array and add the names to all Main Stations.

var ms = system.mainStation; // Checks that a Main Station is actually present. The only time it wouldn't be is on a mis-jump where the player is in Intersteller Space.
if (!ms || !ms.isValid) return; // If there is no Main Station present then don't run the function.

// Checks for Galaxy so the correct part of the array to name the stations in that Galaxy is read.
if (galaxyNumber === 0) var mainGrid = Math.floor(system.ID+0); 

// Names the Main Station with the name for that station contained in the array.
// Numbering for system.ID starts at 0 so the last name in the array is number 2047 rather than 2048.

ms.shipUniqueName = ms.shipUniqueName+""+main[mainGrid&2047];

}

this.$renameMonkStations = function $renameMonkStations ()
{
//  This Function sets up the array for naming all the Black Monk Stations in the game, using the Array called monkpool. (Number of Names in Array: 256 )
//  For Stations such as Black Monks which are Galaxy wide but only appear at certain systems it is simpler to just use a pool of 256 names as then every Black station in the 8 Galaxies is assigned a consitent name from the pool.
//  Doing it this way means I only have to check for the station being present in the system rather than having to work out where they all are and have a load of conditions to test which system of the 2048 the player is in.
//  Except for Stations added by the Extra Stations for Extra Planets OXP (due to the huge number of these a different method is used) all the OXP stations are named with the same method, but each type of station is named from a different pool.

var monkpool = ["Clerical Mace", "Tome of Debt", "Debtor's Rosary", "Joy of Debt", "Purity of Poverty", "Piety of Penury", "Flail of Repayment", "Abbot of Avarice", "Exorcism of Solvency", "Negative Equity", "Tome of Armaments", "Pontiff of Destitution", "Cardinal of Credit", "Rector of Repayment", "Verger of Vengeance", "Altar of Accounting", "Patriarch of Poverty", "Prayer for Solvency", "Defaulter's Pyre", "Credit Control", "Cowl of Receivership", "Sin of Liquidity", "Abbot of Accounting", "Deacon of Piety", "Tabard of Debt", "Sacrament of Mammon", "Pound of Flesh", "Bankrupt Bishop", "Blessedly Insolvent", "State of Debt", "Bliss of Bankruptcy", "Compound Interest",

"Day of Reckoning", "Nave of Receivership", "Sacrament of Debt", "Chapple of Affluence", "Indebted Sinner", "Papal Currency", "Abbot of Austerity", "Repayment or Revenge", "Curse of Liquidity", "Temptation of Solvency", "In Debt We Trust", "Austere Fellowship", "Matriarch of Insolvency", "Psalm of Debt", "Chant of Mammon", "Repenting Sinner", "Vow of Poverty", "Lamb of Loans", "Defaulter's Bane", "Patriarch of Loans", "Mace of Repentance", "Cleric of Currency", "Sin of Equity", "Mortgage of Mammon", "Monastic Inquisition", "Reaper of Sin", "Missionary of Lending", "Curate of Credit", "Vicar of Vengeance", "Reverent of Revenge", "Monetary Miracle", "Manifestation of Mammon",

"Graven Image", "Bankrupt Matriarch", "Tome of Liquidation", "Chosen of Mammon", "Joyous Bankruptcy", "Sanctity of Capital", "Adept of Insolvency", "Hymn of Debt", "Temple of Insolvency", "Cathedral of Mammon", "Righteous Repayment", "Sin of Solvency", "Accountant of Woe",  "Pope of Penury", "Destitute Debtor", "Repentance for Repayment", "Stocks of Debt", "Defaulter's Penance", "Sack Cloth", "Missionary of Debt", "Mass for Insolvency", "Papal Blessing", "Gospel of Mammon", "Pawnbroker's Bible", "Pain of Solvency", "Crusade for Currency", "Prayer of Destitution", "Fellowship of Penury", "Communion of Debt", "Bible of Avarice", "Incarnation of Insolvency", "Minister of Poverty",

"Sinner's Lamentation", "Repentance for Solvency", "Joy of Servitude", "Vow of Repayment", "Crusader of Mammon", "Monastic Moneylender", "Cathedral of Credit", "Vestments of Bankruptcy",  "Scythe of Default", "Mace of Mammon", "Purification of Sin", "Saviour of Solvency", "Hymn of Vengeance", "Nave of Bankruptcy", "Temple of Ruin", "Avenger of Default",  "Communion of Mammon", "Cathedral of Debt", "Scourge of Default", "Flail of Sin", "Cleric of Credit", "Mace of Vengeance", "Cassock of Insolvency", "Monastic Communion ", "Abbot of Ruin", "Crusading Bishop", "Chant of Mammon", "Gospel of Debt", "Vestments of Vengeance", "Bliss of Insolvency", "Purge of Default", "Debtor's Prayer",

"Impecunious Pontiff", "Lash of Default", "Rapture of Debt", "Vengeful Pope", "Vicar of Woe", "Monastic Accounting", "Vestments of Repossession", "Puritanical Avenger", "Joyous Repayment", "Blessed Servitude", "Curate of Capital", "Altar of Mammon", "Clerical Coffers", "Bible of Vengeance", "Destitute Sinner", "Monastic Avenger", "Bejewelled Bishop", "Nave of Servitude", "Indentured Debtor", "Collection Plate", "Monetarised Fealty", "Cowl of Mammon", "Purge of Sin", "Sacrament of Repayment", "Miracle of Foreclosure", "Merciless Pursuit", "Pitiless Pope", "Prayer of Foreclosure", "Papal Coffer", "Affluent Abbott", "Nave of Avarice", "Fellowship of Debt",  

"Temple of Woe", "Debt Collector", "Beatific Bailiff ", "Avenging Vicar", "Cathedral of Avarice", "Austere Matriarch", "Monastic Capital", "Vow of Poverty",  "Crusading Patriarch", "Altar of Bankruptcy", "Tome of Debt", "Robe of Revenge", "Crooke of Collection", "Psalm of Mammon", "Avenging Verger", "Hymn of Pain",  "Miraculous Repossession", "Credit Reaper", "Direct Debit", "Cathedral of Servitude", "Monastic Foreclosure", "Puritanical Curate", "Vestments of Piety", "Habit of Pain", "Robe of Mammon", "Lamb of Debt", "Worship of Avarice", "Nave of Piety", "Curse of Solvency", "Avaricious Avenger", "Temple of Ruin", "Robe of Insolvency",  

"Deacon of Doom", "Molly’s Wimple", "Spanish Inquisition", "Cowl of Vengeance", "Cassock of Penury", "Financial Inquisitor", "Agony of Default", "Nave of Destitution", "Flail of Finance", "Hymn of Repossession", "Cowl of Austerity", "Financial Audit", "Chant of Debt", "Cassock of Servitude", "Cassock of Credit", "Tome of Default",  "Chant of Foreclosure", "Crusading Curate", "Temple of Temptation", "Goblet of Mammon", "Habit of Repentance", "Sacrament of Bankruptcy", "Reaper's Cowl", "Cassock of Finance", "Fiscal Review", "Purging Day", "Tabard of Woe", "Rector of Revenge", "Deacon of Debt", "Scythe of Piety", "Gospel of Finance", "Robe of Penury",

"Beatific Bishop", "Rapturous Debtor", "Sanctity of Repayment", "Penniless Friar", "Curate of Servitude", "Destitute Deacon", "Austere Friar", "Archbishop of Austerity", "Repentant Sinner", "Pyre of Agony", "Vestments of Poverty", "Fearsome Friar", "Venomous Vicar", "Chaotic Cleric", "Psalm of Repentance", "Vicious Verger", "Habit of Penury", "Mendacious Missionary", "Curate of Cruelty", "Liquidator's Cowl", "Cassock of Receivership", "Tabard of Lending", "Blessed Bailiff", "Sacrament of Receivership", "Robe of Repentance", "Fiscal Missionary", "Hymn of Finance", "Archbishop of Receivership", "Affluent Avenger", "Merciless Missionary", "Dastardly Deacon", "Pope of Piety",

// The Name below is unused but is included for De-Bugging purposes (See the Readme File for Details).

"Sanity Check"];





}












// End of File.
// Version 1.0 Released XX/01/21.

OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2676
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Random Station Names OXP

Post by spara »

I'm so out of touch :roll: ship.hasRole === "blackmonk_monastery" is the part that's wrong. It should be something like ship.hasRole("blackmonk_monastery").

Try this:

Code: Select all

this.shipSpawned = function(ship)
{
    if(ship.hasRole("blackmonk_monastery")) this.ship.displayName = this.ship.name+""+monkpool[system.ID&255];
}
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

Tried that one, but got the error:-

16:35:39.852 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RandomStationNames 1.00): TypeError: this.ship is undefined

Tried it as:-

this.shipSpawned = function(ship)
{
this.$renameMonkStations();
if(ship.hasRole("blackmonk_monastery")) ship.displayName = ship.displayName+""+monkpool[system.ID&255];
}

This time I got the error that monkpool was not defined. This was because in the script I had the definition of monkpool after the shipSpawned.

So I moved it to the start of the script.

Ran with no errors. But the station still isn't named.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5001
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Random Station Names OXP

Post by Cholmondely »

LittleBear wrote: Mon Dec 28, 2020 5:06 pm
Tried that one, but got the error:-

16:35:39.852 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RandomStationNames 1.00): TypeError: this.ship is undefined

Tried it as:-

this.shipSpawned = function(ship)
{
this.$renameMonkStations();
if(ship.hasRole("blackmonk_monastery")) ship.displayName = ship.displayName+""+monkpool[system.ID&255];
}

This time I got the error that monkpool was not defined. This was because in the script I had the definition of monkpool after the shipSpawned.

So I moved it to the start of the script.

Ran with no errors. But the station still isn't named.
It is sounding more and more that Saint Herod imposed some vow of humility on his monks that prevents them from naming their monasteries. Why on earth would you presume that it has to be a coding issue?

And are they sinning if they name their Gunships? ... and does that translate to an improved chance to escape from/fight off a named gunship?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

Found the problem!

Thanks spara, your test for role was correct and this:-

Code: Select all

this.shipSpawned = function(ship)
{
if(ship.hasRole("blackmonk_monastery")) ship.displayName = ship.displayName+""+monkpool[system.ID&255];
}
Works perfectly. I was testing from a commander saved at the Monestary. But if I load up a commander saved at a main station then it was named. So the this.ShipSpawned function is fine, but for some reason it isn't run when you are actually docked and saved at a non-main station and load that commander. I'll add a if dockedStation name test in just to cover the situation where you save a game at an OXP station and name it under start-up as well as ShipSpawned.

The Black Monk Monestray at Ordadve is now named "In Debt We Trust". :D

Working Code is below (without the arrays).

Code: Select all

use strict";
this.name = "RandomStationNames";
this.author = "LittleBear";
this.copyright = "2021 LittleBear";
this.description = "World Script for Random Station Names OXP";
this.version = "1.00";
this.licence = "CC BY-NC-SA 4.0";

//  Version 1.0. Released XX January 2021.

// This OXP names all Main and OXP stations in the game.
// The Arrays hold the names (a total of XXX).
// As Arrays have to be set up before the code is run, the first XXX lines of the script file are just massive lists of text to hold all the station names.
// If you are looking at this script to debug it or find out how it works, you may want to jump to Line XXX as that is where the actual code is.

// Name Arrays Start Here.

// Name Array for Main Stations.

//  This Array holds the names all the 2,048 Main Stations in the game in the Array called main. (Number of Names in Array: 2,048)
//  The array is read by System Number, which is advanced by 256 per Galaxy so that all the names are used without repetition..
//  The names are all stored in one array, but enties 1 to 256 are used for Galaxy 1, 257 to 512 for Galaxy 2 and so on.
//  Only the name for the main station of the system the player is currently in is loaded, so only a few K of memory is actually used.

[Arrays not C&Ped]

/ Code Starts Here.

// Name the Main Station when the Player loads a game or starts a new game.
// Just in case the player saved at an OXP station and is loading a game saved at a non-main station, OXP stations are also checked for and named under start-up.
this.startUpComplete = function ()
{
var ms = system.mainStation; // Checks that a Main Station is actually present. The only time it wouldn't be is on a mis-jump where the player is in Intersteller Space.
if (!ms || !ms.isValid) return; // If there is no Main Station present then don't run the function.

// Checks for Galaxy so the correct part of the array to name the stations in that Galaxy is read.
if (galaxyNumber === 0) var mainGrid = Math.floor(system.ID+0); 
if (galaxyNumber === 1) var mainGrid = Math.floor(system.ID+256);
if (galaxyNumber === 2) var mainGrid = Math.floor(system.ID+512);
if (galaxyNumber === 3) var mainGrid = Math.floor(system.ID+768);
if (galaxyNumber === 4) var mainGrid = Math.floor(system.ID+1024);
if (galaxyNumber === 5) var mainGrid = Math.floor(system.ID+1280);
if (galaxyNumber === 6) var mainGrid = Math.floor(system.ID+1536);
if (galaxyNumber === 7) var mainGrid = Math.floor(system.ID+1792);

// Names the Main Station with the name for that station contained in the array.
// Numbering for system.ID starts at 0 so the last name in the array is number 2047 rather than 2048.

ms.shipUniqueName = ms.shipUniqueName+""+main[mainGrid&2047];

// Check if the player is loading a game saved at an OXP station. If so name the OXP station.

}

//  On making a hyperspace or galatic hyperspace jump name the Main Station for the System the player has just entered. 
//  No check is needed for OXP stations as these are named as they are spawned with the function below.
this.shipExitedWitchspace = function ()
{
var ms = system.mainStation; // Checks that a Main Station is actually present. The only time it wouldn't be is on a mis-jump where the player is in Intersteller Space.
if (!ms || !ms.isValid) return; // If there is no Main Station present then don't run the function.

// Checks for Galaxy so the correct part of the array to name the stations in that Galaxy is read.
if (galaxyNumber === 0) var mainGrid = Math.floor(system.ID+0); 
if (galaxyNumber === 1) var mainGrid = Math.floor(system.ID+256);
if (galaxyNumber === 2) var mainGrid = Math.floor(system.ID+512);
if (galaxyNumber === 3) var mainGrid = Math.floor(system.ID+768);
if (galaxyNumber === 4) var mainGrid = Math.floor(system.ID+1024);
if (galaxyNumber === 5) var mainGrid = Math.floor(system.ID+1280);
if (galaxyNumber === 6) var mainGrid = Math.floor(system.ID+1536);
if (galaxyNumber === 7) var mainGrid = Math.floor(system.ID+1792);

// Names the Main Station with the name for that station contained in the array.
// Numbering for system.ID starts at 0 so the last name in the array is number 2047 rather than 2048.

ms.shipUniqueName = ms.shipUniqueName+""+main[mainGrid&2047];
}

// All stations except the Main Station are classified as 'ships', If the player has no OXP stations installed then none of the OXP station naming functions are run.
// Each type of OXP station is checked to see if it is present. If it is then it is given a name from the array associated with that station.
// So if Black Monks is installed (for example) and the player is in a system where a Black Monk Station is present it will be assigned a name from the array called "monkpool".
// All OXP stations are checked for (as of the release date).
// For OXPs released after the Random Station Names OXP, the Random Station names OXP can name your station if you would like it to.
// The last entry checks for any station which includes as a role "random_station_names_name_this_station".
// If you include that role in your list of roles in the Shipdata file for your station, then it will be named by Random Station Names from the array called "generalpool".
// If however your OXP Station is not on the list of specific stations and you don't include the role "random_station_names_name_this_station" in your shipdata.plist then Random Station Names will not name it.
this.shipSpawned = function(ship)
{
if(ship.hasRole("blackmonk_monastery")) ship.displayName = ship.displayName+": "+monkpool[system.ID&255];



}

OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

This is more a question for Spara.

There is a Headquarters Station in RRS. Is this a unique sation that shouldn't be named or is it okay to name it with the pool of 256 names for the Waystations. Second question? Does it ever appear in the same system as a Waystation. If it doesn't then I'd only need one pool to give both types of station a unquie name

These are not in any particular order. The OXP tweeks the ASC to add the name of the station underneath the display when a station beacon appears. So when I jump to a new system with all the Station OXPs installed I'm just checking my ASC and naming anything without a name that isn't a unique station. So far done are:


Main Stations
Witch Point Buoys
Black Monk
Monastery
Con Store
Station
Super Hub Station
HoOpy Casinos
Taxi Galactica Stations
Fuel Stations & Satellites
S.I.R.F.
Stations
RRS Waystations
Free Trade Zone

Station Type Array Used and Type Example Names Total in Array Identifying Role

Main Stations Main
(Hand-Written) The Red Barron
Dark Star
Transfigured Night 2,048 system.mainStation


Witch Point Buoys Buoypool
(Custom Procedural) BL-261
FF-255
YR-609 256 buoy-witchpoint

Black Monk
Monastery Monkpool
(Hand-Written) Tome of Debt
Cathedral of Mammon
Joy of Penury 256 blackmonk_monastery

Con Store
Station Storepool
(Hand-Written) Bargain Basement
Monroeville Mall
Gleeful Carpetbagger 256 Constore

Super Hub Station Hubpool
(Hand-Written) Union of Worlds
Tropicana Resort
Majestic Cylinder 256 pagroove_superhub

HoOpy Casinos Hoopypool
(Custom Procedural) Three of a Kind
Knave of Wands
Ace of Spades 256 Casinoship

Taxi Galactica Stations Taxipool
(Hand-Written) The Cloned Cabbie
Green Badge
Rapid Rickshaw 256 taxi_station


Fuel Stations & Satellites Fuelpool
(Custom Procedural) Upsilon-087
Kappa-036
Phi-121
Xi-187 512 fuelStation_station
fuelStation_satellite

S.I.R.F.
Stations Sirfpool
(Custom Procedural) Princess Laura
Countess Ruth
Dame Mary II 256 SIRF-YARD


RRS Waystations Rrspool
(Hand-Written) Brigand’s Bane
Rogue Slayer
Aspect of Security 256 rescue_station

Free Trade Zone Ftzpool
(Mix of Handwritten and procedural generation from the OXP’s Chaotic Type1 Template)
(Uses tweeked version of the Chaotic_Evil Generator).

Outlaw's Grotto
Angel's Agony
Judge's Grave
The Sly Fugitive
Death to Justice
Fall of Blackbeard
Brigand's Gambit
Snickering Desperado 256 free_trade_zone


GRS Buoy Factory grspool
(Custom Procedural) Thane Amed
Mikado Tarquin XI
Kaiser Gavin 256 repaired-buoy-station



T
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5001
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Random Station Names OXP

Post by Cholmondely »

If there is only the one witchpoint buoy in a system, why would it have a name?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Random Station Names OXP

Post by phkb »

Cholmondely wrote: Mon Jan 04, 2021 9:37 pm
If there is only the one witchpoint buoy in a system, why would it have a name?
Bureaucracy loves identifiers. So do DB admins. There is no correlation between these two things, though.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2866
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Re: Random Station Names OXP

Post by LittleBear »

Got a few more done. Done now are:-

Main Stations
Witch Point Buoys
Black Monk Monastery
Con Store
Station
Super Hub Station
HoOpy Casinos
Taxi Galactica Stations
Fuel Stations & Satellites
S.I.R.F.
Stations
RRS Waystations
Free Trade Zone
RRS Mining Outposts
GRS Buoy Factory
Darkside Saloons & Distilleries
Royal Hunting Lodges
Imperial Astro Factory
Collective SLAPU

Naming Styles for the additional ones are:-

RRS Mining Outposts: Minepool (Custom Procedural) / Barnacle Rock, Bushmaster Syndicate, Ophidian Weir.

GRS Buoy Factory: grspool (Custom Procedural) / Thane Amed, Mikado Tarquin XI, Kaiser Gavin

Darkside Saloons & Distilleries : Darkpool1, Darkpool2 (Complex Nested Procedural) / The Merry Hound, The Strange Bird, The Python and Bantam, The Asp and Poet, The Speckled Goat

Royal Hunting Lodges: Lodgepool (Special Procedural) / Anna the Lionheart, Jarno the Obscure, Franco the Shrewd

Imperial Astro Factory: Astropool (Custom Procedural) / Dynast Meyer, Pretor de Boer, Consul Rimbert
Collective SLAPU: Slapupoo (Custom Procedural) / Might of the Bolsheviks, Fortitude of the Stasi, Love of Big Brother
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
Post Reply