objGateTo and sysGetStargates node help please

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

objGateTo and sysGetStargates node help please

Post by relanat » Fri Nov 18, 2016 3:58 am

I've come to a grinding halt with my Godship mod because I can't work out why "C1" (or "C3", etc) isn't a valid nodeID.

The game doesn't seem to like the "C1" or similar node ID generated in the following code. I've tried quite a few variations but can't make it work.

Strangely

Code: Select all

(setq destinationGate (@ (sysGetStargates node) 0))
returns an Invalid NodeID error for sysGetStargates even when node returns "C1".

Invalid nodeID [("C1")] ### (sysGetStargates node) ###

Comment out setq destinationGate and the ObjGateTo line give the following error

Identifier expected [("C1")] ### (objGateTo gPlayership node destinationGate 36870) ###

Setting node to "C1" in on the debug screen makes it work with "Inbound" as the GateID.

Which leads me to think that node/"C1" isn't a nodeID here but maybe text?
Or is scrGetListEntry messing something up or possibly the list generating code for the dockscreen or custompicker?
And quite possibly it's because I don't have a clue code-wise! :lol:

Anyone got any idea what's happening? I've used ObjGateTo with variables before successfully but can't make it work here.

TIA.

Relevant code:

Code: Select all

<Dockscreen UNID="&dsD789GodTravelGalaxyDockscreen;"
		name=		"Galaxy Travel"
		type=		"customPicker"
		backgroundID=	"&rsItemListScreen;"
		nestedScreen=	"true"
		>

	<List
		rowHeight="32"
		>
		(block (galaxyTravelList systemList nameList)
			(setq systemList (sysGetNodes))
			(enum systemList nameList (setq galaxyTravelList (lnkAppend galaxyTravelList (sysGetProperty nameList 'name))))
		)
	</List>
	<Panes>
		<Default>
			<OnPaneInit>
				(block Nil
					(scrSetDesc gScreen "Print this")
				);block
			</OnPaneInit>
		;need to set cursor to current system		
			<Actions>
				<Action name="Travel To This System" key="T" default="1" >
					(block Nil
						(setq listEntry (scrGetListEntry gScreen))
						(setq node (filter (sysGetNodes) listSystem (eq (sysGetName listSystem) listEntry)))
						(setq destinationGate (@ (sysGetStargates node) 0))
						(objGateTo gPlayership node destinationGate &efStargateOut;)
						;(objGateTo gPlayership "C1" "Inbound" &efStargateOut;) this works
						(scrExitScreen gScreen 'forceUndock)
					)
Attachments
Scorpion GodPlayership forum help galaxy travel nodeID.xml
(12.78 KiB) Downloaded 4 times

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

Re: objGateTo and sysGetStargates node help please

Post by NMS » Fri Nov 18, 2016 5:08 am

Looks like your node variable is not a string, but a list containing a string. Get the first element and I think it should work.

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

Re: objGateTo and sysGetStargates node help please

Post by relanat » Fri Nov 18, 2016 6:08 am

Thank you. I figured it was some sort of syntax format computery-type thing. But I never thought of a one entry list still being a list. I'll give it a go. Cheers. :D

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

Re: objGateTo and sysGetStargates node help please

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

Success. Thank you. This also helped with the in-system travel, so double thanks!

Final code:

Code: Select all

(block Nil
	(setq listEntry (scrGetListEntry gScreen))
	(setq nodeList (filter (sysGetNodes) listSystem (eq (sysGetName listSystem) listEntry)))
	(setq destinationNode (@ nodeList 0))
	(setq destinationGate (@ (sysGetStargates destinationNode) 0))
	(objGateTo gPlayership destinationNode destinationGate &efStargateOut;)
	(scrExitScreen gScreen 'forceUndock)
)

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

Re: objGateTo and sysGetStargates node help please

Post by NMS » Thu Nov 24, 2016 4:21 am

That's good. Though if you don't use the data in those variables somewhere else, it would be good practice to declare them in the block:

Code: Select all

(block (listEntry nodeList destinationNode destinationGate)
    ...
)
That way you aren't setting global variables that could accidentally interfere with another mod.

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

Re: objGateTo and sysGetStargates node help please

Post by relanat » Thu Nov 24, 2016 5:51 am

Ah, cool. I actually thought it was the other way around. That they were global if you named them after 'block' :oops: . That could be the cause of a few of my code problems. Much rewriting to do now. Thanks for that.

It's a wonder any of my mods work :lol: .

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests