1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Command to open book with json text

Discussion in 'Skript' started by GamingGeek, Aug 3, 2017.

Thread Status:
Not open for further replies.
  1. G

    Supporter

    Joined:
    Aug 1, 2017
    Messages:
    46
    Likes Received:
    0
    Hi, I don't know whether this would be possible with Skript or not but I'm looking to recreate Hypixel's /nick feature. I want to have the command /nick open a book with text and when you click on a rank, it runs a command. I currently have this to open the book but it just says invalid book tag...

    Code (Skript):
    1.    
    2.    
    3. command /openBook:
    4.     trigger:
    5.         set {_item} to slot player's current hotbar slot of player
    6.         set slot player's current hotbar slot of player to a written book
    7.         open book player's tool to player
    8.         set slot player's current hotbar slot of player to {_item}
    9.  
    10.  
    Here is what I'm trying to achieve:
    [​IMG]
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,880
    Likes Received:
    127
    Syntax:
    Code (Skript):
    1. #Expressions:
    2.  
    3.     #Grab a new written book (Because Skript's is different)
    4.     [a] new [written] book
    5.  
    6. #TextComponent stuff
    7.  
    8.     #Create a new text component
    9.     [a] [new] text component [with [text]] %strings%
    10.  
    11.     #Add hover event stuff to the text component (When a player hovers their mouse over it)
    12.     add hover event with action %hovereventaction% (and|with) [(value|text)] %string% to [text component] %textcomponent%
    13.  
    14.     #Add clickable event stuff to the text component (When a player clicks the text)
    15.     add click event with action %clickeventaction% (and|with|to) [(execute|text|link)]  %string% to [text component] %textcomponent%
    16.  
    17.     #Add a page with the text component to a book
    18.     add text component %textcomponent% to [book] %itemstack%
    19.  
    20.     #Message the json text component (tellraw) to the player
    21.     message text component %textcomponent% to %players%
    22.  
    23.     #Works from 1.8-1.12 as tested
     
Thread Status:
Not open for further replies.
Loading...