Skript Loading Variables from YAML File

Discussion in 'Skript' started by JackPlayzMC, Dec 28, 2016.

Thread Status:
Not open for further replies.
  1. Hey there. So I am having problems with loading a variable from a YAML file. Can someone please tell me how to fix it? Thanks!

    Here is what I am using for my config.yml variables.
    Code (Text):

      if file "plugins/PixelSkyWars/config.yml" doesn't exists:
         set "prefix" to "&bSkyWars >" in yaml file "plugins/PixelSkyWars/config.yml"
         set "coinsPerKill" to "5" in yaml file "plugins/PixelSkyWars/config.yml"
         set "coinsPerWin" to "30" in yaml file "plugins/PixelSkyWars/config.yml"
         set "kitsBook" to "&eKits" in yaml file "plugins/PixelSkyWars/config.yml"
         set "kitsBookVIP" to "&aVIP Kits" in yaml file "plugins/PixelSkyWars/config.yml"
         set "leaveItem" to "&c&lLeave..." in yaml file "plugins/PixelSkyWars/config.yml"
         set {prefix} to colored value "prefix" get of "plugins/PixelSkyWars/config.yml"
         set {coinsPerKill} to value "coinsPerKill" get of "plugins/PixelSkyWars/config.yml"
         set {coinsPerWin} to value "coinsPerWin" get of "plugins/PixelSkyWars/config.yml"
         set {kitsBook} to colored value "kitsBook" get of "plugins/PixelSkyWars/config.yml"
         set {kitsBookVIP} to colored value "kitsBookVIP" get of "plugins/PixelSkyWars/config.yml"
         set {leaveItem} to colored value "leaveItem" get of "plugins/PixelSkyWars/config.yml"
       set {prefix} to colored value "prefix" get of "plugins/PixelSkyWars/config.yml"
       set {coinsPerKill} to value "coinsPerKill" get of "plugins/PixelSkyWars/config.yml"
       set {coinsPerWin} to value "coinsPerWin" get of "plugins/PixelSkyWars/config.yml"
       set {kitsBook} to colored value "kitsBook" get of "plugins/PixelSkyWars/config.yml"
       set {kitsBookVIP} to colored value "kitsBookVIP" get of "plugins/PixelSkyWars/config.yml"
       set {leaveItem} to colored value "leaveItem" get of "plugins/PixelSkyWars/config.yml"
     
    When I reload the Skript the console does not get any errors with the variables but when I do the command /skywars, it shows "{prefix} Help Menu" instead of showing what the prefix variable is. Here's the code I used for my SkyWars command.

    Code (Text):
    command /skywars:
        aliases: /sw, /psw, /PixelSkyWars
        trigger:
            send "{prefix} &aHelp Menu"
    My config.yml did get generated but it uses the symbol § instead of &. If you could help me with the as well. Though I'd like the variables problem fixed first, for obvious reasons. :p
    Code (Text):
    prefix: §bSkyWars >
    coinsPerKill: '5'
    coinsPerWin: '30'
    kitsBook: §eKits
    kitsBookVIP: §aVIP Kits
    leaveItem: §c§lLeave...
     
  2. mathhulk

    mathhulk Retired Moderator
    Retired

    The variable needs to be enclosed in percent signs.
    Code (Text):
    send "%{prefix}% Message."
     
Thread Status:
Not open for further replies.