DockScreen Override bug?

These are old bug reports that have been closed.
Locked
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

This is bizarre! I am trying to get the dsAbandonedShip and dsAbandonedStation in a mod extension. I placed the UNID and ds tags into the file, then changed the description of the default pane to mark it so I could see if the override was working properly.

When dsAbandonedShip was last entry in the extension, the screen crashes Transcendence.

When dsAbandonedStation was last entry in the extension, the screen crashes transcendence.

Both screens work normally as an override when they are NOT the last dockscreen in the extension.

Nothing major has been changed otherwise.

So what could be happening here?

EDIT=

Ok, so I built a special extension containing just the override dockscreens I wanted with no other changes except to add "mod here" to the description of the screen, inside the quotes for the desc. No other mods running, no changes from the original code except the description. Whichever screen is the LAST one in the extension crashes the game- it can be dsAbandonedShip, dsAbandonedStation- doesn't matter which one it is, just WHERE it is?????

Correction- Now I placed dsLoot at the END of the File, and it seems to work fine, but TRAPS me on the Loot screen with error of "no binding" for gPrevPane and because of that its Alt-F4 to get free. So, if dsLoot is placed at the end of the extension file, both dsAbandoneds break because it jumps immediately to Loot and won't let you get back out because there isn't a defined prevScreen.

I thought the dockscreens were independent- why would the placement within the file matter? And what should I do, place a bogus dockscreen at the end to catch the error? That seems Not Smart.
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Code: Select all

<?xml version="1.0" ?>
<!DOCTYPE TranscendenceExtension
	[
	<!ENTITY unidExtension				"0xDDDD010A">

	<!ENTITY dsLoot						"0x0000A013">
	<!ENTITY dsAbandonedStation			"0x0000A003">
	<!ENTITY dsAbandonedShip			"0x0000A017">
	<!ENTITY dsAbandonedCrate			"0x0000A018">

	<!ENTITY dsTestItems		"0xDDDD3006">
	
		
	
]>
<TranscendenceExtension UNID="&unidExtension;" version="0.98d">



<DockScreen UNID="&dsAbandonedCrate;"
		name=			"=(objGetName gSource)"
		>

	<Panes>
		<Default
				desc=	"You are docked with an abandoned cargo crate.">

			<Actions>
				<Action name="Loot" imageID="&rsItemListScreen;" imageIndex="1" key="L" default="1" >
					(block Nil
						(setq gPrevScreen "&dsAbandonedCrate;")
						(scrShowScreen gScreen "&dsLoot;")
						)
				</Action>

				<Action name="Jettison" imageID="&rsItemListScreen;" imageIndex="1" key="J">
					(block Nil
						(setq gPrevScreen "&dsAbandonedCrate;")
						(scrShowScreen gScreen "&dsJettison;")
						)
				</Action>

				<Action name="Undock" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="U">
					<Exit/>
				</Action>
			</Actions>

		</Default>
	</Panes>
</DockScreen>

<!-- Abandoned station looting screen -->

<DockScreen UNID="&dsAbandonedStation;"
		name=				"=(objGetName gSource)"
		>

	<Panes>
		<Default
				desc=		"You are docked at the lifeless ruins of a destroyed station. Wrecked machinery and smoldering bodies litter the silent, cavernous bay. mod test">

			<Actions>
				<Action name="Loot" imageID="&rsItemListScreen;" imageIndex="1" key="L" default="1" >
					(block Nil
						(setq gPrevScreen "&dsAbandonedStation;")
						(scrShowScreen gScreen "&dsLoot;")
						)
				</Action>

				<Action name="Jettison" imageID="&rsItemListScreen;" imageIndex="1" key="J">
					(block Nil
						(setq gPrevScreen "&dsAbandonedStation;")
						(scrShowScreen gScreen "&dsJettison;")
						)
				</Action>

				<Action name="Undock" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="U">
					<Exit/>
				</Action>

			</Actions>

		</Default>
	</Panes>

</DockScreen>

<DockScreen UNID="&dsAbandonedShip;"
		name=				"=(objGetName gSource)"
		>

	<Panes>
		<Default
				desc=		"You are docked with the wreck of a ship. mod test">

			<Actions>
				<Action name="Loot" imageID="&rsItemListScreen;" imageIndex="1" key="L" default="1" >
					(block Nil
						(setq gPrevScreen "&dsAbandonedShip;")
						(scrShowScreen gScreen "&dsLoot;")
						)
				</Action>

				<Action name="Jettison" imageID="&rsItemListScreen;" imageIndex="1" key="J">
					(block Nil
						(setq gPrevScreen "&dsAbandonedShip;")
						(scrShowScreen gScreen "&dsJettison;")
						)
				</Action>

				<Action name="Undock" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="U">
					<Exit/>
				</Action>

			</Actions>

		</Default>
	</Panes>

</DockScreen>

