Open Book not working

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

ILikeToLearnStuff

New Member
Aug 10, 2017
7
0
0
24
Hi! So I'm trying to make a /rules command, and the basic idea is that when you type /rules a book opens with the rules.

I found this code to use with Skellett on the forums, so I put it in my .sk file and reload it.
I wrote a quick book with some random text in it and signed it. Then I typed /setrulebook and then /rules. Nothing happens. I've looked att the forums and the documentation and I haven't been able to find a solution.

Skript Version: 2.2-dev29
Minecraft Version: 1.12.1 running latest build of Spigot
---
Full Code:

code_language.skript:
command /setrulebook:
  trigger:
    set {_book} to player's tool

command /rules:
  trigger:
    open {_book} to player

Errors on Reload: None


Console Errors: None

Addons using (including versions):

WildSkript: Can't find version number? But I downloaded it today so it is the latest.

Skellett: (Best addon ever) Version 1.9.6

Have you tried searching the docs? Yes.
Have you tried searching the forums? Yes. For a long time.
What other methods have you tried to fix it? I don't have a clue what the problem is so I haven't been able to try to fix it.
 
in your code specifically you're setting the tool to a local variable which will not work outside it's own command. it may not be the full problem but to make a variable work in another command or code it would need to be {book} rather than {_book}
[doublepost=1502383384,1502383003][/doublepost]just looking at the syntax for opeing a book client side it looks like its meant to be done in a single command This is one of the examples on the skellet page. For this you'd only need your /rules command, then define your rules in the add page section of the code
code_language.skript:
command /openBook:
    trigger:
        set {_item} to slot player's current hotbar slot of player
        set slot player's current hotbar slot of player to a written book
        add page "&4&l&m-&a&l*&4&l&m__ &2&l&nSkellett&4&l&m __&a&l*&4&l&m-&r%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%           &dHot" to player's tool
        open book player's tool to player
        set slot player's current hotbar slot of player to {_item}
 
in your code specifically you're setting the tool to a local variable which will not work outside it's own command. it may not be the full problem but to make a variable work in another command or code it would need to be {book} rather than {_book}
[doublepost=1502383384,1502383003][/doublepost]just looking at the syntax for opeing a book client side it looks like its meant to be done in a single command This is one of the examples on the skellet page. For this you'd only need your /rules command, then define your rules in the add page section of the code
code_language.skript:
command /openBook:
    trigger:
        set {_item} to slot player's current hotbar slot of player
        set slot player's current hotbar slot of player to a written book
        add page "&4&l&m-&a&l*&4&l&m__ &2&l&nSkellett&4&l&m __&a&l*&4&l&m-&r%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%           &dHot" to player's tool
        open book player's tool to player
        set slot player's current hotbar slot of player to {_item}

Thanks. But I would like to be able to edit the book ingame. Also i dident have the "_" in the variable at first. So removing that wont help since that was how it was at first.
 
the "_" will still matter when you have a working syntax. local variables are created on command use, so {_book) will always have a have a value of "none" when you execute your second command because it's being newly created and doesnt keep from your previous command.

You may try this though, you need the addon MundoSk, but you might be able to have your setrulebook command set a variable to the page of your rule book, then in your /rules command replace the actual text in the add page section to the value of that variable.
set {book} to %page 1 of player's tool%
4e499566a3.png

a54a3efc22.png
 
  • command /openBook:
  • trigger:
  • set {_item} to slot player's current hotbar slot of player
  • set slot player's current hotbar slot of player to a written book
  • add page "&4&l&m-&a&l*&4&l&m__ &2&l&nSkellett&4&l&m __&a&l*&4&l&m-&r%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl%%nl% &dHot" to player's tool
  • open book player's tool to player
  • set slot player's current hotbar slot of player to {_item}

I used that code and it gave me a bunch of errors. See attached image
hhSAHF
https://ibb.co/hhSAHF
 
remember you need mundosk, and you only need to change the add page section of the second command. You don't however need the percent's in the first command like I had at first, i just tested this and it works for me with two commands the way you wanted it:emoji_slight_smile:
code_language.skript:
command /test:
    trigger:
        set {book} to page 1 of player's tool
       
command /openBook:
    trigger:
        set {_item} to slot player's current hotbar slot of player
        set slot player's current hotbar slot of player to a written book
        add page "%{book}%" to player's tool
        open book player's tool to player
        set slot player's current hotbar slot of player to {_item}
e9ba5bbc1b.jpg
 
Still does not work for me. I just installed Mundosk and restarted the server :emoji_frowning:
my skellet version is 1.9.5, if that helps. And I just downloaded mundosk so it's the latest of that. There shouldn't be any other addons required that I know of(though I do have just about all of them by nowXD) It's still working just fine for me though.
 
Status
Not open for further replies.