Inputs and Outputs: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
Line 3: Line 3:
'''Inputs''' and '''Outputs''' (collectively "I/O") are the means by which [[Entity|entities]] communicate between each other in [[:Category:Level Design|maps]]. An output targets an input of another entity.
'''Inputs''' and '''Outputs''' (collectively "I/O") are the means by which [[Entity|entities]] communicate between each other in [[:Category:Level Design|maps]]. An output targets an input of another entity.


Consider a [[logic_timer]] entity. It might be configured to "fire" an <code>OnTimer</code> output when it hits its time limit, which "triggers" the <code>ShowSprite</code> input on an [[env_sprite]]. When the timer hits its limit, the sprite appears.
Consider a [[logic_timer]] entity. It might be configured to "fire" its <code>OnTimer</code> output when it hits its time limit, which "triggers" the <code>ShowSprite</code> input of an [[env_sprite]]. When the timer hits its limit, the sprite appears.


== Outputs ==
== Outputs ==

Revision as of 10:39, 22 July 2009

Template:Otherlang2

Inputs and Outputs (collectively "I/O") are the means by which entities communicate between each other in maps. An output targets an input of another entity.

Consider a logic_timer entity. It might be configured to "fire" its OnTimer output when it hits its time limit, which "triggers" the ShowSprite input of an env_sprite. When the timer hits its limit, the sprite appears.

Outputs

Hammer's "Object Properties" dialog

Outputs are events that fire when an entity's state changes. A timer will have an output for reaching its end, a button an output for being pressed, and a door an output for coming to a close.

Outputs are created in the Outputs tab of the object properties dialog. This interface provides a list of the outputs already emitting from the entity, configuration fields for the one(s) currently selected, and buttons for creating new and deleting old. Finally, the button in the bottom left labelled "mark" will take you to the target entity of the current output.

The output configuration fields are:

Output name
What event causes the output to fire.
Target entity
The targetname or classname of the entity that will receive input. Accepts the * character as a search wildcard.
  • A bold name means that the targetname points to multiple entities
  • A red name means that the targetname doesn't point to anything
    Icon-Bug.pngBug:Valid classname and wildcard values will also appear red. Don't worry: the engine will recognise them!  [todo tested in ?]
Input name
The input on the target entity that will be fired.
Parameters
You can pass data to the target entity with parameters. A parameter might be anything: how loud to play a sound, the targetname of another entity, or perhaps a color. It all depends on what the input accepts. If it doesn't accept anything, this field will be greyed out.
Some outputs, like math_counter's OutValue, generate parameters themselves. To use a generated parameter, just leave the field reading <none>.
Note.pngNote:If the output value is a targetname, remember that it may not be unique!
Time delay
The number of seconds to wait after the output event occurs before firing.
Fire once only
The output will be deleted after it fires if this is checked.

Inputs

Inputs connect to outputs of any type. The Input tab shows all of the outputs that are connected from other entities to this entity.

Because any output can connect to any input, there is a multitude of combinations that can be used to create complex entity interactions. Timers can orchestrate a countdown sequence using blinking sprites, sounds and special effects all without any need for special entities. By clicking the "Mark" button or double-clicking on an entry in the list, the user is able to go to the entity sending the output to the input in question.

If a connection is displayed in red, it is invalid. This means that either the output does not exist in the source entity, or the input is not present in the destination entity. Invalid connections are benign but should be fixed before map compilation because the Check For Problems menu command will report them as an error.

I/O entities

[Todo]

Debugging

Because the nature of how entities communicate has become more complex and powerful, so too has the debugging capabilities of the engine to help you track down problems. If a chain of I/O logic is not working as expected, the tools below will aid greatly in solving the error.

developer 0/1/2
By setting this console variable (cvar) to a value of "2", you'll receive a detailed log of how the entities are interacting via the entity I/O system. This is useful for seeing the exact chain of events taking place in complex interactions.
ent_messages_draw 0/1
Setting this cvar to a value of "1" will display visual information about how entities are communicating with one another. This is very similar to using the developer cvar, but can sometimes be more immediately intuitive to the viewer.
ent_fire <entity name> <input name> <input value>
This console command allows you to manually fire inputs on an entity from the console. This can be very useful for testing settings for entities in real-time. To fire the "Open" input for an entity named "testentity" with an input parameter of "3", you would type ent_fire testentity open 3 . You can also fire any entity that is under your crosshair using "!picker" as the entity name.
ent_pause
This command pauses entities in the map. If entered again, the entities will resume their normal behavior. This is most useful when use with the ent_step command, described below.
ent_step <number of steps>
When used with the ent_pause console command, this command allows the user to slowly step through an entity's chain of execution for input and output. Any number of steps can be iterated through at one time, as specified by a value entered after the command (e.g. ent_step 3 would execute three steps at once).

See also