Show Picture From Different Folder

Indsh

Veteran
Veteran
Joined
Oct 11, 2015
Messages
225
Reaction score
65
First Language
English
Primarily Uses
N/A
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);
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
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.
 

Indsh

Veteran
Veteran
Joined
Oct 11, 2015
Messages
225
Reaction score
65
First Language
English
Primarily Uses
N/A
@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.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,895
Reaction score
1,029
First Language
Dutch
Primarily Uses
RMMV
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.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
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 :kaothx:

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

Trace

A Rieri Fan :3
Member
Joined
Jun 7, 2014
Messages
10
Reaction score
9
First Language
Indonesia
Primarily Uses
RMMV
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 :kaothx:

I think personally I'd just establish a standard naming system for all the "book" pictures and stick to the normal Show Picture stuff. :kaoswt:
Whoa... Nice Info, I might use that regexp trick since it's more clean in the project asset folder~
:kaoluv:
 

Indsh

Veteran
Veteran
Joined
Oct 11, 2015
Messages
225
Reaction score
65
First Language
English
Primarily Uses
N/A
@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
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
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);
}}
};
 
Last edited:

stramin

Veteran
Veteran
Joined
Nov 4, 2012
Messages
99
Reaction score
46
First Language
spanish
Primarily Uses
N/A
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 o_O
 

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Wow, did that work for you? For me, it doesn't take those \...
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top