Script Structure

*pfx = two or three letter script prefix (usually the initials of the script creator)

pfx_ScriptName:Name() return String - script "long name" - called when the user opens the "Help > About Scripts" menu

pfx_ScriptName:Version() return String - script version identifier

pfx_ScriptName:Description() return string - long description

pfx_ScriptName:Creator() return string - author's name / designation / affiliation

pfx_ScriptName:UILabel() return string - Label shown in the UI (menu or tool bar) - called by Moho when (setting up a menu?)

pfx_ScriptName:Run(moho, view) - called when button or menu script is activated

pfx_ScriptName:IsEnabled(moho) - called when tool is changed and moving in/out of frame zero

pfx_ScriptName:IsRelevant(moho) - called when tool is changed and moving in/out of frame zero

pfx_ScriptName:OnMouseDown(moho, mouseEvent) - called when mouse left-click is pressed

pfx_ScriptName:OnMouseMoved(moho, mouseEvent) - called when mouse is moved while holding left button

pfx_ScriptName:OnMouseUp(moho, mouseEvent) - called when mouse left-click is released

pfx_ScriptName:OnKeyDown(moho, keyEvent) - called when keyboard key is pressed

pfx_ScriptName:OnKeyUp(moho, keyEvent) - called when keyboard key is released

pfx_ScriptName:NonDragMouseMove() - return bool (return true to have "MouseMoved()" called even if the mouse button is not down) - called at script activation

pfx_ScriptName:SavePrefs(prefs) return void - prefs: see class ScriptPrefs - this typically does many prefs:Setxxx - called by Moho when (a different script is started?)

pfx_ScriptName:LoadPrefs(prefs) - called at script activation

pfx_ScriptName:ResetPrefs() - called when the reset tool or reset all tools button is pressed. The script needs to reset its variables (?? moho does not do this automatically)

pfx_ScriptName:OnInputDeviceEvent(moho, InputDeviceEvent) - called when an event on a connected device (e.g. tablet) occurs - not wholly clear to me if this is "any" input device (i.e. it's "pass through" by Moho) or just ones that moho will trap and pre-process (this seems more probable)

pfx_ScriptName:DrawMe(moho, view)

pfx_ScriptName:DoLayout(moho, layout)

pfx_ScriptName:HandleMessage(moho, view, msg)

For the dialog methods, see the LM_SimpleDialog class.