Paste #64695: Holograms by Berufeng

Date: 2020/01/29 16:45:33 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545


## Created by Berufeng

## Version 1.0.2

## A system for creating, editing, and moving single-
## or multi-line holograms. Create floating signs,
## colorful holographic images, and more!

## User-friendly commands and extensive help options
## make it easy to jump right in and get started.


HologramSymbolProcedure:
    ## This list enables some special characters to be used with shortcuts
    ## This procedure is only called under the Holograms_Setline task
    type: procedure
    script:
        - determine <[1].replace[<&lb>x<&rb>].with[<&chr[2588]>].replace[<&lb>/<&rb>].with[<&chr[258C]>].replace[<&lb><&dot><&rb>].with[<&chr[2591]>].replace[<&lb><&dot><&dot><&rb>].with[<&chr[2592]>].replace[<&lb><&dot><&dot><&dot><&rb>].with[<&chr[2593]>].replace[<&lb>p<&rb>].with[<&chr[2022]>].replace[<&lb><&pipe><&rb>].with[<&chr[2389]>].replace[<&lb>hrt<&rb>].with[<&hrt>]>

SelectedHologramReset:
    ## Resets your selected hologram whenever you log out, to prevent confusion.
    type: world
    debug: false
    events:
        on player quits:
            - flag player selectedhologram:!

HologramInvulnerability:
    ## Prevents players from damaging or placing armor on the holograms (they're invisible armor stands)
    type: world
    debug: false
    events:
        on player right clicks at ARMOR_STAND:
            - if <context.entity.has_flag[is_hologram]>:
                - determine cancelled
        on entity damages ARMOR_STAND:
            - if <context.entity.has_flag[is_hologram]>:
                - determine cancelled

Holograms_Help:
    type: task
    debug: false
    help:
        ## If player types /h help help they get this message.
        - narrate "<&3>Let's not get silly."
        - stop
    script:
        ## If player types /h help, checks the second argument and reroutes.
        - choose <[arg2]>:
            - case help:
                - inject <script[Holograms_Help]> path:help
            - case create new add addnew c:
                - inject <script[Holograms_Create]> path:help
            - case remove rem r delete del:
                - inject <script[Holograms_Remove]> path:help
            - case movehere tphere:
                - inject <script[Holograms_Movehere]> path:help
            - case tpto move moveto tp:
                - inject <script[Holograms_Tpto]> path:help
            - case select sel s:
                - inject <script[Holograms_Select]> path:help
            - case setline set addline adjust edit:
                - inject <script[Holograms_Setline]> path:help
            ## If argument 2 is empty or unrecognized, shows the help commands list.
            - default:
                - narrate " "
                - narrate "<&9><&l>----------Holograms Commands----------"
                - narrate " "
                - narrate "<&b>/h create <&lt>hologram_name<&gt>"
                - narrate "<&b>/h remove <&lt>hologram_name<&gt>"
                - narrate "<&b>/h movehere <&lt>hologram_name<&gt>"
                - narrate "<&b>/h move <&lt>hologram_name1<&gt> <&lt>hologram_name2<&gt>"
                - narrate "<&b>/h select <&lt>hologram_name<&gt>"
                - narrate "<&b>/h setline <&lt>hologram_name<&gt> <&lt>#<&gt> <&lt>Your text here<&gt>"
                - narrate "<&b>/h list"
                - narrate " "
                - narrate "<&8>(Hint: Add '<&b>help<&8>' after any of the above commands for more info!)"
                - stop

