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