Page 1 of 1
what id means in [id] = LoadAnim(id, filename$[, table])?
Posted: Fri Mar 13, 2015 5:59 pm
by Bugala
I had this piece of code:
Code: Select all
newlayerid=LoadAnim(Nil, "temp.jpg")
DebugPrint(newlayerid)
what i was expecting was number like 1
but instead i get:
UserData: 047631E0
What does this id mean actually, and is this right?
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Fri Mar 13, 2015 6:14 pm
by airsoftsoftwair
Yes, this is right. When using the automatic ID selector Hollywood will return an identifier that uses the special data type #LIGHTUSERDATA. This has the advantage that there can never be any conflict with numeric IDs.
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Fri Mar 13, 2015 6:24 pm
by Bugala
How can i use it in practice then?
For when i try:
Code: Select all
ShowLayerFX(newlayerid, {Type = #ZOOMCENTER, Speed=10})
i receive an error message saying: "String or number expected in argument 1!"
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Fri Mar 13, 2015 6:39 pm
by Bugala
hmm, found from user manual about that #LIGHTUSERDATA.
I guess this is a bug in ShowLayerFX command that it doesnt work with that.
I am using Hollywood 5.3
edit: Just checked with "Showlayer(id)" command, doesnt work with that either.
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Fri Mar 13, 2015 6:49 pm
by Bugala
Seems this #LIGHTUSERDATA works on some commands, but not all.
These two seem to work with that:
ScaleAnim
MoveAnim
And SetLayerName refuses to work with that.
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Fri Mar 13, 2015 8:29 pm
by airsoftsoftwair
Layers don't support this. They don't use the standard object allocator but are numbered from 1...N. Alternatively, they can also use names but they will still be numbered from 1..N. A layer's ID always reflects its position in the stack of layers, i.e. 1 is the bottom-most layer.
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Fri Mar 13, 2015 8:34 pm
by Bugala
So what is the use for that automatic ID receiving, if i cant really use it anywhere?
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Sat Mar 14, 2015 8:23 pm
by PEB
Using Nil to create an id of type #LIGHTUSERDATA will give you a reference to be used any time that an object id would be used. Layer numbers are much different than object ids, since they refer to order in the layer stack (which is always subject to change). Of course, layer names can be assigned; but those names are of type #STRING and would never be used in place of object ids.
Object ids can certainly be used together with layers, but just don't confuse them with layer names. Try out this code, and see if it makes sense:
Code: Select all
EnableLayers()
TestBrushOne=LoadBrush(Nil, "Test.png")
TestBrushTwo=LoadBrush(Nil, "Test2.png")
DisplayBrush(TestBrushOne, 10, 10, {Name="TestLayer"})
WaitLeftMouse()
SetLayerStyle("TestLayer", {ID=TestBrushTwo})
Re: what id means in [id] = LoadAnim(id, filename$[, table])
Posted: Sat Mar 14, 2015 11:13 pm
by airsoftsoftwair
Bugala wrote:So what is the use for that automatic ID receiving, if i cant really use it anywhere?
You can use it anywhere except with layers
