SimpleSK

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

CormanYT

Active Member
Jan 6, 2018
122
5
18
THIS MESSAGE IS OUTDATED IN THE THREAD, BUT I WILL KEEP IT HERE ANYWAYS SINCE THIS IS HOW THE THREAD STARTED


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

WHAT IT OFFERS:

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:
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:
sortHighest (2, 3, 1)
sortHighest({_this::*})
sortHighest({_this::*}, 2, 5.3)
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:
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:
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:

"Username-4"
"Otheruser-3"

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

Code:
sortIndexHighest("Me-5", "Him-2", "We-3", "Wow-4")

set {_this::*} to "Me-5", "This-3"

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:
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:
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:
set {_top10::*} to inList({baltop::*}, 1, 10)

Through my testing, you can also directly loop inList without the need to set a variable.

Code:
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:
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:
set {_list::*} to "5, 4, 3, 2, 1, 8, 7"
if indexContains({_list::*}, 8) isn't false:
    broadcast "%indexContains({_list::*}, 8)%"
#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:
capitalize(string, integer 1, integer 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:
capitalize("class", 1, 1)
#This will return "Class"
lowercase("OMG", 1, 3)
#This will return "omg"
capitalize("capital", 1, 3)
#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.

USING THIS SKRIPT MEANS YOU FOLLOW THESE TERMS:

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.
 
Last edited:
""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.
 
if i have 2 region spawn and spawnportal, but if i do
Code:
if player is inside of region "spawn":
it also triggers wenn i am in the region spawnportal. No the regions don't overlap.
 
""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.

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.
[doublepost=1552591770,1552565567][/doublepost]
if i have 2 region spawn and spawnportal, but if i do
Code:
if player is inside of region "spawn":
it also triggers wenn i am in the region spawnportal. No the regions don't overlap.
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.
 
  • Like
Reactions: ShaneBee