Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Beanshell performance health warning to Text Label trait #13737

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ The text of the label can be fixed or specifiable by a player at game time.
. Check if the entered label is a $$ Variable Substitution (defined by a string enclosed between $ characters). This allows <<Properties.adoc#top,Properties>> of the piece to be substituted with $..$ notation, as in a <<MessageFormat.adoc#top,Message Format>>
. If no check is true the entered string is displayed.

****
**Note!** _Label Text_ will be reevaluated every time a piece bearing the Text Label trait is drawn, which will occur frequently in a typical module whenever such a piece is on display. Therefore, longer, more convoluted Beanshell expressions (e.g., comparisons, arithmetic, Count/Sums etc.) may affect performance, especially with widespread use.
****

A known limitation of the evaluation order above is that if you enter a sequence of digits starting with 0s, these will be removed when the string is evaluated as integer.
A workaround to this is to enter the same string via a Beanshell expression. For example to display a sequence of 3 zeroes as label text you can use *{"000"}*.
Note that the Beanshell expressions should be preferred to $$ Variable Substitutions. The latter are only available for historical reasons.

By enclosing the text within tags, you can use simple HTML format to specify various colors, fonts and sizes.

Expand Down