skUtilities

Addon skUtilities 0.9.2

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

@tim740 how do you parse a JSON object in Skript?

I'm trying to parse the /stats/uuid.json player object so I can display simple stuff like stat.walkOneCm for people.
 
How can I download the latest version of my skript from spigot using the download expression?
 
Last edited by a moderator:
How can I download the latest version of my skript from spigot using the download expression?
Using the Spiget API it should be easy:
code_language.skript:
download file from "https://api.spiget.org/v2/resources/<Resource ID>/download" to file "plugins\Skript\scripts"
The resource ID is the one that is after your script name in the resource URL.
 
I think the expression "parsed as date formatted as..." is wrong.

I have the date with the time of an "event" stored in a yml file. When I add it to the expression, one hour is added to the time of the event.

code_language.skript:
set {_LastUsed} to skUtil "09.11.2017 13:45:04" parsed as date formatted as "dd.MM.yyyy HH:mm:ss"
send "%{_LastUsed}%"

Result:
code_language.skript:
09.11.2017 14:45:04

The correct result should be:
code_language.skript:
09.11.2017 13:45:04

The result should be the same data that I entered but parsed as date. What it does is that another data with the hour changed, parsed as data. The result is that if I do a cooldown system, it is always going to say that the waiting time is 1 hour now, because the parsed date increases 1 hour.

Only the "hour" number is changed, no other data.

I have created a small patch in my script that subtracts one hour from the date I have saved. By subtracting an hour, the cooldown works correctly.
 
Last edited:
code_language.skript:
#
# \\ YML/CONFIG //
#



on load:
    file "plugins\LeafSkyWars\config.yml" doesn't exist:
        set {&} to "&"
        create file "plugins/LeafSkyWars/config.yml"
        set skutil yaml value "DefaultGlass" from file "plugins\LeafSkyWars\config.yml" to "95:5"
        set skutil yaml value "WinnerHologram" from file "plugins\LeafSkyWars\config.yml" to "true"   
        set skutil yaml value "ExplosionEffect" from file "plugins\LeafSkyWars\config.yml" to "true"   
        set skutil yaml value "UseBowDamageIndicator" from file "plugins\LeafSkyWars\config.yml" to "true"
        set skutil yaml value "InGameCMDS" from file "plugins\LeafSkyWars\config.yml" to ""       
        add "sw" to skutil yaml list "InGameCMDS" from file "plugins\SuperBans\config.yml"
        
    file "plugins\LeafSkyWars\customization.yml" doesn't exist:   
        set skutil yaml value "Prefix" from file "plugins\LeafSkyWars\customization.yml" to "%{&}%2%{&}%lLeaf %{&}%6%{&}%lSKYWARS %{&}%e%{&}%l» %{&}%7"   
        
        
        
        
    #Settings
    wait 0.5 seconds
    set {Leaf.SW.OPTION::WinnerHologram} to yml value "WinnerHologram" of file "plugins\LeafSkyWars\config.yml"
    set {Leaf.SW.OPTION::DefaultGlass} to yml value "DefaultGlass" of file "plugins\LeafSkyWars\config.yml"
    set {Leaf.SW.OPTION::ExplosionEffect} to yml value "ExplosionEffect" of file "plugins\LeafSkyWars\config.yml"   
    set {Leaf.SW.OPTION::UseBowDamageIndicator} to yml value "UseBowDamageIndicator" of file "plugins\LeafSkyWars\config.yml"
    
    set {Leaf.SW.OPTION::InGameCMDS::*} to yml list "InGameCMDS" of file "plugins\LeafSkyWars\config.yml"   
    
    
    #messages
    
    set {Leaf.SW.MSG::Prefix} to yml value "Prefix" of file "plugins\LeafSkyWars\customization.yml"

