I'd like to add a script to a prim filing cabinet that will allow the cabinet to be locked and unlocked via a prim key. Basically, I'd like the cabinet to toggle between 2 states, "locked" and "unlocked".
If "locked", clicking the cabinet will result in a chat message letting the person know it's locked. The contents of the cabinet would be inaccessible.
If "unlocked", clicking the cabinet will present the person with a menu of the contents within which can be taken into inventory.
The prim key would lock or unlock the cabinet by whispering on a secure channel. Thus, if the key is rezzed or attached within listening distance of the cabinet and clicked, it will whisper its code word on the secure channel and toggle the state of the cabinet.
Basically, I'm trying to combine a listener script with a simple 2 state script (like a door open/close script) and a multi-object giver script (like a bar that offers multiple drinks for the taking).
I know what I want, but I know nothing about scripting to combine these simple elements. Can anyone help, or at least point me in the right direction?
Thanks in advance.