Date: 2023/09/10 05:19:42 UTC-07: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
# speaker:
# title (string)
# text (string)
# options:
# - text (string)
# click (task)
tickquests_create_dialogue_task:
type: task
definitions: d|loc
script:
- spawn tickquests_text_display <[loc]> save:text
- define text_entity <entry[text].spawned_entity>
- define title <[d.speaker.title]>
- define text <[d.speaker.text]>
- define lines <list>
# TITLE
- define lines:->:<[title]>
# TEXT
- define lines:->:<empty>
- define lines:->:<&[base]><[text]>
- define text <[lines].separated_by[<n>]>
- adjust <[text_entity]> text:<[text]>
- define line_width <[text_entity].line_width>
- define height <[text].split_lines_by_width[<[line_width]>].split[<n>].size>
# OPTIONS
- define lines:->:<empty>
- define option_lines <list>
- foreach <[d.options]> as:opt:
- define lines:->:<&[base]><[opt.text]>
- define option_line <[opt.text].split_lines_by_width[<[line_width]>].split[<n>].size>
- define option_lines:->:<[option_line]>
- announce "Option '<[opt.text]>' is at <[option_lines].sum.add[<[height]>]>."
- define text <[lines].separated_by[<n>]>
- adjust <[text_entity]> text:<[text]>
- flag <[text_entity]> dialogue:<[d]>
- flag <[text_entity]> option_lines:<[option_lines]>
- announce <[height]>
tickquests_text_display:
type: entity
entity_type: text_display
mechanisms:
background_color: black
pivot: center
display: left
scale: 0.7,0.7,0.7
line_width: 150
tickquests_sample_dialogue:
type: data
d:
speaker:
title: James
text: Hello, I'm <element[James].custom_color[emphasis]>. This is a sample dialogue.
options: <list[<map[text=Opt 1]>].include_single[<map[text=Opt 2]>]>