Here's the code. There is some other code and a Nil entry at the end which isn't shown here. This <GetGlobalDockscreen> event doesn't show any dockscreens, just runs code.
Code: Select all
(if (or ;Arcology special case.
(eq (objGetName gSource) "Arcology of New Victoria")
;CSCs.
(if (objIsShip gSource)
(and (eq (shpGetClassName (objGetType gSource) 0x100) "Commonwealth Star Carrier")
(eq (shpGetDockObj gPlayerShip) gSource)
)
)
;Europa vault.
(eq gSource (sysFindObject Nil "TN+CSCEuropa"))
;CSC wrecks. Also handles CSC-IIs from the Network mod.
(typHasAttribute (objGetShipwreckType gSource) 'commonwealthStarCarrier)
;Cargo autons.
(and (objHasAttribute gSource 'cargoAuton)
(eq (shpGetDockObj gPlayerShip) gSource)
)
;Cargo auton wrecks.
(typHasAttribute (objGetShipwreckType gSource) 'cargoAuton)
;Everything else.
(and (find (staGetDockedShips gSource) gPlayerShip)
(not (objHasAttribute gSource 'shipwreck))
)
)
(block Nil
(printTo 'console "CheckScreen running.")
(typSetData &evD789CommandersLog; 'currentStation gSource)
(typAddRecurringTimerEvent &evD789CommandersLog; 15 "CheckScreen")
)
)
Code: Select all
<CheckScreen>
(if (or (isError (scrGetScreen gScreen)) ;TY, NMS.
(eq (scrGetScreen gScreen) Nil)
)
(block Nil
(typCancelTimerEvent &evD789CommandersLog; "CheckScreen")
(printTo 'console "CheckScreen cancelled.")
(logSetItems
(set@ (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>
This is, I assume, because the player works through multiple Bendict dockscreens and each of these different screens fires the event again.
But on undocking "CheckScreen cancelled." only shows once.
Does this mean there are still two of the events running? And if so how do I stop them? By the end of a game there could be quite a few still running!
Or is some alteration to the code that fires the event needed so it only fires once per object?
Possibly it needs to be changed to an object timer event but I don't want to mess with it while it is working so well unless absolutely necessary.
TIA.