Scripters cove

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

Moderators: winston, another_commander

User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 518
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Scripters cove

Post by Day » Wed Apr 26, 2017 2:51 pm

I am currently thinking about the map visualization of the diverse alliances / antagonisms in my Diplomacy OXP.

To begin, I thought about drawing a line in red between two opposed systems, and a line in green between two allied systems; depending on the player knowledge, of course.

First, I would take any proposition of graphical improvement, over using lines, to represent alliances and oppositions.

Foremost (why should it always be the same thing?), is it possible to draw lines between systems on the full map? I only found the markSystem() functionality.

Barring that, I'll have to use system marks to signal alliances.

User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 518
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Scripters cove

Post by Day » Fri Apr 28, 2017 9:24 pm

I've found it!

Code: Select all

SystemInfo.setInterstellarProperty(galaxyNumber, dta[j], dta[k], 2, "link_color", this._regionColor);
Thanks to phkb and his galactic registry :p

User avatar
phkb
Commodore
Commodore
Posts: 2369
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Scripters cove

Post by phkb » Wed May 31, 2017 1:08 am

How does one work out the dimensions of a docking port? That is, the max width and height of the docking slit? Is the "boundingBox" property sufficient for this?

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2543
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Scripters cove

Post by Norby » Wed May 31, 2017 6:57 am

phkb wrote:
Wed May 31, 2017 1:08 am
the max width and height of the docking slit? Is the "boundingBox" property sufficient for this?
In the case of the old dock model with brick shape, yes. I use only this in ILS because this is the only way that I found in js.

A more complex way would be if you open every dock models in wings3d to measure the inner sizes of the gates and make an array of dimensions based on the datakey of stations. Note there are non-rectangular inlets in Rock Hermits and Superhubs.

Somewhere we discussed that there is a validator in the core which put a message into the log when a too big NPC made an unsuccessful attempt to launch through a small dock. This part probably use a more accurate code for the size check.

User avatar
phkb
Commodore
Commodore
Posts: 2369
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Scripters cove

Post by phkb » Wed May 31, 2017 7:34 am

Ah, I thought that might have been the answer. I was just planning on updating some stats on the wiki and was hoping for an easy option.

Might be time for a quick hack'n'slash of the source code...

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2543
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Scripters cove

Post by Norby » Wed May 31, 2017 8:04 am

Here is my data table:

Dock sizes (W x H x L) in Oolite 1.77:
Main stations: 192.000 x 64.000 x 250.000
Rock-hermit: 138.001 x 138.001 x 250.120

From 1.79:
cori: 241.888 x 103.412 x 250.000
dodo: 210.362 x 81.027 x 250.000
ico: 238.546 x 82.108 x 273.278
rock: 194.688 x 108.567 x 253.500 (but only 64.8m height at full width)

User avatar
Phasted
Competent
Competent
Posts: 44
Joined: Wed Jun 09, 2010 3:56 pm

Re: Scripters cove

Post by Phasted » Tue Jul 25, 2017 2:20 pm

Okay, re: galactic jumps...

What's the earliest point in the galactic jump sequence that Oolite knows FOR SURE which system the player will arrive in?

Can I, for example, read player.ship.targetSystem in playerEnteredNewGalaxy?

The idea here is to get the system ID before Oolite calculates prices and quantities...

And how exactly are prices calculated? It seems that price_economic and price_random are working opposite sides of the street. I need to know what the highest possible price [max_p] and the lowest possible price [min_p] for each commodity will be, and it's just not making any sense...

User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 13611
Joined: Sat Jul 04, 2009 9:31 pm
Location: Corke's Drift
Contact:

Re: Scripters cove

Post by Cody » Sun Jul 30, 2017 4:41 pm

I guess no-one knows, Phasted.

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5394
Joined: Wed Feb 28, 2007 7:54 am

Re: Scripters cove

Post by another_commander » Sun Jul 30, 2017 4:49 pm

Here is a quick snippet from the log during a galactic jump:
18:44:21.794 [test]: shipWillEnterWitchSpace [G:0 S:206]
18:44:21.893 [test]: playerWillEnterWitchspace [G:0 S:206]
18:44:27.902 [test]: playerEnteredNewGalaxy [G:1 S:118]
18:44:27.905 [test]: shipWillExitWitchspace [G:1 S:118]
18:44:31.126 [test]: shipExitedWitchspace [G:1 S:118]
As you can see, the system information is updated with the destination data when the playerEnteredNewGalaxy event is executed.

User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 13611
Joined: Sat Jul 04, 2009 9:31 pm
Location: Corke's Drift
Contact:

Re: Scripters cove

Post by Cody » Sun Jul 30, 2017 4:56 pm

<chortles>

Astrobe
---- E L I T E ----
---- E L I T E ----
Posts: 596
Joined: Sun Jul 21, 2013 12:26 pm

Re: Scripters cove

Post by Astrobe » Sat Sep 02, 2017 1:38 pm

I want to change the location and probability of Kyota stations provided by Wildships OXP.

I'm thinking I could wait until the OXP is loaded, then replace the script's systemWillPopulate() function with my own version. Knowing that the function refers to this, will it work?

User avatar
phkb
Commodore
Commodore
Posts: 2369
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Scripters cove

Post by phkb » Tue Sep 05, 2017 11:53 pm

Astrobe wrote:Knowing that the function refers to this, will it work?
Yes, it will work. If you replace a function in another script, any reference to "this" will be in that script, not yours. (And apologies for the late reply!)

User avatar
phkb
Commodore
Commodore
Posts: 2369
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Scripters cove

Post by phkb » Tue Sep 05, 2017 11:55 pm

Before I go and do something rash (you know, like changing the source code :D), is there any way to get the equipment key of the currently primed equipment item?

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2543
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Scripters cove

Post by Norby » Wed Sep 06, 2017 6:22 am

I do not know any. The logical way would be two new event listeners in Equipment scripts, for example this.primed and this.unprimed .

Astrobe
---- E L I T E ----
---- E L I T E ----
Posts: 596
Joined: Sun Jul 21, 2013 12:26 pm

Re: Scripters cove

Post by Astrobe » Thu Sep 07, 2017 4:23 am

phkb wrote:
Tue Sep 05, 2017 11:53 pm
Astrobe wrote:Knowing that the function refers to this, will it work?
Yes, it will work. If you replace a function in another script, any reference to "this" will be in that script, not yours. (And apologies for the late reply!)
No worries, I had other ideas to explore. Thanks for the answer.

Post Reply