Skript Sound error

Discussion in 'Skript' started by Stoian, Feb 8, 2020.

  1. Hello, I have a skript with folder and I try to play an sound from config.yml when player join on server.
    Code (Text):
    set yml value "JoinSound" of file "plugins/MythCore/Config.yml" to "AMBIENCE_CAVE"
    set {_JoinSound} to yaml value "JoinSound" from "plugins/MythCore/Config.yml"
    play "%{_JoinSound}%" to player at volume 15
     
    And I get this error in console: is not a valid sound type...How to fix?
     
  2. you need to parse it as sound, also use skript yaml, it's much faster than others
     
    • Agree Agree x 1
  3. Code (Text):
    on load:
        if file "plugins/MythCore/Config.yml" doesn't exist:
            create file "plugins/MythCore/Config.yml"
            set yml value "JoinMsg" of file "plugins/MythCore/Config.yml" to "&d%%player%% a intrat pe server."
            set yml value "LeaveMsg" of file "plugins/MythCore/Config.yml" to "&c%%player%% a iesit de pe server."
            set yml value "Sound" of file "plugins/MythCore/Config.yml" to "entity.experience_orb.pickup"
            set yml value "SoundVolume" of file "plugins/MythCore/Config.yml" to "1.0"

     
    on join:
        set {_Sound} to yaml value "Sound" from "plugins/MythCore/Config.yml"
        set {_SoundVolume} to yaml value "SoundVolume" from "plugins/MythCore/Config.yml"
        set join message to "%{_JoinMsg}%"
        play sound "%{_Sound}%" with volume {_SoundVolume} to player
    This is the new code, %%player%% get recognized as <none> how to fix this, and {_SoundVolume} doesn't work...I don't know how to fix it.
     
  4. Code (Text):
    on load:
        if file "plugins/MythCore/Config.yml" doesn't exist:
            create file "plugins/MythCore/Config.yml"
            set yml value "JoinMsg" of file "plugins/MythCore/Config.yml" to "&d%%player%% a intrat pe server."
            set yml value "LeaveMsg" of file "plugins/MythCore/Config.yml" to "&c%%player%% a iesit de pe server."
            set yml value "Sound" of file "plugins/MythCore/Config.yml" to "entity.experience_orb.pickup"
            set yml value "SoundVolume" of file "plugins/MythCore/Config.yml" to "1.0"

    on join:
        set {_Sound} to yaml value "Sound" from "plugins/MythCore/Config.yml"
        set {_SoundVolume} to yaml value "SoundVolume" from "plugins/MythCore/Config.yml"
        set join message to "%{_JoinMsg}%"
        play sound "%{_Sound}%" with volume {_SoundVolume} to player
    This is the new code, %%player%% get recognized as <none> how to fix this, and {_SoundVolume} doesn't work...I don't know how to fix it.
     
  5. you need to replace %player% with player's name and parse SoundVolume as a number

    and as I see you are simply making a configuration of messages in skript, why? Skript is human-readable already, it's not Java where you have to decompile, so there's absolutely no point in making configuration for messages if you aren't making multi-language support, since people can just change messages in .sk file, it only makes it a harder job for you to parse stuff
     
    • Like Like x 1
  6. You are right, I did it just in Skript and it's working ok now.