[VXAce] Using multiple of the same window class in the same scene with different info shown

Discussion in 'RGSSx Script Support' started by Sixth, Dec 5, 2014.

  1. Sixth

    Sixth Veteran Veteran

    Messages:
    2,132
    Likes Received:
    801
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Here I am again!

    This time I started my first scene completely made by me.

    However, I got an issue, which I can't seem to fix...

    So, the scene will be for Tsukihime's Party Manager script.

    The link for the script, if it is needed:

    http://forums.rpgmakerweb.com/index.php?/topic/17270-party-manager/

    The scene will show the available party members, the new parties and all the info needed for them, and on this scene the player can arrange the actors how he/she likes. When the arrangement is completed, upon exiting the scene, the parties automatically spawn at the desired place and with the party members the player arranged on the scene.

    Now, this all works just fine.

    The only thing which is not fully working is the new parties windows.

    I use this script call to initiate the scene:

    def enter_party_scene(info=[]) SceneManager.call(Scene_Party_Manager_S) SceneManager.scene.prepare(info) endAnd the prepare looks like this:
    Code:
      def prepare(info)    p "start! "    @partiess = Array.new    info.each do |party| # [party_id,[starting_actor_ids],[map_id, map_x, map_y],[min_mem,max_mem],"custom_text"]      print "Party: "; p party      @partiess[info.index(party)] = [party[0],party[1],party[2],party[3],party[4]]    end     end
    This gets all the info I need for the scene.An example script call (which is used on the screenshot below):

    party1 = [2,[],[21,3,4],[3,4],"Location: Eerie Forest"]party2 = [3,[],[21,4,4],[4,5],"Location: Castle Entrance"]party3 = [4,[],[21,7,4],[2,6],"Location: Cave Tunnels"]info = [party1,party2,party3]enter_party_scene(info)This is how I initiated the new party windows for showing the future party info:
    Code:
      def create_parties_window    @parties = Array.new    print "p.size: "; p @partiess.size    #@partiess.size.times do |index|    @partiess.each do |party|      index = @partiess.index(party)      @parties[index] = PM_Parties.new(@partiess[index],index,@partiess.size)      @parties[index].set_handler(:on_member_new, method(:member_remove))     #@parties[index].set_handler(:on_cancel, method(:confirm_cancel_par))     # @parties[index].set_handler(:cancel, method(:confirm_cancel_par))      @parties[index].deactivate     # index += 1    end  end
    See, I used an array, because I need different identifiers for each separate party window.But I am not sure if this leads me to my actual problem, or not.

    So, the actual problem:

    I can't move the cursor on any of these party windows.

    It got a Command_Window parent class.

    When printing the 'active' value, it always prints the normal value, which is true if activated and false if not.

    In theory it is working, but in practice, the cursor won't move on any of these windows, I can't even press the direction buttons to move it, no sound effects, nothing happens.

    The scene won't freeze or anything when I activate one of these windows, it just won't show any cursor change at all, and there will be no effect on any button presses aside from the "switch-back" button, which gets me back on the window on the left.

    Here is a sample screenshot of how the scene looks right now:

    party_manager_scene_alpha_v1.PNG

    If I need to post the whole scene script, I can do that too later, I am not on my laptop now, writing this from memory.

    This is far from being a finished scene, no visuals are done on it yet, I just put it up, so my explanation is made clear.

    The problematic windows are on the right side of the screen.

    So, my question, why can't I operate the cursor on those windows?

    My guess is because of the method I used to make those windows in the scene, but I am not sure.

    And if it is really the issue, than how could I make them in another way?

    The 'info' used on the script call can be very different at each call, the size of it can vary too, so I thought that it is a good try. No so sure anymore. :D

    Any help would be appreciated, thanks! *-*
     
    Last edited by a moderator: Dec 5, 2014
    #1
  2. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,969
    Location:
    Philippines
    First Language:
    Tagalog
    At the end of the line you deactivated the window that you created...

    What is the normal value that is printed out for all of them?

    What is the value that p @partiess.size print out when you test it out?

    also, if ur gonna do this



    @partiess.each do |party|index = @partiess.index(party)@parties[index] = PM_Parties.new(@partiess[index],index,@partiess.size)@parties[index].set_handler:)on_member_new, method:)member_remove))#@parties[index].set_handler:)on_cancel, method:)confirm_cancel_par))# @parties[index].set_handler:)cancel, method:)confirm_cancel_par))@parties[index].deactivate# index += 1end
    might as well just do



    Code:
    @partiess.each_index do |index|@parties[index] = PM_Parties.new(@partiess[index],index,@partiess.size)@parties[index].set_handler(:on_member_new, method(:member_remove))#@parties[index].set_handler(:on_cancel, method(:confirm_cancel_par))# @parties[index].set_handler(:cancel, method(:confirm_cancel_par))@parties[index].deactivate# index += 1end
     
    Last edited by a moderator: Dec 5, 2014
    #2
  3. Sixth

    Sixth Veteran Veteran

    Messages:
    2,132
    Likes Received:
    801
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    I deactivated them, because that is not the active window when the scene starts.

    Did that because when I first play-tested the scene, I got the command window and the current party member window both activated at the start, so I figured I just deactivate every window except the command window, and activate (and later deactivate) the others when I need to.

    And this works everywhere, except at the right windows, but there nothing seems to work, unfortunately. >.>

    I activate the first window on the right (the top one) with a button trigger when the lower left window is active, and get back to that same window on the left when I press the same button while any of the right window is active.

    And yeah, thanks for the shortcut for the window making, I always forget about the 'each_index' method.

    '@partiess.size' is the size of the 'info' in the script call. Basically, it is the number of "to be created parties". I need that to divide the Graphics.height with that, and assign the result as the window_height for each window. It always prints out the right value (in the example, it is 3).

    As for the 'active' value printed out for those windows...

    I made the 'update' in the scene like this:

    def update super if @members.active == true if Input.trigger?:)kSHIFT) Sound.play_cursor @parties_activated = true @parties[@party_index].active = true @members.deactivate p @parties[@party_index].active @parties[@party_index].update_cursor end end # if @parties_activated == true if @parties[@party_index].active == true if Input.trigger?:)kSHIFT) Sound.play_cursor @parties_activated = false @parties[@party_index].active = false @members.activate p @parties[@party_index].active end if Input.trigger?:)kDOWN) @party_last = @party_index Sound.play_cursor @parties[@party_index].active = false @party_index += 1 if @party_index > @parties.size - 1 @party_index = 0 end @parties[@party_index].select(0) @parties[@party_index].active = true @parties[@party_last].active = false print "party index down: "; p @party_index print "index: "; p @parties[@party_index].index p @parties[@party_index].active @parties[@party_index].update_cursor end if Input.trigger?:)kUP) @party_last = @party_index Sound.play_cursor @party_index -= 1 if @party_index < 0 @party_index = @parties.size - 1 end @parties[@party_index].select(0) @parties[@party_index].active = true @parties[@party_last].active = false print "party index up: "; p @party_index print "index: "; p @parties[@party_index].index p @parties[@party_index].active @parties[@party_index].update_cursor end end end
    So, when I press the SHIFT button while the left window is active, one of the right window activates and the left one deactivates. When I am on one of the right windows, pressing UP or DOWN should make me switch between the right windows themselves. And pressing SHIFT on any of the right windows, it takes me back on the left window and deactivates the currently activated right window.

    Here is what I see on the console when I test the prints:

    Pressing SHIFT on the left window prints a 'true' for the window activation status.

    Pressing SHIFT on the right window prints a 'false' for the same window's activation status.

    This seems to be working, but still it isn't for some reason. >.>

    Pressing UP or DOWN, the printed index shows the right values (0, 1 and 2), the sound effect plays well too. But for some reason, my cursor is not activated on any of the right windows.

    There is no error, no freeze, it's just the cursor won't react on anything, it won't even blink like it should on an activated window.

    I can jump left and right with the SHIFT button, and the left window is always activated when it should, the right windows however never get activated.

    Just got home, so here is the full script:

    party_man_scene_alpha1.txt

    It needs Tsukihime's Party Manager script if you want to test it.

    Even if you don't want to test it, maybe you will see something I made wrong, which leads to this annoying issue I have.

    Ignore the many dead code and commented out stuffs. :p

    Thanks for the help!

    EDIT:

    Well, I managed to emulate the effect I wanted with hard-coding the direction button trigger effects and the OK/Cancel effects in the 'update' method itself. It works like that, thou the cursor still won't blink, that is it's only fault now. Still pretty annoying issue, and I am still clueless why those windows won't work like they should. >.>
     

    Attached Files:

    Last edited by a moderator: Dec 6, 2014
    #3
  4. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,969
    Location:
    Philippines
    First Language:
    Tagalog
    Try calling refresh on the activated window maybe?
     
    Last edited by a moderator: Dec 6, 2014
    #4
  5. Sixth

    Sixth Veteran Veteran

    Messages:
    2,132
    Likes Received:
    801
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    It doesn't work, tried that already.


    Nothing seems to work. :(


    The info shown is perfect, everything is perfect except the cursor.


    I gave up on that, managed to did everything in the 'update' method of the scene.


    The cursor moves where it should when I forcibly call '@parties[@index].select(@p_index)' on direction button presses, and it operates well like that. It just doesn't blink, unfortunately.


    Maybe I will try to emulate the blinking effect too someday, but first I make the functions bug-free and design the rest of the visuals.


    Ohh, well, I will try to find a solution after I finish the whole scene completely, maybe there is something I am missing. For now, the scene looks pretty good and I guess I will release it soon for public use and bug testing.
     
    #5

Share This Page