Collide is when, well, two entities collide. =p "Activate" is a loose term.
I think what you mean is "callback."
When a lever is pulled (a "state change"), it will call(back) whichever function you specified, thus executing your script. You can set a callback for collides, interactions, on pickup etc etc, as well. The basic formula will apply.
Anyway, use this to call a function when you pull a lever:
void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);
//Callback syntax is:
void Func(string &in asEntity, int alState)
//State can either be 1, 0, or -1
//I'm not quite sure this works with doors
To answer your second question, use this for interactions with doors:
void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
//Callback syntax
void MyFunc(string &in asEntity)
Now, you want something to happen if the player interacts with a locked door, correct?
Do something like this:
void CallbackForPlayerInteract(string &in asEntity)
{
if(GetSwingDoorLocked("doorname"))
{
//Do something if locked
}
else
{
//Do something if unlocked, or omit this if you don't want anything to happen
}
}
Play around with it a bit. =p If you need any more help, lemme know.