RMMV [SOLVED ] Window_ItemDisplay

Status
Not open for further replies.

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,629
Reaction score
900
First Language
Dutch
Primarily Uses
RMMV
move when in wrong section!

SOLVED: SpacingY between items,

ISSUE LEFT: UPDATE Item Display Picture when opening the scene (see image)
itemscene.png
I hope someone can help me how to update this ItemDisplay window, it does work,
after pressing OK or after pressing Right or Down and back, but not on the 1st item
when opening the scene.

if anyone knows how, I would be happy :)
 
Last edited:

casper667

Casper Gaming
Veteran
Joined
Mar 15, 2012
Messages
210
Reaction score
290
First Language
English
Primarily Uses
RMMZ
Images do not load instantly when you call ImageManager.loadPicture (or other call), so if you try to draw it right away you will run into problems. It appears to work after the initial load because images are cached and don't need to be loaded subsequent times. You need to either add a load listener to the bitmap by doing yourImage.addLoadListener(callbackFunction) which will be called when the image is done loading, or make an update function that checks if the image is loaded every frame.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,629
Reaction score
900
First Language
Dutch
Primarily Uses
RMMV
I got no idea how to approach that, I got 2-3 refresh function to read th item and item meta,
still learning, there are some other issues with it as well, but I need it anyway otherwise
for improvement for it.

can you make a sample on how to make a call back function?
while refresh and refreshItemDisplay didn't quiet work.
 

casper667

Casper Gaming
Veteran
Joined
Mar 15, 2012
Messages
210
Reaction score
290
First Language
English
Primarily Uses
RMMZ
The code would look something like this
JavaScript:
yourBitmapObject.addLoadListener(this.yourFunctionName.bind(this, {"arg1": arg1, "arg2": arg2}));
Then when the bitmap finishes loading it will call yourFunctionName with the arguments provided (if you don't need any arguments, then you can probably just do:
Code:
bitmap.addLoadListener(this.yourFunctionName.bind(this));
or even
Code:
bitmap.addLoadListener(this.yourFunctionName);
if the "this" context isn't important for your function.

Then in your refresh function (or wherever you start loading the image) you could do something like:
Code:
this.yourVariable = ImageManager.loadPicture(file, hue);
this.yourVariable.addLoadListener(this.yourFunctionName.bind(this));
and then when it's loaded it will call yourFunctionName

---Alternative---

you can also make an update function that checks if ImageManager.isReady() is true, if so draw your image.

Code:
yourClass.prototype.update = function() {
  parent.prototype.update.call(this);
  if(ImageManager.isReady()) {
    this.yourFunctionName();
  }
};
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,629
Reaction score
900
First Language
Dutch
Primarily Uses
RMMV
it has an update function, 3 refreshes to return too, but the code is bit changed, and improved.
as well for the updatePlacements of those images.

so the issue is solved,

while I dont work with loadListener before, the bottom part is something I didn't know either,
but more easier to understand than the others, I keep this is mind and save the samples,
so I can play with those. Thank you for for the time and explanation of those samples.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,645
Reaction score
5,166
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

Less than a week and I can move into my new apartment and out of this bad situation. I'm so excited! Then game making power will increase. :kaoluv:
Enter the password in letters. (English subtitles)
I really tried to pull off something for halloween, but I don't feel like going on. I feel like the plot I was building was too generic, and I couldn't connect to it as I do with other projects. On the bright side, I've been working on my cosmic-puzzle project, so far I think the core mechanics are working properly, so I'll be creating some large test maps to see how it works out.
People2_5 & SF_Monster1 added!

Ami
--- X Costume ---

M.Healer: I'm wearing M.Mage's Costume.
M.Mage: I'm wearing M.Healer's Costume.
M.Knight: Why not using the Scary Costume like me,The Scary Frankenstein?
M.Healer: Err…Because we have low of Budget.
M.Mage: Yeah,right.

Forum statistics

Threads
104,602
Messages
1,007,483
Members
136,084
Latest member
TikeTenGamesOffical
Top