Scripters cove

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

Moderators: winston, another_commander

User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
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'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?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripters cove

Post 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+)
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Thanks cim!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post 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.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post 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 ) ?
OS : Arch Linux 64-bit - rolling release

OXPs : My user page

Retired, reachable at [email protected]
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Is it possible to determine if the current HUD has the "allow_big_gui" set?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripters cove

Post 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.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Is it possible to set the color of the "drawMissileDisplay:", "drawScoopStatus:", "drawAegis:", and "drawWeaponsOfflineText:" HUD selectors?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripters cove

Post 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.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2687
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Scripters cove

Post 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."?
In your heart, you know it's flat.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2687
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Wildeblood wrote:
You can change it in descriptions.plist if you wish.
Ah yes, of course. Thanks. :)
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post 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!
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripters cove

Post 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
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Scripters cove

Post 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.
Post Reply