Holograms_Create:
    ## Aliases: create, add, addnew, c
    type: task
    debug: false
    help:
        ## What is displayed when player types '/h help create' or '/h create help'.
        - narrate " "
        - narrate "<&9><&l>----------Holograms '<&b><&l>Create<&9><&l>' Help----------"
        - narrate " "
        - narrate "<&3>    Used for creating a new hologram. You must specify"
        - narrate "<&3>    the name you wish to give your new hologram."
        - narrate " "
        - narrate "<&9>Aliases: <&b>/h create<&3>, <&b>/h add<&3>, <&b>/h addnew<&3>, or <&b>/h c"
        - narrate "<&9>Usage: <&b>/h create <&lt>hologram_name<&gt> <&8>(here/there/<&lt>hologram<&gt>)"
        - narrate " "
        - narrate "<&3>    Creates a hologram <&8>(optionally: at <&2>your location<&8>,"
        - narrate "<&8>    your <&2>cursor location<&8>, or at the location of <&2><&lt>hologram<&gt><&8>)."
        - narrate " "
    script:
        ## Prevents names that contain characters other than alphanumeric, hyphen, and underscore.
        - if <[arg2].matches[^[a-zA-Z0-9_-]+$].not>:
            - narrate "<&4>Invalid argument! Hologram names can only include alphanumeric characters, hyphens, and underscores."
            - stop
        - if <[arg2].is[matches].to[number]>:
            - narrate "<&4>Numeric names are not allowed. Please include at least one letter (a-z) in your hologram name."
            - stop
        - choose <[arg3]>:
            ## Allows a third argument for the new hologram's location.
            - case null:
                - define createlocation <player.location.sub[0.0,1.25,0.0]>
            - case here:
                - define createlocation <player.location.sub[0.0,1.25,0.0]>
            - case there:
                - define createlocation <player.cursor_on.sub[-0.5,1.25,-0.5]>
            - default:
                - if <[arg3].contains[<&cm>]>:
                    - define createlocation <[arg3].as_location||null>
                    - if <[createlocation].is[==].to[null]>:
                        - narrate "<&4>Invalid location specified. Correct format:<&nl><&c>    l<&at>x,y,z,world"
                        - stop
                - else if <server.flag[myholograms].contains[<[arg3]>]||false>:
                    - define createlocation <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<[arg3]>]].get[1].location>
                - else:
                    - narrate "<&4>Invalid arguments. Usage:<&nl>/h <[arg1]||create> <&lt>hologram_name<&gt> (here/there/<&lt>hologram_name<&gt>)<&nl> - /h <[arg1]||create> help"
                    - stop
        - choose <[arg2]>:
            - case null:
                - narrate "<&4>What do you want to name it? Usage:<&nl> - /h <[arg1]||create> <&lt>hologram_name<&gt><&nl> - /h <[arg1]||create> help"
                - stop
            - case all:
                - narrate "<&4>Oops! You can't name your hologram '<&b><[arg2]><&4>'! If you want it to display '<[arg2]>' you can create it with a different name and then edit the text with /h edit."
                - stop
            - default:
                - if <server.flag[myholograms].contains[<[arg2]>]||false>:
                    - narrate "<&4>A hologram named '<[arg2]>' already exists."
                    - stop
                - else:
                    ## Creates the new hologram at the proper location.
                    - narrate "<&3>Created hologram '<&b><[arg2]><&3>'."
                    - flag server myholograms:->:<[arg2]>
                    - flag player selectedhologram:<[arg2]>
                    - spawn ARMOR_STAND[custom_name=<[arg2]>;custom_name_visibility=true;gravity=false] <[createlocation]> save:newhologram
                    - invisible <entry[newhologram].spawned_entities.get[1]> state:true
                    - flag <entry[newhologram].spawned_entities.get[1]> is_hologram
                    - flag <entry[newhologram].spawned_entities.get[1]> holoname:<[arg2]>
                    - flag server hologram_entities:->:<entry[newhologram].spawned_entities.get[1]>
                    - stop

