Page 83 of 118

Re: Scripters cove

Posted: Wed Jun 17, 2015 12:38 am
by phkb
I'm trying to update the Oolite Trumbles mission to be compatible with XenonUI. What I'd like to do is change the "runScreen" command and change the "background" parameter to be an "overlay", like this:

Code: Select all

				// Show the mission screen.
				mission.runScreen({
					titleKey: "oolite_trumble_title",
					messageKey: "oolite_trumble_offer",
					overlay: {name:"trumblebox.png", height:512},
					choicesKey: "oolite_trumble_offer_yesno"
				},
The trouble (with Trumbles - ha!) is, firstly, there is no screen ID on the Trumbles mission screen. And secondly, when I try to replace the existing missionScreenOpportunity function with one of my own, it doesn't seem to work the same. I tried this:

Code: Select all

	var w = worldScripts["oolite-trumbles"];

	w.missionScreenOpportunity = function missionScreenOpportunity() {
			if (pendingOffer && player.credits > 6553.5)
			{
				pendingOffer = false;

				// Show the mission screen.
				mission.runScreen({
					screenID: "oolite-trumbles",
					titleKey: "oolite_trumble_title",
					messageKey: "oolite_trumble_offer",
					overlay: {name:"trumblebox.png", height:512},
					choicesKey: "oolite_trumble_offer_yesno"
				},
				function (choice)
				{
					if (choice === "OOLITE_TRUMBLE_YES")
					{
						player.credits -= 30;
						player.ship.awardEquipment("EQ_TRUMBLE");

						missionVariables.trumbles = "TRUMBLE_BOUGHT";
						cleanUp(this);
					}
					else
					{
						missionVariables.trumbles = "NOT_NOW";
					}
				});
			}
		};
But I get an error saying "pendingOffer is not defined". I tried adding "this" to the front of "pendingOffer" but that doesn't seem to help. Is it possible to even do what I'm trying to do?

Re: Scripters cove

Posted: Wed Jun 17, 2015 6:35 am
by cim
phkb wrote:
there is no screen ID on the Trumbles mission screen.
Good point. I'll make a note to add screen IDs to all the core mission screens when I get a moment. Until then...
phkb wrote:
But I get an error saying "pendingOffer is not defined". I tried adding "this" to the front of "pendingOffer" but that doesn't seem to help. Is it possible to even do what I'm trying to do?
Because of how the trumbles script is written, and how JS variable scoping works, pendingOffer is global to the functions defined within that script, and otherwise inaccessible.

Instead what you can do is take a copy of the entire oolite-trumbles script, place it in your OXP Scripts folder without changing the name (no need to add it to worldscripts.plist as it's already defined), and make your changes directly to the function there.

(This will limit you to releasing the OXP under GPLv2+ or CC-BY-NC-SA 3+)

Re: Scripters cove

Posted: Thu Jun 18, 2015 2:11 am
by phkb
Thanks cim!

Re: Scripters cove

Posted: Thu Jun 18, 2015 4:42 am
by phkb
Another one: I've been playing around with the "oolite-extras-column-title" in descriptions.plist, trying to add columns. Is it possible to include variables is the text? I've tried multiple options without success.

Re: Scripters cove

Posted: Thu Jun 18, 2015 9:33 pm
by Lone_Wolf
I'm not entirely sure how cloaked ships work wrt shipBeingAttacked & shipBeingAttackedByCloaked .

cloaked ship attacks player with laser
shipBeingAttackedByCloaked should fire then.

Does shipBeingAttacked also fire in that case (probably with whom == null ) ?

Re: Scripters cove

Posted: Wed Jul 01, 2015 12:29 am
by phkb
Is it possible to determine if the current HUD has the "allow_big_gui" set?

Re: Scripters cove

Posted: Wed Jul 01, 2015 5:40 am
by cim
phkb wrote:
Is it possible to determine if the current HUD has the "allow_big_gui" set?
That would have been useful... No, it's not. I'll add it to my list.

Re: Scripters cove

Posted: Mon Jul 06, 2015 4:32 pm
by phkb
Is it possible to set the color of the "drawMissileDisplay:", "drawScoopStatus:", "drawAegis:", and "drawWeaponsOfflineText:" HUD selectors?

Re: Scripters cove

Posted: Mon Jul 06, 2015 5:20 pm
by cim
phkb wrote:
Is it possible to set the color of the "drawMissileDisplay:", "drawScoopStatus:", "drawAegis:", and "drawWeaponsOfflineText:" HUD selectors?
None of them currently have this option.

Re: Scripters cove

Posted: Tue Jul 07, 2015 1:00 am
by Redspear
cim wrote:
phkb wrote:
Is it possible to set the color of the "drawMissileDisplay:", "drawScoopStatus:", "drawAegis:", and "drawWeaponsOfflineText:" HUD selectors?
None of them currently have this option.
You can change the alpha level however (with at least one of them anyway), which can make a significant change.

For example:

Image

A little too bright for my tastes considering it's position...


Image

Much better...


P.S. Should the full stop be there ("Weapons systems offline.")? It looks a little odd to me.

Re: Scripters cove

Posted: Tue Jul 07, 2015 3:08 am
by Wildeblood
Redspear wrote:
P.S. Should the full stop be there ("Weapons systems offline.")? It looks a little odd to me.
You can change it in descriptions.plist if you wish. Nearly all core text strings in descriptions.plist are punctuated and end with a full stop.

A chance to ride my hobby-horse: is the comma still missing from "Press space[,] Commander."?

Re: Scripters cove

Posted: Wed Jul 08, 2015 1:52 pm
by Redspear
Wildeblood wrote:
You can change it in descriptions.plist if you wish.
Ah yes, of course. Thanks. :)

Re: Scripters cove

Posted: Wed Jul 15, 2015 7:45 am
by phkb
Is it possible to work out the dimensions of a ship (height, width, length in game meters) without loading the model into some external utility (like Wings3D)?

Edit: Nevermind - I found what I was looking for in the {ship model}.dat file!

Re: Scripters cove

Posted: Wed Jul 15, 2015 8:11 am
by cim
phkb wrote:
Edit: Nevermind - I found what I was looking for in the {ship model}.dat file!
In-game you can use ship.boundingBox

Re: Scripters cove

Posted: Wed Jul 15, 2015 9:05 am
by Norby
[wiki]Gallery[/wiki] use this to show the ship sizes in-game. Note subentities counted in the boundingBox but the .dat show the main hull only and you must add manually others (like a gun) using subentity positions and sizes.