All other stations have their uninstalled items recorded when the player undocks from them. This is done using this (abreviated) code.
But it doesn't work on newly created jettisoned crates. The items in the crate aren't recorded unless the player docks with the crate after it has been created.
Code: Select all
<GetGlobalDockscreen> (block Nil (if find (staGetDockedShips gSource) gPlayerShip) (block Nil (typSetData &evD789CommandersLog; 'currentStation gSource) (typAddRecurringTimerEvent &evD789CommandersLog; 15 "CheckScreen") ) ) Nil ) </GetGlobalDockscreen> <CheckScreen> (if (eq (scrGetScreen gScreen) Nil) (block Nil (typCancelTimerEvent &evD789CommandersLog; "CheckScreen") (logSetItems ([email protected] (logGetItems) (convertTo 'string (objGetID (typGetData &evD789CommandersLog; 'currentStation))) (list (objGetID (typGetData &evD789CommandersLog; 'currentStation)) (objGetName (typGetData &evD789CommandersLog; 'currentStation)) (sysGetNode) "Visited" (objGetItems (typGetData &evD789CommandersLog; 'currentStation) '*U) ) ) ) (typSetData &evD789CommandersLog; 'currentStation Nil) ) ) </CheckScreen>
I had the idea of using another timer event which checked for &dsCargoHold;. This could then record items in the crates within 100 ls of the playership after the player exited the cargo hold.
Ideally an event could be triggered if
But unfortunately this doesn't seem to work.
Code: Select all
(and (eq gSource gPlayerShip) (eq (shpGetDockObj gPlayerShip) Nil) (eq aScreenUNID &dsCargoHold;) )
I think this is because gSource in <GetGlobalDockscreen> (quoting from digdug's events doc) is the "spaceObject the player just docked with". The playership hasn't docked with any object, they are just in the cargo hold, so (eq gSource gPlayerShip) isn't a valid reason for <GetGlobalDockscreen>.
Can anyone see a way around this? Using the existing station code modified to work on crates would work. But how to trigger it?
Or is there another way to check for the creation of a jettisoned crate? All crates of this type come from the player, either from jettisoning or game code creating them for the player.
The only other idea I have is an <OnUpdate> event, but these are usually to be avoided.
What is needed is some way to record the items in a newly created jettisoned crate without having to dock the playership with it.