Function strangly not working.

  • 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 community!

    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.

BenjaMCDK

New Member
Feb 16, 2017
9
0
1
So i wanted to code a config.yml but a little more advanced.. I had this function "writeFile" but when i call the function with the first argument as "config-broken" or "config.yml-broken" nothing happens... I have tried sending a message to the console to check if the if statement is correct but it's not... I just can't see what i've done wrong here. There is also no error in the script it self.

code_language.skript:
function writeFile(yml: text, id: integer):
    if {_yml} is "config-broken" or "config.yml-broken":
        send "Writing file balaalal %{_id}%" to console
        wf "## KitPvP Core Configuration Broken - %now% ##" to "plugins/Core/config.yml-broken.%{_id}%"
        wf " " to "plugins/Core/config.yml-broken.%{_id}%"
        wf "Kits: %{core.kits}%" to "plugins/Core/config.yml-broken.%{_id}%"
        wf "CombatLog: %{core.combat}%" to "plugins/Core/config.yml-broken.%{_id}%"
        wf "Scoreboard: %{core.scoreboard}%" to "plugins/Core/config.yml-broken.%{_id}%"
        wf "Shop: %{core.shop}%" to "plugins/Core/config.yml-broken.%{_id}%"
        wf " " to "plugins/Core/config.yml-broken.%{_id}%"
        wf "## End of Configuration ##" to "plugins/Core/config.yml-broken.%{_id}%"
    if {_yml} is "config" or "config.yml":
        wf "## KitPvP Core Configuration ##" to "plugins/Core/config.yml"
        wf " " to "plugins/Core/config.yml"
        wf "Kits: true" to "plugins/Core/config.yml"
        wf "CombatLog: true" to "plugins/Core/config.yml"
        wf "Scoreboard: true" to "plugins/Core/config.yml"
        wf "Shop: true" to "plugins/Core/config.yml"
        wf " " to "plugins/Core/config.yml"
        wf "## End of Configuration ##" to "plugins/Core/config.yml"

on load:
    if folder "plugins/Core" doesn't exists:
        create folder "plugins/Core"
    if file "plugins/Core/config.yml" doesn't exist:
        create file "plugins/Core/config.yml"
        writeFile("config", 0)
    wait 20 ticks
    set {core.kits} to value "Kits" get of "plugins/Core/config.yml"
    set {core.combat} to value "CombatLog" get of "plugins/Core/config.yml"
    set {core.scoreboard} to value "Scoreboard" get of "plugins/Core/config.yml"
    set {core.shop} to value "Shop" get of "plugins/Core/config.yml"
    wait 20 tick
    if {core.kits} or {core.combat} or {core.scoreboard} or {core.shop} is not "true" or "false":
        debugConsole("There is something wrong with the Config.yml file. It has been reset %{core.kits}% , %{core.combat}% , %{core.scoreboard}% , %{core.shop}%")
        set {_y} to random integer between 100000 and 999999
        create file "plugins/Core/config.yml-broken.%{_y}%"
        wait 20 ticks
        writeFile("config.yml-broken" , {_y} parsed as integer)

By the way. debugConsole is also a function i've made..
 
Status
Not open for further replies.