RMMV [SOLVED ] Window_ItemDisplay

Status
Not open for further replies.

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
2,587
Reaction score
880
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
194
Reaction score
281
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,587
Reaction score
880
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
194
Reaction score
281
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,587
Reaction score
880
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,617
Reaction score
5,156
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 Posts

Latest Profile Posts

Officially not a mod anymore. Thanks for the many years!
Thinking if i should post on the classifieds section...
Made another plugin showcase video! :kaojoy:
(Plugins and details inside the description of the YouTube video.) :LZScheeze:
Ami
Castle is my Biggest Fear :kaodes:. I just Managed make Part by Part (like the Entrance only),not the Entire Castle like in the RM Sample...
This video really speaks to me...

Forum statistics

Threads
104,373
Messages
1,005,908
Members
135,894
Latest member
EnriX
Top