Skript: 2.2-dev36 | has and doesn't have not working on functions

Created on 14 Jun 2018  ·  11Comments  ·  Source: SkriptLang/Skript

command /testfunction:
    trigger:
        testfunction(executor)

function testfunction(e: offline player):
    {_e} doesn't have tnt
    send "notnt" to {_e}

not returning value also if executor has tnt
the same for the opposite (has)

bug completed needs-testing medium

All 11 comments

Duplicate of https://github.com/SkriptLang/Skript/issues/1287, also there is a workaround ^^

I don't need to return boolean values ._.

This was just a testfunction, but in the real one where I also have this problem and I won't split it in 1921482194215219581952189 functions that return a boolean so that I also have to manage the response to these boolean if true in all events where I use these 192418521952195912 functions xD

Really man, it must work, can bensku fix this in next version release and soon please? c.c

Readed, doesn't work.

Get my workaround code there and use it for now.

command /hi:
    trigger:
        set {_x} to player
        if {_x} has stone:
            message "yes"
        else:
            message "no"

The problem is that in CondContains the container is a CraftPlayer, aka it's neither an Inventory nor a String nor a Variable, and a default return false; at the end of the check method is executed

1287 is unrelated since the syntax used here is "%inventories% ha(s|ve) %itemtypes% [in [(the[ir]|his|her|its)] inventory]" (no expressions that accept multipe types). There is an Entity -> Inventory converter, but I believe the following line causes it to be ignored

https://github.com/SkriptLang/Skript/blob/b11c6e8a59f9546f217d0268599842a06c65b6f1/src/main/java/ch/njol/skript/conditions/CondContains.java#L70

This issue should be reopened.

Re-opened and labelled, thanks for the analysis Nico.

I think this is fixed? When i use the code of Nicofisi and do /hi without having stone i get "no".
When i have stone it says yes. So i think its fixed?

Tested both Nico's command as well as Sitieno's command, both work.

Im guessing this was fixed somewhere along the line.

Was this page helpful?
0 / 5 - 0 ratings