Mirreski / Skript

Skript is a Bukkit plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
http://njol.ch/projects/skript
7 stars 2 forks source link

Name of {_variable} problems [V8b] #30

Closed Mirreski closed 9 years ago

Mirreski commented 9 years ago

Related: https://github.com/Mirreski/Skript/issues/14

Previously I fixed "name of {_itemstackVariable}" not working. But I noticed that if the variable is a player (or possibly a entity) then the expression fails to run and returns null.

command /testing2:  
    trigger:
        set {_test} to "Mirreducki" parsed as player
        set {_test2} to tool of player
        message "%name of {_test}%"
        message "%name of {_test2}%"

These returns <none> in Skript 2.1.2/2.2 but in my versions it returns <none> for the first and then the correct name for the second one.

Mirreski commented 9 years ago

Quick fixed. Real problem probably lies somewhere in the parser or anywhere deep.

Basicly, Skript thinks the variable is a itemstack even if it is a player and and then the converter fails to get the name of the player variable.

Pattern: [the] (display|nick|chat)[ ]name[s] of %slots/item stacks/living entities/players%

Seems to be because the pattern part "%itemstacks/slots/livingentities/players%" and therefore thinks the variable is a itemstack.

Fixed by altering "%itemstacks/slots/livingentities/players%" to "%objects%" and manually checking the return type if the %objects% part is not a variable and is a expression so it successfully errors if said expression is not a itemstack/slot/livingentity or player.

Shouldn't be any problems with it.

Testcode:

command /testing2:  
    trigger:
        set {_test} to "Mirreducki" parsed as player
        set {_test2} to tool of player
        set {_test3} to "Variable"
        message "Direct This Should Error: %name of ""Test""%"
        message "Variable Should Fail: %name of {_test3}%"
        message "Variable Name: %name of {_test}%"
        message "Variable Item Name: %name of {_test2}%"
        message "Direct Item Name: %name of tool of player%"
        message "Direct Name: %name of ""Mirreducki"" parsed as player%"
        message "________Display Name________"
        message "Variable Display Name: %display name of {_test}%"
        message "Variable Item Display Name: %display name of {_test2}%"
        message "Direct Item Display Name: %display name of tool of player%"
        message "Direct Display Name: %display name of ""Mirreducki"" parsed as player%"

In Skript 2.2/2.1.2 only the Direct ones work(except the first one since it should error). In my older versions Direct ones and Variable ones that contains a itemstack works. In the next version all of these work, well except those two in the beginning since they should error or return <none>.

Mirreski commented 9 years ago

Reopen because last fix broke it for entities. Deleted V8 download and uploaded one without this fix.

Mirreski commented 9 years ago

Fixed again. Seems to be no problems now. Got an insight from CondContains which helped me fix this.

Mirreski commented 9 years ago

Added in V8b.