Saving variables to items

  • 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 community!

    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.

RaikaS

Active Member
Apr 6, 2018
53
1
0
Skript Version: Skript 2.2
Skript Author: Bensku
Minecraft Version: 1.12.2
---
Full Code:
I dont have any code but i need a way to save variables to items
 
Last edited:
You can save an item by doing
Set {_} to player’s tool
Or you can give a saved item by typing
Give player {_}
 
Raika, I guess it all depends what the variable is you're wanting to add to the item, and where you want to add it.
Example, if the variable is a players XP points, and you want to add it to an item, you could add it to the lore of said item.
Can you give us a little more info?
 
I need {%item%.saaty} (player's job)
[doublepost=1524380897,1524380645][/doublepost]
You can save an item by doing
Set {_} to player’s tool
Or you can give a saved item by typing
Give player {_}
Uhh. How i can send the variable what i saved to item?
 
It sends it to player when he rightclicks a book named "Henkilötodistus: %saved player name%
 
like you want to send the variable to the player when they click the book?
As a message?
You could do something like
code_language.skript:
on right click of book:
    if name of book is "name here":
        send "%{variable}%" to player
 
Edit this :emoji_grinning:D

code_language.skript:
command /henkkarit [<player>]:
    description: Anna henkkarit
    usage: /henkkarit <pelaaja>
    permission: kaupungit.henkkarit
    permission message: Sinä et voi antaa henkilötodistuksia
    executable by: players
    trigger:
        if arg-1 is not set:
            send "Sinun pitää valita kenelle annat nämä"
        else if player's tool is not a book:
            send "Sinulla ei ole kirjaa"
        

        else:
            player's tool is book
            set {henkkaripelaaja} to arg-1
            remove player's tool from player
            set {_book} to book named "Henkilötodistus: %arg-1%"
            set {henkkaripelaaja} to {_book}
            give {_book} to player
            send "<blue>Henkilötodistuksesi on luotu"
            send "Henkkarit annettu"
            
every 10 seconds in "Maailma":
    loop all players:
        if {%loop-player's uuid%.saaty} is not set:
            set {%loop-player's uuid%.saaty} to "Asukas"
        
        if loop-player has permission "saaty.aatelinen":
            set {%loop-player' uuid%.saaty} to "Aatelinen"

on rightclick:
    player's tool is book named "Henkilötodistus: %player%"

    send "Nimi: %{_book}%"
    send "Sääty: %{_book.saaty}%"
    send "Koti: Ei määritetty"
    send "Asuinpaikkakunta: Ei määritetty"
on rightclick with stick:
    add 1 to data value of the clicked block
    send "%data value of clicked block%"
 
Oy, this will be hard as i dont understand half of that due to the language, but any variable that starts with an underscore ie: {_book} is a local variable, and is only set for that event.... so when you set it in your command, it can not be called upon in your right click event, because the variable would only be local to the command
 
Status
Not open for further replies.