Discord
Login
Community
DARK THEME

Draw maps of the project in custom plugin

I made a plugin (Javascript Language). when I run plugin itself then I can correctly list the maps and draw small thumbnails of them. When I enable my plagin in a project and set Working Folder to nothing then the system.project.listFiles("maps") gives me the correct map list of the project, but the msImage.drawMap(path,...) function draws the maps only from the plugin itself. That means if the path of my projects map is the same as in the plugin then the plugin map is drawn else nothing. The result is the same if I use the map object in msImage.drawMap(map,...). The map itself has correct data from project.

project plugin map drawn
project->maps/level1/ground plugin->maps/level1/ground yes plugin map
project->maps/level2/ground no such folder or map nothing

The correct behavior i need is to draw the the bypassed into msImage.drawMap projects maps.

Is that a Microstudio bug? Do I need to set something else beside the WorkingFoloder="" of the plugin?

When you add a plugin to a project, you can set a name for the plugin's working folder - text field. By default, the plugin name is there. The plugin is limited to this folder, it cannot download or save anything outside of this folder. If you delete the name completely - the plugin will be able to read, write and delete anywhere in the project.

If, despite deleting the name, you still cannot read the map, make the plugin public.

This project only works correctly if you delete its name in the text field of this plugin

https://microstudio.dev/i/joyrider3774/projectinfo/

Plugins will only use their own assets unless you use system.project.readFile.

@Loginus, @TwiceUponATime As I already written the "Working Folder" - the field that Loginus meant, is already set to "", that means I have the Projects root access:

the functions system.project.listFiles and system.project.readFile do work. I have the correct maps of the project What does not work is the msImage.drawMap. Even if I bypass the correct map from project it does not draw it. It seams like the functions msImage.drawMap and screen.drawMap are glued to plugin folder.

I loaded sprites before loading maps, now everything works fine.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community