[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

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

Post by nexus »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 14 Aug 2009 06:55:21 -0000

1)

I'd really like to have a feature similar to perl's 'eval BLOCK' in order to execute code within 'Block'.

In this way, it would be possible to "dynamically" load code parts or construct them within the code. That's useful for libraries or for parsing and executing the code of "simplified" templates.

2)

Another important feature is to have the possibility to determin the number of "keys" within a table

and

a method which tells you, if a certain "key" is within a table (or is nil).

ListItems() is very limited and only works for tables with keys starting from "0".

(Actually, the concept of a table in Hollywood is more similar to a hashtable and, thus, it would be important to get more information about the keys and values within the table).

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

[17 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 Mon, 17 Aug 2009 10:53:26 +0200

any change that these features will come? :-)

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

[17 Aug 2009] 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, 17 Aug 2009 22:08:00 +0200
1)

I'd really like to have a feature similar to perl's 'eval BLOCK' in order to execute code within 'Block'.

In this way, it would be possible to "dynamically" load code parts or construct them within the code. That's useful for libraries or for parsing and executing the code of "simplified" templates.
Dynamically loading code can't be supported because it would enable users to write scripts that load & run other scripts and then there would be no difference between the Hollywood full version and the Hollywood player :)
2)

Another important feature is to have the possibility to determin the number of "keys" within a table

and

a method which tells you, if a certain "key" is within a table (or is nil).

ListItems() is very limited and only works for tables with keys starting from "0".

(Actually, the concept of a table in Hollywood is more similar to a hashtable and, thus, it would be important to get more information about the keys and values within the table).
There's currently no function that returns the size of non-linear tables but you can easily determine it by traversing the table using NextItem(). Check the Hollywood doc... it has a nice example. Iterating with NextItem() allows you to obtain all keys of any table.
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[19 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, 19 Aug 2009 21:40:21 +0200
Dynamically loading code can't be supported because it would enable users to write scripts that load & run other scripts and then there would be no difference between the Hollywood full version and the Hollywood player :)
ok, that's a good point but also a pity because it restics Hollywood apps somehow. Bye the way, what else than loading und playing hollywood apps does the "Hollywood player"? I can't imagine what you can do with a player if you can't "play" Hollywood scripts. :-)
There's currently no function that returns the size of non-linear tables but you can easily determine it by traversing the table using NextItem(). Check the Hollywood doc... it has a nice example. Iterating with NextItem() allows you to obtain all keys of any table.
true, but not very convenient and maybe slow for bigger tables ;-) So, future release will nothing change here?

Another nice feature would be:

3) "Combining" object to move them on the screen in one shot instead of moving each of them separtely

Thanks for your responds and don't take this as bad criticism to Hollywood. Hollywood is great and I just want to let you know what I'd like to have in addition ;-)

My current little Hollywood example codings bring all these things to my mind :-)

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

[19 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 Wed, 19 Aug 2009 20:32:10 -0000
Another nice feature would be:

3) "Combining" object to move them on the screen in one shot instead of moving each of them separtely
This can already be done. See documentation for AddMove().
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[19 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 Wed, 19 Aug 2009 23:27:08 +0200
ok, that's a good point but also a pity because it restics Hollywood apps somehow. Bye the way, what else than loading und playing hollywood apps does the "Hollywood player"? I can't imagine what you can do with a player if you can't "play" Hollywood scripts. :-)
The Hollywood Player can only play applets of course. Everything else wouldn't make much sense because then the player would be the full version. The full version can turn source code into applets. The player version can only read these applets then. And applets are safe because they don't contain any source code but precompiled 128bit encrypted highly secure bytecode instead :)
true, but not very convenient and maybe slow for bigger tables ;-) So, future release will nothing change here?
Depends. What exactly do you want? Just a function that returns the real number of elements of a non-linear table? Everything else should be possible with NextItem()... if not, give me an example :)
3) "Combining" object to move them on the screen in one shot instead of moving each of them separtely
As Paul already said, you can use AddMove() for that or with Hollywood 4.0 it is even easier using the SetLayerStyle() command.
Thanks for your responds and don't take this as bad criticism to Hollywood. Hollywood is great and I just want to let you know what I'd like to have in addition ;-)
Sure, don't hesitate to post suggestions. I'm always interested in them :)
nexus
Posts: 150
Joined: Sun Mar 07, 2010 11:54 am

