D'Lanor wrote:If simple state variables fail there is usually a fundamental error in the way the AgeSDLHook is set up.
AgeSDLHook setup? Umm, I assume you mean a block in OnFirstUpdate() like this?
Code: Select all
global TID
TID = "0"+str(intTransID.value) # unique Transporter ID
ageSDL = PtGetAgeSDL()
ageSDL.setFlags("boolOperated"+TID,1,1)
ageSDL.setFlags("TravellerID"+TID,1,1)
ageSDL.setFlags("ChainRunning"+TID,1,1)
ageSDL.sendToClients("boolOperated"+TID)
ageSDL.sendToClients("TravellerID"+TID)
ageSDL.sendToClients("ChainRunning"+TID)
# register for notification of age SDL var changes
ageSDL.setNotify(self.key,"ChainRunning"+TID,0.0)
# (boolOperated / TravellerID do not need notification because those are queried when needed)
# Elevator handling
if (self.isElevator):
ageSDL.setFlags("ElevStatus"+TID,1,1)
ageSDL.sendToClients("ElevStatus"+TID)
ageSDL.setNotify(self.key,"ElevStatus"+TID,0.0)
By the way, they do not fail completely - they work perfectly on region exits. The only problem is when the state is changed soon befor link out.
But to be honest: I do not really understand what setFlags() and sendToClients() do. Which flags are set? When is something sent to Clients?
Only setNotify() gives me a real idea.
D'Lanor wrote:The fact that BeginAgeUnload is not called is also very strange (unless you are using global prp files or something like that).
No, I don't use any global PRP files.
Here's BeginAgeUnload() as a snippet of the script, as an example:
Code: Select all
def BeginAgeUnload(self, avatar): # Multiplayer handling
"reset accessibility if user links out" # ~~~~~~~~~~~~~~~~~~~~
print ('---%s.BeginAgeUnload()' % self.cn) # (Seems not to be called ever)
if (self.ControlKeysTrapped):
PtDisableControlKeyEvents(self.key)
self.ControlKeysTrapped = False
if (self.FirstPersonOverriden):
ptCamera().enableFirstPersonOverride()
self.FirstPersonOverriden = False
# Make sure player re-enables occupied Transporter
ageSDL = PtGetAgeSDL()
avID = PtGetClientIDFromAvatarKey(avatar.getKey())
if (avID == ageSDL["TravellerID"+TID][0]):
self.ILockTransporter(None, False)
self.PlayChainRun(kPlayStop)
print("%s.BeginAgeUnLoad(): Operator (ID=%d) linked out, reenabled Transporter #%d." % (self.cn, avID, intTransID.value))
D'Lanor wrote:About the vault SDL, you should not use it unless you need to change SDL variables across ages. But whatever you do, never use both because offline (and in Alcugs) they are not synched. If you switch over from one to the other now the age might become "confused" even more than it already is.
Okay. So PtGetAgeSDL() and related functions are all I need and I should avoid functions from the ptAgeVault class?
Already did it this way. Really strange.
D'Lanor wrote:These things are always tough to troubleshoot. Once you checked the AgeSDLHook you could try deleting the sav file and see if that makes any difference.
It did not make any difference if I deleted the .sav file.
UPDATE: Oh, wait, it's BeginAgeUnLoad(), not BeginAgeUnload(). Ding, dong, Dang!
Well, I'll test that soon.
UPDATE2: Okay, BeginAgeUnLoad() is called now, and it does what it should.
Or, better said, it does nothing - because "if (avID == ageSDL["TravellerID"+TID][0])" evaluates already to false, since the ID was already cleared in OnBehaviorNotify(), which is called prior to BeginAgeUnLoad(). Completely logical.
So the SDL value is definitely cleared on link out - and it's STILL again set on the next link in.
