Page 11 of 12

Re: Randomshipnames.oxp v 1.4 released

Posted: Mon Nov 02, 2015 5:52 pm
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.

Re: Randomshipnames.oxp v 1.4 released

Posted: Mon Nov 02, 2015 5:57 pm
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?

Re: Randomshipnames.oxp v 1.4 released

Posted: Thu Sep 29, 2016 5:54 pm
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:

Re: Randomshipnames.oxp v 1.4 released

Posted: Thu Sep 29, 2016 6:08 pm
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!

Re: Randomshipnames.oxp v 1.4 released

Posted: Fri Sep 30, 2016 5:19 am
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!

Re: Randomshipnames.oxp v 1.4 released

Posted: Fri Sep 30, 2016 9:27 am
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!

Re: Randomshipnames.oxp v 1.4 released

Posted: Mon Oct 24, 2016 5:33 am
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>

Re: Randomshipnames.oxp possibilities

Posted: Tue Jul 05, 2022 5:21 pm
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?

Re: Randomshipnames.oxp v 1.4 released

Posted: Tue Jul 05, 2022 10:36 pm
by Cholmondely
Behemoth.oxp names each of the various Behemoths it contains. And I think that GenerationShip.oxp does too. No randomness though.

Re: Randomshipnames.oxp v 1.4 released

Posted: Tue Jul 05, 2022 10:58 pm
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.

Re: Randomshipnames.oxp v 1.4 released

Posted: Tue Jul 05, 2022 10:59 pm
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;
}

Re: Randomshipnames.oxp v 1.4 released

Posted: Tue Jul 05, 2022 11:06 pm
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.

Re: Randomshipnames hacking

Posted: Wed Jul 06, 2022 8:32 pm
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?

Re: Randomshipnames.oxp v 1.4 released

Posted: Wed Jul 06, 2022 8:48 pm
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)];

Re: Randomshipnames.oxp v 1.4 released

Posted: Wed Jul 06, 2022 9:12 pm
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?