How to merge tools?

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
Vagabond
Posts: 106
Joined: Wed Aug 19, 2009 11:44 pm
Location: Connecticut
Contact:

How to merge tools?

Post by Vagabond »

I had an idea for an improved Select Shape tool.

A regular LMB click would select the shape
Holding down shift +LMB would select more than one shape so I could hit the spacebar and make them one shape like how text is one style

ALT+LMB would push both Fill and Stroke
ALT+RMB would push stroke only

CTRL+LMB would push the fill only
Holding down CTRL + dragging the RMB will change the line width

I've never scripted before but is there a way I could at least copy the Line Width tool into the Select Shape tool? I know I'm clueless and am probably talking crazy. Since the User's Manual doesn't even have a paragraph on basic Lua I wouldn't know where to start. Any suggestions?
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

First get a good code editor that highlights syntax etc. so you more easily can see what you are doing. Scite is a good cross platform one.

Open up both scripts you want to merge in the editor, then copy/paste between them. Study different scripts and figure out how it all works.

There's some documentation for lua scripting if you dig around here at the forum:
viewtopic.php?t=11627&highlight=lua+reference
viewtopic.php?t=1031
http://www.lua.org/manual/5.0/manual.html

Good luck! Hope you'll manage to do what you want.
Vagabond
Posts: 106
Joined: Wed Aug 19, 2009 11:44 pm
Location: Connecticut
Contact:

Post by Vagabond »

THANK YOU rylleman. You have definitely put me on the right track with learning scripting. Scite looks like a great programming sandbox to start playing in too. Hopefully I will be able to contribute something to the forum soon.
Post Reply