<Hi guys, first here... um i was wondering if anyone knows of a way to properly make a row window using window_selectable. I've tried and succeeded but im getting weird errors and i'd like to know why. I figured that the errors must mean i've done it wrong, hence me asking. So if there is anyone who know knows anything on the matter pls, id appreciate any help.
Proper way to make row window from window_selectable.
Learning JavascriptWhat do you mean by a row window? A window that, instead of having one column and multiple rows, has one row and multiple column? In other words horizontal window? If that's the case, then it is easy.
Code:
function Window_Row () {
this.initialize.apply(this, arguments);
};
Window_Row.prototype = Object.create(Window_Selectable.prototype);
Window_Row.prototype.constructor = Window_Row;
Window_Row.prototype.initialize = function (x,y,width.height) {
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
};
Window_Row.prototype.maxRows = function () {
return 1;
};
Window_Row.prototype.maxCols = function () {
return whatever amount of items visible on screen you need.
};
ok next question, how do you draw a character in such a window?
Window_SavefileList.prototype.drawItem fires a function that draws a character, among other things.
can it only be done from the window_savefilelist ?
Of course not. It can be used in any window. But savefilelist does it, so you can find inspiration there. How much do you know about object oriented programming btw?
not much really, but i do understand the structure of rmmv's main code and how to manipulate it. It just that i created a custom save_file window using a window by doing this,
Window_SavefileList.prototype.maxCols = function() {
return 3;
};
Window_SavefileList.prototype.maxItems = function() {
return 3; //DataManager.maxSavefiles();
};
Window_SavefileList.prototype.maxVisibleItems = function() {
return _max_save_slots; //5;
};
Window_SavefileList.prototype.itemHeight = function() {
var innerHeight = this.height - this.padding * 2;
return Graphics.boxHeight / 4 + 150; //Math.floor(innerHeight / this.maxVisibleItems());
};
but i keep getting an error where characters i draw are not shown. but when i close and reopen the menu they show up in the top right corner.
which is highly annoying. And i need to get pass this as ive been stuck on it for a while now. 😢
Window_SavefileList.prototype.maxCols = function() {
return 3;
};
Window_SavefileList.prototype.maxItems = function() {
return 3; //DataManager.maxSavefiles();
};
Window_SavefileList.prototype.maxVisibleItems = function() {
return _max_save_slots; //5;
};
Window_SavefileList.prototype.itemHeight = function() {
var innerHeight = this.height - this.padding * 2;
return Graphics.boxHeight / 4 + 150; //Math.floor(innerHeight / this.maxVisibleItems());
};
but i keep getting an error where characters i draw are not shown. but when i close and reopen the menu they show up in the top right corner.
which is highly annoying. And i need to get pass this as ive been stuck on it for a while now. 😢
Well, from what you've shown I can't be any wiser. Because 1. I don't see the whole code, 2. I don't see your console (f8) reports if there are errors and 3. I don't know what _max_save_slots is and where it is defined.
ok the code is extremely cluttered and unorganized i usually do that after im done so basically its unreadable for anyone else sorry also there are no reported errors in the console. which is why i thought i did something wrong in building the window leading to my current problem. 😔 have you ever experienced such an error btdubs?
No, never had this error. But even if I did experience such an error, there are a myriad of different possible reasons why certain thing is happening.
Ok thanks for your help. Ill try drawing the character in another window then placing it where i need it. not sure if it will work. then as a last resort ill recreate the window from bottm up.
Original thread: https://forums.rpgmakerweb.com/threads/proper-way-to-make-row-window-from-window_selectable.92161/