Holograms_Remove:
    ## Aliases: remove, rem, r, delete, del
    type: task
    debug: false
    help:
        ## What is displayed when player types '/h help remove' or '/h remove help'.
        - narrate " "
        - narrate "<&9><&l>----------Holograms '<&b><&l>Remove<&9><&l>' Help----------"
        - narrate " "
        - narrate "<&3>    Used for removing holograms. Specify a hologram"
        - narrate "<&3>    or '<&b>all<&3>' to remove ALL existing holograms<&8>*<&3>."
        - narrate " "
        - narrate "<&9>Aliases: <&b>/h remove<&3>, <&b>/h rem<&3>, <&b>/h r<&3>, <&b>/h delete<&3>, or <&b>/h del"
        - narrate "<&9>Usage: <&b>/h remove <&3><&lb><&b><&lt>hologram_name<&gt><&3>/<&b>all<&8>*<&3><&rb>"
        - narrate " "
        - narrate "<&3>    Deletes the specified hologram, or ALL holograms<&8>*<&3>. If no"
        - narrate "<&3>    hologram is specified, defaults to your selected hologram."
        - narrate " "
        - narrate "<&8>  *requires confirmation"
        - narrate " "
    confirmation:
        ## Requires player to confirm a 'remove all' attempt.
        - if <player.has_flag[holograms_removeall_attempt].not||true>:
            - flag player holograms_removeall_attempt
            - narrate " "
            - narrate "<&4><&lb>WARNING:<&rb> Are you SURE you want to remove all <&c><server.flag[hologram_entities].size><&4> holograms?"
            - wait 1s
            - narrate "<&4>Type the command '<&c>/h <[arg1]> all<&4>' again to confirm."
            - narrate " "
            - stop
        - else:
            - flag player holograms_removeall_attempt:!
    script:
        - if <[arg2].is[==].to[null]>:
            - define removearg <player.flag[selectedhologram]>
        - else:
            - define removearg <[arg2]>
        - choose <[removearg]||null>:
            - case all:
                - choose <server.flag[hologram_entities].size>:
                    ## Responds differently depending on how many holograms are being removed with '/h remove all'.
                    - case 0:
                        - narrate "<&4>No holograms to remove!"
                        - stop
                    - case 1:
                        - inject locally confirmation
                        - narrate "<&3>Removed <&b>1<&3> hologram!"
                    - default:
                        - inject locally confirmation
                        - narrate "<&3>Removed all <&b><server.flag[hologram_entities].size><&3> holograms!"
                - remove <server.flag[hologram_entities].as_list>
                - remove <server.flag[subordinate_holograms].as_list>
                - flag player selectedhologram:!
                - flag server myholograms:!
                - flag server hologram_entities:!
                - flag server subordinate_holograms:!
                - stop
            - case null:
                - narrate "<&4>Remove which one? Usage:<&nl> - /h <[arg1]||remove> <&lt>hologram_name<&gt><&nl> - /h <[arg1]||remove> help"
            - default:
                ## Deletes the specified hologram.
                - define removinghologram <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<[removearg]>]].get[1]>
                - define removingsubordinates <server.flag[subordinate_holograms].as_list.filter[flag[parent].is[==].to[<[removearg]>]].as_list>
                - if <server.flag[myholograms].contains[<[removearg]>].not||true>:
                    - narrate "<&4>There is no hologram named '<[removearg]>'. <&nl>You can create a hologram with '/h create <&lt>hologram_name<&gt>'."
                    - stop
                - else:
                    - narrate "<&3>Removed hologram '<&b><[removearg]><&3>'."
                    - if <[removearg].is[==].to[<player.flag[selectedhologram]>]||false>:
                        - flag player selectedhologram:!
                    - flag server myholograms:<-:<[removearg]>
                    - flag server hologram_entities:<-:<[removinghologram]>
                    - define removesubordinatelist <server.flag[subordinate_holograms].as_list.exclude[<[removingsubordinates]>]>
                    - flag server subordinate_holograms:!
                    - flag server subordinate_holograms:|:<[removesubordinatelist]>
                    - remove <[removinghologram]>
                    - remove <[removingsubordinates]>
                    - stop