<DockScreen UNID="&dsLoot;"
		name=				"=(objGetName gSource)"
		type=				"itemPicker"
		backgroundID=		"&rsItemListScreen;"
		>

	<ListOptions
		dataFrom=	"station"
		list=		"*U"
		/>

	<Panes>
		<Default
				desc=		"There are no items here.">

			<Initialize>
				(block (thisItem)
					(setq thisItem (scrGetItem gScreen))
					(if thisItem
						(block (affordCount availCount desc itemMass)
							(setq itemMass (itmGetMass thisItem))
							(setq availCount (itmGetCount thisItem))
							(setq affordCount (divide (objGetCargoSpaceLeft gPlayerShip) itemMass))
							(setq gMaxCount (if (gr affordCount availCount) availCount affordCount))

							(setq desc (cat "Unit mass: " (intMassString (itmGetMass thisItem))))
							(if (gr gMaxCount 1)
								(setq desc (cat desc " (" gMaxCount " at " (intMassString (multiply (itmGetMass thisItem) gMaxCount)) ")"))
								)

							(setq desc (cat desc "\n\n"))

							(switch
								(eq gMaxCount 0)
									(setq desc (cat desc "You do not have enough space to carry " (itmGetName thisItem 4) "."))
								(eq gMaxCount 1)
									(setq desc (cat desc "You have enough room to carry one " (itmGetName thisItem 0) "."))
								(gr availCount affordCount)
									(setq desc (cat desc "You have enough room to carry only " affordCount " " (itmGetName thisItem 2) "."))
								(setq desc (cat desc "You have enough room to carry all " (itmGetName thisItem 8) "."))
								)

							(scrSetDesc gScreen desc)
							)
						(setq gMaxCount 0)
						)

					; Enable/disable actions
					(scrEnableAction gScreen 0 (gr gMaxCount 0))
					)
			</Initialize>

			<Actions>
				<Action name="Loot this item" imageID="&rsItemListScreen;" imageIndex="1" key="L" default="1" >
					<![CDATA[
					(if (> gMaxCount 1)
						(scrShowPane gScreen "LootQuantity")
						(if (eq gMaxCount 1)
							(block (itemsToLoot)
								(setq itemsToLoot (scrRemoveItem gScreen 1))

								(objAddItem gPlayerShip itemsToLoot)
								(scrShowPane gScreen "Default")
								)
							)
						)
						]]>
				</Action>

				<Action name="Done" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="D">
					(scrShowScreen gScreen gPrevScreen)
				</Action>

			</Actions>

		</Default>

		<LootQuantity
				showCounter=	"true">

			<Initialize>
				(block Nil
					(scrSetDesc gScreen (cat "How many items do you wish to loot?"))
					(scrSetCounter gScreen gMaxCount)
					)
			</Initialize>

			<Actions>
				<Action name="Loot" imageID="&rsItemListScreen;" imageIndex="1" default="1" key="L">
					<![CDATA[
					(block (count)
						(setq count (scrGetCounter gScreen))
						(if (> count gMaxCount)
							(scrSetCounter gScreen gMaxCount)
							(block (itemsToLoot)
								(setq itemsToLoot (scrRemoveItem gScreen count))
								(objAddItem gPlayerShip itemsToLoot)
								(scrShowPane gScreen "Default")
								)
							)
						)
						]]>
				</Action>

				<Action name="Cancel" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="C">
					<ShowPane pane="Default"/>
				</Action>

			</Actions>

		</LootQuantity>
	</Panes>

</DockScreen>

	<DockScreen UNID="&dsTestItems;"
			name=				"Scan System"
			desc=				"Interior of Ship"
			type=				"itemPicker"
			backgroundID=		"&rsItemListScreen;"
			>

		<ListOptions
			dataFrom=	"player"
			list=		"*U"
			/>

		<Panes>
			<Default
					desc=	"You are looking at your items.">



				<Actions>
					<Action name="Test this item" imageID="&rsItemListScreen;" imageIndex="1" default="1" key="T">
				<ShowPane pane="UNIDGetter"/>

						
					</Action>

					<Action name="Ship" cancel="1" key="S">
						<Navigate screen="&dsShipInterior;"/>
					</Action>

					<Action name="Done" cancel="1" key="D">
						(block Nil
						(scrExitDock gScreen)
						)
					</Action>

				</Actions>

			</Default>

<UNIDGetter desc= ".....">
			<Initialize>
			(block (message desc thisItem charges data)
						
						(setq thisItem (scrGetItem gScreen))
						(setq message (cat "UNID: " (itmGetUNID thisItem) " "(itmGetName thisItem 0)))
						(setq charges (cat (itmGetCharges thisItem)))
						(setq desc (cat message " Charges: " charges))
						(setq data (itmGetTypeData thisItem))
						(setq desc (cat desc "Data: " data))
					
							(scrSetDesc gScreen desc)

					)

			</Initialize>
