Solved Execute function from gui -- HELP

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Jeroeno_Boy

Active Member
Jun 2, 2017
61
2
8
24
i have problems with executing funtions from a gui

code_language.skript:
Format slot 22 of player with 1 nametag named "Name" with lore "lore" to close then run [execute function "function"]

Please help
 
Or use TuSKe's GUI Manager, which is easy to use if you already used skQuery and can easily run functions.

@ThinkingAboutIt I consider both ways to be about equal but different in use context. So, for the sake of it, could you show the two different ways ?
 
code_language.skript:
command /open:
    trigger:
        open chest with 6 rows named "&4&lExample" to player
        set slot 22 of player's current inventory to a nametag named "Name" with lore "lore"

on inventory click:
    if inventory name of player's current inventory is "&4&lExample":
        cancel event
        if clicked slot is 22:
            function(player)
 
Or use TuSKe's GUI Manager, which is easy to use if you already used skQuery and can easily run functions.

@ThinkingAboutIt I consider both ways to be about equal but different in use context. So, for the sake of it, could you show the two different ways ?
@LimeGlass has already shown it using set slot, however I haven't used format slot in a long time and do not know if it is even supported fully anymore.
 
@LimeGlass has already shown it using set slot, however I haven't used format slot in a long time and do not know if it is even supported fully anymore.
TuSKe =/= format slot. TuSKe and fully supported and functional.
Using regular GUI Manager :
code_language.skript:
open virtual chest inventory with size 6 named "Example GUI"
make gui slot 22 of player with  nametag named "Name" with lore "lore" to close then run function functionName(arguments)
Using GUI Manager v2 (since 1.7.5 or 1.7.7) :
code_language.skript:
create new gui with virtual chest with 6 rows named "Example":
    make gui slot 22 with nametag named "Name" with lore "lore":
        functionName(arguments)
open last gui to player
 
TuSKe =/= format slot. TuSKe and fully supported and functional.
Using regular GUI Manager :
code_language.skript:
open virtual chest inventory with size 6 named "Example GUI"
make gui slot 22 of player with  nametag named "Name" with lore "lore" to close then run function functionName(arguments)
Using GUI Manager v2 (since 1.7.5 or 1.7.7) :
code_language.skript:
create new gui with virtual chest with 6 rows named "Example":
    make gui slot 22 with nametag named "Name" with lore "lore":
        functionName(arguments)
open last gui to player
I think alot of people are going to move over to set slot now. The GUI v2 is too complex for most people.
 
I think alot of people are going to move over to set slot now. The GUI v2 is too complex for most people.
I agree, it looks cool and can do cool things but it's look also goes against how the majority of skript looks, especially with the indents and colons.

edit: I don't agree most will use set slot, but that the GUI v2 looks intimidating to most (but it is the more advanced option because the other is still around)
 
I agree, it looks cool and can do cool things but it's look also goes against how the majority of skript looks, especially with the indents and colons.

edit: I don't agree most will use set slot, but that the GUI v2 looks intimidating to most (but it is the more advanced option because the other is still around)

But that's the main idea. You can use both. Both will be together and work nice, it is just in case you have issues with loading time from Skript issue, which most of times only happens with low servers.
Also, the indentation idea is not much complex imo, it is a thing already present in Skript and we shouldn't lock at same way to make scripts. Maybe, if Skript lives longer, its syntax and ways of code will change, like every other language has its changes.

TL;DR: The v2 isn't a replacement, just more options which to make stuffs. The good one still present.
 
Last edited by a moderator:
But that's the main idea. You can use both. Both will be together and work nice, it is just in case you have issues with loading time from Skript issue, which most of times only happens with low servers.
Also, the indentation idea is not much complex imo, it is a thing already present in Skript and we should lock at same way to use Skript.

Maybe, if Skript lives longer, its syntax and ways of code will be change, like every other language has its changes.

TL;DR: The v2 isn't a replacement, just more options which to make stuffs. The good one still present.
Yeah, it's not complex but its a different idea for lots of people. I'm talking about how people aren't used indenting effects, but only events and conditions.
 
If you even consider them as effects. The v1 is still here, so people will not switch to another method whatsoever anytime.

@Tuke_Nuke You don't plan on removing the v1, do you ?
[doublepost=1496473710,1496473161][/doublepost]@LimeGlass Also, allowing to run code directly through a section superseds the argument of "it's unconvenient because you have to create a function/command for everything whereas set slot doesn't have that limitation"
 
code_language.skript:
command /open:
    trigger:
        open chest with 6 rows named "&4&lExample" to player
        set slot 22 of player's current inventory to a nametag named "Name" with lore "lore"

on inventory click:
    if inventory name of player's current inventory is "&4&lExample":
        cancel event
        if clicked slot is 22:
            function(player)
Thanks, it works :emoji_slight_smile:


btw love your vids <3
 
  • Like
Reactions: LimeGlass
Status
Not open for further replies.