1- // dat_generate(name)
2- // Returns: string
3- var o, objective, str, note, instrument, pitch, tick, source, name
4- o = obj_controller
5- objective = o.dat_obj
6- source = o.dat_source
7- name = argument0
8- str = " scoreboard players add @s " + objective + " 1" + br
9- tick = 1
10-
11- for (a = 0 ; a <= o.enda; a ++) {
12- if (o.colamount [a] > 0 ) {
13- for (b = 0 ; b <= o.collast [a]; b += 1 ) {
14- if (o.song_exists [a, b] && (o.lockedlayer [b] = 0 || o.dat_includelocked )) {
15- if (o.song_key [a, b] > 32 && o.song_key [a, b] < 58 ) {
16- instrument = dat_instrument (ds_list_find_index (other.instrument_list , o.song_ins [a, b]))
17- pitch = dat_pitch (o.song_key [a, b])
18-
19- // Add command to result
20- if (o.dat_enableradius ) str += " execute at @s[scores={" +objective+" =" +string (tick)+" }] run playsound " + instrument +" " +source+" @a ~ ~ ~ " + string (o.dat_radiusvalue ) + " " + string (pitch) + br
21- else str += " playsound " + instrument +" " +source+" @s[scores={" +objective+" =" +string (tick)+" }] ~ ~ ~ 1 " + string (pitch) + " 1" + br
22- }
23- }
24- }
25- }
26- tick += o.dat_tempo
27- }
28- str += " execute if score @s " +objective+" matches " +string(tick)+" run function " + name +" :stop"
1+ // dat_generate(name)
2+ // Returns: string
3+ var o, objective, str, note, instrument, pitch, tick, source, name, blockvolume
4+ o = obj_controller
5+ objective = o.dat_obj
6+ source = o.dat_source
7+ name = argument0
8+ str = " scoreboard players add @s " + objective + " 1" + br
9+ tick = 1
10+
11+ for (a = 0 ; a <= o.enda; a ++) {
12+ if (o.colamount [a] > 0 ) {
13+ for (b = 0 ; b <= o.collast [a]; b += 1 ) {
14+ if (o.song_exists [a, b] && (o.lockedlayer [b] = 0 || o.dat_includelocked )) {
15+ if (o.song_key [a, b] > 32 && o.song_key [a, b] < 58 ) {
16+ instrument = dat_instrument (ds_list_find_index (other.instrument_list , o.song_ins [a, b]))
17+ pitch = dat_pitch (o.song_key [a, b])
18+ blockvolume = o.layervol [b]/100
19+
20+ // Add command to result
21+ if (o.dat_enableradius ) str += " execute at @s[scores={" +objective+" =" +string (tick)+" }] run playsound " + instrument +" " +source+" @a ~ ~ ~ " + string (o.dat_radiusvalue ) + " " + string (pitch) + br
22+ else str += " playsound " + instrument +" " +source+" @s[scores={" +objective+" =" +string (tick)+" }] ~ ~ ~ " +string (blockvolume)+ " " + string (pitch) + " 1" + br
23+ }
24+ }
25+ }
26+ }
27+ tick += o.dat_tempo
28+ }
29+ str += " execute if score @s " +objective+" matches " +string(tick)+" run function " + name +" :stop"
2930return str
0 commit comments