#How To Make It So You Can't Get Stacks

1 messages · Page 1 of 1 (latest)

mental marsh
#

**How Would I Make It So You Can't Wish For Stack Items **

mossy beacon
#

add a random nbt value to an item

mental marsh
#

what do u mean a random nbt value ?

mossy beacon
#

add nbt

#

that nbt being a random number

#

ex {random:%random number between 0 and 10000%}

mental marsh
mossy beacon
#

if is message parsed as quantity

#

only number types are integer and number

mental marsh
#

i think i fixed it but when i wish for an item it just gives/refund me back my wish token

mental marsh
#

do i still need the else:
send "No item name provided. Here's your Wish Token back."
give echo shard named "Wish Token" to player
delete {wish::%player's uuid%}

mental marsh
#

ik the issue is send "No item name provided. Here's your Wish Token back."

but idk how i would fix it

jolly marsh
#

can you send the current code in here

#

formatted with three `

mental marsh
#
    if {wish::%player's uuid%} is set:
        if (message parsed as itemtype) is set:
            if (message parsed as a number) is set:
                send "You can't wish for stacks of items. Here's your Wish Token back."
                give echo shard named "Wish Token" to player
                delete {wish::%player's uuid%}
            else:
                if (message parsed as an item type) is set:
                    if (message parsed as a number) > 1:

                send "Your wish has been granted! You received the requested item."
        else:
            if "No item name provided. Here's your Wish Token back."
            give echo shard named "Wish Token" to player
            delete {wish::%player's uuid%}```
jolly marsh
#

what is the message you are putting into chat

#

like steak 1?

mental marsh
#

i am trying to make the player wish for any item

jolly marsh
#

yeah i get that

mental marsh
#

o

jolly marsh
#

what im asking is how do you think skript is going to parse steak 1 as an example as both a number and an itemtype?

#

it wont be parsed as either bc its neither

#

for this youll probably have to split the message into a variable so that {_var::1} would be steak and {_var::2} would be 1

#

then parse those and see if its correct

#

do you get what im trying to say

mental marsh
#

kinda

jolly marsh
#

do you know how to split strings

mental marsh
#

i don't think so

jolly marsh
#

okay so youd do set x to split y at "z"

#

with those placeholders replaced with the actual values

mental marsh
#
    set {_messageParts} to split message at " "
    if {wish::%player's uuid%} is set:
        if {_messageParts} is set:
            if (the first item of {_messageParts} parsed as itemtype) is set:
                if (the second item of {_messageParts} parsed as a number) is set:
                    send "You can't wish for stacks of items. Here's your Wish Token back."
                    give echo shard named "Wish Token" to player
                    delete {wish::%player's uuid%}
                else if (the first item of {_messageParts} parsed as an item type) is set:
                    if (the second item of {_messageParts} parsed as a number) > 1:
                        send "Your wish has been granted! You received the requested item."
            else:
                send "No item name provided. Here's your Wish Token back."
                give echo shard named "Wish Token" to player
                delete {wish::%player's uuid%}```

like this ?
mental marsh
#

would i remove

                send "No item name provided. Here's your Wish Token back."
                give echo shard named "Wish Token" to player
                delete {wish::%player's uuid%} ```
mental marsh
#

Or would I leave it there ?

jolly marsh
#

message parts variable needs to be a list variable.

#

you cant store multiple values in a variable that can only hold one value.

mental marsh
#

is this right and i am getting a error but i am guessing first item of, does not exist

    set {_messageParts::*} to split message at " " 
    if {wish::%player's uuid%} is set:
        if first item of {_messageParts::*} is set:
            if (the first item of {_messageParts::*} parsed as item type) is set:
                if (the second item of {_messageParts::*} is a number) is set:
                    send "You can't wish for stacks of items. Here's your Wish Token back."
                    give echo shard named "Wish Token" to player
                    delete {wish::%player's uuid%}
                else if (the second item of {_messageParts::*} is a number) is set:
                    if (the second item of {_messageParts::*} > 1):
                        send "Your wish has been granted! You received the requested item."
            else:
                send "No item name provided. Here's your Wish Token back."
                give echo shard named "Wish Token" to player
                delete {wish::%player's uuid%}```
jolly marsh
#

yeah you can specify what object in a list variable you are trying to access via {_var::1}, {_var::2} etc

mental marsh
#

like this ?

    set {_messageParts::*} to split message at " " 
    if {wish::%player's uuid%} is set:
    if {_messageParts::1} is set:
        if ({_messageParts::1} parsed as item type) is set:  
            if {_messageParts::2} is a number:
                send "You can't wish for stacks of items. Here's your Wish Token back."
                give echo shard named "Wish Token" to player
                delete {wish::%player's uuid%}
            else if {_messageParts::2} is a number:
                if {_messageParts::2} > 1:
                    send "Your wish has been granted! You received the requested item."
        else:
            send "No item name provided. Here's your Wish Token back."
            give echo shard named "Wish Token" to player
            delete {wish::%player's uuid%}```
valid zealot
#

I would put what you have on line 3, on line two instead, and indent the new line 3

#

and instead of checking a message on chat, why not just put that into a command? like command wish [<itemtype>]

mental marsh