Basic LockableWithKey NULL Question

I have some doors that are LockableWithKey doors - if the player tries:

unlock door

I get a null error, for the key not being specified. How do I gracefully handle this error? So far I haven’t seen any syntax examples for this. Could someone point me to the documentation on this, or provide a basic example?

Thanks so much!

Hard to tell without code sample and without knowing where the nil reference is reported, so only few guesses: LockableWithKey is mix-in class to be combined with actual Door class, so you must declare mydoor: LockableWithKey, Door. And you must declare property holding list of keys for example: keyList = [mykey] where mykey is Key class object. Sample:

In the room I have the following door declaration. If I say ‘unlock guard post door with pcomm’ it unlocks - if I say ‘unlock guard post door’ I don’t get a friendly error like ‘unlock guard post with what?’ or similar - I get a null object error:

[Runtime error: nil object reference]

Door Code:

    LockableWithKey, Door
    'guard post door' 'guard post door'
    location = Brig;
    keyList = [Brig_Guard_PComm];

            if (Achieve_DisableBrigCameras.achieved == nil &&
                Brig.AllCamerasDisabled() == true)
                ... Goal Stuff ...

I would like to show the player a friendly message, helping them out.


I don’t see anything wrong. Please try in debug mode so you get call trace indicating where exactly the nil object reference is located and post it here.