help me with / Stack Command

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

GK_Nico

Member
Jan 6, 2019
31
0
0
32
Hey could anyone help me with / Stack Command?
Unfortunately, do not get it and now I would like to ask you if who knows how to do it!



PS: And please not only read but also give a tip!
 
For example, in essentials there is yes / stack command can you do with a script?
I'm not a friend of essentials
 
stack the items in the inventory for example player x gives "/ stack" and all the same items stack up i have no code to do it because i cant get it!
 
Here's an example

Code:
command /stack [<text>]:
    permission: system.stack
    permission message: &7[&eSkyBlock&7] &cDu hast keine Rechte dazu.
    trigger:
        send "&7[&eSkyBlock&7] &7Deine Items wurden gestackt!"
        stack items of player's inventory


Here again an example user x has in slot 1 Stone and in 4 again Stone as man knows it at essentials can enter /stack and thus stack the items
 
Emmmmmm, I understanded, I'll make it and i'll reply Asap
[doublepost=1570828153,1570828009][/doublepost]Yo, Should i set {@prefix} for you to do not keep Writing The Prefix Many Times?
 
code_language.skript:
options:
    prefix:    &7[&eSkyblock&7]
command stack [<text>]:
    permission: system.stack
    permission message: &7[&eSkyBlock&7] &cDu hast keine Rechte dazu.
    trigger:
        if arg 1 is set:
            set {_item} to arg 1 parsed as item
            set {_slot} to 0
            loop 36 times:
                if slot {_slot} of player is {_item}:
                    set {SB.Main::%player%} to {_slot}
                    stop loop
                add 1 to {_slot}
            set {_slotv2} to {SB.Main::%player%}
            loop 36 times:
                if {SB.Main::%player%} is set:
                    if slot {_slotv2} of player is {_item}:
                        set {_THERE::%{_slotv2}%::NUMBER} to {_slotv2}
                        set {_THERE::%{_slotv2}%} to slot {_THERE::%{_slotv2}%::NUMBER} of player
                       
                        set slot {_THERE::%{_slotv2}%::NUMBER} of player to air
                        give player {_THERE::%{_slotv2}%}
                else:
                    send "{@prefix} Item Not found, Make sure that you've typed the name correctly or You don't have it"
                    stop trigger
                add 1 to {_slotv2}
            send "{@prefix} Successfully Stacked Your Items!"
            clear {SB.Main::%player%}
               
        else:
            send "{@prefix} Select an item"
[doublepost=1570871287,1570830628][/doublepost]Update: Added "all" method stack all items at once
code_language.skript:
options:
    prefix:    &7[&eSkyblock&7]
command stack [<text>]:
    permission: system.stack
    permission message: &7[&eSkyBlock&7] &cDu hast keine Rechte dazu.
    trigger:
        if arg 1 is set:
            if arg 1 is not "all":
                set {_item} to arg 1 parsed as item
                set {_slot} to 0
                loop 36 times:
                    if slot {_slot} of player is {_item}:
                        set {SB.Main::%player%} to {_slot}
                        stop loop
                    add 1 to {_slot}
                set {_slotv2} to {SB.Main::%player%}
                loop 36 times:
                    if {SB.Main::%player%} is set:
                        if slot {_slotv2} of player is {_item}:
                            set {_THERE::%{_slotv2}%::NUMBER} to {_slotv2}
                            set {_THERE::%{_slotv2}%} to slot {_THERE::%{_slotv2}%::NUMBER} of player
                           
                            set slot {_THERE::%{_slotv2}%::NUMBER} of player to air
                            give player {_THERE::%{_slotv2}%}
                    else:
                        send "{@prefix} Item Not found, Make sure that you've typed the name correctly or You don't have it"
                        stop trigger
                    add 1 to {_slotv2}
                send "{@prefix} Successfully Stacked: &e%{_item}%&7!"
                clear {SB.Main::%player%}
            else:
                set {_slot} to 0
                loop 36 times:
                    if slot {_slot} of player is not air:
                        set {_slotN::%{_slot}%} to {_slot}
                        loop {_slotN::*}:
                            if slot {_slotN::%loop-value-2%} of player is slot {_slot} of player:
                                set {_slotM::%loop-value-2%} to {_slot}
                                loop 36 times:
                                    set {_SLOTTOGIVE} to slot {_slotM::%loop-value-2%} of player                           
                                    set slot {_slotM::%loop-value-2%} of player to air
                                    give player {_SLOTTOGIVE}
                    add 1 to {_slot}               
                send "{@prefix} Successfully Stacked Your Items!"
        else:
            send "{@prefix} Select an item or type ""all"""
 
Status
Not open for further replies.