"open book" does not work [Skellett]

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

Deleted member

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_language.skript:
command /createbook <text>:
    trigger:
        set {book.%arg 1%} to player's tool

command /openbook <text>:
    trigger:
        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.
[doublepost=1513444439,1513438421][/doublepost]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?
 
Try this:

code_language.skript:
command /openbook <text>:
    trigger:
        set {_i} to player's tool
        set player's tool to {book.%arg 1%}
        open player's tool to player
        set player's tool to {_i}

or

code_language.skript:
command /openbook <text>:
    trigger:
        open book {book.%arg 1%} to the player
 
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_language.skript:
set {_itemType} to diamond

Vs

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_language.skript:
set {_book} to new written book
add a page with text "Hello" to book {_book}
set author of book {_book} to "&aLime"
set page 1 in book {_book} to "&6Hello testing"
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
 
Status
Not open for further replies.