Simple plugin Hello World - add to a menu item

Hi,

Day two and I’m trying to write a simple plugin for Asprite 1.3. So far so good - managed to install it ok. However, it doesn’t seem to have added to a menu - for that is the plan. This is what I’ve got so far.

function init(plugin)
print("Initializing...")

--

plugin:newMenuGroup {
id = group,
title = "Hello World",
group = "help_menu"
-- group = "edit_menu"
}

--

plugin:newCommand{
id = "HelloWorld",
title = "Simple plugin test",
group = group,
onclick = function()
print("Hello world")
end
}
end

function exit(plugin)
print("Aseprite is closing my plugin")
end

The idea is to simple print “Hello world” when accessing an item in the menu - i’ve tried help and edit.
This might not be possible as you might have to create a button in order to print text. And there doesn’t appear to be any console log if the plugin has installed problems - missing files etc.

I’ve looked at the example here, which starts of fine, but doesn’t have a complete script for newbies.

Any ideas where I’m going wrong?

You can’t add groups directly to the main menu bar groups. You can only add to groups that are referenced in a command’s group property in the gui.xml. It’s a little hacky.

For example, you can add to the edit_clear group:

image

I’ve made an issue report here, hopefully it will be fixed in the future: [Lua API] Some ui groups cannot be added to · Issue #5379 · aseprite/aseprite · GitHub

1 Like