MohoScripting.com - unofficial Moho scripting documentation

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Stan
Posts: 199
Joined: Sun Apr 19, 2009 3:22 pm

Re: MohoScripting.com - unofficial Moho scripting documentat

Post by Stan »

synthsin75 wrote:Maybe just add an "Insert" dropdown that lists all the code snippets under each Keyboard/Mouse Controls function. You'd want to show the Run function for button/menu scripts, and probably see about having a new "Insert" dropdown appear after one's been used. No idea how hard that may be to do.
I thought maybe some kind of a drag & drop widget that can be dropped on GUI elements to be implemented on the element's message. I'll give it a try today.
synthsin75 wrote:I can't seem to delete the first GUI element I add.
Yeah, you cannot delete an element that is the only child of it's block. One element in the panel must be active (selected), otherwise it would not be clear where the new element should be added to, because there can be nested dialogs, nested blocks, etc.

So, if you need to delete the first element, just add another one, and then delete the first one.
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: MohoScripting.com - unofficial Moho scripting documentat

Post by synthsin75 »

Stan wrote:So, if you need to delete the first element, just add another one, and then delete the first one.
Okay, thanks.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: MohoScripting.com - unofficial Moho scripting documentat

Post by synthsin75 »

Hey Stan, TextControl for a tool doesn't seem to respect the width setting.
Stan
Posts: 199
Joined: Sun Apr 19, 2009 3:22 pm

Re: MohoScripting.com - unofficial Moho scripting documentat

Post by Stan »

Thanks Wes, that is fixed now.
So, if you set the width to 0, the field will be automatically sized to fit the initial text. If the number is greater than 0, the field will be sized to the number (in pixels). Perhaps, I should add some kind of explanatory tooltips or something.
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: MohoScripting.com - unofficial Moho scripting documentat

Post by synthsin75 »

Stan wrote:Thanks Wes, that is fixed now.
So, if you set the width to 0, the field will be automatically sized to fit the initial text. If the number is greater than 0, the field will be sized to the number (in pixels). Perhaps, I should add some kind of explanatory tooltips or something.
Thanks, Stan. I think it should be fairly self explanatory once anyone plays with the setting, but you could always add a tooltip to width explaining that 0 fits initial text.

Without initial text, which I often do, the TextControl box gets real short. A single space character fixes that.
Stan
Posts: 199
Joined: Sun Apr 19, 2009 3:22 pm

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by Stan »

Some good news, folks.
- Both mohoscripts.com and mohoscripting.com are now running on https.
- Link to the old Create New Script app is removed as obsolete.
- Fixed a bug with incorrect quotation of the tooltips in the Create New Script v2 app.
- Check out the new Tools section, especially if you are Notepad++ user like me.

Image
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
Stan
Posts: 199
Joined: Sun Apr 19, 2009 3:22 pm

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by Stan »

