Solved YAML

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

CormanYT

Active Member
Jan 6, 2018
122
5
18
Sorry for so many threads lately!
Sorry that I keep making these help threads, but I needed some help.
I know they're close together, please don't mind that, thanks bye!
I know this probably isn't a bug so I won't specify the MC Version, Skript Version and etc.

This code won't work, why?
code_language.skript:
on script load:
    if folder "plugins/iEssentials" doesn't exists:
        create folder "plugins/Autoreboot"
    if file "plugins/iEssentials/config.yml" doesn't exists:
        create file "plugins/iEssentials/config.yml"
        wf "no-permission-message: '&cYou do not have permission for this command!'" to "plugins/iEssentials/config.yml"
        wf "teleporation-message: ''" to "plugins/iEssentials/config.yml"
        wf "first-join-message-toggled: true" to "plugins/iEssentials/config.yml"
        wf "first-join-message: '&6Teleporting...'" to "plugins/iEssentials/config.yml"
        wf "starting-balance: 0" to "plugins/iEssentials/config.yml"
        wf "nickname-max-length: 30" to "plugins/iEssentials/config.yml"
I always get this error!
code_language.skript:
[18:02:45 ERROR]: can't understand this condition: 'folder "plugins/iEssentials" doesn't exists' (iEssentials.sk, line 4: if folder "plugins/iEssentials" doesn't exists:')
[18:02:45 ERROR]: can't understand this condition: 'file "plugins/iEssentials/config.yml" doesn't exists' (iEssentials.sk, line 6: if file "plugins/iEssentials/config.yml" doesn't exists:')
Any help?
 
For the can't understand condition error, there's two common causes.
1)either you don't have an up to date or matching version(skript or addon)
2)or you have the syntax incorrect.

I believe that condition is from wildskript, so be sure you have that addon in it's appropriate version to match your version of skript.
I'm not sure that that particular addon still has support though, so use at your own discretion.
 
use skript-yaml for yaml. it's the only proper yaml implementation for skript.
 
For the can't understand condition error, there's two common causes.
1)either you don't have an up to date or matching version(skript or addon)
2)or you have the syntax incorrect.

I believe that condition is from wildskript, so be sure you have that addon in it's appropriate version to match your version of skript.
I'm not sure that that particular addon still has support though, so use at your own discretion.

1. I'm not using an addon for this, and I have the latest Skript version.
2. I'm sure I don't have this incorrect, I checked multiple times.

use skript-yaml for yaml. it's the only proper yaml implementation for skript.

I checked Skript-Yaml's README.md and it was too confusing.
 
1. I'm not using an addon for this, and I have the latest Skript version.
2. I'm sure I don't have this incorrect, I checked multiple times.



I checked Skript-Yaml's README.md and it was too confusing.
Vanilla skript doesn't have any file operation tools besides log which is very limited so yes it needs an addon. What are you confused about? it has plenty of examples
 
Vanilla skript doesn't have any file operation tools besides log which is very limited so yes it needs an addon. What are you confused about? it has plenty of examples

Well I checked it out and I didn't really get it too well. I'll check it a little bit more and see if I can understand it and edit this post, I just really didn't get it too well, but I'll see if I could.
 
You'll need to pick one of the addons that supports YML for it to work

I'm taking a look into Skript-yaml currently

Well I checked it out and I didn't really get it too well. I'll check it a little bit more and see if I can understand it and edit this post, I just really didn't get it too well, but I'll see if I could.

Alright, continuing this post, how do I check if a folder and file exists? Also how do I create a folder or a file? Something like this:

code_language.skript:
if folder "plugins/iEssentials" doesn't exist:
    create folder "plugins/iEssentials"
if  file "plugins/iEssentials/config.yml" doesn't exist:
    create yaml file "plugins/iEssentials/config.yml"
 
I'm taking a look into Skript-yaml currently



Alright, continuing this post, how do I check if a folder and file exists? Also how do I create a folder or a file? Something like this:

code_language.skript:
if folder "plugins/iEssentials" doesn't exist:
    create folder "plugins/iEssentials"
if  file "plugins/iEssentials/config.yml" doesn't exist:
    create yaml file "plugins/iEssentials/config.yml"
Depends on which addon you picked and the syntax for it^^;; But all of them have examples in the docs. They should be similar, if not exact to what you have just provided. Take a look at the examples provided and try doing some testing:emoji_slight_smile:
 
Thanks, Pikachu. I'll try it out and see what happens and if I need more help I will reply again to this thread (or edit this posts if no replies after this), so thanks.
[doublepost=1517270233,1517269489][/doublepost]
in skript-yaml, loading a file/path that doesnt exist will create it
I have a new error. This is my code:
code_language.skript:
on script load:
    load "plugins/iEssentials/config.yml"
    set yaml value "no-permission-message" from "config" to "'&cYou do not have permission for this command!'"
    set yaml value "teleporation-message" from "plugins/iEssentials/config.yml" to "'&6Teleporting...'"
    set yaml value "first-join-message-toggled" from "plugins/iEssentials/config.yml" to "true"
    set yaml value "first-join-message" from "plugins/iEssentials/config.yml" to "'&dWelcome &6%player% &dto the server'"
    set yaml value "starting-balance" from "plugins/iEssentials/config.yml" to " "
    set yaml value "nickname-max-length" from "plugins/iEssentials/config.yml" to " "
