MirrorUtils - useful utilities for Skript 2.0.1

Random (and useful) utilities for Skript. Suggestions are welcome.

  1. EWS
    Native Minecraft Version:
    1.13
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    Contributors:
    Donut
    Languages Supported:
    Portuguese
    MirrorUtils
    Useful utilities for Skript, based on the addon skript-mirror.

    Requirements

    - Skript dev36 or more recent
    https://github.com/SkriptLang/Skript/releases
    - skript-mirror 2.0.0
    https://cdn.discordapp.com/attachments/574422264666259466/577680953363791885/skript-mirror_2.0.0.jar

    IMPORTANT: make sure that MirrorUtils loads BEFORE your other scripts. To do that, add ! or other characters to the file's name that make it appear on top.


    Features

    ▪ Full text customization. Many features related to random string generation, coloring, reversing and much more.
    Code (Text):

    send rainbow ((trimmed "   completely random   " in camel case) with case swapped) every 2 characters
     
    [​IMG]

    ▪ RegEx support. Adds many conditions and expressions related to regular expressions to make your life easier.
    Code (Text):

           set {_matcher} to match expr-1 to "([0-9]+)([a-zA-Z]+)"
     
           while {_matcher} has another match:
               set {_value} to (current group 1 of {_matcher}) parsed as number
               set {_type} to current group 2 of {_matcher}
               if {_type} = "year" or "y":
                   add (31104000 * {_value}) to {_r}
     

    ▪ Number formatting. Want to convert your number to roman numeral, words, ordinal, properly spaced (1,000,000) or to powers of 10 (k, M, B)? Do it the easy way.
    Code (Text):

           send rainbow (998 to roman numeral) every 1 characters
           set {_n} to roman numeral "XXVI" to number
           send rainbow "%{_n}%" every 1 characters
           send rainbow (number 1945 to words) every 1 characters
           send ordinal of 13
           send rainbow (compacted 9932144 rounded to 2) every 1 characters
     
    upload_2019-5-13_23-26-33.png

    ▪ Rounding. Round your number with the amount of decimal places you want.
    Code (Text):

    set {_rounded} to round pi to 1
     

    ▪ {_var}++. Yes, you can add any value to a variable as simple as that.
    Code (Text):

           loop "a", "b" and "c":
               {_i}++
               set {_list::%{_i}%} to loop-value
     

    ▪ Top values. Do you need to display the top values of your list variable? It's pretty easy with MirrorUtils.
    Code (Text):

           loop 850 times:
               set {_money::%random alphanumeric size 8%} to random integer between 1 and 99999
     
           loop top 10 elements of {_money::*} formatted as "&2<pos>. &f<index> &7has &a$<value>&f.":
               send loop-value
     
    [​IMG]

    ▪ Format seconds. Converts seconds to any format you want using DurationFormatUtils.

    ▪ Time to seconds. Allows you to convert Skript's timespan or strings to seconds, so you can use in your bans script, for example. Formats are [1mo10d4h3m1s].

    ▪ PI, phi and e. Such can be retrieved easily with these expressions.


    Expressions:
    String
    Code (skript (Unknown Language)):

    # NEW LINE
    # Used to add a new line to tab headers/footers and messages.
    (newline|nl|cr)

    # REGEX REPLACE
    # Replaces a regular expression in a string with another string.
    regex replace %text% with %text% in %texts%

    # REGEX SPLIT
    # Splits a string using a regular expression.
    regex split %texts% at %text%

    # MATCHER OF STRING
    # Gets the regular expression matcher in a string.
    match[er] %text% (to|in|of|with) %text%

    # REGEX GROUPS OF MATCHER
    # Gets the regular expression groups from a matcher.
    # A matcher is obtained from the expression above.
    [regex] group[s] %integer% of [matcher] %object%

    # SUBTEXT
    # Gets the subtext of a string. Exactly like Skript's, but for a single argument
    sub(text|string) of %text% (from|char[racter][s]) %integer%

    # EXACTLY EQUALS
    # Checks if a string is equal to another.
    # Case sentitive (only reason for it to be here).
    %text% exactly equals [to] %text%

    # ARGUMENT AT
    # Gets the nth element of texts separated by spaces.
    # Useful for on command events.
    argument [at] %integer% of %text%

    # REPLACER
    # Allows you to replace multiple values at once in a string.
    # Most useful expression around.
    (multi[ple] replace|replacer) [(elements|values)] %texts% with %texts% in %text%

    # RANDOM STRING
    # Generates a random string with the length specified.
    random (1¦alphanumeric|2¦alphabetic|3¦numeric|4¦ascii|5¦graph) [(text|string)] [with] (size|length) %integer%
     
    Numbers
    Code (skript (Unknown Language)):

    # SPACED NUMBER
    # Returns a string with formatted number.
    spaced %numbers%

    # ORDINAL NUMBER
    # Gives you the number with proper formatting (1st, 2nd, 3rd... 22nd, 24th)
    ordinal [of] %integer%

    # SUM PREVIOUS
    # Sums all the integers smaller than a number N.
    # Useful for shops that increase the price and allow multiple items bought at once.
    sum prev[ious] [numbers] of %integer%

    # ROUND TO
    # Rounds a number to N decimal places.
    round %number% to %number% [decimal] [places]

    # TOP/LAST ELEMENTS
    # Sorts a variable directly and returns a list of texts with the format used.
    # Considerably more efficient than any other methods of sorting available in Skript.
    (1¦(top|first)|2¦(last)) %integer% (values|elements) of %objects% [formatted] as %text%

    # NUMBER TO ROMAN NUMERAL
    # Converts a number to a roman numeral.
    %number% (to|in) roman [numeral]

    # NUMBER TO WORDS
    # Converts a number into words.
    number %number% (to|in) words

    # FORMATTED NUMBER
    # Formats a number using symbols to indicate base 10 exponents (k, M, B).
    formatted %number% [round[ed] to %-integer%]

    # PI
    # pi
    pi
     
    Time
    Code (skript (Unknown Language)):

    # TEXT TO SECONDS
    # Parses timespans like 1d10h10s.
    # Incredibly useful for temporary bans/mutes...
    %text% (to|in) seconds

    # FORMAT SECONDS
    # Uses an util to change seconds into any format you want.
    # Check https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/DurationFormatUtils.html.
    format %number% (into|as) %text%

    # CURRENT MILLISECONDS
    # Returns the current time, in milliseconds.
    [current] m[illi]s[econds]
     
    Player
    Code (skript (Unknown Language)):

    # DURATION OF POTION
    # Returns the duration (in seconds) of that potion in an entity.
    duration of [potion] [effect] %potiontype% (on|of) %livingentity%

    # TIER OF POTION
    # Returns the level of the potion applied to an entity.
    tier of [potion] [effect] %potiontype% (on|of) %livingentity%
     

    Conditions
    Text
    Code (skript (Unknown Language)):

    # REGEX MATCHES
    # Checks if a string matches a regular expression.
    %texts% [regex] matches %text%
     
    Player
    Code (skript (Unknown Language)):

    # ENTITY HAS POTIONS
    # Continues if the entity has those enchants in their respective levels.
    %livingentity% has [potion] [effect[s]] %potiontypes% [level[s]] [%-integers%]
     

    Effects:
    Variables
    Code (skript (Unknown Language)):

    # i++
    # Basically a shortcut for lazy people who don't like to use "set {_n} to {_n} + 1"
    # Can also add/remove values that are not 1.
    %object%(1¦++|2¦--)[%-number%]
     

    EWS (TrademarkTM)
    Govindas, Diclo and ANDREI923 like this.

Recent Updates

  1. Added player, location and item utils

Recent Reviews

  1. Govindas
    Govindas
    5/5,
    Version: 2.0.1
    the top values sort is incredibly useful, much better than any skript available sorting methods, has improved my server a lot, thank you!