Show Picture From Different Folder

I have created an evented book system and am looking for a light wait solution to calling

$gameScreen.showPicture(1, "pic_1", 0, 20, 300, 100, 100, 255, 0) for example but it loading from

this.loadBitmap('img/book/', filename, hue, true);

instead of this.loadBitmap('img/pictures/', filename, hue, true);
you might need something like this

_.getPicture = function(filename, hue) {
return ImageManager.loadBitmap('img/FolderName/Folder2/', filename, hue, false);
};

Folder 2 is optional though, but its in the main root.
@ShadowDragon do you know where $gameScreen.showPicture(1, "pic_1", 0, 20, 300, 100, 100, 255, 0) is being handled?

I can only see objects.js line 9941 for the Interpreter Commander.
i show show picture is on your screen and place it else where, I try to make a book meny to add images,
but from the main folder of pictures though. I have no idea how to implent it which i like to do in a separated folder
for the plugin use. there might be a way but im also still learning everything around MV and its code handlers.

if you want to alias the gamescreen show picture, you need to create a window around it.
that is the point and not anywhere on the screen you see as teh "show picture" command as an event.
Game_Picture is an abstracted game object, I think this is the method of interest (rpg_sprites.js):
Code:
Sprite_Picture.prototype.loadBitmap = function() {
    this.bitmap = ImageManager.loadPicture(this._pictureName);
};
You could try a plugin that aliases this method based on, for example, the picture ID:
Code:
var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
Sprite_Picture.prototype.loadBitmap = function() {
  var id = this._pictureId;
  if ([1,2,3,4,5].contains(id)) {
    this.bitmap = ImageManager.loadBitmap('img/book/', this._pictureName, 0, true);
  } else {
    _Sprite_Bitmap_loadBitmap.call(this);
  }
};
I.e. if the picture ID is 1~5 inclusive, load the picture from img/book/, else do the usual thing.

Another option (might make more sense in the long run) could be to branch based on the picture name rather than its ID, e.g.
Code:
if (/^book/.test(this._pictureName)) {
  // book stuff
} else { ...
I.e. if the picture name starts with "book", load from the special "book" folder. The /^book/ thing is a regular expression, more details here in case you're interested: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp 🙏

I think personally I'd just establish a standard naming system for all the "book" pictures and stick to the normal Show Picture stuff. 😅
Game_Picture is an abstracted game object, I think this is the method of interest (rpg_sprites.js):
Code:
Sprite_Picture.prototype.loadBitmap = function() {
    this.bitmap = ImageManager.loadPicture(this._pictureName);
};
You could try a plugin that aliases this method based on, for example, the picture ID:
Code:
var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
Sprite_Picture.prototype.loadBitmap = function() {
  var id = this._pictureId;
  if ([1,2,3,4,5].contains(id)) {
    this.bitmap = ImageManager.loadBitmap('img/book/', this._pictureName, 0, true);
  } else {
    _Sprite_Bitmap_loadBitmap.call(this);
  }
};
I.e. if the picture ID is 1~5 inclusive, load the picture from img/book/, else do the usual thing.

Another option (might make more sense in the long run) could be to branch based on the picture name rather than its ID, e.g.
Code:
if (/^book/.test(this._pictureName)) {
  // book stuff
} else { ...
I.e. if the picture name starts with "book", load from the special "book" folder. The /^book/ thing is a regular expression, more details here in case you're interested: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp 🙏

I think personally I'd just establish a standard naming system for all the "book" pictures and stick to the normal Show Picture stuff. 😅

Whoa... Nice Info, I might use that regexp trick since it's more clean in the project asset folder~
😍
@caethyril thank you so much for all of your information, like you have suggested at the end, just buy naming things properly its not as messy as I thought it would be so will only look into this fully if i bump up against loading issues....the feature creeping has to stop at some point lol
EDIT: Nevermind, it worked now!

Thank you so much!

The solution was:

Sprite_Picture.prototype.loadBitmap = function() {
this.bitmap = ImageManager.loadPicture(this._pictureName);
var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
Sprite_Picture.prototype.loadBitmap = function() {
var id = this._pictureId;
if (/^p_/.test(this._pictureName)) {
this.bitmap = ImageManager.loadBitmap('img/sv_enemies/', this._pictureName, 0, true);
} else {
this.bitmap = ImageManager.loadBitmap('img/pictures/', this._pictureName, 0, true);
}}
};
Hey guys, I just had this issue and I solve it this way!:

$gameScreen.showPicture(1, "../sv_enemies/cockatrice", 1, 408, 250, 100, 100, 200, 2);

YES!!! I added ../ to go up a folder, and then picked a new one (sv_enemies), as simple as that 🙂

Using this method you could even get a picture from the root game folder, or from user folder or even from windows folder!

there is no limit 😳
Wow, did that work for you? For me, it doesn't take those \...
That's because it's ../ and not \..

Original thread: https://forums.rpgmakerweb.com/threads/show-picture-from-different-folder.110234/