<Actions>
				<Action name="Cancel" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="C">
					<ShowPane pane="Default"/>
				</Action>

				<Action name="Verily, Charge 1" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="V">
				(block (charger thisItem)
					(setq thisItem (scrGetItem gScreen))
					(setq charger (shpRechargeItem gSource thisItem 1))
				(setq desc "One charge has been added.")
					(scrSetDesc gScreen desc)

				)
				
				</Action>

				<Action name="Verily, Drain Charge!" imageID="&rsItemListScreen;" imageIndex="0" cancel="1" key="D">
				(block (charger thisItem)
					(setq thisItem (scrGetItem gScreen))
					(if (geq (itmGetCharges thisItem) 0) (setq charger (shpRechargeItem gSource thisItem -1))
					)
				(setq desc "One charge has been removed.")
					(scrSetDesc gScreen desc)
				)
				
				</Action>

</Actions>

</UNIDGetter>


		</Panes>

	</DockScreen>


</TranscendenceExtension>
Take this and move the dockscreens around in the file to see the error. The override works when the 'test' screen is set at the end, but it also means that the 'test' screen is possibly broken. But why would it make any kind of a difference at all?
User avatar
Arisaya
Fleet Admiral
Fleet Admiral
Posts: 5573
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

It's a small bug i discovered- the last station-related entry is often ignored if it's the last one in the extention. This includes both dockscreens and stations. This is why I inlude a "dummy" station at the end of each mod. It's set to an occurence of "----- ----- ----- ----- -----" thus no matter what, it will NEVER appear.
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

I thought a dummy screen would fix that bug, but there are more issues!

When I destroy the Charon Station close to the SE start point, I get sent to the dsAbandonedShip screen!

When I go to a ship to loot it, I get set right on the Loot screen and the game won't exit the screen.

This is a very confusing issue, and it explains some of the mod issues I have had in the past where I spent hours and hours trying to figure out what I had done wrong with a dockscreen! I wish I had known that the extension system was full of bugs for dockscreens. :evil:

But the real question is: How can I Override dockscreens without getting into a HUGE nightmare? :( And why hasn't anyone mentioned this before??!! :evil:

EDIT=> In fact, the more I test the dockscreens in extensions the more problems are cropping up! It doesn't seem that dockscreens can even be modded through an extension successfully. Yes, you can ADD screens, but trying to get a minor change in an existing screen throws the entire game into chaos.

There is no explanation for this, I couldn't find a single reason that dsAbandonedShip would get substituted for dsAbandonedStation. So, none of the dockscreens I am trying to override are functioning at all even without being altered in script much! With or without the UNID in the mod file, and no matter what else is in the file, still having MAJOR issues.

What is going on with this George? Mod File
User avatar
Arisaya
Fleet Admiral
Fleet Admiral
Posts: 5573
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

hmmm...

I have altered dockscreens, but none were these two. (I altered commonwealth ones, but realised that the mod was unnessesary and scrapped the project. I can try my hand at modifying these two though.)
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Wolfy, I think that you will find the same difficulties as I have. I believe that only George could shed some light on what is going on and any possible fix. There is likely no way for us to figure out why a Charon Pirate Cache is set to dsAbandonedStation and instead ends up showing dsAbandonedShip when the two dosckscreens are placed in the extension folder.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

I have so far had no inexplicable trouble with dockscreens so far, but those are defined within the stations themselves and in (unmodified) Transcendence.xml
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

I have been trying to use the extensions in order to allow mods I release to not require the xml version of the game data. I can do most everything I want to do better from the xml, but then it requires the players to have the xml version.

For this mod, overriding the dockscreens from the extension folder is ideal- to bad it doesn't work.

F50- Are you saying that you are using the xml or tdb?
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I'm sorry--it is definitely a bug and definitely a bug that I have fixed for 0.99.

The only work-around that I can see is to delete the original screens that you want to override from Transcendence.xml. That should take care of everything (I hope).

Here is the cause of the bug: When you override a dockscreen, there is a bug which causes station code to hang-on to the old screen. Unfortunately, the override will often delete the original screen, so the station code is hanging on to a bad pointer.
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

No need to apologize. :)

I am more surprised that I have never heard about this bug than anything else.

How does the bad pointer effect having dsAbandonedShip show up when dsAbandonedStation is being asked for? I can see it not using the updated or overriden code.. but switching screens altogether?

If I delete the screens from trans.xml... why wouldn't I just alter them to what I wanted instead? Neither way is making use of a tdb version and extensions, so I can wait till 0.99 to really focus on extensions. :)
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I can't explain why a different screen was used. I can imagine that once freed, a new screen was allocated in the same place and the old pointer now pointed to some other screen.

You're right about altering them instead of deleting them. I just thought it would be easier to create the extension the way you wanted and to delete the screens--then in 0.99 the extension will start working without the work around. But you're right that you can do it the other way to. Or wait until 0.99 (but I'm a couple of months away from that, probably, though I am making progress).
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

hmm... I think I will try keeping as much as possible in an extension format just to get in the habit of it for future releases, which means I will try it like you suggested by deleting. :)
Locked