User Tools

Site Tools


placeholder_expression

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
placeholder_expression [2021/04/11 20:30] justinplaceholder_expression [2021/04/21 20:23] (current) justin
Line 2: Line 2:
 ---- ----
  
-**Placeholder expressions** provide a way to insert dynamic values into [[string|strings]] that will get evaluated at game runtime. Examples of supported values include entity properties, global properties, and arithmetical expressions. Placeholder expressions are currently only supported by the [[Display Message]] function.+**Placeholder expressions** provide a way to insert dynamic values into [[string|strings]] that will get evaluated at game runtime for displaying to the player or printing to the [[developer console]]. Generally, any sort of expression that can be stored into a variable can also be used in a placeholder expression.
  
 <WRAP center round info 100%> <WRAP center round info 100%>
-Since placeholder expressions are parsed at game time, they should be used sparingly to avoid potential slowdowns or hesitations during the execution of a [[script]]. When possible, it'recommended to store the expression into a variable and then use [[string|string concatenation]] to generate the desired [[string]].+Since placeholder expressions are parsed during a [[script|script's]] execution, they should be used sparingly to avoid potential slowdowns or hesitations. When possible, it'best to first store the expression into a variable and then use [[string|string concatenation]] to generate the desired [[string]].
 </WRAP> </WRAP>
  
Line 18: Line 18:
 ====Example:==== ====Example:====
 <code bauxite> <code bauxite>
-display_message("The value of property ABC is ${global.property[\"ABC\"]}")+display_message("The value of property ABC is ${global.property[\"ABC\"]}");
 </code> </code>
  
 ~~NOTOC~~ ~~NOTOC~~
placeholder_expression.1618198234.txt.gz · Last modified: 2021/04/11 20:30 by justin