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
 
(62 intermediate revisions by 37 users not shown)
Line 1: Line 1:
[http://exoticlingerie.coolish.info/ exotic lingerie] [http://orlandoreal.desdee.info/ orlando real estate] [http://surplushunting.stratose.info/ surplus hunting gear] [http://estatelicencenj.shippon.info/ estate licence nj real] [http://propeciaonline.whacks.info/ propecia online] [http://sicklecellanemia.shippon.info/ sickle cell anemia researchers] [http://sexmatures.skunkish.info/ sex matures] [http://pvcpipecutting.injelly.info/ pvc pipe cutting] [http://newjerseynetstickets.shippon.info/ new jersey nets tickets] [http://pornomovie.skunkish.info/ porno movie] [http://softwarequality.injelly.info/ software quality plan] [http://11upn.skunkish.info/ 11 upn] [http://kidneyfailure.desdee.info/ kidney failure] [http://californiaauto.betrunk.info/ california auto auction] [http://marjoriewilson.skunkish.info/ marjorie wilson artist] [http://freemp3ringtone.stratose.info/ free mp3 ringtone editor] [http://2005tacomapart.betrunk.info/ 2005 tacoma part] [http://movingcompany.shippon.info/ moving company key west] [http://reliantresources.stratose.info/ reliant resources] [http://clarinetmusicsheet.coolish.info/ clarinet music sheet] [http://illinoisstatebasketball.coolish.info/ illinois state basketball message board] [http://nixgut.sinkhead.info/ nix gut] [http://commercialdiving.stratose.info/ commercial diving school] [http://manssearchfor.betrunk.info/ man s search for meaning] [http://senateagriculture.betrunk.info/ senate agriculture committee] [http://bonsai.betrunk.info/ bonsai] [http://acyclovirmedication.skunkish.info/ acyclovir medication] [http://landscapeofcosta.footle.info/ land scape of costa rica] [http://wildbunchfilmdistribution.footle.info/ wild bunch film distribution] [http://stategovernments.shippon.info/ state governments india] [http://livesexmovie.footle.info/ live sex movie] [http://hubcaps.betrunk.info/ hub caps] [http://theconsequence.footle.info/ the consequence] [http://skunkish.info/index3_1000.html site] [http://newspaperarticles.footle.info/ newspaper articles of the 1930s] [http://ephedrineonline.shippon.info/ ephedrine online] [http://microsoftproduct.footle.info/ microsoft product support service] [http://cellphoneringtone.footle.info/ cell phone ringtone] [http://accumulationdistribution.footle.info/ accumulation distribution stocks] [http://deltatools.injelly.info/ delta tools] [http://chargers.shippon.info/ chargers] [http://accarshomepage.sinkhead.info/ ac cars homepage] [http://annealingplastic.coolish.info/ annealing plastic] [http://lighthousearound.betrunk.info/ light house around the world] [http://creditreport.stratose.info/ credit report] [http://programstomake.skunkish.info/ programs to make business cards] [http://militaryjobs.desdee.info/ military jobs] [http://removelimewire.whacks.info/ remove limewire] [http://windowsxp2003.betrunk.info/ windows xp 2003 product key viewer generator changer] [http://injelly.info/index2_250.html map] [http://sonysportsnetwork.injelly.info/ sony sports network walkman] [http://mahjonggames.desdee.info/ mahjong games] [http://makinglollipops.footle.info/ making lollipops] [http://vaio.whacks.info/ vaio] [http://manchestercity.skunkish.info/ manchester city football club logo] [http://playingblackjack.footle.info/ playing black jack] [http://christiansingles.shippon.info/ christian singles dating] [http://musclehunksgallery.injelly.info/ muscle hunks gallery] [http://whacks.info/index6_1000.html site] [http://internetmarketing.footle.info/ internet marketing firm virginia] [http://rockandrepublic.skunkish.info/ rock and republic jeans] [http://summasign.skunkish.info/ summa sign] [http://offstarting.sinkhead.info/ off starting] [http://audirs4.shippon.info/ audi rs4] [http://adoptionarkansas.footle.info/ adoption arkansas] [http://poolparts.desdee.info/ pool parts] [http://tonkgconvert.desdee.info/ ton kg convert] [http://tvantenna.whacks.info/ tv antenna] [http://bmwdealerships.footle.info/ bmw dealerships] [http://whacks.info/index5_250.html index] [http://indiancouplesphoto.whacks.info/ indian couples photo] [http://robiewilliams.betrunk.info/ robie williams angel lyric] [http://americawestflight.shippon.info/ america west flight funds] [http://motorolacellphone.coolish.info/ motorola cell phone cover] [http://pilgrimagehistory.desdee.info/ pilgrimage history] [http://aticareercenter.whacks.info/ ati career center training] [http://usbpclock.stratose.info/ usb pc lock] [http://womensvaginas.betrunk.info/ womens vaginas] [http://adadwardse.shippon.info/ ad adward se] [http://meetjoeblacktheme.footle.info/ meet joe black theme] [http://endpointsecurity.stratose.info/ endpoint security vpn] [http://parfum.stratose.info/ parfum] [http://radiocontrolled.betrunk.info/ radio controlled car clubs uk] [http://riversideca.skunkish.info/ riverside ca realtors] [http://skunkish.info/index6_666.html page] [http://costumesforteens.skunkish.info/ costumes for teens halloween] [http://1980actprivacy.betrunk.info/ 1980 act privacy protection] [http://lanarena.footle.info/ lan arena] [http://newbalancecollegiate.stratose.info/ new balance collegiate invitational results 2005] [http://whatisthelibor.whacks.info/ what is the libor interest rate] [http://footle.info/index8_1000.html index] [http://cheaphotelamsterdam.footle.info/ cheap hotel amsterdam] [http://museuminternship.desdee.info/ museum internship new york city] [http://topold.desdee.info/ top old] [http://signsofulcerative.shippon.info/ signs of ulcerative colitis] [http://peroxisomeproliferation.shippon.info/ peroxisome proliferation] [http://ataairlines.desdee.info/ ata airlines] [http://adware60.injelly.info/ adware 6 0] [http://lafreeways.injelly.info/ la freeways] [http://pornmovies.whacks.info/ porn movies]
{{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