I tried this, but it didn't do anything, unfortunately.
I did basically the same thing, but I put my function in the PlayerInteractCallback dialog box in the Level Editor. Then I added your MoveTheDoor function in the script. It looks like this:
void SlideDoor(string &asEntity)
{
SetMoveObjectState("safety_normal_vert_1", 1);
}
I feel like the solution is probably to use the ConnectionStateChangeCallback on the button. I'll try it out with the SetMoveObjectState function and let you know what happens.
EDIT:
So I tried doing this:
void SlideDoor(string &asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("safety_normal_vert_1", 1);
}
else if (alState == 0)
{
SetMoveObjectState("safety_normal_vert_1", -1);
}
}
The door just sits there.
I'm getting the impression that this door only works with levers...
EDIT 2:
I'm such an idiot. I realized what was wrong. I used the above code correctly, but I forgot that I changed the door from "safety_normal_vert_1" to "safety_normal_vert_noauto_1" to prevent it from automatically closing itself.
Well, it all works now. Thanks a lot man! +rep