cmd_fixitem: type: command name: fixitem debug: false usage: /fixitem description: Debug for text centering. script: - if MATCHES air: - narrate "<&c>You need an item." - stop - inventory adjust slot: d: lore: - narrate "<&a>Jobs done." util_center_text: type: procedure debug: false definitions: width|text script: - define n_width <[width].sub[<[text].text_width>].round_down> # Spaces worth 4 width - define space <&sp.repeat[<[n_width].div[4].div[2]>]> - determine <[space]><[text]><[space]> util_clamp_text: type: procedure debug: false definitions: width|text script: - define text_lines <[text].split[<&sp>]> - define final - define these # We have to do this because element.split_lines_by_width doesn't preserve color. - foreach <[text_lines]> as:line: - if <[these].include[<[line]>].separated_by[<&sp>].text_width> > <[width]>: - define last_clr <[these].unseparated.last_color> - define final:->:<[these].separated_by[<&sp>]> - define these <[line]>]> - foreach next - define these:->:<[line]> - if <[loop_index]> == <[text_lines].size>: - define final:->:<[these].separated_by[<&sp>]> - foreach stop - determine <[final].separated_by[<&nl>]> lore_fancy: type: procedure debug: false data: center_text: - Central Information - Apex of Item Info - Pillar of Item Stuff - An Item's Horizon - Lanky Long Text - Lexicon of Information lore_text: - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. script: - define border <&7><&sp.repeat[40]> - define width <[border].text_width> - define text <&a> - define list:->:<[border]> - define list:->:<[border].text_width.proc[util_center_text].context[<[text]>]> - define list:->:<[border]> - define text2 <&6> - define list:->:<[width].proc[util_clamp_text].context[<[text2]>]> - determine <[list]>