dock services in playership query

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Commander
Militia Commander
Posts: 343
Joined: Tue Nov 05, 2013 9:56 am

dock services in playership query

Post by relanat » Thu Nov 24, 2016 2:34 am

I''ve got dock services working nicely inside my Scorpion playership but only by using the older itempicker-style dock services screens (cut and pasted from SantaClausBox, thanks marsrocks).

I would like to use the newer screen (and hopefully inside Ship Configuration) but have run into a wall of code. The screen is easy enough. dsRPGDockServices. But none of the install actions come up except for refuel, the same as in Ship Configuration.

Standard station code for dock services goes through the lambda rpgDockServices then to the RPGDockServices screen. This seems to check for the playership and then select a dockscreen. I've bypassed this and gone straight to dsRPGDockServices.

But I can't understand the code in the dsRPGDockServices dockscreen, it's too complex for me. From what little I can understand isShipConfig (whatever that is) needs to be something other than the playership. But I don't know what it is or where it is defined to change it.

If that happens then actionStatus needs to be a some unknown value which is generated by other lambdas such as

Code: Select all

(setq actionStatus (rpgCalcDockServiceRefuelAction gSource gPlayerShip { }))
I'm clueless on lambdas and especially what the {} means.

Anyone got some time to put up a quick post on what's happening in there or got any hints on how to make the install/repair/etc actions appear inside the playership?

Possibly creating a virtual station at the playerships location and docking with it inside the ship could work if it had the right <Trade> info.

User avatar
Arkheias
Commonwealth Pilot
Commonwealth Pilot
Posts: 94
Joined: Mon Jun 02, 2014 8:06 pm

Re: dock services in playership query

Post by Arkheias » Fri Nov 25, 2016 5:53 pm

I don't think this answers all of your questions, but I've made a (very) basic tutorial on the new method for defining actions and therefore actionStatus anyway.

The key .xml files to look through for dockscreen info/examples are:
RPGCode.xml
RPGDockScreens.xml
RPGShipScreens.xml

Instead of just using the old method of defining actions:

Code: Select all

<Action name="Done" cancel="1" key="D">
	<Exit/>
</Action>
You can now use this new method for finer control:

Code: Select all

<Action id="actionDone" cancel="1">
	<Exit/>
</Action>
Followed later on in the same dockscreen type definition by a list of texts that can appear in it:

Code: Select all

...
	<Language>
		<Text id="actionDone">"[D]one"</Text>
		<Text id="actionDone:DefaultDesc">"I suppose you could use this text block to appear beneath the action by default."</Text>
		<Text id="actionDone:UnavailableDesc">"This description could appear beneath the action to explain why it might be disabled."</Text>
		
		<Text id="someSpecificScreenDesc">
			(cat 
				"Welcome to the " (objGetName gSource) " Screen Description."
				)
		</Text>
	</Language>
</DockScreen>
You choose which texts will display in the dockscreen via the <OnPaneInit> event:

Code: Select all

<DockScreens>
	<Main>
		<Panes>
			<Default>
				<OnPaneInit>
					(block (actionStatus)
						
						;	Potential Screen Description(s) (just use a switch statement or something to select between multiples)
						
						(scrSetDescTranslate gScreen 'someSpecificScreenDesc)
						
						;	Done Action
							
						(setq actionStatus (rpgCalcThisIsABasicTutorialDoneAction))
						(scrShowAction gScreen 'actionDone (@ actionStatus 'visible))
						(scrEnableAction gScreen 'actionDone (@ actionStatus 'enabled))
						(scrSetActionDesc gScreen 'actionDone (@ actionStatus 'desc))
						
				</OnPaneInit>
			...
Which uses a function rpgCalcThisIsABasicTutorialDoneAction (that is traditionally defined as a global in rpgCode.xml) to determine which option to use:

Code: Select all

<Globals>
	(block nil
		(setq rpgCalcThisIsABasicTutorialDoneAction
			(lambda nil
				(switch
					(someconditionalstatementthatdeterminesiftheactionisavailable)
						{
							visible: True
							enabled: Nil
							desc: (scrTranslate gScreen "actionDone:UnavailableDesc")
							}
							
					{
						visible: True
						enabled: True
						desc: (scrTranslate gScreen "actionDone:DefaultDesc")
						}
					)
				)
			)
		...
If you just leave the "visible" option as "visible: Nil", "enabled" and "desc" seem to default to Nil also. You would therefore not need to specify them.

Also note where curly brackets are used instead of parenthesis in rpgCalcThisIsABasicTutorialDoneAction. This means that the function will return a list of three elements:
{ visible:#### enabled:#### desc:#### }

These would generally use values like:
{ visible:True/Nil enabled:True/Nil desc:(scrTranslate gScreen "action####:####")/Nil }
Cabbage Corp, the only mod with cabbages!

Please feel free to submit bug reports or issues related to the Cabbage Corp mod on the GitHub page, the forum thread, in a private message or even on the Xelerus page. Suggestions are fine too.

relanat
Militia Commander
Militia Commander
Posts: 343
Joined: Tue Nov 05, 2013 9:56 am

Re: dock services in playership query

Post by relanat » Tue Nov 29, 2016 4:59 am

Thanks Arkheias. I've saved that info and will work through it. Cheers. :D

relanat
Militia Commander
Militia Commander
Posts: 343
Joined: Tue Nov 05, 2013 9:56 am

Re: dock services in playership query

Post by relanat » Thu Dec 08, 2016 3:35 am

Excellent info, Arkheias. Finally got the new screens sorted. I couldn't see a way around the (= dockObj shipObj) {visible: Nil} code in a lot of the lambdas so rewrote them in a very simplified form, usually with only 2 options.
Your info was invaluable in doing this. Many, many thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests