1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'APIs' started by CormanYT, Mar 11, 2019.

  1. CormanYT

    CormanYT Active Member

    Jan 6, 2018
    Likes Received:

    Hello, I'd like to show you SimpleSK, a simple API requiring NO addons to make your life easier! This uses several skript functions.


    4 Sorting Functions: sortHighest, sortLowest, sortIndexHighest, sortIndexLowest

    2 List Functions: inList, indexContains

    2 String Case Functions: capitalize, lowercase

    The goal of this API is to make your skript life much easier by offering things which can shorten your code, but I really made it out of boredom.

    I'm willing to add more if I get more useful ideas to make Skript life easier. Anyways, here's a basic tutorial of them.

    The first 2 sorting functions can use a list, several lists, integers specified in the function, or a combination of what I just said.

    Code (Text):
    1. sortHighest(numbers)
    This will allow you to sort integers from least to greatest (without indexes). This can be used in several ways, but I'll just show some examples.

    Code (Text):
    1. sortHighest (2, 3, 1)
    2. sortHighest({_this::*})
    3. sortHighest({_this::*}, 2, 5.3)
    4. sortHighest({_a::*}, {_b::*}, 1, 3)
    The next sorting function is just like sortHighest, but sorts from greatest to least. The same syntax applies, but here is the function.

    Code (Text):
    1. sortLowest(numbers)
    The next 2 functions are quite similar to the previous two, except they sort strings, split them, then get the number value and keep the index. Of course, these are index sorting. I'll just show how to use them.

    Code (Text):
    1. sortIndexHighest(strings)
    Here's how it works. You have to put in strings which contain an index split with a - and then with a numerical value. These strings would look like:


    Etc. However, it also supports lists of these strings. Here's a couple examples.

    Code (Text):
    1. sortIndexHighest("Me-5", "Him-2", "We-3", "Wow-4")
    3. set {_this::*} to "Me-5", "This-3"
    5. sortIndexHighest({_this::*})
    Obviously, sortIndexLowest follows the same syntax.

    SimpleSK has two list functions, one is much more simple and probably more useful than the other. We'll start with it.

    Code (Text):
    1. inList(list, integer 1, integer 2)
    inList is quite a simple function as what it does is it will return a list only with the items in the list from place integer 1 to integer 2. What do I mean by that? Let me show an example.

    Code (Text):
    1. inList({baltop::*}, 1, 10)
    This is one way to use the syntax. It returns places 1-10 of {baltop::*} as a list, which is usable like this:

    Code (Text):
    1. set {_top10::*} to inList({baltop::*}, 1, 10)
    Through my testing, you can also directly loop inList without the need to set a variable.

    Code (Text):
    2. loop inList({baltop::*}, 1, 10):
    inList should be able to keep your list indexes, but if it doesn't please report the bug to me.

    The next function we have is indexContains which will go by this syntax:

    Code (Text):
    1. indexContains(list, check)
    It's an alternative to the contains expression which Skript offers because indexContains offers the benefit of instead of returning true or false, it either returns the index in a list or false which could be useful if you wanted not just to find if a list has something, but if it does what place it has it. indexContains can be used in several ways, but I'll show you an example just to finish off this section.

    Code (Text):
    1. set {_list::*} to "5, 4, 3, 2, 1, 8, 7"
    2. if indexContains({_list::*}, 8) isn't false:
    3.     broadcast "%indexContains({_list::*}, 8)%"
    4. #This will broadcast where in the list 8 is, and it's in the 6th spot of the list, so it will broadcast "6"

    These two functions are very much alike, what they do is they will capitalize or make characters lowercase based on two integers. It will make the characters between those two integers either upper-case or lower-face depending on the function you use. I'll show the syntax for both and show a simple example.

    Code (Text):
    1. capitalize(string, integer 1, integer 2)
    2. lowercase(string, integer 1, integer 2)
    That is the syntax you use, you put the string and the area you want to capitalize. Just to clear up the confusion, I'll show an example.

    Code (Text):
    1. capitalize("class", 1, 1)
    2. #This will return "Class"
    3. lowercase("OMG", 1, 3)
    4. #This will return "omg"
    5. capitalize("capital", 1, 3)
    6. #This will return "CAPital"
    I'm sure I could go on but you should get the point.

    If you have any more suggestions for this API to have, please put them in the discussions area for this script. Anyways this is just something I did out of boredom again but I'd also like constructive criticism, like if I did it efficiently or not and tips. This API is now published.


    1. Any resources which depend on my script must have a link to my script in their resource page.
    2. You are not allowed to publish modified versions of this script.
    3. You are not allowed to re-publish this script.
    4. Modifying my script will mean I will not provide you any support.
    5. You must always follow the latest version of these terms.
    #1 CormanYT, Mar 11, 2019
    Last edited: Mar 15, 2019
  2. ShaneBee

    Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
    ""simple API requiring NO addons to make your life easier! This uses several skript functions.""

    Yet it requires Skript Mirror? I also don't see a single function in there.
  3. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Jan 26, 2017
    Likes Received:
    if i have 2 region spawn and spawnportal, but if i do
    Code (Text):
    1. if player is inside of region "spawn":
    it also triggers wenn i am in the region spawnportal. No the regions don't overlap.
  4. CormanYT

    CormanYT Active Member

    Jan 6, 2018
    Likes Received:
    Sorry about that. That was made before the update 1.1 and I haven't got around to updating it. On version 1.0 it didn't require an addon. I'll make sure to update it.
    --- Double Post Merged, Mar 14, 2019, Original Post Date: Mar 14, 2019 ---
    I was looking on your code today and I found something in the code which is not very efficient in the method for checking if the player is in a region. The update is coming soon, I'll fix it in the update.
    ShaneBee likes this.

Share This Page