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.

"open book" does not work [Skellett]

Discussion in 'Skript' started by Hibrocolomedio, Dec 16, 2017.

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

    Joined:
    Dec 14, 2017
    Messages:
    18
    Likes Received:
    0
    Hello!
    I am trying to make a Skript that opens a virtual book for the help page. I am trying to make a skript for making these books, but it does not work. I have searched and found this: https://forums.skunity.com/threads/open-book-w-text.2625/ where @LimeGlass put how to make the book item into a variable than open that book up, however it's not working. Is this a bug with Skellett or did I do something wrong?

    Skript Version: Skript by Bensku (Latest)
    Skript Author: Bensku
    Minecraft Version: Spigot 1.12.2
    Full Code:
    Code (Skript):
    1. command /createbook <text>:
    2.     trigger:
    3.         set {book.%arg 1%} to player's tool
    4.  
    5. command /openbook <text>:
    6.     trigger:
    7.         open book {book.%arg 1%} to player
    Addons using (including versions):
    Skellett (latest version)

    Have you tried searching the docs? Yes
    Have you tried searching the forums? Yes
    What other methods have you tried to fix it? None.
    --- Double Post Merged, Dec 16, 2017, Original Post Date: Dec 16, 2017 ---
    open book does actually work, it looks like the problem is with setting the book to the player's tool. Did I do that wrong?
     
  2. XxMartuixX

    XxMartuixX Member

    Joined:
    Mar 15, 2017
    Messages:
    4
    Likes Received:
    0
    Try this:

    Code (Skript):
    1. command /openbook <text>:
    2.     trigger:
    3.         set {_i} to player's tool
    4.         set player's tool to {book.%arg 1%}
    5.         open player's tool to player
    6.         set player's tool to {_i}
    or

    Code (Skript):
    1. command /openbook <text>:
    2.     trigger:
    3.         open book {book.%arg 1%} to the player
     
  3. LimeGlass

    Supporter Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    605
    Likes Received:
    419
    Medals:
    The coding is very finicky. The NMS packet only accepts an ItemStack of NMS, not a craftbukkit ItemStack and not a ItemType (Skript's custom aliases) Skellett does it's best to try and convert it to what the NMS packet for opening the book wants, it doesn't always work the greatest. The main issue that arises is that most of the time an ItemType is cast in the syntax. So like

    Code (Skript):
    1. set {_itemType} to diamond
    2.  
    3. Vs
    4.  
    5. set {_itemStack} to player's tool
    And sometimes Skript converts ItemStack's to ItemType's if they're simple and blank (No lore, no name etc, just raw item)

    There is a syntax to create a new book which this syntax supports if you want to create and setup a book. It's designed to work well with the open book effect.

    Code (Skript):
    1. set {_book} to new written book
    2. add a page with text "Hello" to book {_book}
    3. set author of book {_book} to "&aLime"
    4. set page 1 in book {_book} to "&6Hello testing"
    5. open book {_book} to player
    If you're looking for how to create clickable things, like links or add the ability to execute a command when someone clicks a word in the book, you can check out Skellett update #122: https://forums.skunity.com/resources/skellett-the-addon-with-a-beast-name.24/update?update=499
     
Thread Status:
Not open for further replies.
Loading...