Randomshipnames.oxp v 1.4 released

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

Moderators: winston, another_commander

User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: Randomshipnames.oxp v 1.4 released

Post by spara »

Fritz wrote:
Randomshipnames does contain code that checks for earlier versions, but perhaps it was an OXP and not an OXZ at the time, and the code has somehow survived.
Exactly. Some of the expansions available from the manager are just OXPs converted to OXZ by adding a manifest. As a result there are redundancies and subtle and not so subtle misbehavior.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Randomshipnames.oxp v 1.4 released

Post by Cody »

spara wrote:
As a result there are redundancies and subtle and not so subtle misbehavior.
I've seen a few names repeating lately, which is something I've never seen before - linked?
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
DredgerMan
Deadly
Deadly
Posts: 253
Joined: Fri Oct 21, 2011 9:01 am
Location: Some buggy planet at the edge of the known universe

Re: Randomshipnames.oxp v 1.4 released

Post by DredgerMan »

Uhhhmmmmm,

Oopsie?

:( :( :( :( :(

I'm afraid I trashed Cody's Machine.

It was a Gecko (red not green) and I let it fire the first volley, truely I did. And it said that i would be in trouble if I wasted his time.

So I didn't. It wasn't much of a fight so I am certain that Cody wasn't piloting it himself. But still.

Sorry, Cody.

:( :( :( :( :(

:mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen:
Flying The Sizzlin' Suzie VI, a trusty and venerable Boa Class Cruiser in Oolite 1.84 on

under Windows 6.1.7601 Service Pack 1 64-bit
with a Geforce GT610 videocard
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Randomshipnames.oxp v 1.4 released

Post by Cody »

DredgerMan wrote:
I'm afraid I trashed Cody's Machine.
There's a ship out there named Cody's Machine, and it was a bit soft? <chortles> A Soft Machine? Out-Bloody-Rageous!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 675
Joined: Sat Aug 09, 2014 4:16 pm

Re: Randomshipnames.oxp v 1.4 released

Post by Commander_X »

Cody wrote:
DredgerMan wrote:
I'm afraid I trashed Cody's Machine.
There's a ship out there named Cody's Machine, and it was a bit soft? <chortles> A Soft Machine? Out-Bloody-Rageous!
Might've been "Kodi's Machine" -- you know spelling ... :-D ... Or did they bring in names from the forums, maybe?! Copyright infringement!
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Randomshipnames.oxp v 1.4 released

Post by Cody »

Commander_X wrote:
Or did they bring in names from the forums, maybe?!
Yeah, there are a few. I'm still searching for Disembodied's secret base. It's out there somewhere, and one fine day, I'll find it.
Then there's McLane's Personalities OXP - that had a bunch of forum veterans included, along with their ships of choice.

As an aside, I got a dodgy email this morning, saying Cody had asked them to send me the financial details, etc - a trifle disconcerting!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Randomshipnames.oxp v 1.4 released

Post by Diziet Sma »

Cody wrote:
Then there's McLane's Personalities OXP - that had a bunch of forum veterans included, along with their ships of choice.
Aye.. he was working on an updated version of it, when he vanished.. <sigh>
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 640
Joined: Sat Dec 04, 2021 11:01 pm

Re: Randomshipnames.oxp possibilities

Post by Old Murgh »

I've read myself a bit stupid throughout this thread and the corresponding posts in Tinkerer's workshop, so eh.. could someone in the know tell me in no uncertain terms if it is possible to include in an OXP an addendum to this engine, introducing a new role to include, and a new pool of names for this new role to choose from?
Or is this only possible by editing the Randomshipnames.oxp proper?

Or isn't it actually possible?
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Randomshipnames.oxp v 1.4 released

Post by Cholmondely »

Behemoth.oxp names each of the various Behemoths it contains. And I think that GenerationShip.oxp does too. No randomness though.
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
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 640
Joined: Sat Dec 04, 2021 11:01 pm

Re: Randomshipnames.oxp v 1.4 released

Post by Old Murgh »

Cholmondely wrote: Tue Jul 05, 2022 10:36 pm
Behemoth.oxp names each of the various Behemoths it contains. And I think that GenerationShip.oxp does too. No randomness though.
I'm pretty sure that Behemoth does it the hard way, with many shipdataentries, not using the RSN. I suppose I could do that –no limit to how many like_ship clones I could put in, but I imagine the risk of that awkward moment when two ships with the same name meet is greater then.
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Randomshipnames.oxp v 1.4 released

Post by phkb »

Old Murgh wrote: Tue Jul 05, 2022 5:21 pm
could someone in the know tell me in no uncertain terms if it is possible to include in an OXP an addendum to this engine, introducing a new role to include, and a new pool of names for this new role to choose from?
It looks like, to add your own naming routines, based on the primaryRole of a ship, you would need to do this:

Code: Select all

this.name = "MyWorldScriptName";

this.startUpComplete = function() {
	var rsn = worldScripts.randomshipnames;
	if (rsn) {
		rsn.$externalNameEngine(this.name, "special_ship_primary_role", 1);
		// the "1" in the function all above is the probability that the routine will be called. 1 means always. 
	}
}

this.$randomName = function(ship) {
	var shipName = "";
	// do stuff to come up with a name

	//
	return shipName;
}
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 640
Joined: Sat Dec 04, 2021 11:01 pm

Re: Randomshipnames.oxp v 1.4 released

Post by Old Murgh »

phkb wrote: Tue Jul 05, 2022 10:59 pm
Old Murgh wrote: Tue Jul 05, 2022 5:21 pm
could someone in the know tell me in no uncertain terms if it is possible to include in an OXP an addendum to this engine, introducing a new role to include, and a new pool of names for this new role to choose from?
It looks like, to add your own naming routines, based on the primaryRole of a ship, you would need to do this:

Code: Select all

this.name = "MyWorldScriptName";

this.startUpComplete = function() {
	var rsn = worldScripts.randomshipnames;
	if (rsn) {
		rsn.$externalNameEngine(this.name, "special_ship_primary_role", 1);
		// the "1" in the function all above is the probability that the routine will be called. 1 means always. 
	}
}

this.$randomName = function(ship) {
	var shipName = "";
	// do stuff to come up with a name

	//
	return shipName;
}
Great stuff, thank you!
Looking forward to try.
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 640
Joined: Sat Dec 04, 2021 11:01 pm

Re: Randomshipnames hacking

Post by Old Murgh »

phkb wrote: Tue Jul 05, 2022 10:59 pm
It looks like, to add your own naming routines, based on the primaryRole of a ship, you would need to do this:
So I had a go, but being oblivious, this was the only way I could see it work.

Code: Select all

this.name      = "scrubNamer"; 
this.author    = "phkb"; 
this.copyright = "";
this.description = "Add Scrub role and names to randomShipNames";
this.version   = "1.0";

/*
This copy/paste code from phkb tries to piggyback on randomShipNames, to add scrub as role and provide pool of scrub names to choose from
*/

this.name = "scrubNamer";

this.startUpComplete = function() {
	var rsn = worldScripts.randomshipnames;
	if (rsn) {
		rsn.$externalNameEngine(this.name, "scrub", 1);
		// the "1" in the function all above is the probability that the routine will be called. 1 means always. 
	}
}

this.$randomName = function(ship) {
	var shipName = "Clan Kirvesniemi: The Sissu", "Clan Jaaskelainen: The Lintu", "Clan Myllyla: The Iso Kaarme", "Clan Kokkonen: Vanha Rouva", "Clan Saarinen: The Lisko", "Clan Pohjola: Iso Kala", "Clan Saijonmaa: Area Peto";
	// do stuff to come up with a name

	//
	return shipName;
}
In control testing, RandomShipNames works when I give it a "trader" role in the script info –endearing custom trader name.. But when I change it to scrub, I get this log report:

Code: Select all

[script.javaScript.exception.noVariableName]: ***** JavaScript exception (scrubNamer.js.anon-script): SyntaxError: missing variable name
I believe my world-script situation is in order, so I gather I am plugging in the names wrong.. :oops:
Is my error obvious?
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Randomshipnames.oxp v 1.4 released

Post by phkb »

It’s what you’re trying to do with shipName. You’ve mixing data types.
Try this:

Code: Select all

    var shipName = [“name1”, “name2”, etc etc];
    return shipName[Math.floor(Math.random() * shipName.length)];
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 640
Joined: Sat Dec 04, 2021 11:01 pm

Re: Randomshipnames.oxp v 1.4 released

Post by Old Murgh »

phkb wrote: Wed Jul 06, 2022 8:48 pm
It’s what you’re trying to do with shipName. You’ve mixing data types.
Try this:

Code: Select all

    var shipName = [“name1”, “name2”, etc etc];
    return shipName[Math.floor(Math.random() * shipName.length)];
:( Not doing it.
No added RandomShipName given to my Scrub in space. Just plain Scrub.

Code: Select all

/*
This copy/paste code from phkb tries to piggyback on randomShipNames, to add scrub as role and provide pool of scrub names to choose from
*/

this.name = "scrubNamer";

this.startUpComplete = function() {
	var rsn = worldScripts.randomshipnames;
	if (rsn) {
		rsn.$externalNameEngine(this.name, "scrub", 1);
		// the "1" in the function all above is the probability that the routine will be called. 1 means always. 
	}
}

this.$randomName = function(ship) {
	var shipName = ["Clan Kirvesniemi: The Sissu", "Clan Jaaskelainen: The Lintu", "Clan Myllyla: The Iso Kaarme", "Clan Kokkonen: Vanha Rouva", "Clan Saarinen: The Lisko", "Clan Pohjola: Iso Kala", "Clan Saijonmaa: Area Peto"];
	// do stuff to come up with a name

	//
	return shipName[Math.floor(Math.random() * shipName.length)];
}

There's no error message in the log. scrubNamer 1.0 is listed in the list of loaded scripts. Are there any other clues I should look for?
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
Post Reply