SsimnJS Docs

Board data

Title, columns, value formats, ranking and entries of a board.

A board is a component that implements leaderboard_source, added next to leaderboard_panel_component. Its GetBoard method returns a leaderboard_board.

top_builders_board.verse
using { /Verse.org/SceneGraph }
using { LeaderboardPanel }

top_builders_board<public> := class<final_super>(component, leaderboard_source):
    GetBoard<override>()<transacts>:leaderboard_board = leaderboard_board:
        Title := "TOP BUILDERS"
        Subtitle := "ALL TIME"
        Columns := array:
            leaderboard_column{Title := "BLOCKS", Format := leaderboard_format.Compact}
            leaderboard_column{Title := "BEST TIME", Format := leaderboard_format.Time}
        RankBy := 1
        HighestFirst := true
        Entries := array:
            leaderboard_entry{Name := "simnJS", Values := array{125000.0, 83.4}}
            leaderboard_entry{Name := "NovaRush", Values := array{98000.0, 91.2}}

leaderboard_board

FieldDefaultDescription
Title"LEADERBOARD"Title of the panel.
Subtitle""Shown above the title. Optional.
NameTitle"PLAYER"Header of the name column.
ColumnsemptyUp to 4 value columns. Place the WBP_Leaderboard_* variant with as many stats.
EntriesemptyThe rows of the board, in any order.
RankBy1Column (1 to 4) that ranks the entries. 0 keeps the order of Entries.
HighestFirsttruetrue: the highest value comes first (points). false: the lowest comes first (times).
MaxEntries0Shows only the best N entries. 0 shows them all.

leaderboard_column

FieldDefaultDescription
Title""Header of the column.
FormatIntegerHow its values are written. See below.
Prefix""Added before the value, for example "$".
Suffix""Added after the value, for example " pts".

leaderboard_entry

FieldDefaultDescription
Name""The name shown in the row.
ValuesemptyOne value per column, in the order of Columns.

An entry without a value for a column shows - in that cell.

Value formats

leaderboard_format sets how a column writes its values. Examples in the English number style.

FormatValueShown
Integer12500.012,500
Decimal12500.7512,500.75
Compact12500.0 / 3400000.012.5K / 3.40M (three significant digits: K, M, B, T…)
Time65.32 (seconds)1:05.32, or 1:02:05 from one hour
Percent87.587.5% (at most one decimal)

The number style is a setting of leaderboard_panel_component (NumberStyle):

StyleExample
English12,500.5
French12 500,5
German12.500,5
Plain12500.5

Ranking

  • Entries are sorted on the RankBy column: highest first, or lowest first with HighestFirst := false.
  • Equal values share a rank, and the next rank skips: 1, 2, 2, 4.
  • Entries without a value in the ranking column come last.
  • With RankBy := 0, entries keep your order and are numbered 1, 2, 3…
  • The first three ranks get the podium colours.

Verse reference

leaderboard_source<public> := interface:
    GetBoard<public>()<transacts>:leaderboard_board

leaderboard_format<public> := enum{Integer, Decimal, Compact, Time, Percent}
leaderboard_number_style<public> := enum{English, French, German, Plain}

# The text of a value, as the panel writes it.
FormatLeaderboardValue<public>(Value:float, Column:leaderboard_column, Style:leaderboard_number_style)<transacts>:string

On leaderboard_panel_component, PageCount() returns the number of pages of the board, with the current rows per page.

On this page