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
 
(58 intermediate revisions by 36 users not shown)
Line 1: Line 1:
[http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/frvabn.html cheap norvasc] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/sotauv.html pop ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/rqtiuv.html order zoloft] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/drrsws.html sildenafil online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ffimnc.html download tracfone ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/vilwaa.html order prozac] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/mnksnq.html free sony ericsson ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/nufpgg.html metronidazole] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/hehecr.html order imitrex] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/msfksb.html cheap viagra] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/sptwjs.html nokia ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/fpjsqx.html discount viagra] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/wqfrpa.html funny ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ausjtx.html free cheap ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/kdlgbr.html accutane] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/hvckon.html lorazepam online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/gpdjmp.html cheap hydrocodone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ngktfk.html cheap carisoprodol] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/sqekcg.html discount zanaflex] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/hbxmde.html download disney ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/truqlw.html discount hoodia] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/pgtlkc.html xenical online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/sowlrt.html free latin ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/wvikog.html buy celebrex] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/rafaoj.html buy effexor] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/cjtbia.html rock ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/wbaatb.html tracfone ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/umnhvv.html buy amitriptyline] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/nrvtut.html buy vicodin] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ilaggr.html lipitor online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/xjrdft.html wwe ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/exljxg.html cheap synthroid] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ibetmk.html buy hoodia] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ijaobr.html free animal ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/bimcpg.html cheap lotrel] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/cwgbtp.html discount vicodin] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/bpiicf.html punk ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/happmi.html actos] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/fvmagr.html free ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/kaucom.html buy celexa] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/nbxcnt.html buy cialis] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/bpsnaf.html talking ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ixqjgs.html actos online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ntftnw.html hindi ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/xjhhut.html buy cyclobenzaprine] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/fdcwla.html buy vigrx] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/lgeqhn.html free talking ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/cciwqi.html rock ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ujugsk.html order celexa] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/xrlqcg.html download music ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ldxnvd.html cheap pharmacy online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ofsjqg.html buy ambien] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/plovoi.html ephedrine online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/liiwdg.html mp3 ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/grivig.html order albuterol] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/rxmpad.html free rave ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/sqqccl.html cellphone ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/dpvpre.html buy vardenafil] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/dlnfaa.html cheap wellbutrin] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/mcrieb.html cheap zocor] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/tlkusv.html discount norco] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/whqvcb.html cheap klonopin] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ugfnpx.html cricket ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/brsxca.html download free ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/kikxvk.html download real ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ciwacj.html free voice ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ntvhge.html cheap atenolol] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/cccmrh.html cheap zovirax] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/wappmr.html order sildenafil] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/mewmpp.html cyclobenzaprine] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/josacb.html amitriptyline online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/wicfee.html download christian ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/skkjer.html cheap zithromax] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/dnvokf.html cheap lortab] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/erudlu.html buy diflucan] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/iujlih.html order codeine] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/teblxv.html download caller ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/bbjrcn.html caller ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/htlcsu.html diflucan online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/xfgipg.html verizon ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/fndlar.html clomid] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/lwipsc.html cheap didrex] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ctnxue.html order vigrx] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ubenue.html ultram online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/njvjpr.html downloadable ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/lhbqlw.html vocal ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/akffuo.html discount hydrocodone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/gocbkc.html cheap ultram] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/hdnqam.html darvon online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/wgwxli.html zovirax online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/vsnxqv.html diazepam online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/idqbio.html cellular ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/lxlcvk.html free alcatel ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/rvrxdp.html humour ringtone] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/xsfwmt.html dianabol online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/ubmpws.html discount hgh] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/pqlhdn.html synthroid online] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/jjeipb.html free tmobile ringtones] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/uqtttj.html discount codeine] [http://www.loyno.edu/~gcnfj/UserFiles/File/tmp/bmajpb.html sexy ringtone]
{{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