scrRemoveAction use query

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

NOTE: Important edit in third post.

Anyone know how to use 'scrRemoveAction'?

Trying to get rid of '<Action name="Ship Configuration"' in the Ship's Interior dockscreen to replace it with 'Ship Services' or 'Ship Dock Services'. I'll remove 'Refuel Reactor' as well if I can work it out.

Func help gives (scrRemoveAction screen actionID) but no explanation and I haven't found a single example in code anywhere. Nothing on xelerus or in the changelog.

It seems to take a UNID as the screen with no problems but I can't work out how to format the actionID.

So far I've had 'Identifier expected, no binding and Exception in' errors.

Any clues? Or if someone knows of a mod that uses this function could you point it out, please. TIA.
Last edited by relanat on Wed Mar 01, 2017 3:19 am, edited 1 time in total.
Stupid code. Do what I want, not what I typed in!
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8:26 am

If the action id isn't specified in XML (like <Action ... id="someString"...>), it defaults to an integer, starting with 0.

If scrRemoveAction doesn't work, you can hide an action with (scrShowAction screen actionID nil).
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

EDIT: This was a bug and was fixed in the 1.7 beta series of game versions. 'scrRemoveAction' will now accept the integer without quotes around it.
From Version 1.7 stable release onwards all similar scrXXXAction functions will accept the integer either with or without quotes around it.
Credit to NMS for knowing it was a bug and reporting it and George for fixing it.
=====================================

Got it, thanks. The hard part was working out the format.

Code: Select all

(scrRemoveAction gScreen "0")
This works but only if the default numeral is enclosed in quotes.
Positions in the list, as is usual in Trans, starts with 0 as the first action, 1 as the second, 2 as the third, etc.
So the code below will remove 'Ship Configuration' (the first action, so position 0), then 'Refuel Reactor' (the 4th action, so position 3) and then adds 'Ship Dock Services at the top of the list (pos 0) and 'God Features' at the bottom of the list (a special case where -1 always places an action at the bottom of the list).

Code: Select all

<ItemType UNID="&vtD789ModifyShipsInteriorDockscreen;"
	virtual=	"true"
	>

	<Events>
		<OnGlobalPaneInit>
			(block Nil
				(if (and (eq aScreenUNID &dsShipInterior;) (eq aPane "Default") (eq (objGetType gPlayership) &scD789ScorpionGODship;))
					(block Nil
						(scrRemoveAction gScreen "0")
						(scrRemoveAction gScreen "3")
						(scrAddAction
							gScreen
							'dockServices
							0
							"Ship Dock Services"
							"S"
							(scrShowScreen gScreen "&dsD789GodNewDockServicesDockscreen;")
						)
						(scrAddAction
							gScreen
							'godFeatures
							-1
							"God Features"
							"G"
							(scrShowScreen gScreen "&dsD789GodFeaturesDockscreen;")
						)
					);block
				);if
			);block
		</OnGlobalPaneInit>
	</Events>
</ItemType>
The finished screen has 5 actions.
Ship Dock Services
Missions
View Cargo Hold
Back to Cockpit
God Features
Stupid code. Do what I want, not what I typed in!
Post Reply