I'm using Cidiomar's Input script: http://www.rpgmakervxace.net/topic/2551-rgss3-input-full-utf8input-error-found-and-fixed/
and Hime's script that checks for if any is pressed: http://himeworks.com/2014/11/checking-if-any-key-is-pressed/
I have a pop up window with some information that inherits Window_Base. I would like for this window to remain visible until the player presses any key. The key that is pressed will be stored in a variable and the window disposes itself. I know I can get this by:
However, this pop up window is called through a menu. When I press return on the command that makes this window pop up, it automatically registers it as a key press for this new method that creates the pop up window and asks for input.
Here is an example of the script I'm using:
It's around line 88, the option2 method that is causing me a headache. When I leave it as shown, the if conditional is ran through (I'm assuming because of the return key being pressed to get to this method is still being processed as a key being pressed due to have fast the script is running through) and the window disposes very quickly. How do I go about the script waiting at this point in time for further user input instead of using the return key from accessing this method?
and Hime's script that checks for if any is pressed: http://himeworks.com/2014/11/checking-if-any-key-is-pressed/
I have a pop up window with some information that inherits Window_Base. I would like for this window to remain visible until the player presses any key. The key that is pressed will be stored in a variable and the window disposes itself. I know I can get this by:
Code:
if Input.any_key_pressed? == true if Input.pressed?(:LETTER_A) storedkey = :LETTER_A end if Input.pressed?(LETTER_ storedkey = :LETTER_B end ...... etc
However, this pop up window is called through a menu. When I press return on the command that makes this window pop up, it automatically registers it as a key press for this new method that creates the pop up window and asks for input.
Here is an example of the script I'm using:
Code:
# Init info for bottom windowclass Bottom_Info_Window < Window_Command def window_width return 544 end def window_height return 366 end def col_max return 1 end def alignment return 1 # center alignment end def make_command_list add_command("Option 2", :option2) end end# Init info for top windowclass Top_Command_Window < Window_Command def window_width return 544 end def window_height return 50 end def col_max return 3 end def alignment return 1 end def make_command_list add_command("Option 1", :option1) endend# init info for window that pops upclass Window_Popup < Window_Base def initialize super(50, 200, 450, 150) end def change_text(text) return unless text.is_a?(String) contents.clear draw_text(text, 0, 0, 450, 150) end def draw_text(text, x, y, text_width, text_height, alignment = 1) contents.draw_text(x, y, text_width, text_height, text, alignment) endend# Creates windows and contains command methodsclass Test_Menu < Scene_MenuBase def start super create_background create_windows end def create_windows @keyinfowindow = Bottom_Info_Window.new(0, 50) @keyinfowindow.set_handler(:option2, method(:option2)) @keyinfowindow.set_handler(:cancel, method(:undowindow)) @keywindow = Top_Command_Window.new(0, 0) @keywindow.set_handler(:option1, method(:option1)) @keywindow.set_handler(:cancel, method(:return_scene)) @keyinfowindow.active = false end def undowindow @keywindow.active = true @keyinfowindow.active = false end def option2 @popwindow = Window_Popup.new @popwindow.change_text("Press a key to close this window.") if Input.any_key_pressed? == true # problem area - this is where I'm having $storedkey = pressed() # difficulty. @popwindow.dispose @popwindow = nil @keyinfowindow.active = true p $storedkey end end def option1 @keyinfowindow.active = true @keywindow.active = false end def pressed if Input.press?(:LETTER_Q) return ':Q' elsif Input.press?(:LETTER_R) return ':R' elsif Input.press?(:RETURN) return ':RETURN' end endend
It's around line 88, the option2 method that is causing me a headache. When I leave it as shown, the if conditional is ran through (I'm assuming because of the return key being pressed to get to this method is still being processed as a key being pressed due to have fast the script is running through) and the window disposes very quickly. How do I go about the script waiting at this point in time for further user input instead of using the return key from accessing this method?