[20 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 Thu, 20 Aug 2009 00:39:21 +0200
The Hollywood Player can only play applets of course. Everything else wouldn't make much sense because then the player would be the full version. The full version can turn source code into applets. The player version can only read these applets then. And applets are safe because they don't contain any source code but precompiled 128bit encrypted highly secure bytecode instead :)
very clever :-)
Depends. What exactly do you want? Just a function that returns the real number of elements of a non-linear table? Everything else should be possible with NextItem()... if not, give me an example :)
For example, if i like to know if a certain "key" is set or has a non-null value, it would be convenient to do the following:

Code: Select all

if (table[key] <> nil) Then do_something Else do_something_else
Of course, I could traverse all the content of the table in order to know if "key" is an element in the table, but this takes time and is not that nice :-) It would look like this:

Code: Select all

Local key, value = NextItem(table)
While GetType(nextptr) <> #NIL
    if (key = the_key_I_search)
       key_was_found=false; 
       do_something
       break
    Endif
    key,value = NextItem(table)
Next
    If (not key_was_found) Then do_something_else
This is unconvenient and time consuming, i think?
As Paul already said, you can use AddMove() for that or with Hollywood 4.0 it is even easier using the SetLayerStyle() command.
Ah, yes. AddMove()/DoMove() most likely does the job :-)

But how does SetLayerStyle() work? I don't really get how it works (from the documentation). Let's say, I want to move 2 Layers from its current position 10 px to the left (relative to each object's x position) and the movement should work in the way like "MoveLayer()" it does: that is, the movement should be visible and not a jump from one position to the next.

SetLayerStyle() takes as arguments the ID from only one layer, right? And with X,Y I can specify it's new position on the screen, right?

But how can I combine the movement of 2 objects then? And how can I control the movement itself (e.g. the speed)?

At the moment, I use "MoveLayer()" for each Layer I want to move, but then there's a delay between until the last layer has reached its target. I can imagine that AddMove()/DoMove() will do exactly what I want (I will look at it tomorrow more closely), but how can SetLayerStyle() do the job?

Thanks a lot!

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

[20 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 Thu, 20 Aug 2009 10:04:37 +0200
As Paul already said, you can use AddMove() for that or with Hollywood 4.0 it is even easier using the SetLayerStyle() command.
Okay, I checked 'AddMove()/DoMove()' and it works, but you have to take care about the animation yourself, i.g. speed, the way the objects go from start to destination, etc).

So, my feature request is still valid, because it would be simply nice to combine objectes and then do somthing like MoveGroupedLayers() in order to move all grouped objects by a certain amount of pixels in x and/or y direction, relative to each object's position. and with the posibility of FX-effects like: #BOUNCE, etc. :-)

Wit AddMove()/DoMove() you have to take care of everything yourself (if I'm not wrong). And how SetLayerStyle works to move several objects together, I still don't know anyway :-)

regards,

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

[20 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 Thu, 20 Aug 2009 14:53:59 +0200
For example, if i like to know if a certain "key" is set or has a non-null value, it would be convenient to do the following:

if (table[key] <> nil) Then do_something Else do_something_else

Of course, I could traverse all the content of the table in order to know if "key" is an element in the table, but this takes time and is not that nice :-) It would look like this:
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.

Code: Select all

t = {x = 5, y = 6}

Print(RawGet(t, "x"))  --> 5
Print(RawGet(t, "y"))  --> 6
Print(RawGet(t, "z"))  --> Nil
Ah, yes. AddMove()/DoMove() most likely does the job :-)

But how does SetLayerStyle() work? I don't really get how it works (from the documentation). Let's say, I want to move 2 Layers from its current position 10 px to the left (relative to each object's x position) and the movement should work in the way like "MoveLayer()" it does: that is, the movement should be visible and not a jump from one position to the next.

SetLayerStyle() takes as arguments the ID from only one layer, right?
Nope, you can change the style of as many layers as you wish.
And with X,Y I can specify it's new position on the screen, right?

But how can I combine the movement of 2 objects then? And how can I control the movement itself (e.g. the speed)?
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
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[20 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 Thu, 20 Aug 2009 14:54:47 +0200
Okay, I checked 'AddMove()/DoMove()' and it works, but you have to take care about the animation yourself, i.g. speed, the way the objects go from start to destination, etc).

So, my feature request is still valid, because it would be simply nice to combine objectes and then do somthing like MoveGroupedLayers() in order to move all grouped objects by a certain amount of pixels in x and/or y direction, relative to each object's position. and with the posibility of FX-effects like: #BOUNCE, etc. :-)
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 :)
Locked