CTRL-F5 doesn't seem to reload the embedded layer scripts.
Is there a faster and/or easier way to do it than deselecting the "Embedded script file" checkbox, and then locating your script again?
Embedded Scripts
Moderators: Víctor Paredes, Belgarath, slowtiger
Might be, but I'm not sure. Theres a few things that arent documented yet (like the new function that makes the paintbucket work), but I dunno. It probably wouldn't save a whole lot of time, unless you made a button tool to reload them. If there was access in Lua to what you needed, I'd do that, as usual I could use it too.
I use this little trick:mwdf wrote:CTRL-F5 doesn't seem to reload the embedded layer scripts.
- I've any embedded script applied in any Moho layer.
- I go to SciTE (of course) and modify any applied embedded script.
- Return to Moho and press Ctrl+F5.
- I Make any change in Moho (move a layer, a bone, point... any) and press Ctrl+Z to UNDO it.
- The embedded scripts are reloaded
It seems like a little pain but it have saved a lot of time to me, try it!
beginner in scripting
hi im a beginner in moho software. i just want to ask how to embed a script in a Moho layer work and how to create the *.lua file?can someone please teach me...tq
i like an animation..
Re: beginner in scripting
This link:alongz wrote:hi im a beginner in moho software. i just want to ask how to embed a script in a Moho layer work and how to create the *.lua file?can someone please teach me...tq
http://www.lua.org/pil/
Along with the Moho Scripting reference available in the scripting forum:
http://www.lostmarble.com/forum/viewtopic.php?t=1031
... is what I used to get started. LUA is about as complex to learn as Javascript. If you have no programming experience at all... it may be a bit of a learning curve for you.
I already had some experience with JS and was able to use that knowledge to help learn LUA.
I also used the existing scripts that come with Moho and that others wrote to learn LUA. Going through a simple tool or menu script VERY CAREFULLY... looking at each line and trying to understand what it is doing from the results of a working script is very very helpful.
If you can eventually "work out" what a script is doing just by reading the code this can lead to a better understanding.
It would be near to impossible to "teach" you LUA from scratch through the forum. If you get a basic understanding of programming in LUA from many free resources on the web and possibly books on the subject and then need specific help on certain areas... hopefully someone here may be able to point you in the right direction.
-Vern
Make a copy of a short .lua file in the scripts/tool folder of your Moho directory, changing the lm_ beginning of the filename to your favourite two letters (try to choose a unique letter pair, hv_, sf_, fa_, cc_, etc. are already used by others) . You can use these letters to identify all of your scripts in the future. The copied program will appear as a button on the tool window in Moho. With a graphic program, you can create an icon too, with the same name and .png extension. Then try to modify the .lua script with a text editor. Edit and save it as a plain (ASCII) text. First of all, change all the names beginning with LM_ to your letters (uppercase). This is important because the whole lua system is a common namespace, so the unique table (= lua object) names are required. So you can call the functions and you can modify the non-local variables of the other .lua files.
You can also write scripts for the scripts menu of the menubar, in the scripts/menu/... . The scripts/utility contains the invisible parts of the programs, you can put function libraries here. Everything will be loaded automatically at the start of Moho.
The other way to run a .lua script is the layerscript. It must has a function named LayerScript() and Moho calls this function every time when renders the layer. You can load the layerscript to a layer at the Layer Settings window, General tab, when enabling the "Embedded script file" checkmark. Then a file requester appears and you can load the script into the layer. You must do this operation for every layer you want to use with the script. But if you duplicate a layer with a script, the script setting is also duplicated.
PS. I really hope in the next version there will be a function to assign a script to a layer from a lua program...
You can also write scripts for the scripts menu of the menubar, in the scripts/menu/... . The scripts/utility contains the invisible parts of the programs, you can put function libraries here. Everything will be loaded automatically at the start of Moho.
The other way to run a .lua script is the layerscript. It must has a function named LayerScript() and Moho calls this function every time when renders the layer. You can load the layerscript to a layer at the Layer Settings window, General tab, when enabling the "Embedded script file" checkmark. Then a file requester appears and you can load the script into the layer. You must do this operation for every layer you want to use with the script. But if you duplicate a layer with a script, the script setting is also duplicated.
PS. I really hope in the next version there will be a function to assign a script to a layer from a lua program...
- - - Fazek
<cross post>
I would like to see the layers script references in the anme file just be the script file name, rather than the whole path, as this stops scenes being easily portable from one artist to another. If the script exists somewhere in the Scripts folder in the AS directory, AS should find them and load them. This means all scripts should have a different name, but I think it's very rare that two names will be the same (don't they have to be all different names anyway?)
As it is, if user A keeps AS in B:\Art\Anime Studio, and use B keeps AS in P:\anime Studio pro, then all layer_script references in scenes swapped between them will be wrong.
I would like to see the layers script references in the anme file just be the script file name, rather than the whole path, as this stops scenes being easily portable from one artist to another. If the script exists somewhere in the Scripts folder in the AS directory, AS should find them and load them. This means all scripts should have a different name, but I think it's very rare that two names will be the same (don't they have to be all different names anyway?)
As it is, if user A keeps AS in B:\Art\Anime Studio, and use B keeps AS in P:\anime Studio pro, then all layer_script references in scenes swapped between them will be wrong.