Holograms_Movehere:
    type: task
    debug: false
    help:
        - narrate " "
        - narrate "<&9><&l>----------Holograms '<&b><&l>Movehere<&9><&l>' Help----------"
        - narrate " "
        - narrate "<&3>    Teleports a hologram to your current location. If no"
        - narrate "<&3>    hologram is specified, defaults to your selected hologram."
        - narrate " "
        - narrate "<&9>Aliases: <&b>/h movehere<&3> or <&b>/h tphere"
        - narrate "<&9>Usage: <&b>/h movehere <&8>(<&3><&lt>hologram_name<&gt><&8>)"
        - narrate " "
        - narrate "<&8>See also: the <&3>move<&8> command. Type '<&3>/h move help<&8>'"
        - narrate "<&8>for more info."
        - narrate " "
    script:
        - if <[arg2].is[==].to[null]||true>:
            - define movearg <player.flag[selectedhologram]>
        - else:
            - define movearg <[arg2]>
        - choose <[movearg]||null>:
            - case null:
                - narrate "<&4>Which one do you want to move? Usage:<&nl> - /h <[arg1]||movehere> <&lt>hologram_name<&gt><&nl> - /h <[arg1]||movehere> help"
            - default:
                - define movinghologram <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<[movearg]>]].get[1]>
                - if <server.flag[myholograms].contains[<[movearg]>].not||true>:
                    - narrate "<&4>There is no hologram named '<[movearg]>'. <&nl>You can create a hologram with '/h create <&lt>hologram_name<&gt>'."
                    - stop
                - else:
                    - define movingsubordinates <server.flag[subordinate_holograms].as_list.filter[flag[parent].is[==].to[<[movearg]>]]||null>
                    - narrate "<&3>Moved hologram '<&b><[movearg]><&3>' to your location."
                    - teleport <[movinghologram]> <player.location.sub[0.0,1.25,0.0]>
                    - if <[movingsubordinates].is[==].to[null].not||false>:
                        - foreach <[movingsubordinates].as_list>:
                            - teleport <[value]> <player.location.sub[0.0,1.25,0.0].sub[0.0,<[value].flag[offset]>,0.0]>

Holograms_Tpto:
    type: task
    debug: false
    help:
        - narrate " "
        - narrate "<&9><&l>----------Holograms '<&b><&l>Move<&9><&l>' Help----------"
        - narrate " "
        - narrate "<&3>    Teleports holograms around."
        - narrate " "
        - narrate "<&9>Aliases: <&b>/h move<&3>, <&b>/h moveto<&3>, <&b>/h tpto<&3>, or <&b>/h tp"
        - narrate "<&9>Usage: <&b>/h move <&3><&lt>hologram_name1<&gt> <&3><&lb><&b><&lt>hologram_name2<&gt><&8>/here/there<&3><&rb>"
        - narrate " "
        - narrate "<&3>    Teleports the specified hologram to <&2>another hologram"
        - narrate "<&3>    or to <&2>your location<&3>, or to your <&2>cursor location<&3>."
        - narrate " "
    script:
        - choose <[arg2]>:
            - case null:
                - narrate "<&4>You didn't specify which holograms! Usage:<&nl> - /h <[arg1]||move> <&lt>hologram_name1<&gt> <&lt>hologram_name2<&gt>"
                - stop
            - default:
                - if <server.flag[myholograms].contains[<[arg2]>]||false>:
                    - define tp1 <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<[arg2]>]].get[1]>
                    - define tptosubordinates <server.flag[subordinate_holograms].as_list.filter[flag[parent].is[==].to[<[arg2]>]]||null>
                - else:
                    - narrate "<&4>Invalid arguments. There is no hologram named '<[arg2]>'."
                    - stop
        - choose <[arg3]>:
            - case null:
                - narrate "<&4>You didn't specify a second hologram! Usage:<&nl> - /h <[arg1]||move> <&lt>hologram_name1<&gt> <&lt>hologram_name2<&gt><&nl> - /h <[arg1]||move> help"
                - stop
            - case there:
                - define tp2 <player.cursor_on.sub[-0.5,1.25,-0.5]>
            - default:
                - if <[arg2].contains[<&cm>]>:
                    - define tp2 <[arg2].as_location||null>
                    - if <[tp2].is[==].to[null]||true>:
                        - narrate "<&4>Invalid location specified. Correct format:<&nl><&c>    l<&at>x,y,z,world"
                        - stop
                - else if <server.flag[myholograms].contains[<[arg3]>]||false>:
                    - define tp2 <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<[arg3]>]].get[1].location>
                - else:
                    - narrate "<&4>Invalid arguments. There is no hologram named '<[arg3]>'."
                    - stop
        - teleport <[tp1]> <[tp2]>
        - if <[tptosubordinates].is[==].to[null].not||false>:
            - foreach <[tptosubordinates].as_list>:
                - teleport <[value]> <[tp2].sub[0.0,<[value].flag[offset]>,0.0]>
        - if <[arg3].is[==].to[there]||false>:
            - narrate "<&3>Teleported hologram '<&b><[arg2]><&3>' to your <&b>cursor<&3> location."
        - else:
            - narrate "<&3>Teleported hologram '<&b><[arg2]><&3>' to hologram '<&b><[arg3]><&3>'."

