Date: 2025/11/08 10:19:35 UTC-08:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
cmd_fixitem:
type: command
name: fixitem
debug: false
usage: /fixitem
description: Debug for text centering.
script:
- if <player.item_in_hand> MATCHES air:
- narrate "<&c>You need an item."
- stop
- inventory adjust slot:<player.held_item_slot> d:<player.inventory> lore:<proc[lore_fancy]>
- 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 <list>
- define these <list>
# 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 <list[<[last_clr]><[line]>]>
- if <[loop_index]> == <[text_lines].size>:
- define final:->:<[these].separated_by[<&sp>]>
- 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:
colors:
- <&gradient[from=<&c>;to=<&6>]>
- <&gradient[from=<&b>;to=<&3>]>
- <&gradient[from=<&a>;to=<&2>]>
- <&gradient[from=<&d>;to=<&5>]>
- <&gradient[from=<&c>;to=<&4>]>
- <&gradient[from=<&9>;to=<&b>]>
- <&gradient[from=<&7>;to=<&f>]>
- <&gradient[from=<&e>;to=<&6>]>
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><strikethrough><&sp.repeat[40]>
- define width <[border].text_width>
- define text <script.parsed_key[data.colors].random><bold><script.data_key[data.center_text].random>
- define list:->:<[border]>
- define list:->:<[border].text_width.proc[util_center_text].context[<[text]>]>
- define list:->:<[border]>
- define text2 <&6><script.data_key[data.lore_text].random>
- define list:->:<[width].proc[util_clamp_text].context[<[text2]>]>
- determine <[list]>