Black_Mage icon

Skip Message Feature RMXP Script AMS Integration

Black_Mage | PRO | 07/04/15 11:36:54 AM UTC | 0 ⭐ | 874 👁️ | Never ⏰ | []
Ruby |

8.49 KB

|

None

|

0 👍

/

0 👎

# This is an integration of Skip Message Script by Black Mage into Dubealex AMS R4.
# The script need Dubealex AMS R4 to work properly.
# If you're not using Dubealex AMS, then use the original script, found in the link below :
# https://burningwizard.wordpress.com/2015/04/23/skip-message-feature-script-rmxp-rgss/
 
class Window_Message < Window_Selectable
  def update
    super
    if @fade_in
      self.contents_opacity += 24
      if @input_number_window != nil
        @input_number_window.contents_opacity += 24
      end
      if self.contents_opacity == 255
        @fade_in = false
      end
      return
    end      
    
    @now_text = nil if @now_text == "" 
 
    if @now_text != nil and @mid_stop == false
      if @write_wait > 0
        @write_wait -= 1
        return
      end
      text_not_skip = LETTER_BY_LETTER_MODE
      while true
        @max_x = @x if @max_x < @x
        @max_y = @y if @max_y < @y
        if (c = @now_text.slice!(/./m)) != nil
          if c == "\000"
            c = "\\"
          end
      
          if c == "\001"
            @now_text.sub!(/\[([0123456789ABCDEF#]+)\]/, "")
            temp_color = $1
            color = temp_color.to_i
            leading_x = temp_color.to_s.slice!(/./m)
            if leading_x == "#"
              self.contents.font.color = hex_color(temp_color)
              next
            end
            if color >= 0 and color <= 7
              self.contents.font.color = text_color(color)
            end
            next
          end
 
          if c == "\002"
            if @gold_window == nil and @popchar <= 0
              @gold_window = Window_Gold.new
              @gold_window.x = 560 - @gold_window.width
              if $game_temp.in_battle
                @gold_window.y = 192
              else
                @gold_window.y = self.y >= 128 ? 32 : 384
              end
              @gold_window.opacity = self.opacity
              @gold_window.back_opacity = self.back_opacity
            end
            c = ""
          end
 
          if c == "\003"
            @now_text.sub!(/\[([0-9]+)\]/, "")
            speed = $1.to_i
            if speed >= 0 and speed <= 19
              @write_speed = speed
            end
            c = ""
          end
 
          if c == "\004"
            @now_text.sub!(/\[(.*?)\]/, "")
            buftxt = $1.dup.to_s
            if buftxt.match(/\//) == nil and buftxt != "" then
              $soundname_on_speak = "Audio/SE/" + buftxt
            else
              $soundname_on_speak = buftxt.dup
            end
            c = ""
          elsif c == "\004" 
            c = ""
          end
      
          if c == "\005"
            @write_wait += 5
            c = ""
          end
      
          if c == "\006"
            @write_wait += 20
            c = ""
          end
      
          if c == "\016"
            text_not_skip = false
            c = ""
          end
      
          if c == "\017"
            text_not_skip = true
            c = ""
          end
      
          if c == "\020"
            @mid_stop = true
            c = ""
          end
      
          if c == "\021"
            terminate_message
            return
          end
      
          if c == "\023"
            @indent = @x
            c = ""
          end
 
          if c == "\024"
            @now_text.sub!(/\[([0-9]+)\]/, "")
            @opacity = $1.to_i
            color = self.contents.font.color
            self.contents.font.name = $ams.font_type
            self.contents.font.size = $ams.font_size
            self.contents.font.color = Color.new(color.red, color.green, color.blue, color.alpha * @opacity / 255)
            c = ""
          end
 
          if c == "\025"
            @now_text.sub!(/\[([0-9]+)\]/, "")
            self.contents.font.size = [[$1.to_i, 6].max, 32].min
            c = ""
          end
 
          if c == "\026"
            @now_text.sub!(/\[([0-9]+)\]/, "")
            @x += $1.to_i
            c = ""
          end
      
          if c == "\027"
            @now_text.sub!(/\[(.*?)\]/, "")
            @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
            if $soundname_on_speak != ""
              Audio.se_play($soundname_on_speak)
            end
            c = ""
          end
 
          if c == "\030"
            @now_text.sub!(/\[(.*?)\]/, "")
            self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
            if $soundname_on_speak != ""
              Audio.se_play($soundname_on_speak)
            end
            @x += 24
            c = ""
          end
 
          if c == "\n"
            @lines += 1
            @y += 1
            @x = 0 + @indent + @face_indent
            if @lines >= $game_temp.choice_start
              @x = 8 + @indent + @face_indent
              @cursor_width = @max_choice_x
            end
            c = ""
          end
      
          if c == "\022"
            @now_text.sub!(/\[([0-9]+)\]/, "")
            @x += gaiji_draw(4 + @x, @y * line_height + (line_height - self.contents.font.size), $1.to_i)
            c = ""
          end
      
          #NEW
          #Dubealex's Text Skip On/OFF Command
          if c == "\100"
            if @alex_skip==false
              @alex_skip=true
            else
              @alex_skip=false
            end
            c = ""
          end  
          #end of new command
                                   
          if c != ""
            self.contents.draw_text(0+@x, 32 * @y, 40, 32, c)
            @x += self.contents.text_size(c).width
            if $soundname_on_speak != "" then
              Audio.se_play($soundname_on_speak)
            end
          end
      
          #SKIP_TEXT_CODE
 
          # B = Escape, 0 (On The NumPad), X 
          # C = Enter, Space Bar and C
          # A = Shift, Z 
 
          if Input.press?(Input::CTRL) # <-- Change the value on that line
            text_not_skip = false
          end
          
          if Input.press?(Input::C) # <-- Change the value on that line
            if @alex_skip==false      
              text_not_skip = false
            end
          end
      
        else
          text_not_skip = true
          break
        end
    
        if text_not_skip
          break
        end
      end
      @write_wait += @write_speed
      return
    end
 
    if @input_number_window != nil
      @input_number_window.update
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        $game_variables[$game_temp.num_input_variable_id] =
        @input_number_window.number
        $game_map.need_refresh = true
        @input_number_window.dispose
        @input_number_window = nil
        terminate_message
      end
      return
    end
 
    if @contents_showing
      if $game_temp.choice_max == 0
        self.pause = true
      end
      # Skip feature added by Fatra
      if Input.press?(Input::CTRL)
        if $game_temp.choice_max > 0
        else
          terminate_message
        end
      end  
      if Input.trigger?(Input::B)
        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
          $game_system.se_play($data_system.cancel_se)
          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
          terminate_message
        end
      end
  
      if Input.trigger?(Input::C)
        if $game_temp.choice_max > 0
          $game_system.se_play($data_system.decision_se)
          $game_temp.choice_proc.call(self.index)
        end
        if @mid_stop
          @mid_stop = false
          return
        else
          terminate_message
        end
      end
      return
    end
 
    if @fade_out == false and $game_temp.message_text != nil
      @contents_showing = true
      $game_temp.message_window_showing = true
      refresh
      Graphics.frame_reset
      self.visible = true
      self.contents_opacity = 0
      if @input_number_window != nil
        @input_number_window.contents_opacity = 0
      end
      @fade_in = true
      return
    end
 
    if self.visible
      @fade_out = true
      self.opacity -= 48
      if self.opacity == 0
        self.visible = false
        @fade_out = false
        $game_temp.message_window_showing = false
      end
      return
    end
  end
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