Page 1 of 1

[10 Jan 2010] #LIGHTUSERDATA, rename layer

Posted: Sat Jun 13, 2020 5:32 pm
by lazi
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 10 Jan 2010 12:00:34 +0100

Hi!

I learned that the automatic id creation creates id types #LIGHTUSERDATA. SetLayerName() can accept #NUMBER for the first parameter. So, how can I rename a layer that created with auto id?

[10 Jan 2010] Re: #LIGHTUSERDATA, rename layer

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 10 Jan 2010 22:24:26 +0100
Hi!

I learned that the automatic id creation creates id types #LIGHTUSERDATA. SetLayerName() can accept #NUMBER for the first parameter. So, how can I rename a layer that created with auto id?
Um, why is everyone suddenly doing the layer stuff wrong? :) There is no auto id creation for layers at all... you can't do things like:

Code: Select all

; BAD CODE!
EnableLayers
new_layer = DisplayBrush(1, 0, 0)
This won't work. The only thing you can do now is convenient assignment of a name to a layer, e.g.

Code: Select all

; GOOD CODE!
DisplayBrush(1, 0, 0, {Name = "mylayer"})
This will automatically insert the brush under the name "mylayer". You no longer have to hassle with ids if you do it this way.

[10 Jan 2010] Re: #LIGHTUSERDATA, rename layer

Posted: Sat Jun 13, 2020 5:32 pm
by lazi
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 10 Jan 2010 23:42:16 +0100

Hello Andreas

Ok, so the new syntax let me change:

Code: Select all

InsertLayer(0,#ANIM,id, x, y, True)
SetLayerName(0,"hal")       
to just this:

Code: Select all

DisplayAnimFrame(id, x, y,1,{hidden=True, name="hal"}) 
That's great. Thanks to clarify that.

[11 Jan 2010] Re: Re: #LIGHTUSERDATA, rename layer

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 11 Jan 2010 12:10:41 +0100
Hello Andreas

Ok, so the new syntax let me change:

InsertLayer(0,#ANIM,id, x, y, True) SetLayerName(0,"hal")

to just this:

DisplayAnimFrame(id, x, y,1,{hidden=True, name="hal"})
Yep, exactly. You can even specify the insert position using the "InsertPos" tag. You can work entirely without using any hardcoded layer IDs. You can just work with names.