Solved YML list "contains" checking.

  • 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.

Barbarx

Active Member
Feb 25, 2017
71
5
0
71
Hello i have problem with YML and i dont know how to fix it.
i using check this
code_language.skript:
if yml list "Mobove" from file "plugins/Skript/MoboveSpawner.yml" contains "- %entity uuid of victim%":
but it doesnt work. can help me somebody?

Full code.
code_language.skript:
on spawn:
    if "%spawn reason%" is "SPAWNER":
        add "%entity uuid of entity%" to yml list "Mobove" of file "/plugins/Skript/MoboveSpawner.yml"
        broadcast "Pridano"
on death:
    if yml list "Mobove" from file "plugins/Skript/MoboveSpawner.yml" contains "%entity uuid of victim%":
        remove "%entity uuid of victim%" from yml list "Mobove" of file "plugins/Skript/MoboveSpawner.yml"
        broadcast "Smazano"
What i want? i want to write all mobs spawned by spawner to list to the yml file. and if they will die and they are in this list they will removed from this list.
 
try:

code_language.skript:
on death:
    set {_E::*} to yml list "Mobove" from file "plugins/Skript/MoboveSpawner.yml"
    loop {_E::*}:
        if "%entity uuid of victim%" is "%loop-value%":
            remove "%loop-value%" from yml list "Mobove" of file "plugins....."
            broadcast "Smazano"
            stop loop
 
"List contains" is buggy in Skript 2.2. To solve this issue, use Rezz's alternative way of contains. https://forums.skunity.com/threads/...you-can-do-in-pure-skript-2-2.2471/#post-5214
good but if cointains...
dont work.
i got this error and event didnt start.
code_language.skript:
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[17:15:39] [Server thread/ERROR]: #!#! Could not load yml.sk
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[17:15:39] [Server thread/ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[17:15:39] [Server thread/ERROR]: #!#! and check whether this error has already been reported.
[17:15:39] [Server thread/ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
[17:15:39] [Server thread/ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[17:15:39] [Server thread/ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[17:15:39] [Server thread/ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Stack trace:
[17:15:39] [Server thread/ERROR]: #!#! ch.njol.skript.SkriptAPIException: Signature of function is null when return type is asked!
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.FunctionReference.getReturnType(FunctionReference.java:201)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.ExprFunctionCall.getReturnType(ExprFunctionCall.java:56)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.conditions.CondCompare.init(CondCompare.java:172)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.conditions.CondCompare.init(CondCompare.java:132)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:249)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:176)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Condition.parse(Condition.java:83)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:833)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:513)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:271)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:167)
[17:15:39] [Server thread/ERROR]: #!#!     at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[17:15:39] [Server thread/ERROR]: #!#!     at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:151)
[17:15:39] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:675)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1393)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1198)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:5)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14)
[17:15:39] [Server thread/ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[17:15:39] [Server thread/ERROR]: #!#!     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:839)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:403)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:763)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:661)
[17:15:39] [Server thread/ERROR]: #!#!     at java.lang.Thread.run(Thread.java:748)
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Version Information:
[17:15:39] [Server thread/ERROR]: #!#!   Skript: 2.2-dev25
[17:15:39] [Server thread/ERROR]: #!#!   Bukkit: 1.11.2-R0.1-SNAPSHOT
[17:15:39] [Server thread/ERROR]: #!#!   Minecraft: 1.11.2
[17:15:39] [Server thread/ERROR]: #!#!   Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[17:15:39] [Server thread/ERROR]: #!#!   OS: Linux amd64 4.4.0-77-generic
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Current node: if contains({_list::*}, "check") is true: (yml.sk, line 13)
[17:15:39] [Server thread/ERROR]: #!#! Current item: null
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Thread: Server thread
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! End of Error.
[17:15:39] [Server thread/ERROR]: #!#!
And my code is:
code_language.skript:
on death:
    set {_list::*} to yml list "Mobove" from file "plugins/Skript/MoboveSpawner.yml"
    if contains({_list::*}, "%entity uuid of victim%") is true:
        remove "%entity uuid of victim%" from yml list "Mobove" of file "plugins/Skript/MoboveSpawner.yml"
        broadcast "Smazano"




function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if loop-value is {_check}:
            return true
    return false
 
good but if cointains...
dont work.
i got this error and event didnt start.
code_language.skript:
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[17:15:39] [Server thread/ERROR]: #!#! Could not load yml.sk
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[17:15:39] [Server thread/ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[17:15:39] [Server thread/ERROR]: #!#! and check whether this error has already been reported.
[17:15:39] [Server thread/ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
[17:15:39] [Server thread/ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[17:15:39] [Server thread/ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[17:15:39] [Server thread/ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Stack trace:
[17:15:39] [Server thread/ERROR]: #!#! ch.njol.skript.SkriptAPIException: Signature of function is null when return type is asked!
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.FunctionReference.getReturnType(FunctionReference.java:201)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.ExprFunctionCall.getReturnType(ExprFunctionCall.java:56)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.conditions.CondCompare.init(CondCompare.java:172)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.conditions.CondCompare.init(CondCompare.java:132)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:249)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:176)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Condition.parse(Condition.java:83)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:833)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:513)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:271)
[17:15:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:167)
[17:15:39] [Server thread/ERROR]: #!#!     at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[17:15:39] [Server thread/ERROR]: #!#!     at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:151)
[17:15:39] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:675)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1393)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1198)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:5)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14)
[17:15:39] [Server thread/ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[17:15:39] [Server thread/ERROR]: #!#!     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:839)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:403)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:763)
[17:15:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:661)
[17:15:39] [Server thread/ERROR]: #!#!     at java.lang.Thread.run(Thread.java:748)
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Version Information:
[17:15:39] [Server thread/ERROR]: #!#!   Skript: 2.2-dev25
[17:15:39] [Server thread/ERROR]: #!#!   Bukkit: 1.11.2-R0.1-SNAPSHOT
[17:15:39] [Server thread/ERROR]: #!#!   Minecraft: 1.11.2
[17:15:39] [Server thread/ERROR]: #!#!   Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[17:15:39] [Server thread/ERROR]: #!#!   OS: Linux amd64 4.4.0-77-generic
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Current node: if contains({_list::*}, "check") is true: (yml.sk, line 13)
[17:15:39] [Server thread/ERROR]: #!#! Current item: null
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! Thread: Server thread
[17:15:39] [Server thread/ERROR]: #!#!
[17:15:39] [Server thread/ERROR]: #!#! End of Error.
[17:15:39] [Server thread/ERROR]: #!#!
And my code is:
code_language.skript:
on death:
    set {_list::*} to yml list "Mobove" from file "plugins/Skript/MoboveSpawner.yml"
    if contains({_list::*}, "%entity uuid of victim%") is true:
        remove "%entity uuid of victim%" from yml list "Mobove" of file "plugins/Skript/MoboveSpawner.yml"
        broadcast "Smazano"




function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if loop-value is {_check}:
            return true
    return false
The function must go above the code using it
 
  • Like
Reactions: Barbarx
Status
Not open for further replies.