From the Emerald - Littleroot Town Header:
Code:
setvar 0x8004 0x5
setvar 0x8005 0x8
...
....
setdooropened 0x8004 0x8005
doorchange
showsprite 0x4
applymovement 0x4 0x81E7F98
waitmovement 0x0
setdoorclosed 0x8004 0x8005
doorchange
pause 0xA
applymovement 0x4 0x81E7F9A
Should be self-explanatory, 0x5 is the X and 0x8 is the Y coordinate of the door.
"showsprite" let's an NPC appear, "hidesprite" disappear. So they don't technically enter/exit, they just turn visible/invisible.
You should also use a "setflag 0x###" command (with ### being your PersonID) so they stay hidden forever (or until you clear the flag).
The Doortile needs the right behaviorbyte, but for the standardtilesets those are already set.