Jump to content

vWill

Member
  • Posts

    6
  • Joined

  • Last visited

Everything posted by vWill

  1. Skripting Tutorial - Newbies

    1580192691_ScreenShot2021-05-06at5_20_29PM.thumb.png.bb4c59c380492f0879007a1988dcbecc.png

    Hi. If you haven't met me in Minehut, i'm vWill, some call me Will.

    This is a tutorial for Skript if you aren't good at coding, and want to level up your server-making skills!

    1. Core Skript Elements

    Skript as a whole is made up of five key elements.

    Events (not the ones for money!)

    Conditions

    Effects

    Expressions

    Functions

    Getting the hang of properly utilizing these five elements of Skript is crucial to becoming a skilled coder for your Minehut server.

    a. Events

    Events are, well, events! They're self explanatory.

    Events are called whenever something happens in your server. If you break a block, thats an event! If you join the server, thats an event. There are hundreds of events in Skript.

    Some examples:

    on join:

    on break:

    on chat:

    That sums up the basics of Skript's events! But what comes after them?

    b. Conditions

    Conditions are pieces of code that check if a condition is satisfied. They raise the complexity of your Skripts and allot a vast amount of possibilities!

    Some examples of conditions are as follows.

    if player is "vWill":

    Checks if the player's IGN is vWill (me, LOL)

    if {var} is not set: (we'll get into variables later!)

    if (3/2) is an integer:

    Checks if 3 divided by 2 is an integer (Hint, it isn't, so this condition can never be satisfied)

    In summary, conditions are cool pieces of code that can step your code up from the basics.

    c. Effects

    Effects are the parts of Skript that, well, do stuff.

    There are hundreds of effects for a variety of things.

    To help you get a better perspective on effects, lets look at a couple examples.

    execute player command "/help"

    This code makes the player say a command.

    stop the server

    This effect stops the server than run.

    cancel the event

     This is arguably the most important event. It cancels things or prevent things from happening.

    broadcast "Hello World!"

    This effect sends "Hello World!" to all players.

    d. Expressions

    Expressions can appear to be quite the obstacle to overcome. In fact, expressions aren't that complex at all.

    An example of an expression is:

    %player%

    This is the most basic expression. It signifies the player in question. This can vary based on the Event you are using (refer to the Events section for info).

    %time%

    This expression shows the current server time.

    %tps%

    This expression shows the TPS from the past 1 minute, 5 minutes, and 10 minutes.

    You might notice that all expressions have "%" appended to the beginning and end.

    Expressions can work to be visualized!

    If you were to send "%first element of tps%", you would see a message with a number between 1 and 20. (20 is best!). "first element" indicates that only the first of the three TPS's will appear, that being the tps that updates every minute.

    e. Functions

    Functions are easily the most difficult to learn, but once you have the hang of them, your Skripts can be further enchanced!

    In simple words, functions are little bubbles of code that can be called to run. 

    Functions are useful for repeating the same thing a lot of times and condensing your code.

    A basic function is as follows:

    function myFunction(p: player)

    Let's break this down.

    "function" tells Skript that you are creating a new function.

    "myFunction" is the name of the function. It can be anything you like!

    Anything that comes after the name of the function are the parameters for the target(s).

    In this example, (p: player), "p" is the local variable that will be reserved for the code.

    player is the target. For a better understanding, take a look at this small bit of code.

     

    532399710_ScreenShot2021-05-06at3_59_57PM.png.5fdeb08f2fee19a1d79fdb1a9e580d50.png

    The first segment indicates the creation of a function. 

    The second segment is the effect example which will run code from the first segment. You might be able to see why this is so usefull

    TIP: Don't put an effect by itself! This is only done for the sake of simplicity.

    2. Variables

    Phew! That was a lot to swallow! Don't worry, it takes time. You'll be able to master basic Skript before you know it.

    So. Variables. Variables are crucial to making a good server.

    Why? Don't worry. I'll tell you.

    Variables are nuggets of code that store information for immediate or later use.

    You can "create" a variable by setting it.

    Example: set {test} to 30

    The variable {test} now exists in your server. When you type /send "%{test}%" (notice the use of expressions to visualize the variable!), A message will send returning "30".

    This is a basic variable. Let's step it up!

    The three types of variable are standard variables, player-specific variables, and lists.

    EX. Of a standard variable: {variable}

    EX. Of a player-specific variable: {variable::%player's uuid%} or {variable::%player%}

    EX. of a list: {variable::*}

    Player-specific variables are set to apply to every player, or every player's Universally Unique Identifier. (UUID)

    They're optimal for balances and stats.

    List variables store multiple terms within one variable.

    They are great for making a list of players or a queue.

    3. MAKING CODE!

    After all the information you read, we can finally put our newfound knowledge to USE!

    To make a new script, go to your Minehut dashboard, navigate to your server, click File Manager -> Plugins -> Skript -> scripts.

    If you haven't installed Skript, type "Skript" in the plugin search.

    Let's make a command. The format for making a command is shown below/

    215050512_ScreenShot2021-05-06at5_29_05PM.png.d67561c385189b388c3d5e2a09eeafcd.png

    Next, when you add code to a command, indent by your preferred indentation style. My personal preference is one press of the TAB key.

    Indent, and append "trigger:", like so.

    1465866969_ScreenShot2021-05-06at5_30_44PM.png.db57a67696c32272d0213bcdb6b673e3.png

    Time to add our code! Remember to utilize the 4 elements of skript in your command whenever possible. (Events aren't used in commands).

    Let's make a command that sends a message to all players, delays, and then sends a title to YOU.

    556294466_ScreenShot2021-05-06at5_33_22PM.png.97408ec7a8fceb5bb94fba9b7ed9440a.png

    It's easy to read Skript code, and you can understand what goes on.

    A live demonstration of the command is at the bottom of this post.

     

    1. BanditEagle

      BanditEagle

      Although this is a decent tutorial, I suggest doing something like this in one of the following so more people see it (as it's kind of hard to find stuff like this when it's posted on people's profiles):

      Script Discussion: https://forums.minehut.com/forum/18-discussion/

      General: https://forums.minehut.com/forum/4-general/

      Hope this helps!

  2. The images below are evidence of BoatFly used in the lobby.
  3. When i select "New topic" and go to the "Report & Apeals - Informtion" category, everything under that is greyed out and i can't click it. Is this intentional?
×
×
  • Create New...