Tinkerer's Workshop - OXP tweaking for fun and profit!

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

Moderators: another_commander, winston

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

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Cholmondely »

another_commander wrote: Wed Nov 02, 2022 5:29 pm
That closing bracket above your comment marker terminates the list early. Move it at the end of everything and it should (hopefully) work. Also, remove the comma at the end of the very last entry.

(a couple of commas found missing)
Thank you, a_c - you fixed it for me! I just could not work out what was wrong (I terminated the list early because it all worked up to there, and the next three entries didn't - and I failed to see what was wrong with them). Plutil on the AppleMac's Terminal is pretty good - but did not tell me what was wrong this time.
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
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Reval »

Question: Is there a shiplibrary_overrides.plist or some such? Or can one include a new ship's description and specs tweaks in a copy of shiplibrary.plist and include that in one's OXP's Config folder? - I confess I've always been in the dark about this, which is why I never made one for the changes FE Ships introduces...
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
Alnivel
Dangerous
Dangerous
Posts: 100
Joined: Fri Jun 10, 2022 7:05 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Alnivel »

Reval wrote: Sun Nov 06, 2022 8:53 am
Question: Is there a shiplibrary_overrides.plist or some such? Or can one include a new ship's description and specs tweaks in a copy of shiplibrary.plist and include that in one's OXP's Config folder? - I confess I've always been in the dark about this, which is why I never made one for the changes FE Ships introduces...
It seems that there is no way to change the shiplibrary entries from outside - there is no overrides file, and each entry in the shiplibrary.plist is a separate entry on the library screen and does not affect others in any way.

But, if the description text (or the text of another key) is placed in description.plist, you can try to redefine it there, but whether this will work or not depends on the order in which the plists are loaded.
And one more thing, about specs - if they are not set in the shiplibrary.plist, they are automatically taken from shipdata, so you probably don't need to do anything to show your specs tweaks.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Reval »

Many thanks to you both - much light has been shed for me! :) I'll experiment to see what, if anything, works...

In any case, all I'm aiming to do is replace the Oolite descriptions with ones reflecting the characteristics and roles of the ('same') ships as offered by Frontier: First Encounters.
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Reval »

For a long time I've been noticing that Oolite Javascript's modulo (%) operator gives no result whatever. Quite simply, it doesn't work (for me) with any of my numeric variables.

The following would seem to be correctly coded:

Code: Select all

	var runs = this.$Runs;
	var intv = this.$Interval;
	// do something every <intv> runs
	if ( (runs > 0) && ((runs % intv)==0) ) this._doSomething();
I suspect also that multiplication (*) doesn't work with numeric variables.

This 'feature' of Oolite JS (if indeed it is one) prevents us implementing some rather elementary stuff that would be a breeze to do in C, or even standard JS for that matter.

Is it a known issue at all? Am I using the right syntax?
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6545
Joined: Wed Feb 28, 2007 7:54 am

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by another_commander »

This is the ouput from the Oolite debug console after running this, once for runs = 22 and once for runs = 24.

Image

Looks like it's working here. The multiplication operator also works, as can be seen. I would suggest checking that your initial variables hold valid values.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Reval »

Thanks a lot for testing it a_c. I really can't see what the problem is then, since my two global variables are set up correctly as numeric (ie. runs = 0 for startup, and then incremented every witchpoint exit with runs+=1; the interval (divisor) is also set up as an 'integer' in startup. I've never been able to get % to work!
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6545
Joined: Wed Feb 28, 2007 7:54 am

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by another_commander »

Try logging the two variables just before the modulus operation occurs. Do they appear as expected before they are used?
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Reval »

I'm attempting, without any luck, to determine whether player.ship is carrying a particular piece of equipment. Even being able to list out the equipment array would be a help...

JS Wiki says, under ship:


equipment

equipment : Array of EquipmentInfo (read-only)

The equipment a ship is carrying.


I've tried to access an element in this 'array', like so:

Code: Select all

	// or any other number as the index
	var eq = player.ship.equipment[0].name;
	log(this.name, eq);
but log just gives [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Equipment Test 1.0): TypeError: player.ship.equipment[0] is undefined'.

What is the correct syntax for accessing the elements of the equipment array? Anyone?
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
Massively Locked
Dangerous
Dangerous
Posts: 84
Joined: Tue Nov 20, 2012 12:20 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Massively Locked »

Reval wrote: Mon Nov 28, 2022 5:21 pm
I'm attempting, without any luck, to determine whether player.ship is carrying a particular piece of equipment...
Try:

Code: Select all

if (player.ship.equipmentStatus ("EQ_RELAXAPADS") === "EQUIPMENT_OK") {…}
If true, it's installed on your ship.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Reval »

Just the ticket M_L - thank you!
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4942
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Cholmondely »

Alnivel and I have been working on Spara's version of Xeptatl's Sword.

There is a problem: we replaced the old monitor stations with a new model snitched from elsewhere. BUT. The model is much bigger than the monitor station - and when we shrink it to size, the docking bay becomes too small to take a Cobra Mk. III

Can anybody help?

Download: as OXP and as OXZ.

If you want to check out how the new station model looks in-game, Diso has one.
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?
DGill
---- E L I T E ----
---- E L I T E ----
Posts: 271
Joined: Thu Jan 01, 2009 9:45 am

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by DGill »

I'm trying to shrink and reposition a model in Runscreen:

Image


I have:

mission.runScreen({
title: "Royal Court",
messageKey: "feudal_mission_accepted",
model:"feudal-tournament-buoy",
background:{name:"Feudal_Screen_C.png",height:512}
});
setScreenOverlay({ name: (this.$message1), height: 512 });

but would like to move the model to the space on the right and shrink it down

I believe there is a command - mission.displayModel.orientation
Is there also commands for position and size?
and if so how would it be scripted?
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2635
Joined: Thu Jun 20, 2013 10:22 pm

Re: Tinkerer's Workshop - OXP tweaking for fun and profit!

Post by Redspear »

DGill wrote: Sat Jan 13, 2024 4:30 pm
but would like to move the model to the space on the right and shrink it down
Total cheat/workaround idea here as I don't know how to do what you're asking exactly the way you're describing it but...

Imagine your image as part of a larger canvas with an alpha channel providing a transparent background.
The shield/medal/whatever placed on the far right of the image, vertically centred.

Result I'd have thought would be that the image is positioned where you want while the alpha channel avoids interfering with other overlays/image placements.
Post Reply