Page 1 of 1

Variable assignment woes

Posted: Thu Feb 22, 2018 2:24 pm
by coatsiecoates
With a switch group, I can:

local layerName = moho.layer:Name()

then SetSelLayer to the parent and

moho.layer:SetValue((moho.frame), (layerName))

but have no idea how to manually specify layerName. It seems like it’d be as easy as

local layerName = “spam”, but I’m not getting results. Do I need a full path? Quotes?

If I had a switch group with layers named a, b, and c, how do I say layerName = c?

Re: Variable assignment woes

Posted: Thu Feb 22, 2018 5:01 pm
by jezjones29

Code: Select all

 moho.layer:SetName('New Layer Name')

Re: Variable assignment woes

Posted: Thu Feb 22, 2018 5:25 pm
by hayasidist
are you trying to make c the active child with the parent selected??

You'll need to turn the generic layer into a switch type object:
http://www.mohoscripting.com/index.php? ... face&id=72

then do the set value
http://www.mohoscripting.com/index.php? ... yer&id=668

I think this should make c the active child with the parent selected

local switchLayer = moho:LayerAsSwitch(moho.layer)
switchLayer:SetValue (moho.frame, "c")

Re: Variable assignment woes

Posted: Thu Feb 22, 2018 11:49 pm
by coatsiecoates
THANK YOU!!!

I was going bonkers! I've seen the word switchLayer so many times in the last 12 hours trying to figure it out, it lost all meaning and just started sounding like the name of some random metal band.

Turns out I had it right at one point during this effort, but was getting errors since I didn't have it indented and I abandoned the idea and moved on to alternative methods, but having it put in front of me like that made me reinvestigate.

God dang, I'm glad that's over.

Re: Variable assignment woes

Posted: Sat Feb 24, 2018 11:13 am
by chucky
coatsiecoates wrote:THANK YOU!!!

I was going bonkers! I've seen the word switchLayer so many times in the last 12 hours trying to figure it out, it lost all meaning and just started sounding like the name of some random metal band.
.
Nice one Coatsie, that would be a good name for a band, or a film/graphic novel.

"Some things, you just don't see coming"..... SWITCH LAYER....In theatres June.