def exit_command @window = New_Text_Creator.new @window.change_text("Are you sure you want to exit?") #line that needs to wait for user input add_command("Yes", :exit) add_command("No", :cancel) end
I have tried plenty of methods, but none have worked. This is what I've tried:
def exit_command @window = New_Text_Creator.new @window.change_text("Are you sure you want to exit?") Input.press?:)CTRL) #control is one of the constants used by Input.press? add_command("Yes", :exit) add_command("No", :cancel) endend
Code:
def exit_command @window = New_Text_Creator.new @window.change_text("Are you sure you want to exit?") if Input.press?(:CTRL) add_command("Yes", :exit) add_command("No", :cancel) endendCode:
def exit_command @window = New_Text_Creator.new @window.change_text("Are you sure you want to exit?") if Input.press?(:CTRL) do add_command("Yes", :exit) add_command("No", :cancel) endendCode:
def exit_command @window = New_Text_Creator.new @window.change_text("Are you sure you want to exit?") case BUTTON when Input.press?(:CTRL) add_command("Yes", :exit) add_command("No", :cancel) endendCode:
If anyone knows a better way to make it wait for user input on the keyboard (or any way at all), then could you please tell me how to make my script wait!? I'm sure it isn't really that hard, but I haven't been able to figure it out, so any help would be appreciated! def exit_command @window = New_Text_Creator.new @window.change_text("Are you sure you want to exit?") yield until Input.press?(:CTRL) add_command("Yes", :exit) add_command("No", :cancel) endend