Holograms_Select:
    type: task
    debug: false
    help:
        - narrate " "
        - narrate "<&9><&l>----------Holograms '<&b><&l>Select<&9><&l>' Help----------"
        - narrate " "
        - narrate "<&3>    Selects a hologram, to be used as a default in most hologram"
        - narrate "<&3>    commands. When you create a new hologram it is automatically"
        - narrate "<&3>    selected."
        - narrate " "
        - narrate "<&9>Aliases: <&b>/h select<&3>, <&b>/h sel<&3>, or <&b>/h s"
        - narrate "<&9>Usage: <&b>/h select <&lt>hologram_name<&gt>"
        - narrate "<&3>   or  <&b>/h select"
        - narrate " "
        - narrate "<&3>    Selects the specified existing hologram, or displays your"
        - narrate "<&3>    currently selected hologram."
        - narrate " "
    script:
        - if <[arg2].is[==].to[null]||true>:
            - define selectarg <player.flag[selectedhologram]>
            - if <[selectarg].is[==].to[null].not||false>:
                - narrate "<&3>You have '<&b><[selectarg]><&3>' selected."
                - stop
        - else:
            - define selectarg <[arg2]>
        - choose <[selectarg]>:
            - case null:
                - narrate "<&4>You don't have a hologram selected! Usage:<&nl> - /h <[arg1]||select> <&lt>hologram_name<&gt><&nl> - /h <[arg1]||select> help"
                - stop
            - default:
                - if <server.flag[myholograms].contains[<[selectarg]>].not||true>:
                    - narrate "<&4>There is no hologram named '<[arg2]>'. <&nl>You can create a hologram with '/h create <&lt>hologram_name<&gt>'."
                    - stop
                - else:
                    - if <player.flag[selectedhologram].is[==].to[<[selectarg]>]||false>:
                        - narrate "<&3>You already have that hologram selected!"
                        - stop
                    - else:
                        - narrate "<&3>Selected hologram '<&b><[selectarg]><&3>'."
                        - flag player selectedhologram:<[selectarg]>
                        - stop

Holograms_List:
    type: task
    debug: false
    help:
        - narrate " "
        - narrate "<&9><&l>----------Holograms '<&b><&l>List<&9><&l>' Help----------"
        - narrate " "
        - narrate "<&3>    Lists all existing holograms. Specify a page number"
        - narrate "<&3>    to display a different page. Defaults to last page."
        - narrate " "
        - narrate "<&9>Usage: <&b>/h list <&8><&lt>#<&gt>"
        - narrate " "
    script:
        - if <[arg2].is[==].to[help]>:
            - inject locally help
        - if <server.has_flag[myholograms].not||true>:
            - narrate "<&4>You don't have any holograms yet. <&nl>You can create a hologram with '/h create <&lt>hologram_name<&gt>'."
            - stop
        - if <[arg2].is[==].to[null]||false>:
            - define arg2 <server.flag[myholograms].size.div[12].round_up>
        - if <[arg2].is[matches].to[number].not||true>:
            - narrate "<&4>Invalid arguments. Usage: <&nl> - /h <[arg1]||list> <&lt>#<&gt>"
            - stop
        - else:
            - if <[arg2]> > <server.flag[myholograms].size.div[12].round_up>:
                - narrate "<&4>There aren't that many pages! Showing last page."
                - define listarg <server.flag[myholograms].size.div[12].round_up>
            - else:
                - define listarg <[arg2]>
        - define listmin <[listarg].sub[1].mul[12].add[1].as_int>
        - define listmax <[listarg].mul[12].as_int>
        - narrate "<&9><&l>----------Hologram List----------"
        - narrate "<&3>      Page <[listarg]> of <server.flag[myholograms].size.div[12].round_up>"
        - narrate " "
        - narrate "<&b><server.flag[myholograms].get[<[listmin]>].to[<[listmax]>].separated_by[<&3>, <&b>]>"
        - if <server.flag[myholograms].size.div[12].round_up> > <[listarg]>:
            - narrate " "
            - narrate "<&a>Type <&2>'/h list <[listarg].add[1]>'<&a> for more."
        - else:
            - narrate " "
            - narrate "<&3>...and that's it!"

