Just Noticed Code.Xml missing this :

Here you can get help resolving Transcendence-related issues.
Post Reply
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1404
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska

Sun Apr 23, 2017 5:49 am

I am re-using an old station and was about to edit the entire dockscreen for purchasing but
remembered seeing a code for backwards compatibility........

However, on Closer Inspection : it is missing what I was hunting :

it HAS :

Code: Select all

			; Aliases for backwards compatibility ------------------------------
			
			(setq comShowBuyScreen scrShowBuyScreen)
			(setq comShowSellScreen scrShowSellScreen)
but in it's full page of ramblings it only carries the Sell screen, does not include the Buy screen.

It would be helpful if the Buy Screen item was included in the Code.Xml for the future
Being AS we all know that dockscreen tags and screen calls can often regress to earlier versions
because some .xml pages never really update with the versions, they just carry over unless there are new images or items to add ( or somebody wants to ruin a perfectly good Destroyer by calling it a Frigate )

So, for my extension I have updated and added the following to cover the missing stuff.

Code: Select all

			; Define various internal functions
			
			(setq comShowBuyScreen (lambda (itemsToSell returnScreen installOptions)
				(block Nil
					; Set the return screen
					(setq gPrevScreen (item returnScreen 0))
					(setq gPrevPane (item returnScreen 1))
					
					; Generate the function that computes price and availability
					(switch
						(isfunction itemsToSell)
							(setq gMargin itemsToSell)
						
				; If itemsToSell is set, then combine with station's Trade descriptors
						(and itemsToSell (not (eq itemsToSell "*")))
							(setq gMargin 
								(lambda (theItem)
									(switch
										(not (itmMatches theItem itemsToSell))
											Nil
											
										(intComputeSellPrice theItem)
										)
									)
								)
							
						; Otherwise, rely on station's Trade descriptors
						(setq gMargin intComputeSellPrice)
						)
						
					; If this station installs devices after purchase, set some vars
					(if installOptions
						(block Nil
							(setq gInstallCriteria (item installOptions 0))
							(setq gTechLevel (item installOptions 1))
							(setq gTechModifier (item installOptions 2))
							(setq gCheckMilitaryID (item installOptions 3))
							; Note: gInstallMargin = 100 means no markup
							(setq gInstallMargin (add 100 (item installOptions 4)))
							)
						(setq gInstallCriteria Nil)
						)
						
					; Show the screen
					(scrShowScreen gScreen "&dsRPGCommoditiesExchangeBuy;")
					)
				))

			(setq comShowSellScreen (lambda (itemsToBuy returnScreen screenOptions)
				(block Nil
					; Set the return screen
					(setq gPrevScreen (item returnScreen 0))
					(setq gPrevPane (item returnScreen 1))
					
					; Generate the function that computes price and availability
					(switch
						(isfunction itemsToBuy)
							(setq gMargin itemsToBuy)
							
						; If itemsToBuy is set, then combine with station's Trade descriptors
						(and itemsToBuy (not (eq itemsToBuy "*")))
							(setq gMargin 
								(lambda (theItem)
									(switch
										(not (itmMatches theItem itemsToBuy))
											Nil
											
										(intComputeBuyPrice theItem)
										)
									)
								)
							
						; Otherwise, rely on station's Trade descriptors
						(setq gMargin intComputeBuyPrice)
						)
						
					; Handle some options (Nil is OK)
					(setq gTitle (item screenOptions 0))
					(setq gMaxPrice (item screenOptions 1))
						
					; Show the screen
					(scrShowScreen gScreen "&dsRPGCommoditiesExchangeSell;")
					)
				))
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..

NMS
Militia Commander
Militia Commander
Posts: 399
Joined: Tue Mar 05, 2013 8:26 am

Sun Apr 23, 2017 11:54 pm

scrShowBuyScreen is defined in HSCompatibility.xml. You shouldn't need to include that code in your mod as long as you declare unidHumanSpaceLibrary.

shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1404
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska

Mon Apr 24, 2017 5:59 am

NMS wrote:
Sun Apr 23, 2017 11:54 pm
scrShowBuyScreen is defined in HSCompatibility.xml. You shouldn't need to include that code in your mod as long as you declare unidHumanSpaceLibrary.

Yes .....I see this now ( but why I failed to locate it earlier is a mystery of Notepad++ ) .

Thank You.
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..

Post Reply