BroadcastComms MFD [Release]

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

Moderators: another_commander, winston

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

Re: BroadcastComms MFD [Release]

Post by phkb »

Small tweak to spec:
phkb wrote: Mon Jul 11, 2022 2:03 am

Code: Select all

{
	"myship" = {
		...
		... various shipdata entries
		...
		script_info = {
			"bcc_disable_defaults = (2,3,4); // this will disable message types 2, 3 and 4 for this ship type.
			"bcc_custom_defaults = {
				"1" = {
					transmit = "[my_custom_greeting]"; // instead of using the default greeting descriptions.plist lookup, use "[my_custom_greeting]"
					reply = "[my_custom_reply]";
				};
			};
		};
	};
}
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: BroadcastComms MFD [Release]

Post by phkb »

Ok v1.3 is now available, which includes all the script_info integration. Rather than explain everything here, if you want to make use of it, head over to the wiki page [EliteWiki] here, and scroll down to External Access subsection, click the link to expand the dark side, and look for the script_info details.

There is also a small test OXP where you can see all the techniques in play. It’s in the main BCC OXP, in the Resources folder, but you can download it independently here: BCC_Testbed.zip.

Let me know if you think anything is missing.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4999
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: BroadcastComms MFD [Release]

Post by Cholmondely »

phkb wrote: Sun Jul 17, 2022 3:31 am
Ok v1.3 is now available, which includes all the script_info integration. Rather than explain everything here, if you want to make use of it, head over to the wiki page [EliteWiki] here, and scroll down to External Access subsection, click the link to expand the dark side, and look for the script_info details.

There is also a small test OXP where you can see all the techniques in play. It’s in the main BCC OXP, in the Resources folder, but you can download it independently here: BCC_Testbed.zip.

Let me know if you think anything is missing.
Nice....

Now to see what his Magnificent Munificence does with it....
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
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: BroadcastComms MFD [Release]

Post by Old Murgh »

phkb wrote: Sun Jul 17, 2022 3:31 am
Ok v1.3 is now available..
Looks at the outset like a superb, thorough package. Very excited to dive in.
Cholmondely wrote: Sun Jul 17, 2022 4:30 am
Now to see what his Magnificent Munificence does with it....
More like Larkish Luddite. :D It feels great to be so thoughtfully enabled.
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: BroadcastComms MFD [Release]

Post by Old Murgh »

phkb wrote: Sun Jul 17, 2022 3:31 am
Let me know if you think anything is missing.
Just to report that is a lot of fun to play with. Really well-considered in its layout and logic.

I do wonder if I've missed how to be able to take a default comms action off the table a bit in. (if one doesn't start with "greeting" but goes down another path, "greeting" will still hang around, when it would be strange to send it) not being able to hide it like one can with the custom messages.

Other than that it opens the door to the mysteries of post_reply_function and post_reply_worldscript, and how I would go about donating a cargo to another ship, or make it follow me blindly..

For anyone curious, here is a WIP of an Xpat (or 3) appearing (mostly) at Lave which can hold a conversation for a bit. prohipXatWIP.oxp (not to be combined IA4 and IALave).
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: BroadcastComms MFD [Release]

Post by phkb »

Old Murgh wrote: Sun Jul 17, 2022 3:19 pm
I do wonder if I've missed how to be able to take a default comms action off the table a bit in. (if one doesn't start with "greeting" but goes down another path, "greeting" will still hang around, when it would be strange to send it) not being able to hide it like one can with the custom messages.
The script_info controls can prevent a particular message option from ever being available. So

Code: Select all

	script_info = {
		bcc_disable_default = (3);
	};
Would mean that you would never see the "Greeting" option on that ship.

However, from the sounds of it, you want to disable the greet option after some other form of communication has taken place (for instance, after a custom conversation has started). At present, the only way to do this is through Javascript. (I might investigate being able to achieve this via script_info in a future release).

To achieve this, in your shipdata.plist file, add these lines to the "level1" custom message

Code: Select all

	<key>post_reply_function</key>
	<string>$hideGreeting</string>
	<key>post_reply_worldscript</key>
	<string>xpat_populator</string>
Then, add this function to the xpat_populator.js file