Holograms_Setline:
    type: task
    debug: false
    help:
        - narrate " "
        - narrate "<&9><&l>----------Holograms '<&b><&l>Setline<&9><&l>' Help-----------"
        - narrate " "
        - narrate "<&3>    Sets the text displayed on your holograms. Supports"
        - narrate "<&3>    formatting and color codes, as well as a number of"
        - narrate "<&3>    special characters. You can set a virtually endless"
        - narrate "<&3>    number of lines, but you must add them one at a time."
        - narrate " "
        - narrate "<&9>Aliases: <&b>/h setline<&3>, <&b>/h addline<&3>, <&b>/h set<&3>, <&b>/h adjust<&3>, or <&b>/h edit"
        - narrate "<&9>Usage: <&b>/h setline <&lt>hologram_name<&gt> <&lt>#<&gt> <&lt>Your <&c><&o><&n>f<&6><&o><&n>o<&e><&o><&n>r<&a><&o><&n>m<&9><&o><&n>a<&b><&o><&n>t<&3><&o><&n>t<&5><&o><&n>e<&d><&o><&n>d<&r> <&b>text<&gt>"
        - narrate " "
        - narrate "<&8>If you don't specify a hologram, it will default to your"
        - narrate "<&8>selected hologram."
        - narrate " "
    script:
        - if <[arg2].is[==].to[null]||true>:
            - narrate "<&4>Not enough arguments. Usage: <&nl> - /h <[arg1]||setline> <&lt>hologram_name<&gt> <&lt>#<&gt> <&lt>Your text here<&gt><&nl> - /h <[arg1]||setline> help"
            - stop
        - else:
            - if <server.flag[myholograms].contains[<[arg2]>]||false>:
                - define setlinehologram <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<[arg2]>]].get[1]>
                - define setlinearg <[arg2]>
                - define linenumberarg <[arg3]>
                - define linecontents <proc[HologramSymbolProcedure].context[<context.args.get[4].to[9999].space_separated>].parse_color>
            - else if <[arg2].is[matches].to[number]||false>:
                - if <player.flag[selectedhologram].is[==].to[null]||true>:
                    - narrate "<&4>You must select a hologram or specify it in the command. Usage: <&nl>'/h select <&lt>hologram_name<&gt>' - '/h setline <&lt>#<&gt> <&lt>Your text here<&gt>'<&nl>-OR-<&nl>'/h setline <&lt>hologram_name<&gt> <&lt>#<&gt> <&lt>Your text here<&gt>'"
                    - stop
                - else:
                    - define setlinehologram <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<player.flag[selectedhologram]>]].get[1]>
                    - define setlinearg <[setlinehologram].flag[holoname]>
                    - define linenumberarg <[arg2]>
                    - define linecontents <proc[HologramSymbolProcedure].context[<context.args.get[3].to[9999].space_separated>].parse_color>
            - else:
                - narrate "<&4>There is no hologram named '<[arg2]>'. <&nl>You can create a hologram with '/h create <&lt>hologram_name<&gt>'."
                - stop
        - if <[linecontents].is[==].to[]||true>:
            - narrate "<&4>You must specify what info you want your hologram to display. Usage: <&nl> - /h <[arg1]||setline> <&lt>hologram_name<&gt> <&lt>#<&gt> <&lt>Your text here<&gt><&nl> - /h <[arg1]||setline> help"
            - stop
        - else:
            - inject Holograms_Addline
            - stop

