Pl/Inputs and Outputs: Difference between revisions

From Valve Developer Community
< Pl
Jump to navigation Jump to search
(Undo revision 210110 by Grymbi (talk))
m (Setting bug notice hidetested=1 param on page where the bug might not need tested in param specified)
 
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{otherlang2
{{LanguageBar|title = Wejścia i Wyjścia}}
|title = Tworzenie Wejść i Wyjść
|en = Inputs and Outputs
|de=Inputs and Outputs:de
|ru = Inputs and Outputs:ru
|zh-cn=Inputs_and_Outputs:zh-cn
|pl = Inputs and Outputs:pl
}}


{{toc-right}}
{{toc-right}}
{{translate}}


'''Wejścia''' i '''Wyjścia''' (razem "I/O") to opcje za pomocą których [[Byt|byty]] komunikują się z innymi na [[:Category:Level Design:pl|mapach]]. Byty mają dwa rodzaje komunikacji: wysyłanie "wyjścia" do innego bytu, lub odbieranie "wejścia" od innego bytu. One entity may send an output when it is killed to another entity's input which causes it to change color. That same output could also be used to trigger another entity's spawning input. The outputs are matched to the inputs via a "connection", which controls what extra data is relayed to the receiver, how much of a delay there is before the output is received, and whether the output should be allowed to be sent again later. Outputs can be linked to any input and vice versa. This allows complex and powerful interactions between entities.
'''Wejścia''' i '''Wyjścia''' (razem "I/O") to opcje za pomocą których {{L|Byt|byty}} komunikują się między sobą na {{LCategory|Level Design|mapach}}. Byty mają dwa rodzaje komunikacji: wysyłanie "wyjścia" do innego bytu, lub odbieranie "wejścia" od innego bytu. Jeden byt może wysłać wyjście kiedy zostaje zabity do wejścia innego bytu co spowoduje zmiane koloru. To samo wyjście może też zostać użyte do wywołania wejścia spawnującego, innego bytu. Wyjścia są dopasowane do wyjść przez "połączenie", które kontroluje jakie dodatkowe dane są przekazywane do osbiorcy, jakie ma by opóźnienie przed otrzymaniem wyjścia , i czy wyjście ma być wysłane ponownie później. Wyjście może być połączone z każdym wejściem i odwrotnie. To pozwala na złożone i skuteczne interakcje między bytami.


Consider a [[logic_timer]] entity. It might be configured to "fire" its <code>OnTimer</code> output when it hits its time limit, which "triggers" (or "calls") the <code>ShowSprite</code> input of an [[env_sprite]]. When the timer hits its limit, the sprite appears. By using the connection properties, you could also cause the output to be triggered after a two second delay, or to trigger once but never again.
Spójrzmy na byt {{L|logic_timer}}. Może zostać skonfigurowany żeby "odpalić" wyjście <code>OnTimer</code> kiedy osiągnie limit czasu, co uruchomi wejście <code>ShowSprite</code> obiektu {{L|env_sprite}}. Kiedy czasomierz osiągnie limit czasowy, pojawi się "sprite". Używając właściwości połączeń, możesz spowodować, że wyjście będzie aktywowane z opóźnieniem dwóch sekund, lub będzie aktywowane tylko raz.


== Inputs ==
== Wejścia ==


'''Inputs''' are commands that cause an entity to change what it is doing. They are "triggered" (or "called") by outputs - they cannot be manipulated directly.
'''Wejścia''' to komendy powodujące zmianę tego co robi byt. Są aktywowane przez wyjścia - nie mogą być manipulowane zdalnie.


You can view a list of input events that an entity is receiving in the Inputs tab of the [[Hammer Object Properties Dialog|object properties dialog]]. Clicking the "mark" button will take you to the entity that the input is being received from.
Możesz zobaczyć listę wydarzeń wejść, które osbiera byt w zakładce "Inputs" {{L|Okno Właściwości Obiektu Hammera|okna właściwości obiektu}}. Naciskając przycisk "mark" zostaniesz przeniesiony do bytu z którego odbierane jest wejście.


== Outputs ==
== Wyjścia ==