Code: Select all

this.$hideGreeting = function(ship, msgkey) 
{
	var bcc = worldScripts.BroadcastCommsMFD;
	bcc.$addShipToArray(ship, bcc._greeted);
}
Then the greeting option will be removed after the custom conversation is started.

BTW, you don't need to use "level1" and "level2a" as the keys in your conversation. Feel free to use keys that make sense to you. I only used those key names to help illustrate the different conversation levels in the example.

Also, I noticed that you're using the "post_reply_hide_messages" on each message in your custom conversation to hide that message. However, you also have

Code: Select all

	<key>delete_on_transmit</key>
	<string>yes</string>
which will do the same thing. You only really need to use "post_reply_hide_messages" if you give the player two comms options, but they are mutually exclusive (that is, if the player picks option 1, they can't then choose option 2). So, after sending option 1, the "post_reply_hide_messages" allows you to easily remove option 2. Hope that makes sense. Let me know if you need more details.
Last edited by phkb on Sun Jul 17, 2022 10:51 pm, edited 1 time in total.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: BroadcastComms MFD [Release]

Post by phkb »

Old Murgh wrote: Sun Jul 17, 2022 3:19 pm
Other than that it opens the door to the mysteries of post_reply_function and post_reply_worldscript, and how I would go about donating a cargo to another ship, or make it follow me blindly..
For the first one, it depends on how "visual" you want to make it. You can just run functions to subtract cargo from your manifest, and then add the same amount to the manifest of the other ship. Nice and easy - although you are essentially using a matter transmat control, which theoretically doesn't exist in the game. Magic would also explain it!

The other way to achieve this is to eject the cargo from your ship, then switch the AI on your target to scavenger, which should then make them try to scoop any visible cargo containers. I did this in GalCop Missions, mission type 40, in the galcopbb_delivery.js script file. It's complicated though. Have a look at that as an example (although there is a lot of other stuff in and around the type 40 mission, so it might be hard to discern).

For the second one, that might be easier: I haven't looked at this myself, but it should be possible to make the target an escort of the player ship. If I get some time I'll look into how to make this happen.
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: BroadcastComms MFD [Release]

Post by Old Murgh »

phkb wrote: Sun Jul 17, 2022 10:07 pm
However, from the sounds of it, you want to disable the greet option after some other form of communication has taken place (for instance, after a custom conversation has started). At present, the only way to do this is through Javascript. (I might investigate being able to achieve this via script_info in a future release).
Yes, exactly. But all right, this should do the trick for now then.
phkb wrote: Sun Jul 17, 2022 10:07 pm
BTW, you don't need to use "level1" and "level2a" as the keys in your conversation. Feel free to use keys that make sense to you. I only used those key names to help illustrate the different conversation levels in the example.
Good to know, but that system does make it clear and easy to keep track of the dialogue steps and paths.
phkb wrote: Sun Jul 17, 2022 10:07 pm
Also, I noticed that you're using the "post_reply_hide_messages" on each message in your custom conversation to hide that message. However, you also have.
Ah yes, I didn't realise. I thought I was obliged to tidy up the path not taken, but that's even more convenient then.
phkb wrote: Sun Jul 17, 2022 10:18 pm
For the first one, it depends on how "visual" you want to make it. You can just run functions to subtract cargo from your manifest, and then add the same amount to the manifest of the other ship. Nice and easy - although you are essentially using a matter transmat control, which theoretically doesn't exist in the game. Magic would also explain it!
I guess if the transfer demanded that the ships be close enough, one could excuse skipping the visuals.
Could I force interject direct AI commands like performIdle and pauseAI through the post_reply_function/post_reply_worldscript, or would the solution be to temporarily switch to a simple custom made "standByToReceiveAI"?
phkb wrote: Sun Jul 17, 2022 10:18 pm
For the second one, that might be easier: I haven't looked at this myself, but it should be possible to make the target an escort of the player ship. If I get some time I'll look into how to make this happen.
That sounds great. I think there are a couple of situations I've wished for the opportunity to command an NPC to do a "duckling follow".
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: BroadcastComms MFD [Release]

Post by phkb »

Old Murgh wrote: Sun Jul 17, 2022 10:47 pm
Could I force interject direct AI commands like performIdle and pauseAI through the post_reply_function/post_reply_worldscript, or would the solution be to temporarily switch to a simple custom made "standByToReceiveAI"?
There are probably ways you could send those specific commands to the AI, I think the easiest way would be to switch the AI, and then switch it back afterwards.
Old Murgh wrote: Sun Jul 17, 2022 10:47 pm
I guess if the transfer demanded that the ships be close enough, one could excuse skipping the visuals.
Again in GalCop Missions, mission type 43, in that same script file, you have to deliver 1t of machinery to a damaged ship, which requires you to get close to it and eject the cargo. I then use some JS methods to act as a tractor beam to pull the cargo into the target ship. But the method you suggest would be much simpler.
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: BroadcastComms MFD [Release]

Post by Old Murgh »

phkb wrote: Sun Jul 17, 2022 11:01 pm
There are probably ways you could send those specific commands to the AI, I think the easiest way would be to switch the AI, and then switch it back afterwards.
I am no enemy of "easiest". Especially if I persuade myself it is also "most elegant".
phkb wrote: Sun Jul 17, 2022 11:01 pm
Again in GalCop Missions, mission type 43, in that same script file, you have to deliver 1t of machinery to a damaged ship, which requires you to get close to it and eject the cargo. I then use some JS methods to act as a tractor beam to pull the cargo into the target ship. But the method you suggest would be much simpler.
Cool, I'll see what I can identify.

Two ships lining up belly to belly for direct cargo transfer ought to be a more common sight in the Oolite universe. Which would call for a David Attenborough-style soft-voice commentary. :D
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: BroadcastComms MFD [Release]

Post by Old Murgh »

phkb wrote: Sun Jul 17, 2022 3:31 am
Let me know if you think anything is missing.
It would make sense to me to have the possibility of postponing the revelation of unique message until after the generic Greeting has been selected and replied to. So only then would custom message level1 be unhidden..

This way, a player wouldn't be able to see at first glance on the menu if there was a special reason to communicate to a ship, and only after the greeting does an unusual Comms entry pop up on the menu. To give the option of withholding that clue..
Did I manage to explain that understandably?

Do you see the value in it? Is that something you could envision squeezed in there?
It might revitalise that ancient custom of saying hello to everyone. :D
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: BroadcastComms MFD [Release]

Post by phkb »

Old Murgh wrote: Mon Jul 18, 2022 4:41 pm
Is that something you could envision squeezed in there?
It's achievable now, in a way.

1. Disable the default "Greeting"
2. Make your conversation tree start with a greeting. You could even use the existing descriptions.plist entries for the transmission and replies.
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: BroadcastComms MFD [Release]

Post by Old Murgh »

phkb wrote: Mon Jul 18, 2022 5:26 pm
It's achievable now, in a way.

1. Disable the default "Greeting"
2. Make your conversation tree start with a greeting. You could even use the existing descriptions.plist entries for the transmission and replies.
Hey that's clever. I didn't think of that, that's just as good.
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: BroadcastComms MFD [Release]

Post by Old Murgh »

phkb wrote: Mon Jul 18, 2022 5:26 pm
It's achievable now, in a way.
1. Disable the default "Greeting"
2. Make your conversation tree start with a greeting. You could even use the existing descriptions.plist entries for the transmission and replies.
So this one was frustrating me.
I went forth trying to disguise my conversation start after the replaced greeting, and I thought I was doing everything by the book, but the desired Comms wasn't happening, and I every time I got this error:

Code: Select all

[script.javaScript.exception.uncaughtException]: ***** JavaScript exception (BroadcastCommsMFD 1.3): uncaught exception: Invalid settings: Cannot use comm system message types.
I went far back and tried to see if anything could be remotely different from what had irrefutably been working before..
Until I finally tried changing the display heading "Send greeting to target" to simply "Send greeting", which indeed turned out to have been the showstopper.
So, this it will not allow..
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: BroadcastComms MFD [Release]

Post by phkb »

Ah, yes! That was a bit of a "gotcha" moment waiting in the code. I'll have another look at what I'm doing there to make it at least more transparent, but hopefully more flexible as well.
Post Reply