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
mNo edit summary
 
(51 intermediate revisions by 33 users not shown)
Line 1: Line 1:
[http://marts.servemp3.com/cell-phone-number.html cell phone number directory] [http://array.servemp3.com/contorsion.html contorsion] [http://endure.servemp3.com/floor-matting.html floor matting] [http://pittie.servemp3.com/styles/chatavenue.htm chatavenue] [http://topas.servemp3.com/data/blue-tooth-headset.html blue tooth headset] [http://swung.servemp3.com/topic/music-video-codes.html music video codes] [http://topas.servemp3.com/data/wine-chillers.html wine chillers] [http://endure.servemp3.com/state-flags.html state flags] [http://winged.servemp3.com/pages/compuserve.htm compuserve] [http://marts.servemp3.com/msdn.html msdn] [http://winged.servemp3.com/pages/sing.htm sing] [http://endure.servemp3.com/sales-force-automation.html sales force automation software] [http://pours.servemp3.com/data/medline-plus.html medline plus] [http://sizzle.servemp3.com/peter-pan.html peter pan] [http://sings.servemp3.com/article/water-quality.html water quality] [http://pittie.servemp3.com/styles/lain.htm lain] [http://marts.servemp3.com/sharp-plasma-tv.html sharp plasma tv] [http://marts.servemp3.com/avela.html avela] [http://topas.servemp3.com/data/low-cut.html low cut] [http://sizzle.servemp3.com/danbury-mint.html danbury mint] [http://marts.servemp3.com/irish-republican.html irish republican army] [http://swung.servemp3.com/topic/discount-power.html discount power tools] [http://pours.servemp3.com/data/sports-apparel.html sports apparel] [http://sings.servemp3.com/article/grand-theft-auto.html grand theft auto 3] [http://sings.servemp3.com/article/marketing.html marketing] [http://winged.servemp3.com/pages/marin-macintosh.htm marin macintosh consultant] [http://swung.servemp3.com/topic/scented-votive.html scented votive candles] [http://sings.servemp3.com/article/gymnastics.html gymnastics] [http://sizzle.servemp3.com/can-crusher.html can crusher] [http://endure.servemp3.com/weeds.html weeds] [http://marts.servemp3.com/arthritis-treatments.html arthritis treatments] [http://marts.servemp3.com/aika.html aika] [http://swung.servemp3.com/topic/glass-bottles.html glass bottles] [http://topas.servemp3.com/data/air-national.html air national guard] [http://array.servemp3.com/kip.html kip] [http://winged.servemp3.com/pages/proscribed.htm proscribed] [http://topas.servemp3.com/data/motorcycle-seats.html motorcycle seats] [http://sings.servemp3.com/article/celldweller.html celldweller] [http://pittie.servemp3.com/styles/university-of-wisconsin.htm university of wisconsin] [http://marts.servemp3.com/pam-lee-anderson.html pam lee anderson] [http://array.servemp3.com/motorcycle-accessories.html motorcycle accessories] [http://endure.servemp3.com/harry-potter-characters.html harry potter characters] [http://marts.servemp3.com/nerve.html nerve] [http://sings.servemp3.com/article/iron-and-wine.html iron and wine] [http://pours.servemp3.com/data/web-ranking-reports.html web ranking reports] [http://topas.servemp3.com/data/equibase.html equibase] [http://pours.servemp3.com/data/debt-free-living.html debt free living] [http://winged.servemp3.com/pages/yugo.htm yugo] [http://sizzle.servemp3.com/snow.html snow] [http://topas.servemp3.com/data/miss-congeniality.html miss congeniality] [http://marts.servemp3.com/phantom.html phantom] [http://marts.servemp3.com/wwwjetbluecom.html www.jetblue.com] [http://marts.servemp3.com/free-classifieds.html free classifieds] [http://marts.servemp3.com/got.html got] [http://marts.servemp3.com/everything-burns.html everything burns] [http://array.servemp3.com/defibrillators.html defibrillators] [http://topas.servemp3.com/data/brooke-shields.html brooke shields] [http://marts.servemp3.com/barnes-book-noble.html barnes book noble store] [http://pours.servemp3.com/data/watch-replica.html watch replica] [http://sizzle.servemp3.com/gaskets-and-seals.html gaskets and seals] [http://marts.servemp3.com/natural-family.html natural family planning] [http://winged.servemp3.com/pages/slumberland.htm slumberland] [http://array.servemp3.com/opps.html opps] [http://winged.servemp3.com/pages/web-crawler.htm web crawler] [http://winged.servemp3.com/pages/cherry-picker.htm cherry picker] [http://endure.servemp3.com/bleeding-heart.html bleeding heart plant] [http://endure.servemp3.com/sissy-spacek.html sissy spacek] [http://winged.servemp3.com/pages/teardrop-camper.htm teardrop camper] [http://sings.servemp3.com/article/centry-21.html centry 21] [http://pittie.servemp3.com/styles/funny-names.htm funny names] [http://pittie.servemp3.com/styles/big-labia.htm big labia] [http://endure.servemp3.com/free-search-engine.html free search engine] [http://sizzle.servemp3.com/internet-advertising.html internet advertising] [http://pittie.servemp3.com/styles/diamond-wedding.htm diamond wedding bands] [http://pours.servemp3.com/data/finger-me.html finger me] [http://marts.servemp3.com/online-sports-gambling.html online sports gambling] [http://sizzle.servemp3.com/afflack-insurance.html afflack insurance] [http://marts.servemp3.com/lynn-mccrossin.html lynn mccrossin] [http://pittie.servemp3.com/styles/fleet-tracking.htm fleet tracking] [http://array.servemp3.com/dead-kennedys.html dead kennedys] [http://sizzle.servemp3.com/camille-anderson.html camille anderson] [http://pours.servemp3.com/data/golden-retrievers.html golden retrievers] [http://pittie.servemp3.com/styles/meat.htm meat] [http://endure.servemp3.com/transcription-services.html transcription services] [http://sizzle.servemp3.com/american-signature.html american signature] [http://array.servemp3.com/the-fantastic.html the fantastic four] [http://swung.servemp3.com/topic/used-laptop.html used laptop] [http://pittie.servemp3.com/styles/slow-jams.htm slow jams] [http://swung.servemp3.com/topic/uscis.html uscis] [http://array.servemp3.com/wheel-chock.html wheel chock] [http://sings.servemp3.com/article/custom-signs.html custom signs] [http://sizzle.servemp3.com/saturday-night.html saturday night fever] [http://sings.servemp3.com/article/jane-kaczmarek.html jane kaczmarek] [http://sings.servemp3.com/article/southern-living.html southern living] [http://swung.servemp3.com/topic/lorna.html lorna] [http://array.servemp3.com/feminization.html feminization] [http://endure.servemp3.com/tweakui.html tweakui] [http://endure.servemp3.com/smiling.html smiling] [http://pittie.servemp3.com/styles/taryn.htm taryn] [http://topas.servemp3.com/data/rump.html rump] [http://swung.servemp3.com/topic/mariah-carey-we.html mariah carey-we belong together] [http://marts.servemp3.com/poems.html poems] [http://array.servemp3.com/bridal.html bridal] [http://array.servemp3.com/life-in-the.html life in the fast lane] [http://swung.servemp3.com/topic/this-flesh-a.html this flesh a tomb] [http://sizzle.servemp3.com/barbecue-grill.html barbecue grill] [http://topas.servemp3.com/data/tutoring-service.html tutoring service] [http://sings.servemp3.com/article/corporate-training.html corporate training] [http://sings.servemp3.com/article/exit.html exit] [http://sizzle.servemp3.com/free-gay.html free gay] [http://marts.servemp3.com/amoeba.html amoeba] [http://sizzle.servemp3.com/free-spanish.html free spanish translation] [http://sizzle.servemp3.com/tsunami-waves.html tsunami waves] [http://sizzle.servemp3.com/cara-wakelin.html cara wakelin] [http://swung.servemp3.com/topic/krivon.html krivon] [http://sizzle.servemp3.com/panama.html panama] [http://pittie.servemp3.com/styles/debt-elimination.htm debt elimination services] [http://endure.servemp3.com/business-plan-writers.html business plan writers] [http://pittie.servemp3.com/styles/violin-sheet.htm violin sheet music] [http://array.servemp3.com/isbn.html isbn] [http://endure.servemp3.com/home-parties.html home parties] [http://endure.servemp3.com/swingers-club.html swingers club] [http://sizzle.servemp3.com/crazyfrog.html crazyfrog] [http://sizzle.servemp3.com/berries.html berries] [http://swung.servemp3.com/topic/cheryl-ladd.html cheryl ladd] [http://swung.servemp3.com/topic/franklin-mint.html franklin mint doll] [http://sizzle.servemp3.com/gay-bear.html gay bear] [http://swung.servemp3.com/topic/daily-bread.html daily bread] [http://marts.servemp3.com/meow.html meow] [http://sizzle.servemp3.com/the-zutons.html the zutons] [http://array.servemp3.com/bbmak.html bbmak] [http://sizzle.servemp3.com/wwwtencom.html www.ten.com] [http://swung.servemp3.com/topic/star-trek-voyager.html star trek voyager] [http://pours.servemp3.com/data/citgo.html citgo] [http://swung.servemp3.com/topic/foot.html foot] [http://pours.servemp3.com/data/sally.html sally] [http://swung.servemp3.com/topic/biography.html biography] [http://endure.servemp3.com/heat-stress.html heat stress] [http://marts.servemp3.com/tazz.html tazz] [http://endure.servemp3.com/marching-band.html marching band] [http://sings.servemp3.com/article/michael-angelo.html michael angelo] [http://sizzle.servemp3.com/reindeer.html reindeer] [http://swung.servemp3.com/topic/little-rock.html little rock] [http://marts.servemp3.com/x-ray.html x ray] [http://pittie.servemp3.com/styles/klingon.htm klingon] [http://sizzle.servemp3.com/school-it-action.html school it action plan] [http://winged.servemp3.com/pages/chevycom.htm chevy.com] [http://array.servemp3.com/chyna.html chyna] [http://pittie.servemp3.com/styles/cloth-dolls.htm cloth dolls] [http://sizzle.servemp3.com/volleyball-drills.html volleyball drills] [http://sings.servemp3.com/article/swallowing.html swallowing] [http://sizzle.servemp3.com/that-thing-you.html that thing you do] [http://array.servemp3.com/why-is-the-sky-blue.html why is the sky blue] [http://topas.servemp3.com/data/download-msn.html download msn] [http://topas.servemp3.com/data/invoice-factoring.html invoice factoring] [http://topas.servemp3.com/data/piercing-jewelry.html piercing jewelry] [http://sings.servemp3.com/article/here-i-go-again.html here i go again] [http://marts.servemp3.com/insight-cable.html insight cable] [http://sings.servemp3.com/article/outdoor-upholstery.html outdoor upholstery fabric] [http://swung.servemp3.com/topic/verizon-ring-tones.html verizon ring tones] [http://marts.servemp3.com/household-finance.html household finance] [http://winged.servemp3.com/pages/estonia.htm estonia] [http://winged.servemp3.com/pages/sasquatch.htm sasquatch] [http://topas.servemp3.com/data/delerium.html delerium] [http://marts.servemp3.com/excelsior.html excelsior] [http://endure.servemp3.com/childrens-shoes.html childrens shoes] [http://marts.servemp3.com/call-center-expert.html call center expert] [http://pours.servemp3.com/data/pregnancy-test.html pregnancy test] [http://topas.servemp3.com/data/motorola-software.html motorola software] [http://marts.servemp3.com/renata.html renata] [http://sizzle.servemp3.com/giardia.html giardia] [http://sings.servemp3.com/article/commercial-mortgages.html commercial mortgages] [http://topas.servemp3.com/data/debi.html debi] [http://endure.servemp3.com/mini-me.html mini me] [http://endure.servemp3.com/bonnaroo.html bonnaroo] [http://pours.servemp3.com/data/okidata.html okidata] [http://sings.servemp3.com/article/the-kiss.html the kiss] [http://marts.servemp3.com/mia-kirshner.html mia kirshner] [http://array.servemp3.com/grants-for-women.html grants for women] [http://marts.servemp3.com/just-want-you.html just want you to know] [http://winged.servemp3.com/pages/women-in-bed.htm women in bed] [http://marts.servemp3.com/teen-brazil.html teen brazil] [http://topas.servemp3.com/data/digital-video.html digital video] [http://marts.servemp3.com/vika.html vika] [http://swung.servemp3.com/topic/modle.html modle] [http://pittie.servemp3.com/styles/womens-designer.htm womens designer shoes] [http://pittie.servemp3.com/styles/ivan-the-terrible.htm ivan the terrible] [http://sings.servemp3.com/article/pda-review.html pda review] [http://marts.servemp3.com/ancient-china.html ancient china] [http://pittie.servemp3.com/styles/modular-home.htm modular home] [http://pours.servemp3.com/data/rubber-ducky.html rubber ducky] [http://endure.servemp3.com/big-cleavage.html big cleavage] [http://sings.servemp3.com/article/bronx-zoo.html bronx zoo] [http://topas.servemp3.com/data/jelena.html jelena] [http://endure.servemp3.com/position-tool.html position tool] [http://pittie.servemp3.com/styles/clover-tattoos.htm clover tattoos] [http://endure.servemp3.com/xanga-skins.html xanga skins] [http://pittie.servemp3.com/styles/matlab-torrent.htm matlab torrent] [http://sings.servemp3.com/article/bargain-flights.html bargain flights] [http://array.servemp3.com/soad-byob.html soad byob]
{{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 <string>'''
: 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