PDA

View Full Version : User.getCurrentIdentity() returns nil?



Paleotech
August 30th, 2017, 00:51
It worked fine for a while and then suddenly today it stopped returning the identity. It's nil for GM as GM, GM as PC, GM as NPC, and PC(client) as one or more PCs. All of those returned the name of the GM, PC, or NPC just fine yesterday.

I have no idea what I could have changed to break something I thought was so basic to the program.

The weirdest part is that the ID still pops up in chat regardless of the nil returned in code. Also, getUsername() works fine.

Any ideas guys? This one is pretty frustrating!

Moon Wizard
August 30th, 2017, 01:02
A couple things to check:
* Make sure that you aren't overriding the built-in package with your own global script named "Identity". Named global ruleset scripts will override built-in packages.
* Also, make sure that you are not passing any sort of parameter to the function, even nil. If you do, the client will think you are trying to determine the current identity for a user with a name that matches the parameter. (which only works on the GM client) If no parameter, then it will return nil on GM, or the current identity on the player client (if any).

Regards,
JPG