looking for auton check suggestions

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

Looking for some ideas on checking autons when leaving and entering a system.

The Commander's Log mod keeps track of objects in all known systems and saves this info for access out of system. It is a record of all stations, autons and CSCs.

Most objects are checked/updated in <OnGlobalPlayerLeftSystem> but this doesn't seem to work for autons. I think this is because they leave the system after the player. Similarly they arrive in the next system after the player.

What is needed is to be able to check which autons remained in the previous system and which ones gated with the player.
I had considered trying <OnGlobalSystemStopped> but I guess this won't work because the system is no longer available by the time this event runs.

Previously autons were checked using 'unvFindObject' and searching the previous system for the auton type. A count of the type was then shown as the number of autons in the previous system. This worked but was very basic. With the addition of the new auton attributes the search is by attribute now which really helps to handle autons from other mods. Thanks, George.

But realistically there needs to be something like a check for property 'playerWingman' so that any autons belonging to objects other than the player aren't recorded. But how to do this?

One idea I've had is to create a list of autons as the player leaves the system. Then check that list against a list of autons in the current system. But I'm not sure if this would handle an auton being destroyed in that short time period after the player has left the system.

The other option is to use 'unvFindObject' to check for auton IDs in the previous system. Might need a list of IDs to check against here because they can't be filtered for properties if they are in the previous system.

But I'm wondering if there isn't some other way to check for escorting ships using ascend/suspend functions somehow? This would help with wingmen as well when that feature gets added to the mod.

The end requirement is a list of autons left in the previous system which can be used by additional code to show the player where the autons are.

Anyone got any ideas?
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

SysFindObject finds autons in OnGlobalPlayerLeftSystem for me. Try something like this:

Code: Select all

(enum (sysFindObject Nil "s +auton; +property:playerWingman;") obj
	(if (eq (objGetData obj 'behavior) 'waiting)
		; Store some data about the auton
		)
	)
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

Once again, my bad communication skills. Yes, code finds the autons but it was finding all of them, even the ones which were gating with the playership. What was needed was a behaviour check for 'waiting. Thanks, that'll do it very nicely. Much simpler.
Stupid code. Do what I want, not what I typed in!
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

The code is working beautifully.
In the end I let the code which checks all system objects in <OnGlobalPlayerLeftSystem> run as usual. This added all autons (if any) to the stored data.
Then checked any autons in the system for 'not behavior 'waiting'. I removed these autons from the stored data as they will follow the player so will not be in the system anymore.
Then created a list of any autons which did have 'behavior 'waiting'. I could have checked the stored data for these autons as they would still be saved but it was easier to just use 'sysFindObject'.
This list was used to create and save the list display for these autons so the player could check where they were when out of system.

Easy when you know how. Thanks.


Final code which runs in <OnGlobalPlayerLeftSystem>.
'logGet/SetStations' is a lambda running as a 'typGet/SetData' shortcut. It is the large data store which is updated first and stores all autons in the system whether they will leave the system with the player or remain behind. The second lot of code removes the autons which will leave the system (and uses the code supplied in another topic).

Code: Select all

	;Check for autons which will gate with the player.
(setq autonsLeavingWithPlayer
	(filter (sysFindObject Nil "s +auton; +property:playerWingman; +property:known;") theAuton
		(neq (objGetData theAuton 'behavior) 'waiting)
	)
)

(if autonsLeavingWithPlayer
	(block Nil
		(enum autonsLeavingWithPlayer theObj
			(logSetStations
				(set@ (logGetStations)
					(sysGetNode)
					(filter (@ (logGetStations) (sysGetNode)) theEntry
						(neq (@ theEntry 'ID) (objGetID theObj))
					)
				)
			)
		)
	)
)
Stupid code. Do what I want, not what I typed in!
Post Reply