Simple Script Change: Disable Message Sound Effect Script

Discussion in 'RGSS3 Script Requests' started by Randolph Carter, Jul 6, 2012.

  1. Randolph Carter

    Randolph Carter Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    Hello,

    I am using this script to play sound effects when messages are shown. I was just wondering if a simple line of code could be added to allow a script call that would disable the entire plugin momentarily.

    Thanks



    Code:
    # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
    # Message Window SEs v1.0
    # FenixFyreX
    # RPG Maker VxAce
    # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
    # This script adds sound effects to the characters and control characters drawn
    # in the message window. You can choose for the character to wait with the se,
    # or just for the se to wait, thus not slowing the text any.
    # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
    module FyxA
    module LetterSE
    # How long should each respective type of characte wait? In frames.
    Waits = {
    	 :char => 5,
    	 :line => 0,
    	 :page => 0, }
    
    # Should the respective type of character wait for its alotted time above,
    # or should just the SE wait?
    CharsWait = {
    	 :char => false,
    	 :line => false,
    	 :page => false, }
    
    # RPG::SE.new(name,volume,pitch)
    # volume and pitch can be left out, or included.
    # Set to nil for no sound effect at all.
    SEs = {
    :char => RPG::SE.new("Talk",70),
    :line => nil,
    :page => nil,
    :gold => nil,
    :wait => nil,
    :input => nil,
    :fast => nil,
    :slow => nil,
    :skip => nil,
    :color => nil,
    :icon => nil,
    :big => nil,
    :small => nil, }
    end
    end
    
    class Window_Message < Window_Base
    alias initialize_char_se_wait initialize
    def initialize(*a,&
    @fyx_waits = {:char => fyx_wait(:char),
    				 :line => fyx_wait(:line),
    				 :page => fyx_wait(:page), }
    initialize_char_se_wait(*a,&
    end
    alias new_page_se_fyx new_page
    def new_page(*a,&
    new_page_char_wait
    new_page_se_fyx(*a,&
    end
    alias process_new_line_se_fyx process_new_line
    def process_new_line(*a,&
    new_line_char_wait
    process_new_line_se_fyx(*a,&
    end
    alias process_escape_se_fyx process_escape_character
    def process_escape_character(*a,&
    fyx_escape_se(a[0].upcase).play rescue nil
    process_escape_se_fyx(*a,&
    end
    alias process_norm_char_se_fyx process_normal_character
    def process_normal_character(*a,&
    normal_char_wait
    process_norm_char_se_fyx(*a,&
    end
    alias close_n_wait_se_fyx close_and_wait
    def close_and_wait(*a,&
    close_n_wait_se_fyx(*a,&
    self.contents.clear
    end
    def obtain_escape_param_!(text)
    text.slice(/^\[\d+\]/)[/\d+/].to_i rescue 0
    end
    def char_wait_se?(sym)
    (b = FyxA::LetterSE::CharsWait[sym]).nil? ? false : b
    end
    def fyx_wait(sym)
    (n = FyxA::LetterSE::Waits[sym]).nil? ? 0 : n
    end
    def reset_fyx_wait(sym)
    @fyx_waits[sym] = fyx_wait(sym)
    end
    def fyx_escape_se(code)
    case code
    when '$'; fyx_char_se(:gold)
    when '.','|'; fyx_char_se(:wait)
    when '!'; fyx_char_se(:input)
    when '>'; fyx_char_se(:fast)
    when '<'; fyx_char_se(:slow)
    when '^'; fyx_char_se(:skip)
    when 'C'; fyx_char_se(:color)
    when 'I'; fyx_char_se(:icon)
    when '{'; fyx_char_se(:big)
    when '}'; fyx_char_se(:small)
    end
    end
    def fyx_char_se(sym)
    (se = FyxA::LetterSE::SEs[sym]).nil? ? RPG::SE.new : se
    end
    def normal_char_wait
    if char_wait_se?(:char)
    	 wait(fyx_wait(:char))
    	 fyx_char_se(:char).play rescue nil
    else
    	 update_normal_char_wait
    end
    end
    def new_line_char_wait
    if char_wait_se?(:line)
    	 wait(fyx_wait(:line))
    	 fyx_char_se(:line).play rescue nil
    else
    	 update_line_char_wait
    end
    end
    def new_page_char_wait
    self.contents.clear
    if char_wait_se?(:page)
    	 wait(fyx_wait(:page))
    	 fyx_char_se(:page).play rescue nil
    else
    	 update_page_char_wait
    end
    end
    def update_normal_char_wait
    @fyx_waits[:char] -= 1
    if @fyx_waits[:char] <= 0
    	 fyx_char_se(:char).play rescue nil
    	 reset_fyx_wait(:char)
    end
    end
    def update_line_char_wait
    @fyx_waits[:line] -= 1
    if @fyx_waits[:line] <= 0
    	 fyx_char_se(:line).play rescue nil
    	 reset_fyx_wait(:line)
    end
    end
    def update_page_char_wait
    @fyx_waits[:page] -= 1
    if @fyx_waits[:page] <= 0
    	 fyx_char_se(:page).play rescue nil
    	 reset_fyx_wait(:page)
    end
    end
    end
    
     
    #1

Share This Page