Smarter Text Persistence (Show Text Combining With Choices)

Venima

Treasure experiences and sensations, not progress.
Veteran
Joined
Oct 8, 2013
Messages
128
Reaction score
48
First Language
English
Primarily Uses
N/A
Smarter Text Persistence

Introduction
A simple script (fix) to make "show text" still combine windows with choice selections when separated by conditional branches, comments or jump to label events.


Features
The event "show text" will combine with choice selection, number selection or item selection regardless of any of the following being executed inbetween:

- Conditional branches (can be nested)

- Jump to labels

- Comments

But not:

- Labels


Screenshots

SmTxPr1.png

SmTxPr2.png

SmTxPr3.png

SmTxPr4.png
How to Use

Installation: Simply insert this script in the Script Editor under Materials (above Main Process).

If you don't want the text to persist, just put a blank label underneath it.

If you want to put a label between text and choices and have the text persist, put a jump to label above it as shown in the 4th screenshot.



Bugs

[Fixed 12/10] If text is the last event, game crashes (derp).

Script

Code:
#==============================================================================
# Smarter Text Persistence
# By: Muramasa & Venima
# Version 1.01
#------------------------------------------------------------------------------
# A simple script to make "show text" still combine with choice selection
# when separated by conditional branches, comments or jump to label events.
#------------------------------------------------------------------------------
# Installation: Simply insert this script in the Script Editor near the bottom
# under Materials (above Main Process).
#------------------------------------------------------------------------------
# Special usage:
# If you don't want the text to persist, just put a blank label under it.
# If you want to put a label between text and choices and have the text
# persist, put a jump to label just above the label.
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Show Text
  #--------------------------------------------------------------------------
  def command_101
    wait_for_message
    $game_message.face_name = @params[0]
    $game_message.face_index = @params[1]
    $game_message.background = @params[2]
    $game_message.position = @params[3]
    while next_event_code == 401       # Text data
      @index += 1
      $game_message.add(@list[@index].parameters[0])
    end
    while check_text_persist(next_event_code); end #Smarter Text Persistence
    case next_event_code
    when 102  # Show Choices
      @index += 1
      setup_choices(@list[@index].parameters)
    when 103  # Input Number
      @index += 1
      setup_num_input(@list[@index].parameters)
    when 104  # Select Item
      @index += 1
      setup_item_choice(@list[@index].parameters)
    end
    wait_for_message
  end
 
  def check_text_persist(code)
    case code
    when 111 # Conditional Branch
      @index += 1
      execute_command
      if (next_event_code==411) # Else
        @index += 1
        execute_command
      end
      @indent += 1
      return true
    when 0 # Close indent
      if @index == @list.length - 2 #bugfix #1
        return false
      end
      @index += 1
      @indent -= 1
      return true
    when 108, 119, 411, 412 # Comment, Jump to Label, Else, Conditional Branch End
        @index += 1
        execute_command
      return true
    end
    return false
  end
end

FAQ

Q: What is this script compatible with?
A: Mostly anything, if another script modifies command_101, try adding in the line "while check_text_persist(next_event_code); end" above the "case next_event_code" in the other script.

Credit and Thanks
Muramasa & Venima

Feel free to use this script as you wish.
 
Last edited:

tale

Volunteer
Veteran
Joined
Dec 16, 2016
Messages
632
Reaction score
1,069
First Language
English
Primarily Uses
N/A
Fixed script format, credit Muramasa & Venima.
Code:
#==============================================================================
# Smarter Text Persistence
# By: Muramasa & Venima
# Version 1.01
#------------------------------------------------------------------------------
# A simple script to make "show text" still combine with choice selection
# when separated by conditional branches, comments or jump to label events.
#------------------------------------------------------------------------------
# Installation: Simply insert this script in the Script Editor near the bottom
# under Materials (above Main Process).
#------------------------------------------------------------------------------
# Special usage:
# If you don't want the text to persist, just put a blank label under it.
# If you want to put a label between text and choices and have the text
# persist, put a jump to label just above the label.
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Show Text
  #--------------------------------------------------------------------------
  def command_101
    wait_for_message
    $game_message.face_name = @params[0]
    $game_message.face_index = @params[1]
    $game_message.background = @params[2]
    $game_message.position = @params[3]
    while next_event_code == 401       # Text data
      @index += 1
      $game_message.add(@list[@index].parameters[0])
    end
    while check_text_persist(next_event_code); end #Smarter Text Persistence
    case next_event_code
    when 102  # Show Choices
      @index += 1
      setup_choices(@list[@index].parameters)
    when 103  # Input Number
      @index += 1
      setup_num_input(@list[@index].parameters)
    when 104  # Select Item
      @index += 1
      setup_item_choice(@list[@index].parameters)
    end
    wait_for_message
  end
 
  def check_text_persist(code)
    case code
    when 111 # Conditional Branch
      @index += 1
      execute_command
      if (next_event_code==411) # Else
        @index += 1
        execute_command
      end
      @indent += 1
      return true
    when 0 # Close indent
      if @index == @list.length - 2 #bugfix #1
        return false
      end
      @index += 1
      @indent -= 1
      return true
    when 108, 119, 411, 412 # Comment, Jump to Label, Else, Conditional Branch End
        @index += 1
        execute_command
      return true
    end
    return false
  end
end
 

Venima

Treasure experiences and sensations, not progress.
Veteran
Joined
Oct 8, 2013
Messages
128
Reaction score
48
First Language
English
Primarily Uses
N/A
Thanks @tale. I've updated the original post with the fix. :)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Not easy to find DS resources, is it? I need to make a good compilation thread linking to all the artists that do DS...
Spent a whole evening planning Stats, Animations, Abilities of 24 different weapons.. Only to realize I was just Bloating the Game. In the end i decided to stick with only 6.
Haven’t gotten over a mentor’s promotion. He deserves it, but he was the first person to be nice to me at work. It’s been hard for me to let him go.
So its confirmed MZ will have tile size locked at 48x48. So thats extremely lame. Still probably going to get it for the assets but Im gonna pout the whole time.
A friend used to ask why I don't colorize most of my drawings? The answer: I'm colorblind.

Forum statistics

Threads
99,342
Messages
964,312
Members
130,945
Latest member
studiojap
Top