Is it possible to enforce a short wait before the player can select a choice from a 'Show Choices' command? By default, if the player is tapping the button during messages to avoid waiting for all the text to display, it is quite easy to accidentally select a choice before seeing them. I'm not sure how long the gap should be, half a second perhaps? Ideally the script will only prevent the player from selecting a choice, not from scrolling through them. Thanks for reading!
Pause before player can select a choice?
RGSS3 Script RequestsSure! You can use the following scriptlet :
Or you can edit lines 24 and 25 of the script to set a default for all choice inputs.
Code:
#==============================================================================# ** Game_Message#==============================================================================class Game_Message #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :choice_wait # frame wait before showing choices attr_accessor :choice_wait_press # wait until user halts input #-------------------------------------------------------------------------- # * ALIAS - Clear #-------------------------------------------------------------------------- unless method_defined?(:choice_f3YBEBMZ_gm_clear) alias_method(:choice_f3YBEBMZ_gm_clear, :clear) end def clear(*args, &block) choice_f3YBEBMZ_gm_clear(*args, &block) # Change values to set default for all choice inputs @choice_wait = 0 @choice_wait_press = false endend # Game_Message#==============================================================================# ** Window_ChoiceList#==============================================================================class Window_ChoiceList < Window_Command #-------------------------------------------------------------------------- # * ALIAS - Object Initialization #-------------------------------------------------------------------------- unless method_defined?(:choice_UvZVkywt_wcl_initialize) alias_method(:choice_UvZVkywt_wcl_initialize, :initialize) end def initialize(message_window, *args, &block) @choice_wait = 0 @choice_wait_press = false choice_UvZVkywt_wcl_initialize(message_window, *args, &block) end #-------------------------------------------------------------------------- # * ALIAS - Frame Update #-------------------------------------------------------------------------- unless method_defined?(:choice_NijdHkOl_wcl_update) alias_method(:choice_NijdHkOl_wcl_update, :update) end def update(*args, &block) update_input_wait choice_NijdHkOl_wcl_update(*args, &block) end #-------------------------------------------------------------------------- # * NEW - Update Input Wait #-------------------------------------------------------------------------- def update_input_wait return if @choice_wait == 0 if @choice_wait_press && Input.press?(:C) @choice_wait = $game_message.choice_wait end @choice_wait -= 1 end #-------------------------------------------------------------------------- # * ALIAS - Start Input Processing #-------------------------------------------------------------------------- unless method_defined?(:choice_kRGebiXc_wcl_start) alias_method(:choice_kRGebiXc_wcl_start, :start) end def start(*args, &block) @choice_wait = $game_message.choice_wait @choice_wait_press = $game_message.choice_wait_press choice_kRGebiXc_wcl_start(*args, &block) end #-------------------------------------------------------------------------- # * ALIAS - Handling Processing for OK and Cancel Etc. #-------------------------------------------------------------------------- unless method_defined?(:choice_I4oHtm5H_wcl_process_handling) alias_method(:choice_I4oHtm5H_wcl_process_handling, :process_handling) end def process_handling(*args, &block) choice_I4oHtm5H_wcl_process_handling(*args, &block) if @choice_wait == 0 endend # Window_ChoiceList
Code:
# Callable as follows :$game_message.choice_wait = num_frame_to_wait# or ... # With 'choice_wait_press' set to 'true', the frame wait set by# 'choice_wait' will be reset whenever the user presses a button.# In this case, 'choice_wait' should be set fairly low (10 ~ 20 frames).$game_message.choice_wait_press = true_false$game_message.choice_wait = num_frame_to_wait# Place script call before the message leading up to the choice list.
This is quite a nice one, thank you again ExHydra!
Edit: Hmm I am trying it out here and tried to select it, I only had it delay before the choices where shown. It's not allowing me to scroll through the choices before input is accepted after the given time elapses. I'll keep trying to see if I am using it properly.
EDIT2: Tested with dialogue spamming before choice and it works even with non keyboard controls for Shaz's mouse driven system. Much appreciated =3
Edit: Hmm I am trying it out here and tried to select it, I only had it delay before the choices where shown. It's not allowing me to scroll through the choices before input is accepted after the given time elapses. I'll keep trying to see if I am using it properly.
EDIT2: Tested with dialogue spamming before choice and it works even with non keyboard controls for Shaz's mouse driven system. Much appreciated =3
Ah, no, that's what I thought MU was after, but re-reading the request it is not. I'll poke around with it a little more. I also added the ability to wait until the user stopped pressing a button to continue. I'll see if I can work those in to the original request as well.
EDIT : Above script updated to fit MU's request!
EDIT : Above script updated to fit MU's request!
Exhydra, it works perfectly! Thank you so much 😀 😀
This looks super usefull and amazing. 😀
Happend to me more then once, that I accidently hit the wrong choice, because of tapping the button too fast. 😀
What are the terms of use for this awesome script? 🙂 (\s/)
Happend to me more then once, that I accidently hit the wrong choice, because of tapping the button too fast. 😀
What are the terms of use for this awesome script? 🙂 (\s/)
All of my scripts are under the Creative Commons Attribution-ShareAlike licence unless otherwise stated. o:
Apologies for the necro, but I wanted to use the script above and unless I'm missing something it's all jammed together into one line with no spacing? How do I use this?
@AngusBeef
you can't
this mashup of scripts into one-liners was caused by a forum problem one or two years back, and it needs a scripter to sort it out again into the correct form before any such script can ever work again.
In some cases, this was already done - but only if someone needed the script and found someone with programming knowledge to sort it out.
you can't
this mashup of scripts into one-liners was caused by a forum problem one or two years back, and it needs a scripter to sort it out again into the correct form before any such script can ever work again.
In some cases, this was already done - but only if someone needed the script and found someone with programming knowledge to sort it out.
Here you go:
Code:
# Callable as follows : $game_message.choice_wait = num_frame_to_wait
# or ...
# With 'choice_wait_press' set to 'true', the frame wait set by
# 'choice_wait' will be reset whenever the user presses a button.
# In this case, 'choice_wait' should be set fairly low (10 ~ 20 frames).
# $game_message.choice_wait_press = true_false
# $game_message.choice_wait = num_frame_to_wait
# Place script call before the message leading up to the choice list.
#==============================================================================
# ** Game_Message
#==============================================================================
class Game_Message
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :choice_wait # frame wait before showing choices
attr_accessor :choice_wait_press # wait until user halts input
#--------------------------------------------------------------------------
# * ALIAS - Clear
#--------------------------------------------------------------------------
unless method_defined?(:choice_f3YBEBMZ_gm_clear)
alias_method(:choice_f3YBEBMZ_gm_clear, :clear)
end
def clear(*args, &block)
choice_f3YBEBMZ_gm_clear(*args, &block)
# Change values to set default for all choice inputs
@choice_wait = 0
@choice_wait_press = false
end
end # Game_Message
#==============================================================================
# ** Window_ChoiceList
#==============================================================================
class Window_ChoiceList < Window_Command
#--------------------------------------------------------------------------
# * ALIAS - Object Initialization
#--------------------------------------------------------------------------
unless method_defined?(:choice_UvZVkywt_wcl_initialize)
alias_method(:choice_UvZVkywt_wcl_initialize, :initialize)
end
def initialize(message_window, *args, &block)
@choice_wait = 0
@choice_wait_press = false
choice_UvZVkywt_wcl_initialize(message_window, *args, &block)
end
#--------------------------------------------------------------------------
# * ALIAS - Frame Update
#--------------------------------------------------------------------------
unless method_defined?(:choice_NijdHkOl_wcl_update)
alias_method(:choice_NijdHkOl_wcl_update, :update)
end
def update(*args, &block)
update_input_wait
choice_NijdHkOl_wcl_update(*args, &block)
end
#--------------------------------------------------------------------------
# * NEW - Update Input Wait
#--------------------------------------------------------------------------
def update_input_wait
return if @choice_wait == 0
if @choice_wait_press && Input.press?(:C)
@choice_wait = $game_message.choice_wait
end
@choice_wait -= 1
end
#--------------------------------------------------------------------------
# * ALIAS - Start Input Processing
#--------------------------------------------------------------------------
unless method_defined?(:choice_kRGebiXc_wcl_start)
alias_method(:choice_kRGebiXc_wcl_start, :start)
end
def start(*args, &block)
@choice_wait = $game_message.choice_wait
@choice_wait_press = $game_message.choice_wait_press
choice_kRGebiXc_wcl_start(*args, &block)
end
#--------------------------------------------------------------------------
# * ALIAS - Handling Processing for OK and Cancel Etc.
#--------------------------------------------------------------------------
unless method_defined?(:choice_I4oHtm5H_wcl_process_handling)
alias_method(:choice_I4oHtm5H_wcl_process_handling, :process_handling)
end
def process_handling(*args, &block)
choice_I4oHtm5H_wcl_process_handling(*args, &block) if @choice_wait == 0
end
end # Window_ChoiceList
Original thread: https://forums.rpgmakerweb.com/threads/pause-before-player-can-select-a-choice.42823/