Page 28 of 29

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

Posted: Wed Nov 02, 2022 9:11 pm
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.

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

Posted: Sun Nov 06, 2022 8:53 am
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...

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

Posted: Sun Nov 06, 2022 3:26 pm
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.

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

Posted: Sun Nov 06, 2022 3:30 pm
by Redspear
I asked similar some time ago.

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

Posted: Mon Nov 07, 2022 6:45 am
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.

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

Posted: Mon Nov 14, 2022 4:54 pm
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?

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

Posted: Mon Nov 14, 2022 5:20 pm
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.

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

Posted: Mon Nov 14, 2022 5:28 pm
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!

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

Posted: Mon Nov 14, 2022 5:36 pm
by another_commander
Try logging the two variables just before the modulus operation occurs. Do they appear as expected before they are used?

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

Posted: Mon Nov 28, 2022 5:21 pm
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?

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

Posted: Mon Nov 28, 2022 7:12 pm
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.

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

Posted: Tue Nov 29, 2022 4:06 am
by Reval
Just the ticket M_L - thank you!

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

Posted: Thu Jun 01, 2023 11:51 am
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.

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

Posted: Sat Jan 13, 2024 4:30 pm
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?

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

Posted: Sat Jan 13, 2024 6:11 pm
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.