Page 113 of 118

Re: Scripters cove

Posted: Fri Jul 28, 2023 2:21 pm
by phkb
I'm not missing something, am I? Is there no way to script a galactic hyperspace jump?

Re: Scripters cove

Posted: Fri Jul 28, 2023 3:08 pm
by Cody
[dumb pilot mode]Isn't the Constrictor scripted? [/dumb pilot mode]

Re: Scripters cove

Posted: Fri Jul 28, 2023 3:15 pm
by phkb
Cody wrote: Fri Jul 28, 2023 3:08 pm
Isn't the Constrictor scripted?
More of a "hand-wave" than a script. His "galactic jump" is telegraphed to the player via text, but it's not visible in game.

Re: Scripters cove

Posted: Fri Jul 28, 2023 6:25 pm
by Cody
Ahh... visible to the player? Intriguing!

Re: Scripters cove

Posted: Fri Jul 28, 2023 8:04 pm
by Redspear
Could you spawn a wormhole, asign it with the relevant properties and then have the desired ship make a beeline for it?

Re: Scripters cove

Posted: Fri Jul 28, 2023 10:26 pm
by phkb
I don’t think a wormhole can be spawned directly. You can spawn a ship have have it exitSystem, but you can’t give it galactic hyperspace co-ordinates. You can give the playership galactic co-ordinates, but you can only beginhyperspaceCountdown, which just does a local jump and will fail if you don’t have a local system targeted.

It’s not a big deal, though. I’ve added the script method to do a galactic jump to my local build. I was just curious if I’d missed something obvious somewhere.

Re: Scripters cove

Posted: Fri Jul 28, 2023 10:29 pm
by phkb
Cody wrote: Fri Jul 28, 2023 6:25 pm
Ahh... visible to the player? Intriguing!
I should say, only visible as a piece of text the player receives when docked, not in space.

Re: Scripters cove

Posted: Thu Aug 03, 2023 7:15 pm
by Switeck
Does this mean you will be putting in a way for the player to hitchhike on another ship's Galactic Jump, such as from the otherwise dead-end system Oresrati in Galaxy Chart 8?
...saving 5000 credits (and time to find and equip) for the Galactic Hyperdrive for your ship.

Re: Scripters cove

Posted: Thu Aug 03, 2023 8:47 pm
by phkb
Switeck wrote: Thu Aug 03, 2023 7:15 pm
Does this mean you will be putting in a way for the player to hitchhike on another ship's Galactic Jump, such as from the otherwise dead-end system Oresrati in Galaxy Chart 8?
...saving 5000 credits (and time to find and equip) for the Galactic Hyperdrive for your ship.
Not for this update. All I’m planning on adding is a beginGalacticHyperspaceCountdown method to the playerShip.

Re: Scripters cove

Posted: Sat Aug 05, 2023 4:47 pm
by Switeck
As for detecting a jump-attempt might be a galactic hyperdrive jump...

Code: Select all

this.playerStartedJumpCountdown = function (jump)
{
	if(jump == "galactic") {
// do something here!
	}
}
...or is the beginGalacticHyperspaceCountdown method to the playerShip...a way of auto-forcing the player's ship to do a galactic jump, perhaps unexpectedly?

Re: Scripters cove

Posted: Sat Aug 05, 2023 11:05 pm
by phkb
Switeck wrote: Sat Aug 05, 2023 4:47 pm
As for detecting a jump-attempt might be a galactic hyperdrive jump...

Code: Select all

this.playerStartedJumpCountdown = function (jump)
{
	if(jump == "galactic") {
// do something here!
	}
}
...or is the beginGalacticHyperspaceCountdown method to the playerShip...a way of auto-forcing the player's ship to do a galactic jump, perhaps unexpectedly?
The initial goal was automation. I wanted to easily calculate the average/min/max amounts for all commodities in the system, and by visit the system, rather than using the function to estimate prices. A sort of set and forget type of thing where I could come back and see the results. But I wanted to do it across all charts as well. And given how many times I wanted to do it, it made sense to add the missing function.

But what it gets used for in future - who knows.

Re: Scripters cove

Posted: Mon Aug 28, 2023 5:42 pm
by DGill
Ramirez's code has a number of strings giving names for a number of nationalities e.g.

"feudal_firstname_german_he" = ("Bruno","Dieter","Eric","Franz","Gustav","Heinrich","Johan","Lothar","Otto","Reinhard","Thorsten","Ulrich","Walter","Wilhelm","Wolfgang")

and uses:

player.rankGenerator_feudal_firstname = expandDescription("[feudal_firstname_" + [rankGenerator_language] + "_" + [player.rankGenerator_gender] + "]");

to extract a random name from the list for a specified language e.g german , english, etc.

I want to extract only the first name in the list for a specified language e.g Bruno in the above list for german

Anyone know how I can do it?

Re: Scripters cove

Posted: Tue Aug 29, 2023 6:21 pm
by Alnivel
DGill wrote: Mon Aug 28, 2023 5:42 pm
Ramirez's code has a number of strings giving names for a number of nationalities e.g.

"feudal_firstname_german_he" = ("Bruno","Dieter","Eric","Franz","Gustav","Heinrich","Johan","Lothar","Otto","Reinhard","Thorsten","Ulrich","Walter","Wilhelm","Wolfgang")

and uses:

player.rankGenerator_feudal_firstname = expandDescription("[feudal_firstname_" + [rankGenerator_language] + "_" + [player.rankGenerator_gender] + "]");

to extract a random name from the list for a specified language e.g german , english, etc.

I want to extract only the first name in the list for a specified language e.g Bruno in the above list for german

Anyone know how I can do it?
As far as I know, there is no way to get value at some specific index from a list in descriptions.plist.

If you need just only the first for a specified language you can just add entries like "feudal_firstname_german_he_0" = "Bruno"; for each language, but if you want more control, you, most likely, need to move the lists in a js file.

Re: Scripters cove

Posted: Tue Aug 29, 2023 6:45 pm
by DGill
Alnivel wrote: Tue Aug 29, 2023 6:21 pm

As far as I know, there is no way to get value at some specific index from a list in descriptions.plist.
Thank you for your help; I had a feeling this would be the case when all my feeble attempts to get it to work failed.

Re: Scripters cove

Posted: Tue Aug 29, 2023 9:32 pm
by LittleBear
You can select a specific position number from an array in script if you want to. But this would mean C&Ping the names from descriptions into script in array format:

Code: Select all

this.feudalfirstnamegermanhe = ["Bruno","Dieter","Eric","Franz","Gustav","Heinrich","Johan","Lothar","Otto","Reinhard","Thorsten","Ulrich","Walter","Wilhelm","Wolfgang"];
You can then summon a particular position in the array by its number (but Oolite starts counting from 0) with:

Code: Select all

var position = 0;
var name = feudalfirstnamegermanhe[position &14];
Var name will now be the name in the array at position 0 out of 15 positions (the number for total number above is one less than the actual number as position 1 is 0 and so on).