Door commands
 
Specific commands for the func_door, func_rotatingdoor and func_scriptdoor entities. Door entities are a subclass of scriptslave entities, they also responds to many entity, trigger and scriptslave commands (gameX86 source code reference: doors.cpp).

Specific entity commands are colored in brown in my custom SinScript syntax coloring wordfile for UltraEdit32.


close  
 
Function
 
This closes a opened door.

Syntax
 
$<door_name> close

Notes & examples
 
This command is useful for "stay-open" doors (wait key = -1) or "toggle" doors (TOGGLE spawnflag set) and is pretty useless for doors which close by themselves after a while. Doors can be opened with the open command.

Note:
Do not confuse this command with the close Areaportal command. It is an entirely different command with a different function even though it has the same name.



doorclosed  
 
Function
 
This command tells the script that the scriptdoor has finished closing.

Syntax
 
$<scriptdoor_name> doorclosed

Notes & examples
 
This command applies to func_scriptdoor entities only and is always used at the end of the closethread thread.


dooropened  
 
Function
 
This command tells the script that the scriptdoor has finished opening.

Syntax
 
$<scriptdoor_name> dooropened

Notes & examples
 
This command applies to func_scriptdoor entities only and is always used at the end of the openthread thread.


lock
 
Function
 
This locks a door so it can't be opened by the player in the game.

Syntax
 
$<door_name> lock

Notes & examples
 
This can be used to lock doors for which the player has to aquire a certain item or accomplish a task before he is allowed to open it. Doors can be unlocked with the unlock command.

Note:
Do not confuse this command with the lock Vehicle command. It is an entirely different command with a different function even though it has the same name.



open  
 
Function
 
This opens a closed door.

Syntax
 
$<door_name> open <activator_entity>

Notes & examples
 
Syntax-wise, the <activator_entity> argument is required for all doors. In practical terms, there's a nuance. If the argument is included as it should, this is what happens:
  • If the door is a rotating door (func_rotatingdoor), the location of the activator entity determines in what direction the door opens and the script doesn't complain.
  • If the door is a sliding door (func_door), the door opens normally (it only has one place to go since the direction is set by the entity's "angle" key). The location of the activator entity makes no difference but the script doesn't complain.
If the argument is omitted, this is what happens:
  • If the door is a rotating door, then the opening direction is unpredictable because the script can't determine for sure in what direction to open the door and the script complains.
  • If the door is a sliding door, this makes no difference because a sliding door "knows" in what direction to slide but the script complains anyway.
So the bottom line is that specifying the argument only really makes a difference for rotating doors although getting an undesirable error message during the game might look silly to the person who will play your map. The reason for the message on sliding doors is that the script has no way of knowing whether your door is a sliding door or a rotating door so it automatically assumes it's a rotating door.

For rotating doors, the best way to avoid any problems is to choose, as the activator, an entity which you know will be on the side of the door that will make it open in the direction you want. Remember, rotating doors always open away from the activator entity.

For sliding doors, the best way to avoid the nagging error messsage is to choose the player (*1) as the activator entity in all cases.

Doors can be closed with the close command.

Note:
Do not confuse this command with the open Areaportal command. It is an entirely different command with a different function even though it has the same name.



time  
 
Function
 
This sets the time in seconds a door will take to either open or close.

Syntax
 
$<door_name> time <value>

Notes & examples
 
This command overrides the value set in the door entity's "time" key.

Note:
Do not confuse this command with the time Scriptslave command. It is an entirely different command with a different function even though it has the same name.



toggledoor  
 
Function
 
This command will open a closed door or close an opened door depending on the current state of the door.

Syntax
 
$<door_name> toggledoor <activator_entity>

Notes & examples
 
This command is useful for "stay-open" doors (wait key = -1) or "toggle" doors (TOGGLE spawnflag set) and is not really meant to be used with doors which close by themselves after a while. For more info on the <activator_entity> argument, refer to the notes of the open command.


unlock
 
Function
 
This unlocks a door previously locked by the lock command. Once unlocked, the player is able to open the door.

Syntax
 
$<door_name> unlock

Notes & examples
 
This can be used to unlock doors after the player has succeded in aquiring a certain item or has accomplished a task that allows him to open it.

Note:
Do not confuse this command with the unlock Vehicle command. It is an entirely different command with a different function even though it has the same name.