code_language.skript:
22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! [Skript] Severe Error:
[22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[22:14:31 ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[22:14:31 ERROR]: #!#! and check whether this error has already been reported.
[22:14:31 ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
[22:14:31 ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[22:14:31 ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[22:14:31 ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! Stack trace:
[22:14:31 ERROR]: #!#! java.lang.NullPointerException
[22:14:31 ERROR]: #!#!     at uk.tim740.skUtilities.files.SExprYaml.get(SExprYaml.java:45)
[22:14:31 ERROR]: #!#!     at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:103)
[22:14:31 ERROR]: #!#!     at ch.njol.skript.effects.EffChange.execute(EffChange.java:268)
[22:14:31 ERROR]: #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:52)
[22:14:31 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[22:14:31 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[22:14:31 ERROR]: #!#!     at ch.njol.skript.effects.Delay$1.run(Delay.java:94)
[22:14:31 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
[22:14:31 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
[22:14:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723)
[22:14:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
[22:14:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654)
[22:14:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557)
[22:14:31 ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
[22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! Version Information:
[22:14:31 ERROR]: #!#!   Skript: 2.2-dev27
[22:14:31 ERROR]: #!#!   Bukkit: 1.8.8-R0.1-SNAPSHOT
[22:14:31 ERROR]: #!#!   Minecraft: 1.8.8
[22:14:31 ERROR]: #!#!   Java: 1.8.0_151 (Java HotSpot(TM) 64-Bit Server VM 25.151-b12)
[22:14:31 ERROR]: #!#!   OS: Windows 10 amd64 10.0
[22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! Running CraftBukkit: false
[22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! Current node: null
[22:14:31 ERROR]: #!#! Current item: set {Leaf.SW.OPTION::InGameCMDS::*}(as java.lang.Object) to uk.tim740.skUtilities.files.SExprYaml
[22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! Thread: Server thread
[22:14:31 ERROR]: #!#!
[22:14:31 ERROR]: #!#! End of Error.
[22:14:31 ERROR]: #!#!

Any help?
 
Hey, before I begin thank you for this great addon that made scipting much easier ♥.
I have a couple questions..
1. Is there is any way to write line in file like WildSkript or Umbaska (wf "..." to "...") in SkUtilities?
2. Is there is a way to format gui like that: ↓?
Code:
format a gui slot 0 of player with stone named ".."  to do:
   code here ....

And thank you ♥.
 
1. Is there is any way to write line in file like WildSkript or Umbaska (wf "..." to "...") in SkUtilities?
Yes, you can do:
code_language.skript:
write "something" at line (file "whatever.sk"'s line count + 1) to file "whatever.sk"
I'd make a function just to avoid writing that all the time.

As for your second question, it's completely unrelated to skUtilities so you're better off creating a help thread for it.
 
Yes, you can do:
code_language.skript:
write "something" at line (file "whatever.sk"'s line count + 1) to file "whatever.sk"
I'd make a function just to avoid writing that all the time.

As for your second question, it's completely unrelated to skUtilities so you're better off creating a help thread for it.
Thank you for that idea (first question) :emoji_slight_smile:
And I'm sorry I confused between SkUtilites and Tuske lol, my bad :emoji_grinning:
 
Hey Tim
I saw in the docs the use of profession in spawning a villager.
Was that removed?
I tried
code_language.skript:
spawn a villager with profession NORMAL at location of player
and it returned
"Can't understand this condition/effect: spawn a villager with profession NORMAL at location of player"

Also, on this same topic, is a personal able to call upon the villagers profession during a spawn event? If not are you able to add that?
I found an API Skript for changing villagers trades on spawn, but I wanted to set them per profession.
 
Suggestion:
Add "yaml node is %type%" condition. Right now we're capable of looping through our yaml files quite alright, but it's hard and especially messy to determine what the looped yaml node functions as. I'm suggesting usage like this:

code_language.skript:
loop yaml nodes with keys "" of file {_file}:
    yaml node "%loop-value%" of file {_file} = list
    set {_list::%loop-value%} to yaml list "%loop-value%" of file {_file}