Proper way to make row window from window_selectable.

Discussion in 'Learning Javascript' started by ougitou1, Mar 4, 2018.

  1. ougitou1

    ougitou1 Invisible Black Veteran

    Messages:
    101
    Likes Received:
    9
    First Language:
    en-
    Primarily Uses:
    N/A
    <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.
     
    #1
  2. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,523
    Likes Received:
    8,652
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    What 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.
    };
     
    #2
    ougitou1 likes this.
  3. ougitou1

    ougitou1 Invisible Black Veteran

    Messages:
    101
    Likes Received:
    9
    First Language:
    en-
    Primarily Uses:
    N/A
    thanks a bunch. :kaocry:
     
    #3
  4. ougitou1

    ougitou1 Invisible Black Veteran

    Messages:
    101
    Likes Received:
    9
    First Language:
    en-
    Primarily Uses:
    N/A
    ok next question, how do you draw a character in such a window?
     
    #4
  5. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,523
    Likes Received:
    8,652
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    Window_SavefileList.prototype.drawItem fires a function that draws a character, among other things.
     
    #5
    ougitou1 likes this.
  6. ougitou1

    ougitou1 Invisible Black Veteran

    Messages:
    101
    Likes Received:
    9
    First Language:
    en-
    Primarily Uses:
    N/A
    can it only be done from the window_savefilelist ?
     
    #6
  7. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,523
    Likes Received:
    8,652
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    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?
     
    #7
    ougitou1 likes this.
  8. ougitou1

    ougitou1 Invisible Black Veteran

    Messages:
    101
    Likes Received:
    9
    First Language:
    en-
    Primarily Uses:
    N/A
    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. :kaocry:
     
    #8
  9. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,523
    Likes Received:
    8,652
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    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.
     
    #9
    ougitou1 likes this.
  10. ougitou1

    ougitou1 Invisible Black Veteran

    Messages:
    101
    Likes Received:
    9
    First Language:
    en-
    Primarily Uses:
    N/A
    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. :kaosigh: have you ever experienced such an error btdubs?
     
    #10
  11. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,523
    Likes Received:
    8,652
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    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.
     
    #11
    ougitou1 likes this.
  12. ougitou1

    ougitou1 Invisible Black Veteran

    Messages:
    101
    Likes Received:
    9
    First Language:
    en-
    Primarily Uses:
    N/A
    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.
     
    #12

Share This Page