Pause before player can select a choice?

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,399
Reaction score
731
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
1,076
Reaction score
854
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

Get ready to be Wowed!
Restaff
Joined
May 26, 2013
Messages
2,941
Reaction score
2,897
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
1,076
Reaction score
854
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,399
Reaction score
731
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
2
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
31,355
Reaction score
7,667
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,162
Reaction score
822
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

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,847
Messages
1,016,972
Members
137,561
Latest member
JaCrispy85
Top