[14 Aug 2009] Feature Request: eval(), etc.

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[21 Aug 2009] Re: Feature Request: eval(), etc.

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 01:32:29 +0200
Oh no, never ever do it like that :)

Finding out if a table item exists is really easy. Just use the RawGet() function. If it returns Nil, then the table item doesn't exist, e.g.

t = {x = 5, y = 6}

Print(RawGet(t, "x")) --> 5 Print(RawGet(t, "y")) --> 6 Print(RawGet(t, "z")) --> Nil
RawGet() ?

Yes, that's exactly what I want and I am surprised that this function exists! I was looking for it for ages now :-) It's the first time I hear of it and I can't find this function in the hollywood documentation? There's also no quickhelp from the Golded-hollywood-plugin (although, it highlights "RawGet" and corrects the "R" and "G" to upper-case if necessary -- of course you still have to know of the existence of this function to see it gets highlighted ;-) ).

So is the documentation incomplete or am I blind (the latter is definitive possible ? :-) )
Just use a loop:

Code: Select all

; move 5 pixels per cycle
speed = 5

; move layers 1 & 2 from 0 to 640 at a variable speed
For Local k = 0 To 640 Step speed
 SetLayerStyle(1, {x = k}, 2, {x = k})
 VWait
Next
Aha! Here the documentation for SetLayerStyle() is not very clear, I think. I never had understood the documentation in a way, that I can pass more then one Layer-ID *in this way* as arguments to it (despite the "..." in the parameter list of the function). :-) It's also one of the few functions that has no expample :-). Actually, I would have expected to pass a table *per* ID that contains all the changes for a layer :-) But hey, it was hard to find a function in the documentation which was not completely clear to me because the documentation is very good :)

Thanks a lot!

Tom
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[21 Aug 2009] Re: Feature Request: eval(), etc.

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 02:16:52 +0200
Aha! Here the documentation for SetLayerStyle() is not very clear, I think. I never had understood the documentation in a way, that I can pass more then one Layer-ID *in this way* as arguments to it (despite the "..." in the parameter list of the function). :-) It's also one of the few functions that has no expample :-). Actually, I would have expected to pass a table *per* ID that contains all the changes for a layer :-)
Actually, it would be a good idea to pass a table containing the Layer-ID as "key" and another table, which contains all the style-changes, as "value", In this way, SetLayerStyle() could be used in a dynamic way.

(e.g. mytable[id1] = {x=1,y=2} mytable[id2] = {x=3,y=4} SetLayerFunction(mytable) )

At the moment (if I understand it correctly), SetLayerStyle() can only be used if you already know during coding time what layers you want to change and how.

Hm, maybe Unpack() can be used here to achieve the same? Like this:

Code: Select all

