This article's documentation is for anything that uses the Source engine. Click here for more information.

Logic case: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(64 intermediate revisions by 38 users not shown)
Line 1: Line 1:
[http://canzonedeipuffi.alient.info/ canzone dei puffi] [http://medical-space.behav.info/ medical-space] [http://carito.etotest.info/ carito] [http://ibmthinkpadt43.behav.info/ ibm thinkpad t43] [http://sodimmpc100256.skains.info/ sodimm pc100 256] [http://asusp4p800deluxe.etotest.info/ asus p4p800 deluxe intel i865pe chipset] [http://magazzinomdb.wedged.info/ magazzino mdb] [http://wwwinbanknet.etotest.info/ www in bank net] [http://fusin.enlard.info/ fusin] [http://granditettevideo.enlard.info/ grandi tette video gratis] [http://nontereggaepiu.demogen.info/ non te reggae piu] [http://knockingatyourbackdoor.enlard.info/ knocking at your backdoor] [http://nikond70kit18-70mm.enlard.info/ nikon d70 kit 18-70mm] [http://barchevelaemotori.etotest.info/ barche vela e motori] [http://donnechefanno.alient.info/ donne che fanno sesso conte] [http://annuncicontatti.etotest.info/ annunci contatti erotici a verona] [http://siemensm34.skains.info/ siemens m34] [http://sessovideoconsigliato.etotest.info/ sesso video consigliato] [http://guantidigomma.etotest.info/ guanti di gomma] [http://tea.etotest.info/ tea] [http://herwithoutyou.skains.info/ her without you 3 doors down] [http://eagleheart.enlard.info/ eagleheart] [http://nonmelosospiegare.etotest.info/ non me lo so spiegare tiziano ferro] [http://mrsnoozleberg.alient.info/ mrsnoozleberg - first contact] [http://fotodinudisti.wedged.info/ foto di nudisti gratis] [http://carlobetocchi.behav.info/ carlo betocchi] [http://etotest.info/index5_500.html url] [http://spegniquellaluce.enlard.info/ spegni quella luce midi] [http://huaraz.wedged.info/ huaraz] [http://donnafugata.etotest.info/ donnafugata] [http://nikonspeedlight.etotest.info/ nikon speedlight sb800] [http://didohunter.etotest.info/ dido hunter] [http://cardgameclub.wedged.info/ cardgame club] [http://yugihogameshark.demogen.info/ yu gi ho game shark] [http://mercedesslk.wedged.info/ mercedes slk prezzo] [http://videoshockdi.wedged.info/ video shock di donne famose] [http://reggaetonen.enlard.info/ reggaeton en vivo] [http://fotopaparazzigratis.etotest.info/ foto paparazzi gratis] [http://krzysztofcieciuch.wedged.info/ krzysztof cieciuch] [http://alient.info/index3_1000.html map] [http://microzenaccessori.demogen.info/ micro zen accessori] [http://strawberryfields.skains.info/ strawberry fields] [http://staffasharpsoffitto.wedged.info/ staffa sharp soffitto] [http://storiedicinque.enlard.info/ storie di cinque lolite] [http://copertinafronte.enlard.info/ copertina fronte e retro giochi per la ps2] [http://rottinit.skains.info/ rottin it] [http://guerrabianca.demogen.info/ guerra bianca] [http://ragazzeatrapani.behav.info/ ragazze a trapani] [http://osthoffhermann.enlard.info/ osthoff hermann] [http://appuntobtesina.demogen.info/ appunto b tesina] [http://boschlavatrici.alient.info/ bosch lavatrici] [http://tonercanonnp1010.skains.info/ toner canon np1010] [http://intercity.alient.info/ intercity] [http://mercedes200elegance.etotest.info/ mercedes 200 elegance] [http://laprovadelcuoco.enlard.info/ laprovadelcuoco rai it] [http://videosk8erboy.demogen.info/ video sk8er boy] [http://ricaricafrigorifero.alient.info/ ricarica frigorifero] [http://alient.info/index0_500.html link] [http://postaisromanticos.enlard.info/ postais romanticos] [http://skains.info/ skains.info] [http://formatoa1.etotest.info/ formato a1] [http://applemacmini.enlard.info/ apple mac mini 1 25 ghz] [http://vilmagoich.wedged.info/ vilma goich] [http://confezioniregalo.etotest.info/ confezioni regalo italia] [http://murolomidi.wedged.info/ murolo midi] [http://annuncioschiave.behav.info/ annuncio schiave] [http://premiletterari.behav.info/ premi letterari] [http://granadanicaragua.etotest.info/ granada nicaragua] [http://modenacityramble.enlard.info/ modena city ramble] [http://tariffeadsl.demogen.info/ tariffe adsl] [http://smsanimatinokia.skains.info/ sms animati nokia] [http://hotelloira.enlard.info/ hotel loira] [http://enlard.info/index1_500.html page] [http://copiludeaut.behav.info/ copilu de aut] [http://mousenero.behav.info/ mouse nero] [http://staytommyvee.alient.info/ stay tommy vee] [http://wwwpinnacle.behav.info/ www pinnacle] [http://etenp300palmari.alient.info/ eten p300 palmari] [http://daitarn3sigla.demogen.info/ daitarn 3 sigla] [http://eiffelalexandre-gustave.wedged.info/ eiffel alexandre-gustave] [http://ilbaronerampante.wedged.info/ il barone rampante] [http://phaser6100bd.alient.info/ phaser 6100bd] [http://crybaby.enlard.info/ cry baby] [http://storiadelsistema.enlard.info/ storia del sistema bancario] [http://correttorechanel.enlard.info/ correttore chanel] [http://nurzubesuch.wedged.info/ nur zu besuch] [http://folkestone.behav.info/ folkestone] [http://storiadamore.skains.info/ storia damore con i crampi] [http://macchinefotografiche.alient.info/ macchine fotografiche digitali fujifilm] [http://sennheiser350.skains.info/ sennheiser 350] [http://chingyballababy.enlard.info/ chingy balla baby] [http://bebysitter.behav.info/ beby sitter] [http://incestovideo.demogen.info/ incesto video free] [http://www156cl.behav.info/ www 156 cl] [http://dietabodybuilding.enlard.info/ dieta body building] [http://kwdencoded.behav.info/ kwd encoded] [http://wwwangela.behav.info/ www angela] [http://classificalibro.demogen.info/ classifica libro online] [http://generaleamericano.wedged.info/ generale americano abizaid] [http://sansalvadortesto.behav.info/ san salvador testo]
{{LanguageBar}}
{{wrongtitle|title=logic_case}}
{{TabsBar|main=s2|base=logic_case}}
 
{{CD|CLogicCase|file1=logicentities.cpp}}
== Entity description ==
{{this is a|logical entity|name=logic_case|sprite=1}} It compares an input to up to 16 configured values, firing a corresponding output if there is a match (on <code>InValue</code>), or fires a random output (on <code>PickRandom</code>). Use [[logic_random_outputs]] for a weighted random output.
[[Image:logic_case.png|right]]
{{Important|This entity stores values ​​as '''strings''', so if you specify one of the case as "1.50", then when you try to compare [[float]] it will not match, because the float will be "1.5", and not "1.50".}}
 
Compares an input to up to 16 preset values. If the input value is the same as any of the preset values, an output corresponding to that value is fired.
 
For example: If ''Case01'' is set to <code>2</code> and ''Case02'' is set to <code>5</code>, and the input value is <code>5</code>, the ''OnCase02'' output will be fired.
 
This entity can also be used to select from a number of random targets via the ''PickRandom'' input. One of the ''OnCase'' outputs that is connected to another entity will be picked at random and fired.
 
{{note|This entity with not recognize float values ending in <code>0</code> (like <code>0.50</code> or <code>1.00</code>). Simply remove these.}}
 
* The ideal entity for randomized events.
* Use with [[logic_timer]] for extremely random events.


{{tip|Use with [[logic_timer]] for extremely random events.}}
__NOTOC__
== Keyvalues ==
== Keyvalues ==
* {{kv targetname}}
{{KV Targetname}}
 
{{KV|Case 01|to=Case 16|intn=Case01|intn2=Case16|string|The values to test against.}}
* '''Case''(01-16)'''''
: <string>


== Inputs ==
== Inputs ==
* {{i targetname}}
{{I|InValue|Compares the Input value converted to string to the case values, and fires the appropriate output, if any.|param=variant}}
 
{{I|PickRandom|param=void|Fires a random OnCase output with at least one connection.}}
* '''InValue <string>'''
{{I|PickRandomShuffle|param=void|Fires a random OnCase output with at least one connection, with no repeats until all cases have been picked, at which point the shuffle starts over.}}
: Compare the Input value to the case values, and fire the appropriate output, if any.
 
* '''PickRandom'''
: Fire a random OnCase output with at least one connection.
 
* '''{{ep1 add|PickRandomShuffle}}'''
: Fires a random OnCase output with at least one connection, with no repeats until all cases have been picked, at which point the shuffle starts over.


== Outputs ==
== Outputs ==
* {{o targetname}}
{{O|OnCase01|to=OnCase16|param=void|activator = activator of the input causing this|Fired when the input value equals the corresponding Case value.}}
 
{{O|OnDefault|param=variant|activator = activator of InValue input|Fired when the input value does not equal any of the Case values.}}
* '''OnCase''(01-16)'''''
{{O|OnUsed|param=variant|activator = activator of InValue input|Fired when an input value is received, regardless of whether it matches a case. Outputs the same parameter type as was inputted with InValue input (i.e. if it was float this output will be of type float, the same applies to OnDefault output in {{mapbase}})|only={{mapbase}}}}
: Fired when the input value equals the Case''(01-16)'' value. {{activator|activator}}
 
* '''OnDefault'''
: Fired when the input value does not equal any of the Case values. {{activator|activator}}


[[Category:Entities]]
== See Also ==
* {{ent|logic_timer}}
* {{ent|logic_relay}}
* {{ent|math_counter}}
[[Category:IO System]]

Latest revision as of 10:59, 8 May 2025

English (en)中文 (zh)Translate (Translate)
C++ Class hierarchy
CLogicCase
CLogicalEntity
CServerOnlyEntity
CBaseEntity
C++ logicentities.cpp
Logic case.png

logic_case is a logical entity available in all Source Source games. It compares an input to up to 16 configured values, firing a corresponding output if there is a match (on InValue), or fires a random output (on PickRandom). Use logic_random_outputs for a weighted random output.

Icon-Important.pngImportant:This entity stores values ​​as strings, so if you specify one of the case as "1.50", then when you try to compare float it will not match, because the float will be "1.5", and not "1.50".
Tip.pngTip:Use with logic_timer for extremely random events.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Case 01 (Case01) to Case 16 (Case16) <string>
The values to test against.

Inputs

InValue <variantRedirectInput/variant>
Compares the Input value converted to string to the case values, and fires the appropriate output, if any.
PickRandom <void>
Fires a random OnCase output with at least one connection.
PickRandomShuffle <void>
Fires a random OnCase output with at least one connection, with no repeats until all cases have been picked, at which point the shuffle starts over.

Outputs

OnCase01 to OnCase16 <void>
!activator = activator of the input causing this
!caller = this entity
Fired when the input value equals the corresponding Case value.
OnDefault <variantRedirectOutput/variant>
!activator = activator of InValue input
!caller = this entity
Fired when the input value does not equal any of the Case values.
OnUsed <variantRedirectOutput/variant> (only in Mapbase)
!activator = activator of InValue input
!caller = this entity
Fired when an input value is received, regardless of whether it matches a case. Outputs the same parameter type as was inputted with InValue input (i.e. if it was float this output will be of type float, the same applies to OnDefault output in Mapbase)

See Also