Page 1 of 1

Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Mon Feb 02, 2015 1:33 pm
by Bugala
I am trying to make video tutorial 3 for hollywood with designer tutorials, however, i ran into a problem where i myself need tutoring first.

I am using command MoveLayer(id, xa, ya, xb, yb)

and inside this command it is possible to use #USELAYERPOSITION as any of these x and y co-ordinates.

Thing is, I want that object to move 30 pixels towards left, to achieve this I tried:

MoveLayer(id, #USELAYERPOSITION, #USELAYERPOSITION, #USELAYERPOSITION -30, #USELAYERPOSITION)

but when i use this, the strangest thing is that instead of moving it towards left, like i thought it would, it is actually moving it towards right, and seems like it keeps moving it towards right forever since only way i can get anything to happen in my designer project after that, is to use ESC to abort it.

Normally you could use Constants, ie: #MYDEFAULTNUMBER in mathematic calculations, as example: x = #MYDEFAULTNUMBER + 1, but I couldnt use this #USELAYERPOSITION inside HideLayer command for calculations, at least not the way i thought it would work.

Hence, is it possible to do it the way I was planning to do at all, and if yes, then how?

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Mon Feb 02, 2015 1:45 pm
by Allanon
I think it's not possible because #USELAYERPOSITION and all special constants uses special values, if you try to print #USELAYERPOSITION you will see that it holds a special value that is interpreted by the command at runtime.
If you change the special value adding +1 the special command became another special command with unpredictable results.
So the way I suggest is to use GetAttribute(...) to get the current position of your layer, hold it in variable and then add 1 to the value retrieved.
Another way is to use the TranslateLayer() command that uses an offset to move a layer around.

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Mon Feb 02, 2015 2:40 pm
by Bugala
Thanks Allanon.

I will either use hard value in which case i show where to get that hard value, or then use GetAttribute. Or perhaps I even show how to use them both, which might be a good idea actually too.

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Sun Feb 08, 2015 11:05 am
by airsoftsoftwair
It's not possible to do this, though #CENTER+x or #RIGHT-x will actually work but it isn't supported for #USELAYERPOSITION :)

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Tue Feb 20, 2018 1:57 pm
by Clyde
Any plans (or possibilities) to add this behavior to #USELAYERPOSITION? That would be superhelpful and as it works for #CENTER and so on ... :-)

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Wed Feb 21, 2018 7:52 pm
by airsoftsoftwair
Should be possible to add this.

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Wed Feb 21, 2018 10:21 pm
by Clyde
That would be most awesome and welcomed! :-) Thanks!

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Tue Dec 11, 2018 7:38 pm
by airsoftsoftwair

Code: Select all

- New: Offsets can also be added to and subtracted from #USELAYERPOSITION now in the same way you can
  fine-tune other special constants like #CENTER or #RIGHT

Re: Can i somehow use Movelayer with #USELAYERPOSITION+1?

Posted: Wed Dec 12, 2018 5:15 pm
by Bugala
Thanks a lot! This will save some hassle.