Editing Expressions
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
You can use expressions as input parameter to reduce the amount of logic entities used. Expressions in input parameter start with $$= | You can use expressions as input parameter to reduce the amount of logic entities used. Expressions in input parameter start with $$= | ||
For example, using this as input parameter: $$='Health: ('..!activator.m_iHealth..'/'..!activator.m_iMaxHealth..')' will set health information as input parameter | For example, using this as input parameter: $$='Health: ('..!activator.m_iHealth..'/'..!activator.m_iMaxHealth..')' will set health information as input parameter | ||
Expressions are calculated during input execution. | Expressions are calculated during input execution . | ||
Do not put double quote | Do not put double quote " inside expression, but you are allowed to use comma , . | ||
== Syntax == | == Syntax == | ||
Line 29: | Line 27: | ||
|- | |- | ||
|entityname.variable | |entityname.variable | ||
|access entity | |access entity sendprop, datamap, or custom variable | ||
|!activator.m_iHealth + 41 | |!activator.m_iHealth + 41 | ||
|- | |- | ||
Line 78: | Line 76: | ||
Values are automatically converted when types of left and right sides of operators differ. | Values are automatically converted when types of left and right sides of operators differ. | ||
For example, [1 4 5] + 4 will automatically convert 4 to [4 4 4] vector | For example, [1 4 5] + 4 will automatically convert 4 to [4 4 4] vector | ||
\' escapes single quotes inside literal string | \' escapes single quotes inside literal string | ||
== Functions == | == Functions == | ||
Line 87: | Line 85: | ||
test( test expression, if true, if false ) | test( test expression, if true, if false ) | ||
?( test expression, if true, if false ) | ?( test expression, if true, if false ) | ||
exists( value ) | exists( value ) | ||
not( value ) | not( value ) | ||
!( value ) | !( value ) | ||
~( value ) | ~( value ) | ||
case( test value, default, case1 ) | |||
case( test value, default, case1 | |||
type( value ) | type( value ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Entity === | === Entity === | ||
<syntaxhighlight | <syntaxhighlight> | ||
playeratindex( index ) | playeratindex( index ) | ||
entityindex( entity ) | entityindex( entity ) | ||
playeritematslot( entity, slot ) | playeritematslot( entity, slot ) | ||
attribute( player or item, | attribute( player or item, attribute name ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 163: | Line 152: | ||
find( haystack, needle ) | find( haystack, needle ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||