Solved Upgrading System

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

WiebeHero

Active Member
Aug 23, 2017
135
5
0
23
So i have FINALLY figured out how to do this upgrading system thing like finally god XD.
But now here is the thing with this.
Could this be made in easier and shorter code?
Best regards, WiebeHero.
Code:
Code:
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 0 / 2":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 1 / 2"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 1 / 2":
                cancel the event
                set cursor of player to air
                remove clicked item from player's inventory
                give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:10.0,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.6,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 2]" with lore "&7Confusion II||&7---------------------||&7Attack Damage: 10||&7Attack Speed: 0.4||&7---------------------||&7Upgrade Progress: 0 / 4||&7Rarity: Common" 
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 0 / 4":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 1 / 4"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 1 / 4":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 2 / 4"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 2 / 4":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 3 / 4"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 3 / 4":
                cancel the event
                set cursor of player to air
                remove clicked item from player's inventory
                give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:8.5,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 3]" with lore "&7Confusion III||&7---------------------||&7Attack Damage: 8.5||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 10||&7Rarity: Common" 
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 0 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 1 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 1 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 2 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 2 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 3 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 3 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 4 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 4 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 5 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 5 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 6 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 6 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 7 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 7 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 8 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 8 / 10":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 9 / 10"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 9 / 10":
                cancel the event
                set cursor of player to air
                remove clicked item from player's inventory
                give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:10,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 4]" with lore "&7Confusion IV||&7Blast I||&7---------------------||&7Attack Damage: 10||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 20||&7Rarity: Common" 
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 0 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 1 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 1 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 2 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 2 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 3 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 3 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 4 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 4 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 5 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 5 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 6 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 6 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 7 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 7 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 8 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 8 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 9 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 9 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 10 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 10 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 11 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 11 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 12 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 12 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 13 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 13 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 14 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 14 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 15 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 15 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 16 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 16 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 17 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 17 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 18 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 18 / 20":
                cancel the event
                set the 7th line of lore of clicked item to "&7Upgrade Progress: 19 / 20"
                set cursor of player to air
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 19 / 20":
                cancel the event
                set cursor of player to air
                remove clicked item from player's inventory
                give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:12,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 5]" with lore "&7Confusion IV||&7Blast II||&7---------------------||&7Attack Damage: 12||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 50||&7Rarity: Common"
 
why are you using a lot "on inventory click" you can do shorter with else if?

example:

code_language.skript:
on inventory click:
    if cursor slot of player is stone hoe:
        if lore of cursor slot of player contains "&7Upgrade Progress: 0 / 2":
            if lore of clicked item contains "&7Upgrade Progress: 0 / 2":
                cancel the event
                set the 6th line of lore of clicked item to "&7Upgrade Progress: 1 / 2"
                set cursor of player to air
            else if lore of clicked item contains "&7Upgrade Progress: 1/2":
                cancel event

#P.S i will go to shower, and maybe i can try to post full code shorter.


#edit

There you go

