Solved Anvil GUI click/variable issue

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

Wynnevir

Well-Known Member
Jul 9, 2017
1,015
62
48
30
Elsewhere
Skript Version: Skript 2.2 (dev30d)
Skript Author: Bensku
Minecraft Version: 1.12.1
---
What I'm trying to accomplish is a gui option in a virtual chest that opens an anvil gui where a player can name there pet. The gui portions work just fine, the issue comes in taking the input name or event-string and executing the command to name the pet with it as a variable specifically for the third slot. If I click the 1st slot with the named name tag it will execute the command just fine.

code_language.skript:
on load:
    create a gui with id "name pet" with virtual anvil:
        make next gui with name tag named "Choose a Name"
   
command /test:
    trigger:
        open gui "pets" to player
       
on inventory click:
    if clicked item is name tag:
        cancel event
        set {_name} to "%name of clicked item%"
        make player execute command "/mp name %{_name}%"

When you type in the gui of course another name tag appears in the third slot with the name you typed, but clicking it just makes it disappear, while clicking on the name tag "Choose a Name" will name your pet "Choose a Name".

Troubleshooting:
I did also try using the on anvil rename event first, as referenced in some of the other anvil gui posts here, and while it had no errors it also did nothing. Only doing it that way didn't event execute the command when the first name tag is clicked. This was the code with that event:
code_language.skript:
on anvil rename:
    cancel event
    set {_name} to event-string
    make player execute "/mp name %{_name}%"


Addons:
SkQuery, WolvSK, SkAction, MundoSK, skUtilities, SkStuff, skRayFall, Skellet, TuSKe
All up to date, I re-downloaded all of them in troubleshooting

The /mp name <name> command is from the plugin MiniPets

Been working with this one a while, any help is greatly appreciated!^-^
**Edit: Will update with working code for anybody else with the same problem once I figure it out
 
Last edited:
Skript Version: Skript 2.2 (dev30d)
Skript Author: Bensku
Minecraft Version: 1.12.1
---
What I'm trying to accomplish is a gui option in a virtual chest that opens an anvil gui where a player can name there pet. The gui portions work just fine, the issue comes in taking the input name or event-string and executing the command to name the pet with it as a variable specifically for the third slot. If I click the 1st slot with the named name tag it will execute the command just fine.

code_language.skript:
on load:
    create a gui with id "name pet" with virtual anvil:
        make next gui with name tag named "Choose a Name"
  
command /test:
    trigger:
        open gui "pets" to player
      
on inventory click:
    if clicked item is name tag:
        cancel event
        set {_name} to "%name of clicked item%"
        make player execute command "/mp name %{_name}%"

When you type in the gui of course another name tag appears in the third slot with the name you typed, but clicking it just makes it disappear, while clicking on the name tag "Choose a Name" will name your pet "Choose a Name".

Troubleshooting:
I did also try using the on anvil rename event first, as referenced in some of the other anvil gui posts here, and while it had no errors it also did nothing. Only doing it that way didn't event execute the command when the first name tag is clicked. This was the code with that event:
code_language.skript:
on anvil rename:
    cancel event
    set {_name} to event-string
    make player execute "/mp name %{_name}%"


Addons:
SkQuery, WolvSK, SkAction, MundoSK, skUtilities, SkStuff, skRayFall, Skellet, TuSKe
All up to date, I re-downloaded all of them in troubleshooting

The /mp name <name> command is from the plugin MiniPets

Been working with this one a while, any help is greatly appreciated!^-^
Pretty sure this is just how anvil guis work in tuske but I could be wrong. IIRC spigot/bukkiy have had/do have shitty fake anvil/enchant table support. It probably works if you did it by packet items and opening the gui with packets. I have a script that can do this but I have no idea if it works on anything besides 1.8
 
Pretty sure this is just how anvil guis work in tuske but I could be wrong. IIRC spigot/bukkiy have had/do have shitty fake anvil/enchant table support. It probably works if you did it by packet items and opening the gui with packets. I have a script that can do this but I have no idea if it works on anything besides 1.8
Darn it, It was probably about time I learned how to use packets anyway x) thanks
 
Status
Not open for further replies.