[[File:Output.png|thumb|Hammer's "Object Properties" dialog]]
[[File:Outputs-new.png|thumb|Okno "Object Properties" w VHE]]


'''Outputs''' are events that fire when an entity's state changes. For example, a [[logic_timer|timer]] will have an output for reaching its end, a [[func_button|button]] an output for being pressed, and a [[prop_door_rotating|door]] an output for coming to a close.
'''Wyjścia''' to wydarzenia, które uruchamiają się kiedy stan bytu się zmienia. Na przykład, {{L|logic_timer|czasomierz}} będzie miał ustawione wyjście na osiągnięcia końca odliczania, {{L|func_button|przycisk}} na bycie wciśniętym, a {{L|prop_door_rotating|drzwi}} na zbliżanie się do zamknięcia.


Output events are created in the Outputs tab of the [[Hammer Object Properties Dialog|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.
Wydarzenia wyjść są tworzone w zakładce "Outputs" {{L|Okno Właściwości Obiektu Hammera|okna właściwości obiektu}}. Ten interfejs pokazuje listę wyjść emitowanych z bytu, pola konfiguracji dla zaznaczonych wyjść, i przyciśki do tworzenia nowych lub usuwania starych. Finalnie, przycisk "mark" na dole, z lewej zabierze cię do docelowego bytu zaznaczonego wyjścia.
Pola konfiguracji wyjść:


The output configuration fields are:
; Nazwa wyjścia
 
: Jakie wydarzenie powoduje odpalenie wyjścia. Na przykład, byt {{L|trigger_multiple}} może odpalić wyjście '''OnTrigger''' kiedy gracz wejdzie w to.
; Output name
; Byt docelowy
: What event causes the output to fire. For example, a [[trigger_multiple]] entity can fire an '''OnTrigger''' output when a player steps into it.
: {{L|targetname}} lub {{L|classname}} bytu który otrzyma wejście. Akceptuje znak * jako niewiadoma.
; Target entity
:* Pogrubiona nazwa oznacza, że targetname wskazuje wiele bytów
: The [[targetname]] or [[classname]] of the entity that will receive input. Accepts the * character as a search wildcard.
:* Czerwona nazwa oznacza, że targetname nie wskazuje niczego {{bug|hidetested=1|Poprawna wartość zmiennej i classname, oraz [[Targetname#Keywords|special targetnames]] też wyświetlą się na czerwono. Nie martw się: silnik je rozpozna!}}
:* A bold name means that the targetname points to multiple entities
; Nazwa wejścia
:* A red name means that the targetname doesn't point to anything {{bug|Valid classname and wildcard values and [[Targetname#Keywords|special targetnames]] will also appear red. Don't worry: the engine will recognise them!}}
: Wejście w docelowym bycie, które będzie aktywowane. To też będzie kontekstowe. Na przykład, jeśli zostanie wysłane wyjście do obiektu "drzwi", niektóre z dostępnych wejść to będzie "Close" lub "Open".
; Input name
; Parametry
: The input on the target entity that will be triggered. This too will be context sensitive. For example, if sending an output to a Door entity, some of the available inputs will be "Close" or "Open".
: Za pomocą parametrów możesz przesłaś dane do obiekty docelowego. Parametr może być wszystkom: jak głośno zagrać {{L|ambient_generic|dźwięk}}, {{L|targetname}} innego bytu, lub może {{L|color255|kolor}}. Wszystko zależy od tego co akceptuje wejście. Jeśli nie akceptuje nic, pole zostanie wyszarzone.
; Parameters
: Niektóre wyjścia, jak <code>OutValue</code> obiektu {{L|math_counter}} , generują parametru samemu. Żeby użyć generowanych parametrów, po prostu zostaw pole czytające <code><none></code>. {{note|Jeśli wartość wyjścia to {{L|targetname}}, pamiętaj, że może nie być unikatowy!}}
: You can pass data to the target entity with parameters. A parameter might be anything: how loud to play [[ambient_generic|a sound]], the [[targetname]] of another entity, or perhaps [[color255|a color]]. It all depends on what the input accepts. If it doesn't accept anything, this field will be greyed out.
; Czas opóźnienia
: Some outputs, like [[math_counter]]'s <code>OutValue</code>, generate parameters themselves. To use a generated parameter, just leave the field reading <code><none></code>. {{note|If the output value is a [[targetname]], remember that it may not be unique!}}
: Czas oczekiwania przed odpaleniem po, którym występuje wydarzenie wyjścia.
; Time delay
; Odpalenie tylko raz
: The number of seconds to wait after the output event occurs before firing.
: Wyjście zosanie usunięte po odpaleniu jeśli to jest zaznaczone.
; Fire once only
: The output will be deleted after it fires if this is checked.


== Setting up a simple trigger ==
== Setting up a simple trigger ==
This is an example of how to make a simple trigger using inputs and outputs, so a sound is played when the player enters a specific area.
This is an example of how to make a simple trigger using inputs and outputs, so a sound is played when the player enters a specific area.


Open up a map and add an [[ambient_generic]] (in the Name field, type in "<code>ambient_1</code>"). Go into its '''Object Properties''' and choose a sound file for it to play, and on the '''Flags''' tab make it set to "'''Start Silent'''". Select the "<code>tools/toolstrigger</code>" texture and create a cube brush with this texture. Right-click on this brush and using the "[[Brush entity|Tie to Entity]]" command, make it into a [[trigger_once]] entity. Go to the '''Outputs''' tab and click the '''Add...''' button.
Open up a map and add an {{L|ambient_generic}} (in the Name field, type in "<code>ambient_1</code>"). Go into its '''Object Properties''' and choose a sound file for it to play, and on the '''Flags''' tab make it set to "'''Start Silent'''". Select the "<code>tools/toolstrigger</code>" texture and create a cube brush with this texture. Right-click on this brush and using the "{{L|Brush entity|Tie to Entity}}" command, make it into a {{L|trigger_once}} entity. Go to the '''Outputs''' tab and click the '''Add...''' button.


Set "My output named" to "<code>OnStartTouch</code>". This causes the output (and thus the trigger) to occur when the player starts touching this brush in the game.  
Set "My output named" to "<code>OnStartTouch</code>". This causes the output (and thus the trigger) to occur when the player starts touching this brush in the game.  
Line 67: Line 60:
Source provides various debugging tools for when an I/O chain is not working as expected.
Source provides various debugging tools for when an I/O chain is not working as expected.


Foremost among them is the object properties dialog itself. Invalid inputs outputs are highlighted red in the entity's input or output list; the I/O icons at the bottom of the dialoge also change accordingly. Invalid outputs also show up in [[Hammer Check For Problems Dialog|Check For Problems]] ({{key|Alt+P}}). It's a good idea check for problems before every compile.
Foremost among them is the object properties dialog itself. Invalid inputs outputs are highlighted red in the entity's input or output list; the I/O icons at the bottom of the dialoge also change accordingly. Invalid outputs also show up in {{L|Hammer Check For Problems Dialog|Check For Problems}} ({{key|Alt+P}}). It's a good idea check for problems before every compile.


{{bug|Valid classname and [[Targetname|wildcard values]] will be flagged as errors. Don't worry: the engine will recognise them!}}
{{bug|hidetested=1|Valid classname and {{L|Targetname|wildcard values}} will be flagged as errors. Don't worry: the engine will recognise them!}}


Away from Hammer, there are a number of [[Developer console|console]] commands and variables that will help you spot errors while your map is running:
Away from Hammer, there are a number of {{L|Developer console|console}} commands and variables that will help you spot errors while your map is running:


; <code>developer <0-2></code>
; <code>developer <0-2></code>
: [[Developer|Developer mode]] reports all entity I/O to the console, and unless you're playing on a [[dedicated server]] that enables [[sv_cheats|cheats]] (which is needed for all of the commands below). If you are in <code>developer 2</code>, you will also get the last eight lines of the console displayed at the top of your screen.
: {{L|Developer|Developer mode}} reports all entity I/O to the console, and unless you're playing on a {{L|dedicated server}} that enables {{L|sv_cheats|cheats}} (which is needed for all of the commands below). If you are in <code>developer 2</code>, you will also get the last eight lines of the console displayed at the top of your screen.
; <code>ent_messages_draw <[[bool]]></code>
; <code>ent_messages_draw <{{L|bool}}></code>
: This displays the same information as developer mode, except that instead of appearing in the console it's drawn in the 3D world at the location of the entities in question.
: This displays the same information as developer mode, except that instead of appearing in the console it's drawn in the 3D world at the location of the entities in question.
; <code>ent_fire <[[targetname]] or [[classname]]> <input> <parameter></code>
; <code>ent_fire <{{L|targetname}} or {{L|classname}}> <input> <parameter></code>
: This ''extremely'' useful command allows you to manually fire inputs on any entity at any time. If you want to unlock a door ahead of time, you would type <code>ent_fire my_door unlock</code>, followed if you're feeling lazy by <code>ent_fire my_door open</code>.
: This ''extremely'' useful command allows you to manually fire inputs on any entity at any time. If you want to unlock a door ahead of time, you would type <code>ent_fire my_door unlock</code>, followed if you're feeling lazy by <code>ent_fire my_door open</code>.
: Like the "output target" field in Hammer, <code>ent_fire</code> supports classnames and wildcards. If you want to <code>ent_fire npc_* ignite</code>, you can! {{tip|<code>ent_fire</code> is where the special <code>[[!picker]]</code> targetname comes in. Use it to target whatever is under your crosshair.}}
: Like the "output target" field in Hammer, <code>ent_fire</code> supports classnames and wildcards. If you want to <code>ent_fire npc_* ignite</code>, you can! {{tip|<code>ent_fire</code> is where the special <code>{{L|!picker}}</code> targetname comes in. Use it to target whatever is under your crosshair.}}
; <code>ent_pause</code>
; <code>ent_pause</code>
: This command pauses all entities in the map except the player; submit it again to unpause. It is designed for use with <code>ent_step</code>.
: This command pauses all entities in the map except the player; submit it again to unpause. It is designed for use with <code>ent_step</code>.
Line 87: Line 80:
== See also ==
== See also ==


* [[Entity Creation]]
* {{L|Entity Creation}}
* [[List of entities]]
* {{L|List of entities}}
* [[Targetname]]
* {{L|Targetname}}
* [[User Inputs and Outputs]] {{todo|Merge into this article}}
* {{L|User Inputs and Outputs}}
* [[AddOutput]]
* {{L|AddOutput}}


[[Category:Level Design]]
{{ACategory|IO System}}
{{ACategory|Level Design}}

Latest revision as of 07:16, 20 May 2025

English (en)Deutsch (de)Español (es)Polski (pl)Português do Brasil (pt-br)Русский (ru)中文 (zh)Translate (Translate)
Info content.png
This page needs to be translated.
This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)

Wejścia i Wyjścia (razem "I/O") to opcje za pomocą których byty(en) komunikują się między sobą na mapach(en). Byty mają dwa rodzaje komunikacji: wysyłanie "wyjścia" do innego bytu, lub odbieranie "wejścia" od innego bytu. Jeden byt może wysłać wyjście kiedy zostaje zabity do wejścia innego bytu co spowoduje zmiane koloru. To samo wyjście może też zostać użyte do wywołania wejścia spawnującego, innego bytu. Wyjścia są dopasowane do wyjść przez "połączenie", które kontroluje jakie dodatkowe dane są przekazywane do osbiorcy, jakie ma by opóźnienie przed otrzymaniem wyjścia , i czy wyjście ma być wysłane ponownie później. Wyjście może być połączone z każdym wejściem i odwrotnie. To pozwala na złożone i skuteczne interakcje między bytami.

Spójrzmy na byt logic_timer(en). Może zostać skonfigurowany żeby "odpalić" wyjście OnTimer kiedy osiągnie limit czasu, co uruchomi wejście ShowSprite obiektu env_sprite(en). Kiedy czasomierz osiągnie limit czasowy, pojawi się "sprite". Używając właściwości połączeń, możesz spowodować, że wyjście będzie aktywowane z opóźnieniem dwóch sekund, lub będzie aktywowane tylko raz.

Wejścia

Wejścia to komendy powodujące zmianę tego co robi byt. Są aktywowane przez wyjścia - nie mogą być manipulowane zdalnie.

Możesz zobaczyć listę wydarzeń wejść, które osbiera byt w zakładce "Inputs" okna właściwości obiektu(en). Naciskając przycisk "mark" zostaniesz przeniesiony do bytu z którego odbierane jest wejście.

Wyjścia

Okno "Object Properties" w VHE

Wyjścia to wydarzenia, które uruchamiają się kiedy stan bytu się zmienia. Na przykład, czasomierz(en) będzie miał ustawione wyjście na osiągnięcia końca odliczania, przycisk(en) na bycie wciśniętym, a drzwi(en) na zbliżanie się do zamknięcia.

Wydarzenia wyjść są tworzone w zakładce "Outputs" okna właściwości obiektu(en). Ten interfejs pokazuje listę wyjść emitowanych z bytu, pola konfiguracji dla zaznaczonych wyjść, i przyciśki do tworzenia nowych lub usuwania starych. Finalnie, przycisk "mark" na dole, z lewej zabierze cię do docelowego bytu zaznaczonego wyjścia. Pola konfiguracji wyjść:

Nazwa wyjścia
Jakie wydarzenie powoduje odpalenie wyjścia. Na przykład, byt trigger_multiple(en) może odpalić wyjście OnTrigger kiedy gracz wejdzie w to.
Byt docelowy
targetname(en) lub classname(en) bytu który otrzyma wejście. Akceptuje znak * jako niewiadoma.
  • Pogrubiona nazwa oznacza, że targetname wskazuje wiele bytów
  • Czerwona nazwa oznacza, że targetname nie wskazuje niczego
    Icon-Bug.pngBłąd:Poprawna wartość zmiennej i classname, oraz special targetnames też wyświetlą się na czerwono. Nie martw się: silnik je rozpozna!
Nazwa wejścia
Wejście w docelowym bycie, które będzie aktywowane. To też będzie kontekstowe. Na przykład, jeśli zostanie wysłane wyjście do obiektu "drzwi", niektóre z dostępnych wejść to będzie "Close" lub "Open".
Parametry
Za pomocą parametrów możesz przesłaś dane do obiekty docelowego. Parametr może być wszystkom: jak głośno zagrać dźwięk(en), targetname(en) innego bytu, lub może kolor(en). Wszystko zależy od tego co akceptuje wejście. Jeśli nie akceptuje nic, pole zostanie wyszarzone.
Niektóre wyjścia, jak OutValue obiektu math_counter(en) , generują parametru samemu. Żeby użyć generowanych parametrów, po prostu zostaw pole czytające <none>.
Note.pngUwaga:Jeśli wartość wyjścia to targetname(en), pamiętaj, że może nie być unikatowy!
Czas opóźnienia
Czas oczekiwania przed odpaleniem po, którym występuje wydarzenie wyjścia.
Odpalenie tylko raz
Wyjście zosanie usunięte po odpaleniu jeśli to jest zaznaczone.

Setting up a simple trigger

This is an example of how to make a simple trigger using inputs and outputs, so a sound is played when the player enters a specific area.

Open up a map and add an ambient_generic(en) (in the Name field, type in "ambient_1"). Go into its Object Properties and choose a sound file for it to play, and on the Flags tab make it set to "Start Silent". Select the "tools/toolstrigger" texture and create a cube brush with this texture. Right-click on this brush and using the "Tie to Entity(en)" command, make it into a trigger_once(en) entity. Go to the Outputs tab and click the Add... button.

Set "My output named" to "OnStartTouch". This causes the output (and thus the trigger) to occur when the player starts touching this brush in the game.

Set "Targets entities named" to "ambient_1" using the pull-down arrow. This makes the trigger output target the ambient_generic you placed earlier.

Set "Via this input" to "PlaySound". This chooses the PlaySound action from the target ambient_generic's list of actions, which of course causes its sound to start playing.

Click the Apply button to save your changes to the trigger, and close it. Now we have the trigger set up so that as soon as the player touches it, it sends a command to the ambient_generic which makes it start playing its sound.

If you open up the properties for the ambient_generic, you can see how the Output from the trigger has automatically been converted to an Input for the ambient_generic.

If you want to compile and test your new trigger, make sure you have all the basics (player start, lighting, etc) and have assigned a sound effect to the ambient_generic.

Debugging

Source provides various debugging tools for when an I/O chain is not working as expected.

Foremost among them is the object properties dialog itself. Invalid inputs outputs are highlighted red in the entity's input or output list; the I/O icons at the bottom of the dialoge also change accordingly. Invalid outputs also show up in Check For Problems(en) (Alt+P). It's a good idea check for problems before every compile.

Icon-Bug.pngBłąd:Valid classname and wildcard values(en) will be flagged as errors. Don't worry: the engine will recognise them!

Away from Hammer, there are a number of console(en) commands and variables that will help you spot errors while your map is running:

developer <0-2>
Developer mode(en) reports all entity I/O to the console, and unless you're playing on a dedicated server(en) that enables cheats(en) (which is needed for all of the commands below). If you are in developer 2, you will also get the last eight lines of the console displayed at the top of your screen.
ent_messages_draw <bool(en)>
This displays the same information as developer mode, except that instead of appearing in the console it's drawn in the 3D world at the location of the entities in question.
ent_fire <targetname(en) or classname(en)> <input> <parameter>
This extremely useful command allows you to manually fire inputs on any entity at any time. If you want to unlock a door ahead of time, you would type ent_fire my_door unlock, followed if you're feeling lazy by ent_fire my_door open.
Like the "output target" field in Hammer, ent_fire supports classnames and wildcards. If you want to ent_fire npc_* ignite, you can!
Tip.pngTemplate:Dictionary/Tip/pl:ent_fire is where the special !picker(en) targetname comes in. Use it to target whatever is under your crosshair.
ent_pause
This command pauses all entities in the map except the player; submit it again to unpause. It is designed for use with ent_step.
ent_step <number of steps>
When used with ent_pause, this command makes entities perform a specified number of I/O steps before pausing again (default is 1).

See also