Date: 2023/09/08 02:58:03 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
chat_formatting:
type: world
debug: true
enabled: true
events:
on player chats flagged:!player.chat.busy:
- determine cancelled passively
################## highlight player names, server locations and links
- define textrpl <context.message.parse_color>
- define symbols <list[?|,|:|;|!|.]>
- define linkstart <list[https://|http://|www.]>
- definemap words:
discord: <element[Discord: <&n>https://is.gd/cdiscord].custom_color[discord]>
Orbis: <element[Orbis].custom_color[location]>
Moraira: <element[Moraira].custom_color[location]>
Ituria: <element[Ituria].custom_color[location]>
Projektwelt: <element[Projektwelt].custom_color[server]>
Regeln: <element[Regeln].custom_color[command].on_click[/regeln].on_hover[Klicken, um Regeln aufzurufen]>
- foreach <context.message.split> as:word:
# test if the word is a link (definition used for now with list of linkstarts)
- if <[linkstart].filter_tag[<[word].starts_with[<[filter_value]>]>].any>:
# if the last letter of the word/link is a symbol
- if <[word].to_list.last.contains_any_text[<[symbols]>]>:
# save the last letter, flag the server with it, remove the letter from the word
# and later readd it via definition (sym).
# necessary because without it will also highlight the symbols like ?,!
- flag server chat.symbol:<[word].to_list.last>
- define wordex <[word].to_list.exclude[<[word].to_list.last>].separated_by[]>
- define sym <server.flag[chat.symbol]>
- define textrpl <[textrpl].replace[<[word]>].with[<element[<&n><[wordex]>].custom_color[link]><[sym]>]>
- flag server chat.symbol:!
- else:
# if the word/link does not end with a symbol, just highlight it as usual
- define textrpl <[textrpl].replace[<[word]>].with[<element[<&n><[word]>].custom_color[link]>]>
- foreach next
# loop through every key in map "words"
- foreach <[words].keys> as:replaceable:
# if substring (length) of the currently indexed word matches with currently indexed key from words map
- if <[word].substring[0,<[replaceable].length>]> == <[replaceable]>:
- define textrpl <[textrpl].replace[<[word].substring[0,<[replaceable].length>]>].with[<[words.<[replaceable]>]>]>
- foreach stop
- define text "<player.proc[player_name_format]><&f><&co> <[textrpl]>"