Pause before player can select a choice?

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,402
Reaction score
739
First Language
English
Primarily Uses
N/A
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!
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
927
Reaction score
677
First Language
English
Primarily Uses
RMMV
Sure! You can use the following scriptlet :

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.
Or you can edit lines 24 and 25 of the script to set a default for all choice inputs.
 
Last edited by a moderator:

Bonkers

Bioware, do you need a nap?
Restaff
Joined
May 26, 2013
Messages
2,948
Reaction score
2,891
First Language
English
Primarily Uses
RMMV
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
 
Last edited by a moderator:

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
927
Reaction score
677
First Language
English
Primarily Uses
RMMV
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!
 
Last edited by a moderator:

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,402
Reaction score
739
First Language
English
Primarily Uses
N/A
Exhydra, it works perfectly! Thank you so much :D :D
 

Gothic Lolita

YouTube Starlet
Veteran
Joined
Oct 21, 2014
Messages
1,132
Reaction score
197
First Language
German
Primarily Uses
RMMV
This looks super usefull and amazing. :D
Happend to me more then once, that I accidently hit the wrong choice, because of tapping the button too fast. :D

What are the terms of use for this awesome script? :) (\s/)
 

AngusBeef

Warper
Member
Joined
May 2, 2017
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMVXA
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?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
28,986
Reaction score
6,669
First Language
German
Primarily Uses
RMMV
@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.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
805
First Language
Hungarian
Primarily Uses
RMVXA
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

The universe does not want me to do another letsplay it seems... I keep bumping into problem after problem... Oh well. Still have several days to sort them out.
I now have something new to learn. Lesson suggestions?
Finally with a new PC! Now I can do nice things both coding and gaming
nvidia release the IA paint to lsd landscape simulator
i just try , it very fun
"If the lion knew her own strength, hard were it for anyone to rule her". This would be my custom title if I had enough spaces for it. Coming off of personal pain, I'm glad I found the original quote I've tweaked.

Forum statistics

Threads
93,458
Messages
912,611
Members
122,988
Latest member
negajo
Top