Date: 2016/08/06 10:00:31 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
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
DUL_hidden_spawn_locations:
type: procedure
debug: false
definitions: location|radius
DUL:
author:
- BlackCoyote
description:
- Finds spawn locations within range that are out of line of sight.
- If no locations out of line of sight are found, it will return valid spawn locations within line of sight.
usage:
- <proc[DUL_hidden_spawn_locations].context[<l@location>|<radius>]>
example:
- <proc[DUL_hidden_spawn_locations].context[<player.location>|15]>
script:
- if <def[location]||null> !matches location {
- debug error "DUL - No valid location specified!"
- determine null
}
- if <def[radius]||null> !matches number {
- debug error "DUL - No valid radius specified!"
- determine null
}
- define radius <def[radius].as_int>
- determine <def[location].find.surface_blocks.within[<def[radius]>].filter[y.sub[<def[location].y>].abs.is[less].than[3]].filter[above.above.above.material.name.is[==].to[air]].filter[above.above.above.above.material.name.is[==].to[air]].filter[above.above.above.above.above.material.name.is[==].to[air]].filter[material.is_occluding].parse[above].filter[above.center.line_of_sight[<def[location].add[0,1.5,0].center>].not]||<def[location].find.surface_blocks.within[<def[radius]>]||li@<def[location]>>>DUL_random_surface_block:
type: procedure
definitions: location|radius
debug: false
DUL:
author:
- BlackCoyote
description:
- Finds a random surface block within the provided radius more efficiently than conventional denizen tags.
usage:
- <proc[DUL_random_surface_block].context[<l@location>|<radius>]>
example:
- <proc[DUL_random_surface_block].context[<player.location>|5000]>
script:
- if <def[location]||null> !matches location {
- debug error "DUL - No valid location specified!"
- determine null
}
- if <def[radius]||null> !matches number {
- debug error "DUL - No valid radius specified!"
- determine null
}
- while true:
- define newloc <def[location].add[<util.random.int[<def[radius].mul[-1]>].to[<def[radius]>]>,0,<util.random.int[<def[radius].mul[-1]>].to[<def[radius]>]>].highest.find.surface_blocks.within[5].get[1]||null>
- if <def[newloc]> != null && <def[newloc].material.is_occluding> {
- determine <def[newloc].above>
} else if <def[loop_index]> >= 10 {
- determine null
}
DUL_script_tracker:
type: world
debug: false
events:
on system time hourly:
- webget "http://morphanone.space/webizen.aspx/tracker?script=96&version=<s@DUL_version_script.yaml_key[version]>"
# DUL_MyScriptHere:
# type: procedure
# DUL:
# author:
# - author
# description:
# - description here
# usage:
# - usage here
# example:
# - example here
# debug: false
# script:
# - script here
DUL_text_progress_bar:
type: procedure
debug: false
DUL:
author:
- BlackCoyote
description:
- Makes a text based progress bar based on the percentage you provide.
usage:
- <proc[DUL_text_progress_bar].context[<percentage>(|<size>|<character>|<color1>|<color2>)]>
example:
- <proc[DUL_text_progress_bar].context[<player.health.percentage>]>
script:
- define percentage <def[1]||0>
- if <def[percentage].as_int||none> == none {
- define percentage 0
}
- if <def[2].exists> {
- define max <def[2]>
}
- if <def[max].as_int||none> == none {
- define max 10
}
- if <def[3].exists> {
- define char <def[3].substring[1,1]||=>
} else {
- define char =
}
- if <def[4].exists> {
- define col1 <def[4]>
} else {
- define col1 &a
}
- if <def[5].exists> {
- define col2 <def[5]>
} else {
- define col2 &7
}
- define string <el@.pad_right[<def[max]>].with[<def[char]>]>
- define split <def[max].div[100].mul[<def[percentage]>].as_int>
- determine "<def[col1].parse_colors><def[string].substring[1,<def[split]>]><def[col2].parse_colors><def[string].substring[<def[split].add[1].as_int>,<def[max]>]>"
DUL_unique_queue_id_prefixed:
type: procedure
debug: false
DUL:
author:
- BlackCoyote
description:
- Gives a unique queue ID for you to use, with a specified prefix.
usage:
- <proc[DUL_unique_queue_id_prefixed].context[<prefix>]>
example:
- <proc[DUL_unique_queue_id_prefixed].context[DUL_<player>]>
script:
- define prefix <def[1]||>
- define id <def[prefix]><util.random.duuid>
- while <queue.list.parse[id].contains[<def[id]>]>:
- define id <def[prefix]><util.random.duuid>
- determine <def[id]>
DUL_version_script:
type: version
name: dUtilLib
id: 96
description: A collection of dscript functions and utilities written by BlackCoyote and Anthony.
version: 3
DUL_WRCG:
type: procedure
debug: false
DUL:
author:
- Anthony
name:
- Weighted Random Choice Generator
description:
- Supply a list of weight/return values and have one of the values returned to you randomly based on weight.
usage:
- <proc[DUL_WRCG].context[weight/return|...]>
example:
- give <proc[DUL_WRCG].context[10/i@apple|1/i@gold_ingot|20/i@stone]>
script:
- define l 'li@'
- foreach '<queue.definitions.exclude[l]>':
- define l '<def[l].include[<def[%value%]>]>'
- define w '0'
- foreach '<def[l].parse[before[/]]>':
- define w '<def[w].add[%value%]>'
- define number '<util.random.int[1].to[%w%]>'
- define hv '0'
- foreach '%l%':
- define ov '%hv%'
- define lv '<def[ov].add[1]>'
- define hv '<def[ov].add[<def[value].before[/]>]>'
- if %number% >= %lv% && %number% <= %hv% {
- determine '<def[value].after[/]>'
}