Scripters cove

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

Moderators: another_commander, winston

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2915
Joined: Sat Jun 11, 2011 6:07 am
Location: Nova Hollandia
Contact:

Re: Scripters cove

Post by Wildeblood »

Lone_Wolf wrote: Thu Aug 14, 2025 2:53 pm
Is there an execution advantage for using a var to call worldscripts or is this cosmetic/style related ?
A slight advantage, yes.

Code: Select all

this.playerBoughtNewShip = this.playerReplacedShip = function _sc_playerReplacedShip(ship) {...}
Are those functions, above, running twice when the player buys a new ship? Would it be sufficient to just have the playerReplacedShip (or, am I thinking of adding and buying equipment)?
R.I.P. John Lodge, 1943-2025.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5593
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

I believe the replace ship event is separate to the bought ship event. They don’t happen together.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 781
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

Wiki on playerBoughtNewShip
Note: In a future release of Oolite, playerBoughtNewShip will no longer be fired when the ship is replaced using player.replaceShip(). Instead, the playerReplacedShip event should be used. At the moment, both events (playerBoughtNewShip and playerReplacedShip) will fire
That suggests it is currently possible for both playerBoughtNewShip and playerReplacedShip to fire for the same event ?
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5593
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Oh… oh well, forget what I said, then! That’s what I get when I don’t check my homework before speaking. Every time. Dang it.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 781
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

I intend to modernise the HUD i'm using and the first thing I want to add is showing names for the asc targets .

Looking at [EliteWiki] Hud.plist and Fully Annotated HUD Configuration (hud.plist) File I think this can de done by adding a dial for drawASCTarget .

Is that the correct approach ?
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2915
Joined: Sat Jun 11, 2011 6:07 am
Location: Nova Hollandia
Contact:

Re: Scripters cove

Post by Wildeblood »

Lone_Wolf wrote: Sat Oct 04, 2025 8:39 pm
I intend to modernise the HUD I'm using and the first thing I want to add is showing names for the ASC targets .

Looking at [EliteWiki] Hud.plist and Fully Annotated HUD Configuration (hud.plist) File I think this can de done by adding a dial for drawASCTarget .

Is that the correct approach ?
Yes.

This is the second time I've seen you refer to Fully Annotated HUD Configuration (hud.plist) File, so I'm glad you seem to find it useful. But, I'll take this opportunity to confess it's not actually "Fully Annotated", as the parameters that control visibility of the HUD elements are not included.

Also, the description of the align parameter of drawASCTarget is incorrect. For this parameter, 0 = left-aligned (the default) and 1 = right-aligned. The note near the top of the file, in the "SPECIAL PARAMETERS DOCUMENTATION" section, claiming it can also be centre-aligned, is a mistake.
R.I.P. John Lodge, 1943-2025.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 781
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

Thanks for the clarification .

I've looked deeper at the milhud*.plist files and noticed they are very similar .
several dials have different colors , a few are only present in one or two of the files.

It seems condensing them in one file would simplify the configuration and could be done using alert_conditions .

Another difference is the crosshair_color setting .
Is there a way to change a global hud setting through script ?
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5593
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Lone_Wolf wrote: Tue Oct 14, 2025 10:04 pm
Is there a way to change a global hud setting through script ?
Not directly. The method employed in existing huds is to have items be dependent on custom hidden equipment items, and then add/remove those equipment items via script as required.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 781
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

That method appears to be part of the dials properties, which makes it an alternative for using alert_conditions but not suitable for crosshairs.

I looked at VimanaX_HUD.js and they have lines like this :

Code: Select all

    var p = player.ship;
    p.crosshairs = "vx_crosshair_off.plist";
 
player.ship.crosshairs = "vx_" + cond + "crosshair_off.plist";
Edited

Although ship doesn't seem to have crosshairs, player.ship does have it .


Also wildeblood has created several oxps that change crosshairs , see viewtopic.php?f=4&t=14368

So there appear to be multiple ways to change crosshairs, although it's unclear to me whether crosshairs_color can be changed by either.
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 781
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

I haven't been able to find a method to change crosshair color through script.

Since I want to stay as close as possible to the original HUD, I am now considering the following approach :

create one foo_in-flight-hud.plist with all settings (global/dials/legends) needed in one of green/yellow/red/critical conditions.
Use a command to create 4 foo_<condition>_hud.plist files that only differ in crooshairs_color.

When foo_in-flight-hud.plist changes, rerun the command.

I would have preferred to this in-oxp but that is just not possible.
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
Cholmondely
Archivist
Archivist
Posts: 6545
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Scripters cove

Post by Cholmondely »

Lone_Wolf wrote: Thu Oct 23, 2025 8:46 pm
foo
?

Fantastically Operative Option?

Fabulously Ontological Oolite?

Fervently Optional Organism?
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
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 781
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

Thanks for making me laugh.

https://en.wikipedia.org/wiki/Foobar gives a decent explanation.
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 781
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

In KicheEmergencyShields I use player.ship.aftShield and other shield related properties.

According to https://wiki.alioth.net/index.php/Oolit ... ence:_Ship the ship object doesn't have those (since npcs have no shields).

In N-shields there are lines like

Code: Select all

if (ship.aftShield > ship.maxAftShield) ship.aftShield = ship.maxAftShield;
Do I need to access N-Shield worldscript to use those variables(if so, how?) or did the oolite ship object gain those properties and is the wiki out-of-date ?
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5593
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Lone_Wolf wrote: Sun Nov 16, 2025 4:08 pm
Do I need to access N-Shield worldscript to use those variables(if so, how?) or did the oolite ship object gain those properties and is the wiki out-of-date ?
Only the player ship has shields (forward and aft). You can test this by starting a strict game and checking the properties of the main station.

Code: Select all

system.mainStation.aftShield
doesn't return anything.
So N-Shields is adding the property to NPC's and then implementing the code to make them work.

Do you need to access these properties? It depends. NPC's don't have shields per-se - they have a boosted max energy amount to simulate shields. For an NPC implementation of your emergency shields mod, you could just add to the energy property of the ship. That way, you don't need to worry about what N-Shields is doing.
User avatar
Cholmondely
Archivist
Archivist
Posts: 6545
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Scripters cove

Post by Cholmondely »

Lone_Wolf wrote: Sun Nov 16, 2025 4:08 pm
According to https://wiki.alioth.net/index.php/Oolit ... ence:_Ship the ship object doesn't have those (since npcs have no shields).
Aegidian distinguished between the player ship's shields and the NPCs' lack of them because the NPCs lacked damageable equipment and he was trying to level the playing field.
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?
Post Reply