With the release of 13.5.2 the scripting interfaces .pkg files are available again. (They weren't available since 12.4).

So, the website has been updated with the new features of 13.5.2 (or maybe 13.5.1 or 13.5.0 - there's no way to find out).

For those who are interested, here's the list of the new API features:

Removed class: PoserActorGroup


Removed methods:

Code: Select all

Mesh3DLayer
	bool IsPoserLayer();
	PoserActorGroup *GetPoserActorGroup(int32 id);
	void UpdatePoserParameters();
	void SetSelectedPoserActorGroup(int32 id);
	void SelectPoserBody(const char *figureName);
	int32 SelectedPoserActorGroup();

ImageLayer
	void SetUniquePSDLayerID(int32 layerPSDID);
	int32 UniquePSDLayerID();
	void SetPSDLayerOrderID(int32 layerOrderID);
	int32 PSDLayerOrderID();

New Constants:

Code: Select all

MOHO
	BM_SOFT_LIGHT: 10
	BM_COLOR_DODGE: 11

New Classes:

Code: Select all

M_BoneGroup
	const char *Name();
	void SetName(const char *name);	
	int32 GetNumBones @ CountBones();
	M_Bone *GetBone @ Bone(int32 id);
	M_Bone *GetActiveBone @ ActiveBone();
	bool ContainsBoneID(int32 boneID);
	void AddBone(int32 boneID);
	void RemoveBone(int32 boneID);

LM.GUI.LM_ShortButton
	void SetLabel(const char *label);
New Methods:

Code: Select all

LM.GUI.ShortButton(const char *label, int32 msg = 0);


MohoLayer
	bool IsIgnoredByLayerPicker();
	void SetIgnoredByLayerPicker(bool b);

MeshLayer
	void SetContinuousTriangulation(bool b);
	bool ContinuousTriangulation();
	void SetNeedsWarpMeshUpdate();
	void UpdateWarpMesh();

ImageLayer
	void ResetPSDBounds();

BoneLayer
	float EvaluateWindTurbulentAngle(LM_Vector2 location);
	float EvaluateWindTurbulentStrength(LM_Vector2 location);

M_Mesh
	bool ContinuousTriangulation();
	M_Shape *GetUserEdgeShape @ UserEdgeShape();

M_Bone
	bool	IsGroupVisible();

M_Skeleton
	int32 GetNumGroups @ CountGroups();
	M_BoneGroup *GetGroup @ Group(int32 id);
	M_BoneGroup	*FirstSelectedGroup();
	M_BoneGroup *AddGroup(int32 frame);
	void DeleteGroup(M_BoneGroup *group);
	void DeleteGroupByID(int32 id);
	M_BoneGroup *GroupForBone(int32 boneID, bool considerParents = true);
	bool IsBoneInAGroup(int32 boneID);
	bool IsBoneActiveInAGroup(int32 boneID);
	void MarkGroupVisibilityUnknown();

ScriptInterface
	const char *UserPrefsDir();
	const char *UserPrefsFile();
	const char *UserContentDir();

New Arguments:

Code: Select all

LM.GUI.AngleWidget
		bool horizontal = false

New Properties:

Code: Select all

BoneLayer
	AnimVal			fWindDirection;
	AnimVal			fWindStrength;
	AnimVal			fWindTurbulentAmplitude;
	AnimVal			fWindTurbulentFrequency;

M_Bone
	bool		fWindDynamics;

M_BoneGroup
	AnimVal		fActiveBone;
	bool		fEnabled;
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by synthsin75 »

Thanks for the updates, Stan!
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by hayasidist »

Great work Stan! Many thanks.
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by hayasidist »

Stan wrote: Thu Nov 11, 2021 2:33 am With the release of 13.5.2 the scripting interfaces .pkg files are available again. (They weren't available since 12.4).
So, the website has been updated with the new features of 13.5.2 (or maybe 13.5.1 or 13.5.0 - there's no way to find out).
Just a heads up: There are new Channel Codes now as well (the ones on the website are from 12.2) -- if you've been using the names rather than the values you'll be fine, but if not - be aware that there are changes to this list - and some current (moho 13.5) channel codes were previously (moho 12.2) assigned to other channels.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by synthsin75 »

Thanks for the warning, Paul. I know you once advised me to use names rather than values.
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by hayasidist »

I've updated the website... the changes are as a result of the addition of V-bones and wind. Do let me know if there are any problems / questions!
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by synthsin75 »

Thanks for leaving the reference to the old values, Paul. Very helpful.
Stan
Posts: 199
Joined: Sun Apr 19, 2009 3:22 pm

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by Stan »

I know that some people just love dark interfaces. And I even received some complains about mohoscripting.com that the light interface hurts people's eyes. So now the website supports different color themes for its general interface, and for Lua syntax highlighting. There are only two themes for the interface, light and dark, but we may add more in the future. As for the syntax highlighting, there's a whole bunch of different themes, thanks to the Highlight.js library.

The styling was significantly refactored, so you may need to reload your browser's cache (Shift + Refresh should do the trick).

You can select color themes in the Tools section.

Image
________________________________________________________________________
https://mohoscripting.com/ - Unofficial Moho Lua scripting documentation
https://mohoscripts.com/ - The best place to publish and download scripts for Moho
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: MohoScripting.com - unofficial Moho scripting documentation

Post by hayasidist »

Stan wrote: Thu Jan 27, 2022 6:36 am I know that some people just love dark interfaces. And I even received some complains about mohoscripting.com that the light interface hurts people's eyes. So now the website supports different color themes for its general interface, and for Lua syntax highlighting. There are only two themes for the interface, light and dark, but we may add more in the future. As for the syntax highlighting, there's a whole bunch of different themes, thanks to the Highlight.js library.
I wasn't one of the complainers, but that's a really great 'addition' to the site! I love it! Thanks Stan!
Post Reply