Can i somehow use Movelayer with #USELAYERPOSITION+1?

Find quick help here to get you started with Hollywood
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Can i somehow use Movelayer with #USELAYERPOSITION+1?

Post 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?
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

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

Post 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.
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

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

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

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

Post 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 :)
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

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

Post 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 ... :-)
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

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

Post by airsoftsoftwair »

Should be possible to add this.
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

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

Post by Clyde »

That would be most awesome and welcomed! :-) Thanks!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

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

Post 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
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

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

Post by Bugala »

Thanks a lot! This will save some hassle.
Post Reply