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 42: | Line 40: | ||
|> >= < <= == != | |> >= < <= == != | ||
|comparison operators | |comparison operators | ||
| | |7 > 3 | ||
|- | |- | ||
|() | |() | ||
Line 62: | Line 60: | ||
|>> << | |>> << | ||
|right bit shift, left bit shift | |right bit shift, left bit shift | ||
| | | | ||
|} | |} | ||
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 | ||
== Functions == | == Functions == | ||
Line 87: | Line 71: | ||
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> | ||
Line 163: | Line 130: | ||
find( haystack, needle ) | find( haystack, needle ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Entity === | |||
<syntaxhighlight> | |||
playeratindex( index ) | |||
entityindex( entity ) | |||
playeritematslot( entity, slot ) | |||
attribute( player or item, attribute name ) | |||
</syntaxhighlight> |