#Command doesent work

1 messages · Page 1 of 1 (latest)

potent shadow
#

you're not returning any values with the getHead function

icy meadow
potent shadow
#

but the getHead function doesn't return anything

icy meadow
potent shadow
#

return ...

icy meadow
#

like this

function getHead(item: text, return: boolean):: object:
    if {_item} is "yetihead":
        set {_item} to player head named "&r" with nbt from "{SkullOwner:{Id:[I;-123817,4104,121127,-8208],Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOThjNjk5ZTNhOGI0MGM2MWQ0YTM1OTA0MDRhZTliYTUyNjJhYjRhMzVkODQyZjI3MWFmNDEzZDdmNGQyMGY1YSJ9fX0=""}]}}}"
    if {_return}:
        return {_item}
potent shadow
#

why if {_return}?

#

don't you always want to return it?

#

otherwise the function is useless

icy meadow
#

so insted of if {_return} i will only do return {_item}?

potent shadow
#

you can just return the item instead of setting it to a variable and then returning it

icy meadow
#

okay

#

so like this

#
function getHead(item: text):: object:
    if {_item} is "yetihead":
        set {_item} to player head named "&r" with nbt from "{SkullOwner:{Id:[I;-123817,4104,121127,-8208],Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOThjNjk5ZTNhOGI0MGM2MWQ0YTM1OTA0MDRhZTliYTUyNjJhYjRhMzVkODQyZjI3MWFmNDEzZDdmNGQyMGY1YSJ9fX0=""}]}}}"
    return {_item}
potent shadow
#

no

#

don't set the item to a variable

#

just return it

icy meadow
#

okay

#

Line 850: (functions/itemfunction.sk)
[11:47:50 INFO]: The return effect can only be used in functions, custom expressions, sections, custom syntax parse sections and custom conditions
[11:47:50 INFO]: Line: return

potent shadow
#

code?

icy meadow
#

function getHead(item: text):: object:
if {_item} is "yetihead":
set {_item} to player head named "&r" with nbt from "{SkullOwner:{Id:[I;-123817,4104,121127,-8208],Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOThjNjk5ZTNhOGI0MGM2MWQ0YTM1OTA0MDRhZTliYTUyNjJhYjRhMzVkODQyZjI3MWFmNDEzZDdmNGQyMGY1YSJ9fX0=""}]}}}"
return

potent shadow
#

codeblocks

icy meadow
#
function getHead(item: text):: object:
    if {_item} is "yetihead":
        set {_item} to player head named "&r" with nbt from "{SkullOwner:{Id:[I;-123817,4104,121127,-8208],Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOThjNjk5ZTNhOGI0MGM2MWQ0YTM1OTA0MDRhZTliYTUyNjJhYjRhMzVkODQyZjI3MWFmNDEzZDdmNGQyMGY1YSJ9fX0=""}]}}}"
    return
icy meadow
potent shadow
#

you're still setting the item to a variable

potent shadow
icy meadow
potent shadow
#

check the 3rd line

icy meadow
#

nahhhh i check it now with return {_item} and now i am getting it

potent shadow
#

why are you still using the {_item} variable?

icy meadow
#

bro its working now

potent shadow
#

I just told you you're doing something pointless

icy meadow
potent shadow
#

wrong way: set {_item} to stone named "..." return {_item}
correct way: return stone named "..."

#

did you get it?

icy meadow
#

ye thanks