Script to Ignore Text Wait Commands

Marche100

Villager
Member
Joined
Aug 11, 2013
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Hey, all.

I'm making a visual novel with VX Ace (would have done it in Visual Novel Maker, but unfortunately that didn't exist until my project was well into development), and one thing I've always really liked is using VX Ace's wait commands to emulate pauses in speech. For instance, I might have a line like: "Oh,\. hey,\. Maya.\! When did you get here?" Brief pauses after commas and certain other punctuation, with a wait for player input at the end of sentences.

However, I know there are people out there who would prefer to be rid of the text pauses and be left to read at their own pace. So, I was wondering if anyone would be willing (assuming it's possible in the first place) to create a script that ignores text wait commands (\. \| and \!) if a switch is turned on. That way, I could easily make it so the player can change the text speed whenever they want and hopefully make more people happy. Of course, if there's an easier way to do this, that works too, but as far as I know, the only way to do this in-engine would be... messy and time-consuming to say the least.

Thanks!
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,386
Reaction score
581
First Language
Italian
Primarily Uses
RMVXA
Code:
module HRK_WMSP
  SWITCH_ID = 10 # Set this to be your switch ID
  # Do not modify after this point
  def self.skip_wait
    $game_switches[SWITCH_ID]
  end
end

class Window_Message < Window_Base
  
  alias hrk_process_escape_character_old  process_escape_character
  def process_escape_character(code, text, pos)
    if HRK_WMSP.skip_wait
      case code.upcase
      when '$'
        @gold_window.open
      when '>'
        @line_show_fast = true
      when '<'
        @line_show_fast = false
      when '^'
        @pause_skip = true
      else
        super
      end
    else
      hrk_process_escape_character_old(code, text, pos)
    end
  end

end
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
809
First Language
Hungarian
Primarily Uses
RMVXA
You are calling super instead of the alias. That will render many scripts that add new message codes in that method useless, since the new message codes will not be read when that switch is turned on.

It would be easier to just remove those pause message codes when the switch is on before the drawing method even starts.
Way more compatible and can be done with a single alias. Something like:
Code:
class Window_Base < Window

  alias rid_pauses9926 convert_escape_characters
  def convert_escape_characters(text)
    text = clear_pause_codes(text.clone) if $game_switches[999]
    rid_pauses9926(text)
  end
 
  def clear_pause_codes(text)
    text.gsub!("\\.","")
    text.gsub!("\\|","")
    text.gsub!("\\!","")
    return text
  end
 
end
Just replace the switch ID (999 in the snippet) with the ID of the switch you want to use.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,386
Reaction score
581
First Language
Italian
Primarily Uses
RMVXA
That one is definitely more compatible with other scripts. Although, if no script is being used to add new message codes, I would rather refrain from changing the text using gsub!, it is quite a slow method, its complexity is O(N), but it is not a very fast linear one (I wonder why though, it does not look that hard to implement efficiently to me).

On the other hand, if scripts to add more message codes are being used, changing the text before checking those codes might be a better option.
 

Marche100

Villager
Member
Joined
Aug 11, 2013
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Sorry for the late response, been a busy week.

Thanks a bunch for your help! One question regarding where to stick these things. If I use, say, Sixth's code, I presume I would put it somewhere in Window_Base, and towards the top (before the text is drawn). And then it should automatically trigger if the switch is on, right? Just a little confused about how to use these snippets of code.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,386
Reaction score
581
First Language
Italian
Primarily Uses
RMVXA
No, both of them are supposed to be placed below Materials in your script editor. As a general rule, do not edit normal classes unless you absolutely know what you are doing.
Mine has less compatibility issues if you place it above other scripts, Sixth's can be placed wherever you want.
 

Marche100

Villager
Member
Joined
Aug 11, 2013
Messages
13
Reaction score
4
First Language
English
Primarily Uses
Gotcha. Thanks a lot once again, both of you! This works like an absolute charm. I couldn't be happier! (And I'm sure this will make my players will be pleased as well.)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Check out SpokenWord- my text-to-speech plugin for RPG Maker MV!
just watched spacex launch. was awesome.
Jumping and gravitation 0.1 build - RPG Maker MV
Currently playing final fantasy 3 on DS. It's an old one but its a classic.

Forum statistics

Threads
97,958
Messages
948,126
Members
129,204
Latest member
Nimhe
Top