code_language.skript:
on inventory click:
    cursor slot of player is stone hoe
    lore of cursor slot of player contains "&7Upgrade Progress: "
    lore of clicked item contains "&7Upgrade Progress: "
    cancel event
    set {_I::*} to lore of clicked item split at "||"
    set {_L::*} to lore of cursor slot of player split at "||"
    loop {_I::*}:
        if "%loop-value%" contains "&7Upgrade Progress: ":
            set {_t} to loop-index parsed as integer
            stop loop
    loop {_L::*}:
        if "%loop-value%" contains "&7Upgrade Progress: ":
            set {_s} to loop-index        
            stop loop
    set {_L} to "%uncolored {_L::%{_s}%}%"
    set {_I} to "%uncolored {_I::%{_t}%}%"
    replace every "Upgrade Progress: " with "" in {_L}
    replace every "Upgrade Progress: " with "" in {_I}
    replace every " " with "" in {_L}
    replace every " " with "" in {_I}
    set {_B::*} to {_I} split at "/"
    set {_A::*} to {_L} split at "/"
    set {_N} to {_A::1} parsed as number
    set {_M} to {_A::2} parsed as number
    set {_O} to {_B::1} parsed as number
    set {_P} to {_B::2} parsed as number
    {_n} is 0
    {_m} is 2
    set cursor of player to air
    add 1 to {_o}
    if {_o} is more than or equal to {_p}:
        send "lvl up "
        remove clicked item from player's inventory
        if {_p} is 2:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:10.0,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.6,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 2]" with lore "&7Confusion II||&7---------------------||&7Attack Damage: 10||&7Attack Speed: 0.4||&7---------------------||&7Upgrade Progress: 0 / 4||&7Rarity: Common"
        else if {_p} is 4:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:8.5,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 3]" with lore "&7Confusion III||&7---------------------||&7Attack Damage: 8.5||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 10||&7Rarity: Common"
        else if {_p} is 10:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:10,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 4]" with lore "&7Confusion IV||&7Blast I||&7---------------------||&7Attack Damage: 10||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 20||&7Rarity: Common"
        else if {_p} is 20:
            give player a unbreakable glowing stone hoe with nbt "{AttributeModifiers:[{AttributeName:""generic.attackDamage"",Name:""generic.attackDamage"",Amount:12,Operation:0,UUIDLeast:324464,UUIDMost:154531,Slot:""mainhand""},{AttributeName:""generic.attackSpeed"",Name:""generic.attackSpeed"",Amount:-3.4,Operation:0,UUIDLeast:8055,UUIDMost:772149,Slot:""mainhand""}]}" named "&7Stone Club [Lv 5]" with lore "&7Confusion IV||&7Blast II||&7---------------------||&7Attack Damage: 12||&7Attack Speed: 0.6||&7---------------------||&7Upgrade Progress: 0 / 50||&7Rarity: Common"
    else:
        set the {_t}th line of lore of clicked item to "&7Upgrade Progress: %{_o}% / %{_p}%"
 
command /item:
    trigger:
        loop 30 times:
            give player stone hoe named "SOLVED!" with lore "||||||||||&7Upgrade Progress: 0 / 2"

#more edit:

Just remain, I tested already over 5 level, but after 50 stone hoe putting, it will remove just for ever... just keep for it just only change your lore "Your progress" into Empty or "Max level" or what ever! but not "Your Progress:"!

if you want keep level contiue just remain to add there
code_language.skript:
else if {_p} is 50:#Requried of tools
    give player stick named "New stuff or contiue what ever you did."
 
Last edited:
Hello there, i just want to thank you you made a little boy very happy today (ME) and i really appericiate it! This helped me out so much that what i thought was impossible is possible! Thank you!
 
skellett i believe.
I am using skellet and many more addons and I still receive this error (copying and pasting code from above)
https://gyazo.com/b2acdd768858768aec44963413849a67
[doublepost=1508372363,1508372214][/doublepost]
I am using skellet and many more addons and I still receive this error (copying and pasting code from above)
https://gyazo.com/b2acdd768858768aec44963413849a67
nvm I got it, it was saying an error but it worked in game
 
Easy way to find your missing addons its, Open Skunity, go to documentions, and type in searchbar "Cursor" and there you go... its tell SkMoraz (Hmmm i wonder i don't have it) maybe mundo
https://docs.skunity.com/syntax/search/Cursor
Right, got that new addon thanks, but I have come across a new error, well not an error since nothing comes up and the skript loads fine.
The skript just won't send the message "hi"
code_language.skript:
on inventory click:
    set {cursor.%player%} to cursor item of player
    set {inventory.item.%player%} to clicked item name
    if name of {inventory.item.%player%} = "Wooden Pickaxe":
        if name of {cursor.%player%} is "&eEnchant Dust":
            if lore of {cursor.%player%} contains "&7Enchant":
                message "hi"
                stop

command /test:
    trigger:
        give player glowing glowstone dust with name "&eEnchant Dust" with lore "&7Enchant"

EDIT: Solved lol, I instantly come to forums when something doesn't work, its a really bad habit :emoji_frowning:
 
Status
Not open for further replies.