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
 
(60 intermediate revisions by 36 users not shown)
Line 1: Line 1:
[http://www.olemissfans.com/chatpro/image/henvsq.html tibia light] [http://www.olemissfans.com/chatpro/image/stnouh.html i want to make love to you lyrics] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/itbkbo.html discount ephedrine] [http://ndr.hu/rhodes/gpfikd.html project mend] [http://aura.c3.hu/thumb/xmkxsv.html 3.3 dos ms] [http://kom-pas.de/3xcms/config/hkatuploads/images/orviam.html email notifier] [http://kristinlyseggen.com/gallery/1documentaries/7travel/wquplq.html mighty max download] [http://kom-pas.de/3xcms/config/hkatuploads/images/ughdgm.html accounting jersey job new] [http://activeimage.c3.hu/css/qafmau.html resident evil 0 cheat codes] [http://activeimage.c3.hu/css/uuxgrq.html why buy a franchise] [http://www.easypayinfo.com/subscribe/tmp/ejcrao.html vacation rental homes orlando florida] [http://maps.my2gig.com/cache/gldluo.html o douglas author anna] [http://kom-pas.de/3xcms/config/hkatuploads/images/jkjami.html asian box decorative] [http://activeimage.c3.hu/css/moxrki.html latitude 38 classified] [http://www.olemissfans.com/chatpro/image/pbsocg.html ejaculation free premature] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/lbsbhn.html buy adipex] [http://activeimage.c3.hu/css/nnwpld.html substance abuse treatment videos] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/pmabsw.html anxiety depression drug] [http://aura.c3.hu/thumb/bipmqn.html uhf television frequency] [http://www.easypayinfo.com/subscribe/tmp/iotdee.html weekend phd program] [http://troniny.ovh.org/gallery/layout/qajepm.html americas development] [http://www.stillwaterhomes.com/listings/images/pic/lbvvtc.html walking around] [http://www.stillwaterhomes.com/listings/images/pic/xgglab.html anniversary him present] [http://maps.my2gig.com/cache/cadrpn.html 2 storey house plan] [http://www.stillwaterhomes.com/listings/images/pic/opfxmq.html monterey heights san francisco] [http://www.housing.und.edu/reshalls/blog/wp-content/uploads/2007/04/img/bpaioa.html nextel ringtones] [http://ndr.hu/rhodes/eaigkq.html market america greensboro] [http://www.plurpage.com/classifieds/cache/vnbjum.html mid fifty ford] [http://www.olemissfans.com/chatpro/image/wbpidr.html simple souls] [http://kristinlyseggen.com/gallery/1documentaries/7travel/lncnaf.html open ended sales] [http://www.easypayinfo.com/subscribe/tmp/damqam.html preschool christmas party] [http://kom-pas.de/3xcms/config/hkatuploads/images/sugxps.html slim down diet] [http://aura.c3.hu/thumb/uipicm.html packaged sewage treatment plant] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/kmvqan.html interview reason for leaving] [http://www.olemissfans.com/chatpro/image/juvoxc.html pregnancy gender charts] [http://troniny.ovh.org/gallery/layout/vkexvp.html most important computer components] [http://www.stillwaterhomes.com/listings/images/pic/tcpuqi.html used atvs in pa] [http://www.stillwaterhomes.com/listings/images/pic/ennmbb.html employer benefit services] [http://informer.siam.edu/themes/hm/jxsqsr.html download metal ringtones] [http://activeimage.c3.hu/css/xcnirt.html laptop intergrated wireless adapter xp] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/npcqev.html ip address location software] [http://troniny.ovh.org/gallery/layout/dibrek.html i hope you dance music] [http://www.systemsupport.und.edu/cache/avatars/emo/olndgi.html i m your lady and you re my man] [http://kom-pas.de/3xcms/config/hkatuploads/images/aikiwj.html african dance lessons] [http://www.lowell.edu/styles/old_style/css/ecrrpj.html jazz guitar setup] [http://www.plurpage.com/classifieds/cache/wfggdp.html new look jeans] [http://aura.c3.hu/thumb/crbcoe.html austin music hall map] [http://2001.c3.hu/mas/qxaogf.html virtual servers] [http://www.plurpage.com/classifieds/cache/atkrkw.html easy cash payday loan] [http://www.stillwaterhomes.com/listings/images/pic/htlhjd.html transformation in mathematics] [http://kristinlyseggen.com/gallery/1documentaries/7travel/cibicv.html pto organization] [http://2001.c3.hu/mas/lvmuet.html 18 club in older] [http://www.stillwaterhomes.com/listings/images/pic/piflgo.html pay per use software] [http://maps.my2gig.com/cache/xdpkpi.html silver chains mens] [http://aura.c3.hu/thumb/lsrxqg.html korean nursery] [http://www.salona-yachts.eu/misc/iekhea.html korea hotel cheap] [http://informer.siam.edu/themes/hm/xkwack.html levitra] [http://www.plurpage.com/classifieds/cache/xsohvg.html mobile n73 nokia phone] [http://aura.c3.hu/thumb/rbiots.html ac led circuit] [http://www.stillwaterhomes.com/listings/images/pic/kwdrxf.html on the internet nobody knows you re a dog] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/gumrjw.html proctor gamble corporation] [http://aura.c3.hu/thumb/ejctvh.html java formatted output] [http://www.easypayinfo.com/subscribe/tmp/mnanmd.html 4 code music myspace u video] [http://activeimage.c3.hu/css/fuilmr.html off switch] [http://ndr.hu/rhodes/smujxj.html warcraft ii patch] [http://troniny.ovh.org/gallery/layout/qokvwo.html which version of iis] [http://kom-pas.de/3xcms/config/hkatuploads/images/geklgp.html asking letter sponsorship] [http://informer.siam.edu/themes/hm/mambis.html music ringtones] [http://maps.my2gig.com/cache/whbfjv.html we borrow it from our children] [http://maps.my2gig.com/cache/eseucx.html lyrics to what do you say] [http://kristinlyseggen.com/gallery/1documentaries/7travel/hosklr.html planar flat screens] [http://www.stillwaterhomes.com/listings/images/pic/vdsmai.html evisu sale] [http://www.stillwaterhomes.com/listings/images/pic/leckqc.html 2005 hurricane mail season] [http://kom-pas.de/3xcms/config/hkatuploads/images/wbxihm.html azz 4 day] [http://troniny.ovh.org/gallery/layout/jorfrc.html age discrimination lawsuit won] [http://www.olemissfans.com/chatpro/image/vomgoo.html attorney houston] [http://maps.my2gig.com/cache/mdmeqc.html verbal abuse in] [http://www.salona-yachts.eu/misc/lwdxjx.html the deviance] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/ieshxe.html linux crm system] [http://www.easypayinfo.com/subscribe/tmp/gblgjl.html she died with her boots on] [http://aura.c3.hu/thumb/aqxatf.html jim wilkinson bio] [http://www.stillwaterhomes.com/listings/images/pic/hkiagv.html outfit shopping] [http://www.plurpage.com/classifieds/cache/drdjbw.html plastic palm tree] [http://www.systemsupport.und.edu/cache/avatars/emo/jnmskb.html one stop automotive] [http://troniny.ovh.org/gallery/layout/hsrxxc.html register server in active directory] [http://kom-pas.de/3xcms/config/hkatuploads/images/riwtcg.html mail recovery pc] [http://www.easypayinfo.com/subscribe/tmp/wavxal.html animals wildlife] [http://2001.c3.hu/mas/bjnetf.html motivational speeches from movies] [http://www.stillwaterhomes.com/listings/images/pic/rtdubu.html state of the union issue] [http://www.systemsupport.und.edu/cache/avatars/emo/gsgslr.html may festival youth chorus] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/msqbuq.html pickup trucks in uk] [http://2001.c3.hu/mas/jfnptq.html mpeg to dvd download] [http://mkatzenbach.de/Website_MK_alt/content/cache/dir/end001/ptcqqo.html lyrics all things are possible] [http://maps.my2gig.com/cache/gnoaqr.html equal interval scale] [http://www.stillwaterhomes.com/listings/images/pic/stgqck.html out off touch] [http://kom-pas.de/3xcms/config/hkatuploads/images/rodwsv.html war destruction pictures] [http://kom-pas.de/3xcms/config/hkatuploads/images/lckdbp.html reflective safety materials] [http://www.plurpage.com/classifieds/cache/ndvaux.html incest sex movie clips] [http://www.stillwaterhomes.com/listings/images/pic/mlrdvt.html online education for indians] [http://activeimage.c3.hu/css/oukqoi.html macquarie group]
{{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