[0.3.6.1] Laser Projector "-" Operator

I’m aware an issue with the minus operator existed before.

[details=Post][quote=“Caboose700, post:1, topic:24155”]
@Zak […] fixed an issue with unary minus operator precedence in the Laser Projector […]
[/quote]

However, there seems to be another issue. Depending on the amount of characters in the code, the minus operator will seem to do something funky. Multiples of 4 are involved.

Video (mute audio, PC still contacting aliens…):

4 Likes

That’s odd, I’ll look into this.

1 Like

Just to add to this, while messing around with the rainbow code from the tornado guide, I found that the negative operator likes to break a perfectly good rainbow. Wasn’t sure if I was doing something wrong but the colour code is pretty much exactly what’s on the guide. Works fine without the minus.

Also, not sure if it’s intentional, but multiplication is always done before division, and the same with addition over subtraction. This leads to
( 20 / 2 * 2 ) equalling 5 instead of 20 and
( 20 - 10 + 5 ) being 5 instead of 15.

The bug where the minus operator changes behavior based on text length is very strange.
Especially with respect to comments as those characters aren’t even being parsed.

This bug can’t be repo’d in-editor for some reason, but definitely exists in the shipped game.
I’ll continue to look into it.

The rainbow issue probably has something to do with how the remainder is computed to wrap the hue range between 0 and 360.

My bad, the default associativity of operators with the same precedence is right-to-left not left-to-right as it should be.
so ( 20 / 2 * 2 ) is compiled as ( 20 / (2 * 2) ) not ( (20 / 2) * 2 ).

Turns out this was insanely easy to fix:

2 Likes

##Update

  • minus behavior is fixed.
  • associativity is fixed.

should be in the next update.

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.