NWN NPC Will not open door

Here is the script that I have in an ‘actions taken’ slot in a dialogue box:

void main()
{

object oDoor = GetObjectByTag(‘oDoor’);
SetLocked(oDoor,FALSE);
ActionOpenDoor(oDoor);
}

It is the last dialogue in the chain. But the NPC does nothing and the door remains locked. The door tag is correct. The NPC has the key for the door. The door requires the key to unlock. I am very frustrated.

I think the problem lies in

It should probably be:

object oDoor = GetObjectByTag("oDoor");

Hint: Do not copy and paste @andgalf’s version into your code. Due to a (much requested by other users of Discourse but not us) feature of these boards the double quotes will be wrong for coding purposes being of the 66 and 99 style. That is why it is essential to post code in code blocks on here. So for everyone’s convenience here is the correct version of that code -

   object oDoor = GetObjectByTag("oDoor");

TR

Thank you everybody. That was the issue, and it has been resolved now.