Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Fix variable type reference being incorrect when same literals

Open TheLimeGlass opened this issue 2 years ago • 1 comments

Description

Makes a fix for re-parsing variables that have the same literal name.

Example of this can be setting a variable to a snowball. Skript assumes it's an itemtype. Now when using that variable in an entitydata expression, Skript attempts to convert but can't as no converters exist for ItemType -> EntityData. That's where this fix steps in.

With the knowledge from my pull request at https://github.com/SkriptLang/Skript/pull/5503 I knew exactly what Skript was doing and how to fix it.

I also cleaned up the EffShoot class to be up to date with standards while I was debugging.

Note that this pull request https://github.com/SkriptLang/Skript/pull/5457 also helps this issue and solidifies that Skript will understand local variables


Target Minecraft Versions: any Requirements: none Related Issues: https://github.com/SkriptLang/Skript/issues/3753, https://github.com/SkriptLang/Skript/issues/5493 there are probably more, but nothing came up relating to index "variable"

TheLimeGlass avatar Mar 10 '23 11:03 TheLimeGlass

The type coercion that Kenzie mentioned earlier is still an issue:

on load:
    set {_a} to "2"
    set {_b} to "5 dirt of sharpness"
    set {_c} to 12 tnt entities
    broadcast "2 + {_a} - expected: 2, actual: %2 + {_a}%"
    broadcast "enchantments of {_b}: expected: <none>, actual: %enchantments of {_b}%"
    broadcast "item amount of {_c}: expected: <none>, actual: %item amount of {_c}%" 

2.7.1: image

This PR's nightly: image

sovdeeth avatar Oct 18 '23 20:10 sovdeeth

Closing for inactivity

sovdeeth avatar Sep 13 '24 14:09 sovdeeth