skript-mirror icon indicating copy to clipboard operation
skript-mirror copied to clipboard

Pattern with type %integer% aren't working if it is in a local variable

Open Abwasserrohr opened this issue 6 years ago • 2 comments

Describe the bug Hi =) If a pattern has %integer% as type, local variables which are integers don't get recognized. Only if the pattern has %int%, it is going to work for me.

To reproduce To reproduce, just load this skript file and type /test. The second pattern works, the first one doesn't. Only happens if the integer is within a local variable, can't really say if this has already been reported though.

effect:
  patterns:
    test1 with %integer%
    test2 with %int%
  trigger:
    broadcast "%expr-1%"
	
command /test:
  trigger:
    set {_integer} to 1
    test1 with {_integer}
    test2 with {_integer}

Expected behavior Both patterns should broadcast the expression 1. In this case: 1. As seen below, only the second pattern works.

Screenshots 5

Server information

  • skript-mirror: 1.0.0
  • Skript: 2.3.1
  • Bukkit: git-Paper-473
  • Minecraft: 1.13.2
  • Java: Java 8
  • OS: Linux

Abwasserrohr avatar Jan 28 '19 16:01 Abwasserrohr

This is due to some weirdness on Skript's end. int is an alias for Skript's Long type, while integer refers to the actual Integer type. Generally, you should be using number to avoid numerical issues.

On the skript-mirror side, I'm not sure how to handle this. The easiest solution would be to make all numerical types internally map to number, though that might cause some unexpected behavior in a few cases.

btk5h avatar Jan 28 '19 17:01 btk5h

Thank you for pointing out to use number, trying to use it instead in the future. =)

Abwasserrohr avatar Jan 28 '19 17:01 Abwasserrohr