Holograms_Addline:
    type: task
    debug: false
    script:
        - define totallines <server.flag[subordinate_holograms].as_list.filter[flag[parent].is[==].to[<[setlinearg]>]].as_list.size.add[1]||1>
        - define difference <[totallines].add[1].sub[<[linenumberarg]>].as_int>
        - define offset <[linenumberarg].sub[1].div[4.5]>
        - if <[difference]> < 0:
            - if <[totallines]> == <[linenumberarg].sub[2]>:
                - narrate "<&4>You can't edit that line yet! You must add line <[totallines].add[1].as_int> first!"
                - stop
            - else:
                - narrate "<&4>You can't edit that line yet! You must add lines <[totallines].add[1].as_int>-<[linenumberarg].sub[1].as_int> first!"
                - stop
        - else if <[difference]> >= 0:
            - if <[linenumberarg]> == 1:
                - define setlinesubordinate <server.flag[hologram_entities].as_list.filter[flag[holoname].is[==].to[<[setlinearg]>]].get[1]>
            - else:
                - define setlinesubordinate <server.flag[subordinate_holograms].as_list.filter[flag[parent].is[==].to[<[setlinearg]>]].get[<[linenumberarg].sub[1]>]>
            - if <server.flag[subordinate_holograms].as_list.contains[<[setlinesubordinate]>]> || <server.flag[hologram_entities].as_list.contains[<[setlinesubordinate]>]>:
                - adjust <[setlinesubordinate]> custom_name:<[linecontents]>
                - narrate "<&3>Set line <&b><[linenumberarg]><&3> of hologram '<&b><[setlinearg]><&3>' to '<&b><[linecontents]><&3>'."
            - else:
                - spawn ARMOR_STAND[custom_name=<[linecontents]>;custom_name_visibility=true;gravity=false] <[setlinehologram].location.sub[0.0,<[offset]>,0.0]> save:newhologram
                - flag <entry[newhologram].spawned_entities.get[1]> parent:<[setlinearg]>
                - flag <entry[newhologram].spawned_entities.get[1]> is_hologram
                - flag <entry[newhologram].spawned_entities.get[1]> offset:<[offset]>
                - invisible <entry[newhologram].spawned_entities.get[1]> state:true
                - flag server subordinate_holograms:->:<entry[newhologram].spawned_entities.get[1]>
                - narrate "<&3>Set line <&b><[linenumberarg]><&3> of hologram '<&b><[setlinearg]><&3>' to '<&b><[linecontents]><&3>'."

Holograms:
    type: command
    debug: false
    name: holograms
    usage: /holograms <&lt>arg1<&gt> <&lt>arg2<&gt>...
    aliases:
        - h
        - holo
        - hologram
    allowed help:
        - determine <player.is_op||<context.server>>
    description: Berufeng's Holograms script!
    tab complete:
        - if <player.is_op.not||<context.server>>:
            - stop
        - determine <list[create|remove|movehere|move|select|setline|help]>
    script:
        - if <player.is_op.not||<context.server>>:
            - narrate "<&4>You do not have permission to use that command."
            - stop
        - if <context.raw_args.is[==].to[]||false>:
            - narrate "<&3>'<&b>Holograms<&3>' by Berufeng. Type <&b>/h help <&3>for more info."
            - stop
        - define arg1 <context.args.get[1].escaped||null>
        - define arg2 <context.args.get[2].escaped||null>
        - define arg3 <context.args.get[3].escaped||null>
        - define arg4 <context.args.get[4].escaped||null>
        - choose <[arg2]>:
            - case help:
                - choose <[arg1]>:
                    - case help:
                        - inject <script[Holograms_Help]> path:help
                    - case create new add addnew c:
                        - inject <script[Holograms_Create]> path:help
                    - case remove rem r delete del:
                        - inject <script[Holograms_Remove]> path:help
                    - case movehere tphere:
                        - inject <script[Holograms_Movehere]> path:help
                    - case tpto move moveto tp:
                        - inject <script[Holograms_Tpto]> path:help
                    - case select sel s:
                        - inject <script[Holograms_Select]> path:help
                    - case setline set addline adjust edit:
                        - inject <script[Holograms_Setline]> path:help
                    - default:
                        - narrate "<&4>I'm sorry, I didn't understand your request for help. Type /h help for a list of commands."
            - default:
                - choose <[arg1]>:
                    - case help:
                        - inject Holograms_Help
                    - case create new add addnew c:
                        - inject Holograms_Create
                    - case remove rem r delete del:
                        - inject Holograms_Remove
                    - case movehere tphere:
                        - inject Holograms_Movehere
                    - case tpto move moveto tp:
                        - inject Holograms_Tpto
                    - case select sel s:
                        - inject Holograms_Select
                    - case list:
                        - inject Holograms_List
                    - case setline set addline adjust edit:
                        - inject Holograms_Setline
                    - default:
                        - narrate "<&4>I'm sorry, I didn't understand your request. Type /h help for a list of commands."