#note block song player

1 messages · Page 1 of 1 (latest)

coral flame
#

i have been searching for a decent way to play note block songs in skript for well over a year, but i haven't found anything worthwhile
FunkySK doesn't use custom instruments (like entity.experience_orb.pickup) and also has a tendency to mess up notes, i thought about using a python script to convert a nbs file to a csv file, but i don't know if skript can read csv files (other than variables.csv)
i was thinking it could maybe create 3 lists for a song, {instrument::*} for the instrument type, {pitch::*} for the pitch, and {delay::*} for the duration between notes.
for example, if you wanted to play a harp at pitch 5 along with a harp at pitch 10, {instrument::1} and {instrument::2} would be "harp", while {pitch::1} would be 5 and {pitch::2} would be 10, but {delay::1} would be 0 to play them simultaneously

#

the simplified version of this: how can i efficiently play note block songs in skript and/or can skript read csv files?

tulip lantern
#

theoretically possible. a csv file is still a text file, you can either use skript-reflect or SkUtilities to read the file and go from there.

coral flame
#
command /playsong <text>:
    trigger:
        if file "songs\%arg%.csv" exists:
            #broadcast yes
            set {_c::*} to file contents of "songs\%arg%.csv"
            set {_a} to 1
            loop {_c::*}:
                set {_b::*} to {_c::%{_a}%} split at ","
                set {instrument::%{_a}%} to {_b::1}
                set {delay::%{_a}%} to {_b::2}
                set {pitch::%{_a}%} to {_b::3} parsed as number
                set {volume::%{_a}%} to {_b::4} parsed as number
                add 1 to {_a}
            set {length} to {_a}
            set {_a} to 1
            loop {length} times:
                {stop} is set: 
                    delete {stop}
                    stop 
                play sound "block.note_block.%{instrument::%{_a}%}%" with volume {volume::%{_a}%} at pitch {pitch::%{_a}%} to all players
                {delay::%{_a}%} is not 0:
                    wait "%{delay::%{_a}%}% ticks" parsed as time span
                add 1 to {_a}
command /stopsong:
    trigger:
        set {stop} to true```
this is my current code
tulip lantern
#

I know the Note Block Studio (the new one) has support for turning your nbs songs into datapacks. So then, you'd need at least Minecraft 1.14 for that, then just use Skript to run the function command for the player

coral flame
#

that'll work for now, but eventually i'll have to find a way to do it in skript