Documentation/heavyspleef 2.0/layout-scripting

HeavySpleef Logo

MainSetupCommandsDev buildsChangelogRequirementsVideosFAQ

Layout Scripting

HeavySpleef 2.0 introduces a new mechanism which lets the user decide how signs look ingame. If you want to customize the signs shown by HeavySpleef this article might be for you.

Sign layouts are stored in YAML form under the directory /plugins/HeavySpleef/layout. You will find six files covering all signs which are available in HeavySpleef.

After you opened the file for the sign you want to edit you probably find a YAML structure like this:

1
2
3
4
5
layout:
  1: "First line text"
  2: "Second line text"
  3: "Third line text"
  4: "Fourth line text"

You can insert the text you want but there are special placeholders available which are covered in the next step.

Variables

In the most cases there are always variables available which will be replaced by their value when ingame. A variable holder always has the following syntax:

$[<name>]

All available variables for the current sign are described in top comment.

If Statements

If you want to add something dynamic to your sign you should consider adding a if statement which can decide between two textual parts. If the condition is true, then string (text) 1 will be choosen, else string 2. The syntax of an if statement is the following:

{if (condition) then \"string_1\" else \"string_2\"}

Since we work with YAML, make sure to escape each quotation character (") with a backslash (\). You may use a simple boolean variable as a condition, but you are also allowed to compare numbers each other provided that both variables are numbers with <, >, <=, >= and ==. Strings may be compared by using the == operator.

Of course you can also use variables in strings. Here is an example of the sign layout for the information sign placed in a lobby wall:

1
2
3
4
5
6
7
8
9
layout:
  1: "&3$[name]"
  2: "$[localized_state]"
  3: "$[players]/&7$[dead]&r
  {
    if ($[has_flag:max-players]) then
      \"$[flag_value:max-players]\"
  }"
  4: "{if ($[is_countdown]) then \"Starting in $[countdown]\"}"