function

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

  1. erenkara

    Addon SkCheese 1.2

    SkCheese is a Skript addon which adds Skript related syntaxes that will likely not make it to official Skript. | Source Code | Syntax Wiki | Documentation | Support | This addon was made and tested in Skript 2.7.3 and 2.8. It may work on other versions but it is not guranteed...
  2. I

    killed entity reward, have code, need to convert to a function

    have this code that I made by myself but I don't want to repeat so many lines for each type of entity, tried to transform the code into a function but... I suffer from serious skill issue. Can someone give me sample code from this? I need to have as "variables" the random amount of money ex...
  3. M

    Looping and making Gui slot with a function

    Hello there so i am trying to create a loop that create gui slots with different functions. But it cannot put the right information into the function part. format slot {_i} of player with skull of {_name} named "&r" with lore "%{_name}%&7&m-" to close then run [kauctiontest(player...
  4. V

    Functions are not working...

    Error: "test(P: player) is not a text" code: function depositAll(P: player): set {bank::%{_P}%} to {bank::%{_P}%} + {_P}'s balance set {_P}'s balance to 0 function depositHalf(P: player): set {_b} to {_P}'s balance / 2 set {bank::%{_P}%} to {bank::%{_P}%} + {_b} set {_P}'s...
  5. I

    Solved how to use Function(%player%)

    I want to make a confirmation skript an i want it to be in a function so it needs to have the player on inventory click: if event-inventory = (metadata tag "Rank" of player): if index of event-slot is 0: set {rank.%player%} to "default" confirm(%player%) if event-inventory =...
  6. sluhtie

    Most performant way to save data

    Hey, so I'm trying out for a while now what would be the most performant and efficient way to save player data. I came up with 4 different ways to do so. But now I wanted to ask what you guys think is the best way to do that. I sorted them from most performant to most unperformant. Method 1 -...
  7. M

    Script Outline GUI 1.1.0

    This script is a simple function. All you need to do in order to use this function is create a GUI, then format it as you like, and use this function to format the edges. Here is a simple example of how you could use this. command /outlinegui: permission: op trigger: set {_gui}...
  8. K

    Functions and communicating with the console

    Script Version: 2.6-beta3 Script Author: KiwiFruit555 (Me) Minecraft Version: 1.17.1 (Paper) The issue is that I need to send a message to the console if the one sending it was the console. There are no errors in the code, it just doesn't work. It stopped working when I tried to implement...
  9. B

    Solved Enchanted Book Stored Enchants

    set {_pord} to 70 set {_item} to player's tool set {_meta} to {_item}.getItemMeta() set {_ench} to {_meta}.getStoredEnchants() if {_ench} = `{Enchantment[minecraft:efficiency, DIG_SPEED]=1}`: (this is a snippet of my full script) Is there an...
  10. G

    Skript value going into minus

    Hey! Im really bad at explaining but its supposed to when i mine it just adds 1 experience and when i mine it just works and updates the xp but when i go after 127 it goes into minus (-127) and then counting like -126 -125 -124 and this keeps happening. Can someone help? Heres my full code...
  11. ClaasCode

    Solved UnparsedLiterals must be converted before us

    Hello, i get the Error from the title my Code: on break: if event-block is a gold block: addCoins(player, "Test", 5) function addCoins(name: player, message: text, amount: number = 1): set {_uuid} to uuid of {_name} send "%{_uuid}%" to console
  12. J

    Function to Mob Spawn depending on Room teleport

    So I wanna make it so custom mobs spawn in set locations depending on the room the players enter. For example if player Steve gets teleported to room 1, mobs spawn at locations A & B of the room 1. then Steve moves to room 2, mobs spawn at locations A & B of room 2. The thing is room teleport...
  13. J

    Solved Kitpvp gui help

    Hello! I'm a returning skript veteran, and I need a little help getting my head around function guis. Could someone give me an example or extract of a kitpvp gui, with functions. E.g format slot 10 of player with stone sword to run function (warrior, p:player) function(warrior): give 1 of...
  14. L

    Function on clicked slot

    How do i make that function remember the clicked item/slot? command /shop-halloween-299 <text>: trigger: if arg 1 is "enchanter": open virtual chest inventory with size 5 named "&aHey" to player on inventory click: if name of player's current inventory is "&aHey"...
  15. jeelzzz

    Solved Functions in GUIs using TuSKE

    I'm trying to make a shop gui, but it does not load the item in the gui because it does not return a value. My gui code: command /h: trigger: open virtual chest inventory with 6 rows named "&bShop" to player format gui slot 22 of player with steak named "&6Steak" with lore...
  16. T

    formated number function request

    Category: Function Suggested name: format.sk Spigot/Skript Version: 1.12.2 What I want: What I need is a function to format number (1k, 1m, 1b...) Ideas for commands: none Ideas for permissions: none When I'd like it by: A couple days
  17. T

    Function cant compare passed text to "string"

    i am trying to make chatcolor but there is some error in the function i have when i am trying to compare a argument passed to the function with text the argument is passed as text would be nice if anyone can help me ty Skript: newest 2.3 function Error: Can't compare "%{_c}% with a text (if...
  18. L

    Enchantment level through variable.

    Hello :emoji_slight_smile: I'm using a function through a GUI to declare the level of an enchantment, but this variable can have a lot of different values (from 0 to 36) and I wouldn't be able to list every single enchantment on the code, therefore I have to use this code: enchant {_p}'s tool...
  19. PatoFrango

    Key Generator

    This function generates a random key (using numbers and lower, upper case letters) with a given amount of characters. Code: function genKey(l: number) :: text: set {_abc} to "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuYvVwWxXyYzZ" loop {_l} times: set {_t} to random integer...
  20. Spartan9802

    subroutine and function

    Hello, I would like to know the difference between a subroutine and a function, can it be executed async?