This is what I want it to generate (I didn't specify what's after the colons because too lazy):
YAML:
no-permission-message:
teleportation-message:
first-join-message-toggled:
first-join-message:
starting-balance:
nickname-max-length:
This is the file it generates:
code_language.skript:
This is the error:
code_language.skript:
[18:54:05 INFO]: [Skript] Encountered 1 error while reloading iEssentials.sk!
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
Help?

EDIT: Fixed Issue, Issue With Colons.

NEW ISSUE: How do I change it from § to & with color codes?
 
Last edited:
Thanks, Pikachu. I'll try it out and see what happens and if I need more help I will reply again to this thread (or edit this posts if no replies after this), so thanks.
[doublepost=1517270233,1517269489][/doublepost]
I have a new error. This is my code:
code_language.skript:
on script load:
    load "plugins/iEssentials/config.yml"
    set yaml value "no-permission-message" from "config" to "'&cYou do not have permission for this command!'"
    set yaml value "teleporation-message" from "plugins/iEssentials/config.yml" to "'&6Teleporting...'"
    set yaml value "first-join-message-toggled" from "plugins/iEssentials/config.yml" to "true"
    set yaml value "first-join-message" from "plugins/iEssentials/config.yml" to "'&dWelcome &6%player% &dto the server'"
    set yaml value "starting-balance" from "plugins/iEssentials/config.yml" to " "
    set yaml value "nickname-max-length" from "plugins/iEssentials/config.yml" to " "
This is what I want it to generate (I didn't specify what's after the colons because too lazy):
YAML:
no-permission-message:
teleportation-message:
first-join-message-toggled:
first-join-message:
starting-balance:
nickname-max-length:
This is the file it generates:
code_language.skript:
This is the error:
code_language.skript:
[18:54:05 INFO]: [Skript] Encountered 1 error while reloading iEssentials.sk!
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
[18:54:05 WARN]: [skript-yaml] No yaml by the name 'plugins/iEssentials/config.yml' has been loaded
Help?

EDIT: Fixed Issue, Issue With Colons.

NEW ISSUE: How do I change it from § to & with color codes?
the name of the yaml would "config" and you need to save it when you've finished with it
 
the name of the yaml would "config" and you need to save it when you've finished with it

I already solved that one, I have two new issues.

1. Why does & go to §?
2. Why doesn't each value go in seprate lines?

Code:
code_language.skript:
on script load:
    clear {iEssentials::config::header::*}
    load "plugins/iEssentials/config.yml" as "config"
    set the header of "config" to "|-------------|" and "| iEssentials |" and "|-------------|"
    set yaml value "no-permission-message" from "config" to "&cYou do not have permission for this command!"
    set yaml value "teleporation-message" from "config" to "&6Teleporting..."
    set yaml value "starting-balance" from "config" to "0"
    set yaml value "nickname-max-length" from "config" to "30"
    save yaml "config"
    unload yaml "config"
Result:
YAML:
## |-------------|
## | iEssentials |
## |-------------|
no-permission-message: §cYou do not have permission for this command!teleporation-message: §6Teleporting...starting-balance: 0nickname-max-length: 30
[doublepost=1517273844,1517272913][/doublepost]Nevermind just depends what you are opening it with, I downloaded notepad++ now it looks fine.
 
I already solved that one, I have two new issues.

1. Why does & go to §?
2. Why doesn't each value go in seprate lines?

Code:
code_language.skript:
on script load:
    clear {iEssentials::config::header::*}
    load "plugins/iEssentials/config.yml" as "config"
    set the header of "config" to "|-------------|" and "| iEssentials |" and "|-------------|"
    set yaml value "no-permission-message" from "config" to "&cYou do not have permission for this command!"
    set yaml value "teleporation-message" from "config" to "&6Teleporting..."
    set yaml value "starting-balance" from "config" to "0"
    set yaml value "nickname-max-length" from "config" to "30"
    save yaml "config"
    unload yaml "config"
Result:
YAML:
## |-------------|
## | iEssentials |
## |-------------|
no-permission-message: §cYou do not have permission for this command!teleporation-message: §6Teleporting...starting-balance: 0nickname-max-length: 30
[doublepost=1517273844,1517272913][/doublepost]Nevermind just depends what you are opening it with, I downloaded notepad++ now it looks fine.
because skript tries to auto color things
 
Ok
[doublepost=1517485822,1517313341][/doublepost]THIS THREAD IS SOLVED, PLEASE DO NOT FURTHER CONTINUE IT.
 
Status
Not open for further replies.