Pangoscript Invert X sets value to 400

Hi Guys,

So I've been reading some threads about inverting zones through various methods, and I seem to remember Alexey posting that
Code:
ZoneWhatever.SizeX= (-ZoneWhatever.SizeX)
should accurately invert ZoneWhatever, right? Then this code should toggle it, shouldn't it?
Code:
OnClick:
ZoneWhatever.SizeX = (ZoneWhatever.SizeX * (-1))
Exit
I would think so, but the problem is that when I try to use the objects this way, the value inexplicably jumps from 100 to 400, and in live controls under zone settings, the X size slider jumps all the way to the left. I don't really want to do things by index because if the index ever changes then my script will stop working, but other than that I have tried rewriting this a couple of different ways and this was the best I could think of. However, ALL of them gave the same result as this one. I'm stumped.

Anyone have any ideas?
 
I'm creating a button that toggles zone inversion by multiplying the Zone's sizeX (or SizeY, but one thing at a time) value by (-1), which should result in reversing the sign of whatever that value is (because if it is negative multiplying it by (-1) will result in a positive number), therefore, by multiplying it by (-1) I can toggle the value back and forth. At least, I could, if pangoscript would work correctly. The way the help file reads, and according to what I've read on here, Pangoscript should be able to handle a line of code like that and at least do the math correctly, but it isn't working right. It's giving a result that makes no sense. If SizeX happens to be 100, SizeX * (-1) should result in -100, not 400, shouldn't it? I'm getting 400 every time regardless of how I manipulate SizeX at zone level, whether it's by grabbing the slider in the Live Controls or using a line of code, the value keeps jumping to 400. I'm aware of this because I included a writeln ZoneWhatever.SizeX as a debug tool so I could see the value each time it changed. If I sound a little frustrated, I'm sorry; it's only because I was not expecting it to be so difficult to get an accurate result from what appeared to be a simple math equation. :confused::(

Let me add a little more:

I tried doing some different things to change the value of ZoneWhatever.SizeX.

I tried simply assigning a value directly:

Code:
[/COLOR][/FONT][/LEFT]
[FONT=Arial][COLOR=rgb(20, 20, 20)]
[LEFT]OnClick:
ZoneWhatever.SizeX = -100
Exit

Result? Return value for ZoneWhatever.SizeX was 400.


I tried creating a variable first and then swapping the values:
Code:
var FlipX
FlipX = -100
Exit

OnClick:
ZoneWhatever.SizeX = FlipX
Exit

Guess what? ZoneWhatever.SizeX returned 400.

I tried moving the minus sign around:

Code:
var FlipX
FlipX = 100
Exit

OnClick:
ZoneWhatever.SizeX = -FlipX
Exit
400.

I tried other ways to get the value and change the sign:
Code:
var FlipX
FlipX = -ZoneWhatever.SizeX;
exit

OnClick:
ZoneWhatever.SizeX = FlipX
Exit
400. Seeing the pattern here?

I tried simplifying to Alexey's original line of code:
Code:
OnClick:
ZoneWhatever.SizeX = -ZoneWhatever.SizeX
Exit

Wouldn't you know it: ZoneWhatever.SizeX returned a value of 400.

Keep in mind, I reset the live controls and verified everything was back to normal before I tried running each new iteration of script, and it gave the same result every single time.

I'm using Beyond 4.0 Build 1122.
 
Last edited:
Hi Lulighttec,

What you describe sounds like a bug. The bad side of this story - I cannot reproduce it here. Code:

Scanner1Main.SizeX = -Scanner1Main.SizeX

works OK, I see inverted zone. I am pretty sure there is something that influence result at your side. The first idea is screen recording of the result, maybe it will give me some hint. Second idea - did you tried assign a constant? like -100. Basically, we may have some problem with a) reading, b) writing, c) math. Using a constant eliminate reading and math. Let me know.
 
Back
Top