Scripting Documentation

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Scripting Documentation

Post by Lost Marble »

Some scripting documentation is finally available. I'm sorry to say that it's a bit sparse still. Every object and function available is described, but there are no step-by-step examples yet. For now, the best way to create new tools and menu commands is to start with one that comes with Moho and modify it to fit your needs.

This document should help when you're trying to figure out what the exact format of a function is, or what other operations are available. You can download it here:

http://www.lostmarble.com/moho/extras/s ... ipting.zip
myles
Posts: 821
Joined: Sat Aug 21, 2004 3:32 am
Location: Australia, Victoria, Morwell
Contact:

Post by myles »

... and there was much rejoicing! Hurrah!

Thank you!
"Quote me as saying I was mis-quoted."
-- Groucho Marx
User avatar
bupaje
Posts: 1175
Joined: Fri Nov 12, 2004 5:44 pm
Location: California
Contact:

Post by bupaje »

Excellent, thanks LM. :)
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Hell yeah! But why did I have to find this at 4 o'clock in the morning (almost 6 now)?

A few things I was looking for I didn't find, that I was wondering about. A couple were from your "Bonesound" script. One:

Code: Select all

if (dlog:DoModal()
Never could quite figure out what that was for. Also none of the audio functions seem to be in there, unless I missed 'em. In searching for clues how things worked I had scanned through the program in a hex editor, and saw that there were now functions for Peak and RMS audio amplitude. They accessible from Lua?

There may be a few other doodads I didn't see, but lordy this has already cleared up some of my stupidity issues.

--Brian
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

7feet wrote:One:

Code: Select all

if (dlog:DoModal()
Never could quite figure out what that was for.
Look in the Reference section, LM.GUI, LM_SimpleDialog class. The DoModal function basically runs the dialog once it has been set up.
7feet wrote:Also none of the audio functions seem to be in there, unless I missed 'em.
Yeah, they're there - RMS and Peak too. See the Reference->MOHO->Script Interface class. The ScriptInterface class is particularly important - it's the object called "moho" that gets passed to your script whenever something happens (like a mouse click, key press, menu command, etc.).

The moho object (the Script Interface class) allows you to access layers, create new ones, rearrange them, access vector and bone data, etc.
User avatar
7feet
Posts: 840
Joined: Wed Aug 04, 2004 5:45 am
Location: L.I., New Yawk.
Contact:

Post by 7feet »

Sorry, I gave it a (relatively) quick run-through, and bloody tired, must have just missed 'em. Thanks

--Brian
User avatar
Rai López
Posts: 2228
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

WOW!!! IT'S GREAT!! :D :D THANK YOU FOR ALL! I hope that this help me for some day can write my own scripts, yes... :?

PD: Ah,that is not important, but will can in the future acces to Scripting Help by Moho Help Menu like occurs with normal help? BYE!
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Ramón López wrote:PD: Ah,that is not important, but will can in the future acces to Scripting Help by Moho Help Menu like occurs with normal help? BYE!
No, probably not. Writing scripts is a different kind of skill than animating. Some people can do both, but we don't want it to look like you need to understand scripting in order to use Moho. Scripting is kind of a "bonus" feature, and something that non-programmers should feel free to completely ignore if they wish.
nobudget
Posts: 412
Joined: Wed Aug 04, 2004 5:01 pm
Contact:

Post by nobudget »

"we don't want it to look like you need to understand scripting in order to use Moho"

Macromedia, are you reading this? Good that's why I never upgraded Flash from version 4!

Reindert.
www.nobudgetvideo.com
User avatar
Rai López
Posts: 2228
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

...LM! LM! (HI :)) It's only for curiosity (really) ...but I'm "trying" to learn something about scripting works and I'd like to know if the Examples*** of Scripting Documetaton will arrive someday cause (of course) I think that this would be a very BIG/GREAT help... Really is not necessary that you reply this post if you don't want, it's only that I'd want to be sure that you remember that... :wink: (only that :) ), well... THANK YOU FOR ALL!
User avatar
Fazek
Posts: 246
Joined: Thu Apr 13, 2006 1:37 pm
Location: Hungary
Contact:

Post by Fazek »

I just tried the new version (the new Paint Bucket looks nice). My question: are there any changes (new functions etc.) in the scripting interface? Can we get an updated scripting documentation?

As I see there is a new function skel:CountBoneChildren(), and a view:FloodSelect(). The CountBoneChildren is OK. since it was inside the ManipulateBones tool before, I mainly understand what FloodSelect(LM_Point, number) does, except the second parameter. Is there any low-level function to reach the Flood drawing (like the BeginShape, IsFullWhite etc. stuff)?
- - - Fazek
User avatar
Rai López
Posts: 2228
Joined: Sun Aug 08, 2004 1:41 pm
Location: Spain
Contact:

Post by Rai López »

Well, now that seems that a lot of help files and contents are been prepared for the *NeW* Anime Studio, I wonder if we'll can see added those necessary Examples*** in the scriptng documentation... :roll:

PS: P-L-E-A-S-E, it's SO important... and well, I think that almost TWO years is TOO MUCH wait...
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Any chance for some update on the new additions to the scripting?

For instance what is:

Code: Select all

MOHO.Localize
It is used quite extensively in all the tools. Does this have to do with versions? Pro versus standard?

And what about:

Code: Select all

BASE_STR + 2
I have no idea what this is and it doesn't seem to relate to my original bone select tool script.

If I write new tools will they not work with the standard version?

Just curious. I wrote a new bone select tool that displays bones in a scrolling list instead of filling the screen with a huge display of all the darn bones and I would like to share it.

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

heyvern wrote:Any chance for some update on the new additions to the scripting?

For instance what is:

Code: Select all

MOHO.Localize
It is used quite extensively in all the tools. Does this have to do with versions? Pro versus standard?

And what about:

Code: Select all

BASE_STR + 2
I have no idea what this is and it doesn't seem to relate to my original bone select tool script.

If I write new tools will they not work with the standard version?

Just curious. I wrote a new bone select tool that displays bones in a scrolling list instead of filling the screen with a huge display of all the darn bones and I would like to share it.

-vern
MOHO.Localize(position, default) is a function that returns a string located in AnimeStudioPro5.5.strings text file at the value given by "position" and if it not found then returns the "default" string. I think it is not documented but if you look to other lua files it makes sense.

I don't know if your Moho version have this feature but it should not interfere into the main code if you don't use it in your scripts.

BASE_STR is just a number to be used into the function in the "position" value
-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Thanks! I put it in anyway.

The script works you can download it from script page:

viewtopic.php?t=7842


-vern
Post Reply