For Local j=0 to max_layer_ID {
    Local Xoff=GetAttribiute(#LAYER,j,#ATTRXPOS)+2;
    Local Yoff=GetAttribiute(#LAYER,j,#ATTRXPOS)+2;
    mytable[j] = {x=Xoff, y=Yoff}
}

SetLayerStyle(unpack(mytable))
Could work? I'll test that tomorrow :-)

Tom
PEB
Posts: 576
Joined: Sun Feb 21, 2010 1:28 am

[21 Aug 2009] Re: Feature Request: eval(), etc.

Post by PEB »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 02:59:18 -0000
Aha! Here the documentation for SetLayerStyle() is not very clear, I think. I never had understood the documentation in a way, that I can pass more then one Layer-ID *in this way* as arguments to it (despite the "..." in the parameter list of the function). :-) It's also one of the few functions that has no expample :-).
The following is an EXAMPLE taken directly from the documentation:

Code: Select all

SetLayerStyle(1, {x = #LEFT, y = #TOP}, 4, {x = #CENTER, y = #CENTER},
            5, {x = #RIGHT, y = #BOTTOM}, "mylayer", {x = 100, y = 100})
PEB
Posts: 576
Joined: Sun Feb 21, 2010 1:28 am

[21 Aug 2009] Re: Feature Request: eval(), etc.

Post by PEB »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 03:01:07 -0000
The following is an EXAMPLE taken directly from the documentation:

SetLayerStyle(1, {x = #LEFT, y = #TOP}, 4, {x = #CENTER, y = #CENTER}, 5, {x = #RIGHT, y = #BOTTOM}, "mylayer", {x = 100, y = 100})
I should have added that the following explanation is also included: The call above changes the position of several layers. Layer 1 is moved to the top left corner, layer 4 to the center, layer 5 to the bottom right corner, and layer "mylayer" is moved to 100:100.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[21 Aug 2009] Re: Feature Request: eval(), etc.

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 09:38:19 +0200
I should have added that the following explanation is also included: The call above changes the position of several layers. Layer 1 is moved to the top left corner, layer 4 to the center, layer 5 to the bottom right corner, and layer "mylayer" is moved to 100:100.
What? Do I have a different documentation? We're talking about "Hollywood:help/Hollywood.guide", right?

Hollywood.guide -> Layer functions -> SetLayerStyle()

There is NO Example and also no explanation in my documentation. It Just says the following (copy and paste from the multiview output of Hollywood.guide):

Code: Select all

   0m1mNAME0m
        SetLayerStyle -- change the style of one or more layers (V4.0)

   0m1mSYNOPSIS0m
        SetLayerStyle(id1, style1, ...)

   0m1mFUNCTION0m
        This command can be used to modify nearly all attributes of one or more
        existing layers with a single call. It is a very powerful command which
        can be used to realize complex animation mechanisms in a very easy and
        straight-forward way. For each layer whose style you want to modify, you
        always have to pass its layer id followed by a table containing the
        attributes you want to change. You can repeat this pattern as many times
        as you need it.
        
        The configuration of the style table depends on the type of layer 
        specified. However, some style elements can be used with all layer types.
        These generic layer styles will be covered first. The specific layer
        styles dependent on layer type will be dealt with below. 
        
        The following style elements are generic and can thus be used on every
        layer:
        
        X,Y           Specifies the position for the layer. If not specified he
                      layer will keep its current position.

        Width,Height: Can be used to scale the layer to new dimensions. This can
                      either be a numerical value specifying a new pixel size
                      or a string containing a percent specification (e.g. "50%").
                      For more information on layer scaling, see the documentation
                      on ScaleLayer().
                              
        Rotate:       This style element can be used to control layer rotation.
                      You have to pass a value in degrees here. A positive value
                      means anti-clockwise rotation, negative values rotate in
                      clockwise direction. For more information see the notes on
                      RotateLayer().
        
        SmoothScale:  Specifies whether or not smooth scaling and rotation shall
                      be used on this layer. This is only applicable for non-vector
                      layers and of course it only makes sense when the layer is
                      scaled or rotated.
        
        Transparency: Use this style element to modify the transparency setting
                      of a layer. This can be either a value ranging from 0 (= no
                      transparency) to 255 (= full transparency) or a string
                      containing a percent specification (e.g. "50%" which means
                      half transparency). For more information see the documentation
                      of SetLayerTransparency().
        
        Tint:         Use this style element to modify the tint setting of a layer.
                      This can be either a value ranging from 0 (= no tinting) to
                      255 (= opaque tinting) or a string containing a percent
                      specification (e.g. "50%" which means half tinting). If this
                      is set to non zero, the layer will be tinted with the color
                      specified in "TintColor" at the specified level. For more
                      information see the documentation of SetLayerTint(). 
        
        TintColor:    Specifies the color to use for tinting. Can only be used in
                      union with the "Tint" style element.
        
        Hidden:       You can use this style element to show or hide the specified
                      layer. Set it to True to hide the layer or to False to show


Nothing else!

Tom
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[21 Aug 2009] Re: Feature Request: eval(), etc.

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 09:59:02 +0200
I should have added that the following explanation is also included: The call above changes the position of several layers. Layer 1 is moved to the top left corner, layer 4 to the center, layer 5 to the bottom right corner, and layer "mylayer" is moved to 100:100.
I've looked into the source code of the hollywood.guide file and now I see the problem! There's an error in the guide file:

Code: Select all

  Hidden:       You can use this style element to show or hide the specified
                      layer. Set it to True to hide the layer or to False to show
                      it. For more information see @{"HideLayer()" LINK HideLayer} and @{"ShowLayer() LINK ShowLayer}.  
The Quote-sign " is missing for the ShowLayer()-LINK and thus, multiview (OS4 and OS3.x via AmigaForever 2006-UAE) doesn't show the rest of description! The only question is, how could YOU see the full description? What do you use to read .guide-files?

(In this way, I also could find out that RawGet() is only mentioned in the "History" of changes for Version 2.0! Who's reading that if one buys Version 4.0 as the very first version? :-) )

I wonder now, if the *latest* documentation was included in my Hollywood4 purchase.

kind regards, Tom
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[21 Aug 2009] Re: Re: Feature Request: eval(), etc.

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 12:00:57 +0200
I've looked into the source code of the hollywood.guide file and now I see the problem! There's an error in the guide file:
Oops, yes, sorry. It's fixed now.
The Quote-sign " is missing for the ShowLayer()-LINK and thus, multiview (OS4 and OS3.x via AmigaForever 2006-UAE) doesn't show the rest of description! The only question is, how could YOU see the full description? What do you use to read .guide-files?
Well, under MorphOS it worked also with the error in the guide... that's why I didn't notice it :)
(In this way, I also could find out that RawGet() is only mentioned in the "History" of changes for Version 2.0! Who's reading that if one buys Version 4.0 as the very first version? :-) )

I wonder now, if the *latest* documentation was included in my Hollywood4 purchase.
Yes, you've the latest version. RawGet() and some other functions are currently undocumented. The reason why there's no documentation on RawGet() is that I'd have to explain metamethods in this context and that's going to require a full new chapter. But I hope I'll do this soon, it is on my list :)

Concerning your SetLayerStyle() problem: Unpack() is indeed the way to go. This is also demonstrated in the LayerStyle.hws example that comes with Hollywood.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[21 Aug 2009] Re: Feature Request: eval(), etc.

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 21 Aug 2009 12:40:33 +0200
Oops, yes, sorry. It's fixed now.
I'm glad I could help (and that I'm not THAT stupid ;-) )
Yes, you've the latest version. RawGet() and some other functions are currently undocumented. The reason why there's no documentation on RawGet() is that I'd have to explain metamethods in this context and that's going to require a full new chapter. But I hope I'll do this soon, it is on my list :)
okay, no problem :-) I'm just pretty sure that people who are NOT reading this mailing list will traverse the full table (like me) to find out if a certain key is within the table :-)
Concerning your SetLayerStyle() problem: Unpack() is indeed the way to go. This is also demonstrated in the LayerStyle.hws example that comes with Hollywood.
great. That functions can be passed to tables and that tables can be "unpacked" are great features of Hollywood!

Can you give a short remark what works "faster" to just move objects animated over the screen? SetLayerStyle() or AddMove()/DoMove()?

Thanks a lot,

Tom
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[24 Aug 2009] Re: Re: Feature Request: eval(), etc.

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 24 Aug 2009 12:59:15 +0200
Can you give a short remark what works "faster" to just move objects animated over the screen? SetLayerStyle() or AddMove()/DoMove()?
Under v4.0 DoMove() should be a little faster but this always depends on the exact movements. Under v4.5 SetLayerStyle() should be as fast as DoMove() too.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[26 Aug 2009] Re: Feature Request: eval(), etc.

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 26 Aug 2009 20:10:27 +0200
Yes, layer grouping is of course planned since a long time. But it is quite some complex stuff so I haven't tackled it yet :)
I've implemented it now myself and I'm already able to define groups of layers and move them ;-) Now, I only have to implement all your fancy move-FX stuff or do I find these movement-code-peaces in some of your examples? ;-)

Hollywood means a lot of fun! Thanks a lot. Unfortunately, my vacation is over and now i have to work again on other things :-).

greetings, Tom
Locked