quack_rgss

Chatter Messages 1.4

Jan 14th, 2016
2,583
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2. #==============================================================================
  3.  * Chatter Messages (Yami's Pop Messages Addon) - v1.4
  4.   Author: Quack
  5. #==============================================================================
  6. What it does:
  7. 1-Allows you to use 'chatter' messageboxes. The difference from normal messages
  8.   is that they don't pause the game and don't close by pressing the action key.
  9.   Instead you provide the message with a timer and it will close automically
  10.   when the time is up. Another difference is that several chatter messages can
  11.   be active at once (though there is a limit (7 by default) which you can adjust
  12.   by chaning MAX_MSGS a bit lower down).
  13.   To make a message into 'chatter' use the '<cm:X>' tag in your message, where X
  14.   is the duration in seconds (IMPORTANT: THIS TAG HAS TO BE ON THE FIRST LINE
  15.   OF THE MESSAGE TO WORK).
  16.   Set X to a negative number and the message will last forever.
  17.   You can use this method in a script call to close all chatter messages:
  18.   clear_chatter
  19.  
  20. 2-By default Pop messages show a speech bubble tag of sorts so it's easier to
  21.   see which character the message belongs to.
  22.   I changed that code a bit and added option of showing a speech bubble tag or
  23.   thought bubble tag for the chose character.
  24.   Speech bubble tag is the same message tag as previous: \bm[x]
  25.   While thought bubble tag is: \bmt[x]
  26.  
  27. 3-By defauult Pop messages don't work during combat. Now they do.
  28.   It works mostly like normal. Use \bm[x] or \bmt[x] to show a pop message.
  29.   The difference is that to apply the pop message to an enemy, make x a positive
  30.   number. So enemy 1 \bm[1] and enemy 4 would be \bm[4]
  31.   Meanwhile actors use negative numbers. Like so: actor 1= \bm[-1]
  32.   HOWEVER, for pop messages to work for actors they needed to have a visual
  33.   battler. And I can't guarantee it will work with all actor battler scripts.
  34.   The only one I can guarantee works is Jet's sideview battlers since it's what
  35.   I use.
  36.   One problem with Pop messages in battler is that if a battle has a different
  37.   size than a normal character sprite the message box will get a bit missplaced.
  38.   To fix that I added to other messagebox tags to use to change the position.
  39.   \ox[X] - Offsets the messagebox position horizontally by X pixels.
  40.   \oy[X] - Offsets the messagebox position vertically by X pixels.
  41.  
  42. Please note if you are using Yanfly's core script & Yanfly's Ace Message script
  43.   together. You need to set FONT_NAME in the core script to have the same value
  44.   as MESSAGE_WINDOW_FONT_NAME in the ace message script. Otherwise when these
  45.   two are combined it will sometimes cause the width of text to be
  46.   miss-measured. This wouldn't cause much of a problem normally, but when using
  47.   pop messages which measure the width of the text to set the width of the
  48.   message box it can cause big problems. (the other font settings on the two
  49.   scripts (that is bold, italic, shadow and outline) should preferably also be
  50.   the same on both)
  51.  
  52. VERSION 1.1 ADDITIONS:
  53.  
  54. 1-Added text sound. You can add different text sounds in the TEXT_SOUNDS hash
  55.   in the config area (further instructions on adding sounds there). By default
  56.   messages won't have sound. To add it use this tag: <ts:x>   where x is a key
  57.   that exists in the TEXT_SOUNDS hash.
  58.  
  59. 2-Added Message box background tones. This allows you to specify different
  60.   background colors for your message boxes. You can add different tones in the
  61.   WINDOW_TONES has in the config area (further instructions on adding tones
  62.   there). By default it will use the normal window tone. To use one of the tones
  63.   in the WINDOW_TONES has use this tag: <bc:x>  where x is a key that exists in
  64.   the WINDOW_TONES hash.
  65.  
  66. 3-Sometimes you might want to change font size in your message, multiple times,
  67.   or do other things that might affect the size required by your message and
  68.   therefore cause the size of the message window too be to big or too small. So
  69.   I added a tag to use to adjust the message window size: <pms:x,y> . It changes
  70.   Pop Message Size, adjusting the width by x and height by y. So if you put
  71.   <pms:20,-10> in your message it will increase the width of the window by 20
  72.   and decrease the height by 10.
  73.  
  74. 4-If you're like me you think it's annoying to have to remember which event has
  75.   what id when writing messages and it's further annoying to have to write so
  76.   many tags for each message. That is why I made it so now in my game using this
  77.   script I can position my pop message on the event I want and make it use the
  78.   background color and text sound that I want just by entering this tag:
  79.   <bt:x> (for speech bubble)  OR <btt:x> (for thought bubble)
  80.   How does that work you might ask?
  81.   Well lets say I have an event which is supposed to be one of my actors. Let's
  82.   call the actor Emil. In the name box of the event I put the tag: <emil>.
  83.   Now when I use the tags: <bt:emil> or <btt:emil>  the pop message will get
  84.   placed on that event. And if WINDOW_TONES has a value with the key 'emil',
  85.   that window tone will be used too. Same for TEXT_SOUNDS except if you are
  86.   using btt because thoughts shouldn't make sound now should they?
  87.   Doesn't that sound so much easier?
  88.   It will also make it easier to tell which event is saying a text when looking
  89.   at the event command in the editor since you know who 'emil' is but might not
  90.   be able to as easily tell which event '72' is.
  91.  
  92.   You can also specify the player with these tags by using 'pl', like so:
  93.   <bt:pl>
  94.   The reason I added this was to allow setting window tone and text sound for
  95.   player as well. This probably won't be all to useful in most cases since
  96.   the showing actor for the party might vary but I figured I should still add
  97.   the functionality.
  98.  
  99.   If you are wondering why all my new tags use different structure than the
  100.   previously existing ones then well.... because! Consistence is overrated
  101.   anyway, who needs it?
  102.  
  103.   Using these these two tags (<bt:x> & <btt:x>) does however require the
  104.   functionality of one of my other scripts, called Qonvenience (guess you could
  105.   kind of call it my 'core' script like how other scripters have (Yanfly,
  106.   Victor, Yami, etc).
  107.   You can find a link to it under the 'Requirements' section.
  108.  
  109. VERSION 1.2 ADDITIONS:
  110.  
  111. -When showing choices it will appear differently depending on if the open
  112.   game_message is a pop message or not. If it is not it will display like normal.
  113.   But if it is a pop message the message window will be made bigger and the
  114.   choices will be displayed inside the message window.
  115.  
  116. VERSION 1.3:
  117.  
  118. -Fixed some problems with faces graphics and nameboxes. It's still not perfect
  119.   but I wrote this script for a project of mine where I don't use nameboxes
  120.   or face graphics so I don't really want to put too much effort into features
  121.   I'm not personally interested in.
  122.  
  123. -Like with window tones and text sounds, you can now associate namebox names to
  124.   a tag.
  125.  
  126. -Position adjustments can also be be associated to a nametag now using POS_ADJUST.
  127.  
  128. ==============================================================================
  129. Instructions/Install notes:
  130. Requires Yami's Pop messages to work.
  131. Paste it below Yami's Pop messages script.
  132.  
  133. ==============================================================================
  134. Requirements:
  135. Requires Yami's Pop messages to work. You can find it here:
  136. ​https://github.com/suppayami/rmvxa-collection/blob/master/yami-script-ace/10%20-%20Pop%20Message.txt
  137. Also requires my script Qonvenience if you plan on using the message tags
  138. <bt:x> and <btt:x>
  139. Find it here:
  140. http://pastebin.com/J6haUy5T
  141.  
  142. ==============================================================================
  143. Credits:
  144. Yami for making Pop messages.
  145.  
  146. ==============================================================================
  147. Terms of Use:
  148. Use it however you wish (yes, that does include commercial projects), as long
  149. as you do not claim it as your own code. I would also prefer you mention me in
  150. your credits if you do decide to use it.
  151. However do remember that this script relies on Yami's pop messages script which
  152. has it has it's own separate terms of use.
  153.  
  154. ==============================================================================
  155. Bugs:
  156. dunno
  157.  
  158. ==============================================================================
  159. History:
  160. 13/06/2018 - Fixed some things. Hopefully it isnt completely broken anymore.
  161. 11/10/2016 - Fixed some problems added some minor feature.
  162. 19/01/2016 - Fixed some bugs, changes to choices when a pop message is used.
  163. 14/01/2016 - Chatter messages now last forever if you set the duration to a
  164.              negative number. Also added method for clearing all chatter
  165.              to use in script calls. Also squashed some bugs.
  166. 13/01/2016 - Pretty big update. Added more functionality.
  167. 10/01/2016 - Proper release since Absurdiness found the original script so I
  168.              could separate the addon from the original.
  169. 08/01/2016 - Initial release
  170.  
  171. =end
  172.  
  173. $imported = {} if $imported.nil?
  174. $imported["Chatter_Messages"] = true
  175.  
  176. #==============================================================================
  177. # * CONFIG
  178. #==============================================================================
  179.  
  180. module YSE
  181.   module POP_MESSAGE
  182.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  183.     # - Visual Settings -
  184.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185.    
  186.     EFFECT2 = { # Start.
  187.       :bubble_tag_name => "BubbleTag_Speech",
  188.       :thought_bubble_tag_name => "BubbleTag_Thought",
  189.     } # End.
  190.   end
  191. end
  192.  
  193. module QUACK
  194.   module MSG
  195.    
  196.     # Max amount of chatter messages that can be exist at the same time.
  197.     # Too few might be limiting your options and too many will clutter up
  198.     # the screen and decrease performance.
  199.     MAX_MSGS = 7
  200.    
  201.     # Used for setting the background color of messages.
  202.     # To add a tone the syntax is:
  203.     # Key => Tone.new(Red,Green,Blue,Grey)
  204.     # Where key is a string, Red,Green and Blue are numerical value from -255 to
  205.     # 255. And Grey is a value from 0 to 255. The Grey value is optional so you
  206.     # don't have to add it.
  207.     # If you are unsure how to do it just copy one of the lines, paste it below
  208.     # and edit the values.
  209.     WINDOW_TONES = {
  210.       # Add tones below this line
  211.       'reddish1' => Tone.new(85,44,51),
  212.       'bluehair' => Tone.new(-34,85,102),
  213.       'geezer' => Tone.new(68,68,68,10),
  214.       'pl' => Tone.new(102,34,-34),
  215.       'alf' => Tone.new(102,34,51),
  216.       # And above this line
  217.     }
  218.    
  219.     # The name is kind of self explanatory
  220.     # If you want to add a sound the syntax is this:
  221.     #Key => [Sound, Volume, Pitch minimum, Pitch Maximum],
  222.     # where Key is a string. Sound is the name of your sound,
  223.     # Volume, Pitch minimum and Pitch Maximum are values from 0-100.
  224.     # Text sound automatically gets disabled for thought bubbles even if text
  225.     # sound is specified.
  226.     # Just a copy a line, paste it and edit it.
  227.     TEXT_SOUNDS = {
  228.       # Add sounds below this line
  229.       '0' => nil, # DEFAULT VALUE USED FOR NO SOUND!
  230.       '1' => ["Cursor1", 80, 70, 100],
  231.       '2' => ["Cursor1", 80, 90, 120],
  232.       '3' => ["Knock", 80, 50, 75],
  233.       'bluehair' => ["Cursor1", 80, 90, 120],
  234.       'geezer' => ["Cursor1", 80, 45, 70],
  235.       'pl' => ["Cursor1", 80, 70, 100],
  236.       'alf' => ["Cursor1", 70, 110, 140],
  237.       # And above this line
  238.     }
  239.    
  240.     NAMES = {
  241.       # Add names below this line
  242.       'bluehair' => "Riverhead",
  243.       'geezer' => "Geezer"
  244.     }
  245.    
  246.     POS_ADJUST = {
  247.       'test' => [20,10]
  248.     }
  249.    
  250.     # Play sound per X characters displayed.
  251.     SOUND_PLAY_FREQUENCY = 3
  252.    
  253.     # Whether the pop message should grow to make place for choices as the text
  254.     # finishes or just have the final size immediately.
  255.     POP_CHOICE_GROW = true
  256.    
  257.   end
  258. end
  259.  
  260. #==============================================================================
  261. # * SCRIPT START
  262. #==============================================================================
  263.  
  264. #==============================================================================
  265. # ?! DataManager
  266. #==============================================================================
  267. module DataManager
  268.   class << self
  269.     alias quack_msg_create_game_objects create_game_objects
  270.     def create_game_objects
  271.       quack_msg_create_game_objects
  272.       if !$imported["YSE-PopMessage"]
  273.         msgbox(sprintf("This script(Chatter Messages) requires Yami's Pop Messages to function", "ChatterMessages", 1))
  274.         exit
  275.       end
  276.       $game_message.quack_msg_make
  277.     end
  278.    
  279.     alias qmsg_sng setup_new_game
  280.     def setup_new_game
  281.       $game_message.clear_chatter
  282.       qmsg_sng
  283.     end
  284.   end
  285. end
  286.  
  287. #==============================================================================
  288. # ?! BattleManager
  289. #==============================================================================
  290. module BattleManager
  291.   class << self
  292.     alias qmsg_proc_victory process_victory
  293.     def process_victory
  294.       $game_message.clear_chatter
  295.       qmsg_proc_victory
  296.     end
  297.    
  298.     alias qmsg_proc_abort process_abort
  299.     def process_abort
  300.       qmsg_proc_abort
  301.       $game_message.clear_chatter
  302.     end
  303.    
  304.     alias qmsg_proc_defeat process_defeat
  305.     def process_defeat
  306.       qmsg_proc_defeat
  307.       $game_message.clear_chatter
  308.     end
  309.   end
  310. end
  311.  
  312. #==============================================================================
  313. # ?! Game_Message
  314. #==============================================================================
  315. class Game_Message
  316.   attr_accessor :quack_msgs
  317.   attr_accessor :ev_id
  318.  
  319.   # new
  320.   def quack_msg_make
  321.     @quack_msgs = []
  322.     QUACK::MSG::MAX_MSGS.times {@quack_msgs.push(Game_Message.new)}
  323.     @quack_msg_ttl = 0
  324.     @c_msg = 0
  325.    
  326.     @qmsg_windows = []
  327.     QUACK::MSG::MAX_MSGS.times do |i|
  328.         qm = Window_Quack_Message.new(@quack_msgs[i], 80-QUACK::MSG::MAX_MSGS+(i*2))
  329.       @qmsg_windows.push(qm)
  330.       ss = Sprite.new
  331.       ss.visible = false
  332.       ss.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  333.       ss.src_rect.set(0, 0, ss.width, ss.height / 2)
  334.       qm.speech_bubble_tag = ss
  335.       ts = Sprite.new
  336.       ts.visible = false
  337.       ts.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  338.       ts.src_rect.set(0, 0, ts.width, ts.height / 2)
  339.       qm.thought_bubble_tag = ts
  340.     end
  341.   end
  342.   # new
  343.   def set_ttl(ttl)
  344.     @quack_msg_ttl = ttl
  345.   end
  346.   # new
  347.   def ttl_sub
  348.     @quack_msg_ttl -= 1 if @quack_msg_ttl > 0
  349.   end
  350.   # new
  351.   def expire?
  352.     return false if @quack_msg_ttl < 0
  353.     @quack_msg_ttl == 0
  354.   end
  355.   # new
  356.   def prepare_msg(duration)
  357.     @quack_msg_ttl = (duration * 60).to_i
  358.   end
  359.   # new
  360.   def fin_msg
  361.     @quack_msg_ttl = 0
  362.     @c_msg = (@c_msg + 1) % QUACK::MSG::MAX_MSGS
  363.   end
  364.   # new
  365.   def add_chatter(text)
  366.     m = @quack_msgs[@c_msg]
  367.     m.add(text)
  368.     m.face_name = face_name
  369.     m.face_index = face_index
  370.     m.set_ttl(@quack_msg_ttl)
  371.   end
  372.   # new
  373.   def clear_chatter
  374.     @quack_msgs.each {|m| m.set_ttl(0) }
  375.     @qmsg_windows.each {|w| w.close }
  376.   end
  377.  
  378.   # new
  379.   def clear_chatter_event(e_id)
  380.     # Find any chatter attached to certain event id and close the chatter
  381.     @quack_msgs.each {|m| m.set_ttl(0) if m.ev_id == e_id }
  382.   end
  383.  
  384.   # new
  385.   def update_chatter
  386.     @qmsg_windows.each {|m|
  387.       m.update
  388.       if m.open?
  389.         m.update_placement
  390.       end
  391.     }
  392.   end
  393.   # new
  394.   def hide_chatter
  395.     @qmsg_windows.each {|m|
  396.       m.hide_me
  397.     }
  398.   end
  399.   # new
  400.   def show_chatter
  401.     @qmsg_windows.each {|m|
  402.       m.show_me
  403.     }
  404.   end
  405.  
  406. end
  407.  
  408. #==============================================================================
  409. # ?! Window_Message
  410. #==============================================================================
  411.  
  412. class Window_Message < Window_Base
  413.  
  414.   # new
  415.   def chatter?
  416.     false
  417.   end
  418.   # new
  419.   def source
  420.     $game_message
  421.   end
  422.   # overwrite
  423.   def standard_padding
  424.     return 8
  425.   end
  426.   # alias
  427.   alias quack_chatter_init initialize
  428.   def initialize
  429.     @msg_tone = $game_system.window_tone
  430.     @snd_f = 0
  431.     #@name_text = ""
  432.     quack_chatter_init
  433.   end
  434.   # new
  435.   def speech_bubble_tag=(sprite)
  436.     @speech_bubble_tag = sprite
  437.   end
  438.   # new
  439.   def thought_bubble_tag=(sprite)
  440.     @thought_bubble_tag = sprite
  441.   end
  442.   # new
  443.   def set_offset_x(x)
  444.     @ox = x
  445.     return ""
  446.   end
  447.   # new
  448.   def set_offset_y(y)
  449.     @oy = y
  450.     return ""
  451.   end
  452.   # overwrite
  453.   def cal_width_line(text)
  454.     result = 0
  455.     text.each_line { |line|
  456.       result = text_size(line).width if result < text_size(line).width
  457.     }
  458.     return result
  459.   end
  460.   # alias
  461.   alias quack_chatter_process_character process_character
  462.   def process_character(c, text, pos)
  463.     if @snd_f == 0 && !@show_fast && !@text_sound.nil?
  464.       Audio.se_play("Audio/SE/"+@text_sound[0],@text_sound[1],@text_sound[2]+rand(@text_sound[3]-@text_sound[2]))
  465.     end
  466.     @snd_f += 1
  467.     @snd_f = 0 if @snd_f == QUACK::MSG::SOUND_PLAY_FREQUENCY
  468.     quack_chatter_process_character(c,text,pos)
  469.   end
  470.   # overwrite
  471.   def update_tone
  472.     self.tone.set(@msg_tone)
  473.   end
  474.   # overwrite
  475.   def message_escape_characters_pop_message(result)
  476.     @msg_tone = $game_system.window_tone
  477.     @event_pop_id = nil
  478.     set_offset_x(0)
  479.     set_offset_y(0)
  480.     @text_sound = QUACK::MSG::TEXT_SOUNDS['0']
  481.     @msg_size_x = 0
  482.     @msg_size_y = 0
  483.     reset_font_settings
  484.    
  485.     result.gsub!(/<BT:([^<>]*)>/i) { event_pop_message_setup2($1, false) }
  486.     result.gsub!(/<BTT:([^<>]*)>/i) { event_pop_message_setup2($1, true) }
  487.     result.gsub!(/\eOX\[([-+]?\d+)\]/i) { set_offset_x($1.to_i) }
  488.     result.gsub!(/\eOY\[([-+]?\d+)\]/i) { set_offset_y($1.to_i) }
  489.     result.gsub!(/\eBM\[([-+]?\d+)\]/i) { event_pop_message_setup($1.to_i, false) }
  490.     result.gsub!(/\eBMT\[([-+]?\d+)\]/i) { event_pop_message_setup($1.to_i, true) }
  491.     result.gsub!(/\eBMF\[(\d+)\]/i) { event_pop_message_setup($1.to_i, false, true) }
  492.     result.gsub!(/\eCBM/i) { event_pop_message_setup(nil, false) }
  493.     result.gsub!(/<BC:([^<>]*)>/i) { @msg_tone = QUACK::MSG::WINDOW_TONES[$1] ;""}
  494.     result.gsub!(/<TS:([^<>]*)>/i) { @text_sound = QUACK::MSG::TEXT_SOUNDS[$1]; ""}
  495.     result.gsub!(/<PMS:([-+]?\d+),([-+]?\d+)>/i) { @msg_size_x = $1.to_i ;@msg_size_y = $2.to_i; ""}
  496.     result
  497.   end
  498.   # new
  499.   def event_pop_message_setup2(tag, thought = false)
  500.     msgbox(sprintf("Using this tag requires that you have Qonvenience installed.","Chatter Messages",1)) if !$imported["Qonvenience"]
  501.     if SceneManager.scene_is?(Scene_Battle)
  502.       ev_id = nil
  503.       $game_party.members.each{|m| ev_id = m if m.name == tag }
  504.       $game_troop.members.each{|m| ev_id = m if m.name == tag } if ev_id.nil?
  505.       if ev_id.nil?
  506.         msgbox(sprintf("No battler with name: '" + tag + "'.","Chatter Messages",1))
  507.         exit
  508.       end
  509.       @msg_tone = QUACK::MSG::WINDOW_TONES[tag] if QUACK::MSG::WINDOW_TONES.has_key?(tag)
  510.       @text_sound = QUACK::MSG::TEXT_SOUNDS[tag] if !thought && QUACK::MSG::TEXT_SOUNDS.has_key?(tag)
  511.       namewindow(QUACK::MSG::NAMES[tag], 1) if $imported["YEA-MessageSystem"] && QUACK::MSG::NAMES.has_key?(tag) && @name_text == ""
  512.       if QUACK::MSG::POS_ADJUST.has_key?(tag)
  513.         set_offset_x(QUACK::MSG::POS_ADJUST[tag][0])
  514.         set_offset_y(QUACK::MSG::POS_ADJUST[tag][1])
  515.       end
  516.       return event_pop_message_setup(ev_id, thought)
  517.     end
  518.     if tag == 'pl'
  519.       ev_id = 0
  520.     else
  521.       ev_id = $game_map.first_event_tag(tag).id
  522.       msgbox(sprintf("No event with tag: '" + tag + "'.","Chatter Messages",1)) if ev_id.nil?
  523.     end
  524.     @msg_tone = QUACK::MSG::WINDOW_TONES[tag] if QUACK::MSG::WINDOW_TONES.has_key?(tag)
  525.     @text_sound = QUACK::MSG::TEXT_SOUNDS[tag] if !thought && QUACK::MSG::TEXT_SOUNDS.has_key?(tag)
  526.     namewindow(QUACK::MSG::NAMES[tag], 1) if $imported["YEA-MessageSystem"] && QUACK::MSG::NAMES.has_key?(tag) && @name_text == ""
  527.     if QUACK::MSG::POS_ADJUST.has_key?(tag)
  528.       set_offset_x(QUACK::MSG::POS_ADJUST[tag][0])
  529.       set_offset_y(QUACK::MSG::POS_ADJUST[tag][1])
  530.     end
  531.     return event_pop_message_setup(ev_id, thought)
  532.   end
  533.   # overwrite
  534.   def event_pop_message_setup(event_id, thought = false, follower = false)
  535.     start_name_window if $imported["YEA-MessageSystem"]
  536.     if follower && $game_player.followers[event_id].nil?
  537.       @event_pop_id = nil
  538.       @event_pop_follower = false
  539.       return ""
  540.     end
  541.     if thought # THOUGHT
  542.       @speech_bubble_tag.visible = false
  543.       @bubble_tag = @thought_bubble_tag
  544.     else # SPEECH
  545.       @thought_bubble_tag.visible = false
  546.       @bubble_tag = @speech_bubble_tag
  547.     end
  548.     @event_pop_follower = follower
  549.     @event_pop_id = event_id
  550.     # close any chatter message currently attached to this event
  551.     $game_message.clear_chatter_event(event_id)
  552.     source.ev_id = event_id
  553.     return ""
  554.   end
  555.   # overwrite
  556.   def set_face_position
  557.     #return unless SceneManager.scene_is?(Scene_Map)
  558.     return unless @event_pop_id
  559.     return unless @face_window
  560.     contents.clear
  561.     @face_window.set_face
  562.     return unless $imported["YEA-MessageSystem"]
  563.     return if @face_window.close?
  564.     #@name_window.x = self.x + YSE::POP_MESSAGE::POSITION[:face_x_buffer] + YSE::POP_MESSAGE::POSITION[:name_x_buffer] if (@name_position == 1 || @name_position == 2)
  565.   end
  566.   # overwrite
  567.   def close
  568.     pop_message_close
  569.     #return unless SceneManager.scene_is?(Scene_Map)
  570.     return unless @event_pop_id
  571.     @event_pop_follower = false
  572.     @face_window.hide_face
  573.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  574.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  575.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  576.     source.ev_id = nil
  577.   end
  578.   # overwrite
  579.   def process_all_text
  580.     @event_pop_id = nil
  581.     @name_text = ""
  582.     txt = convert_escape_characters($game_message.all_text)
  583.     update_placement
  584.     adjust_pop_message(txt)#$game_message.all_text)
  585.     pop_message_process_all_text
  586.   end
  587.   # overwrite
  588.   def update_placement
  589.     if SceneManager.scene_is?(Scene_Map)
  590.       if @event_pop_id.nil?
  591.         fix_default_message
  592.         event_pop_message_update_placement
  593.       elsif @event_pop_id == 0
  594.         character = $game_player
  595.         self.y = character.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  596.         self.x = character.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  597.         fix_position_bubble(character)
  598.         set_bubble_tag(character)
  599.         @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
  600.         @face_window.set_position if !chatter? && @face_window.open?
  601.       elsif @event_pop_id > 0
  602.         hash = @event_pop_follower ? $game_player.followers : $game_map.events
  603.         character = hash[@event_pop_id]
  604.         self.y = character.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  605.         self.x = character.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  606.         fix_position_bubble(character)
  607.         set_bubble_tag(character)
  608.         @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
  609.         @face_window.set_position if !chatter? && @face_window.open?
  610.       end
  611.     else
  612.       # IF IN BATTLE
  613.       #event_pop_message_update_placement
  614.       if @event_pop_id.nil?
  615.         fix_default_message
  616.         event_pop_message_update_placement
  617.       else
  618.         battler = @event_pop_id
  619.         self.y = battler.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  620.         self.x = battler.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  621.         fix_position_bubble(battler)
  622.         set_bubble_tag(battler)
  623.         @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
  624.         @face_window.set_position if !chatter? && @face_window.open?
  625.       end
  626.     end
  627.     if close?
  628.       self.x = -999
  629.       self.y = -999
  630.       @name_window.update_pos if $imported["YEA-MessageSystem"]
  631.       return unless @bubble_tag
  632.       @bubble_tag.x = -999
  633.       @bubble_tag.y = -999
  634.     end
  635.   end
  636.   # overwrite
  637.   def fix_default_message
  638.     self.width = window_width
  639.     self.height = window_height
  640.     self.x = 0
  641.     @face_window.hide_face if @face_window
  642.     #create_contents
  643.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  644.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  645.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  646.   end
  647.   # overwrite
  648.   def fix_position_bubble(character)
  649.     end_x = self.x + self.width
  650.     end_y = self.y + self.height
  651.     self.x = 0 if self.x < 0
  652.     self.y = character.screen_y + @oy if self.y < 0
  653.     self.y = -99 if self.y < 0
  654.     self.x = Graphics.width - self.width if end_x > Graphics.width
  655.     self.y = Graphics.height - self.height if end_y > Graphics.height
  656.   end
  657.   # overwrite
  658.   def set_bubble_tag(character)
  659.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  660.     return unless @bubble_tag
  661.     up = self.y == character.screen_y + @oy
  662.     if self.y == -99
  663.       self.y = 0
  664.       up = true
  665.     end
  666.     self.y += up ? @bubble_tag.height / 2 : -@bubble_tag.height / 2
  667.     @bubble_tag.x = character.screen_x + @ox - @bubble_tag.width / 2
  668.     if up
  669.       @bubble_tag.src_rect.set(0, @bubble_tag.height, @bubble_tag.width, @bubble_tag.height)
  670.       @bubble_tag.y = self.y - @bubble_tag.height - YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  671.     else
  672.       @bubble_tag.src_rect.set(0, 0, @bubble_tag.width, @bubble_tag.height)
  673.       @bubble_tag.y = self.y + self.height + YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  674.     end
  675.     @bubble_tag.z = self.z + 1
  676.   end
  677.   # overwrite
  678.   def adjust_pop_message(text = " ")
  679.     #return unless SceneManager.scene_is?(Scene_Map)
  680.     unless @event_pop_id
  681.       if $imported["YEA-MessageSystem"]
  682.         #adjust_message_window_size
  683.       end
  684.       return
  685.     end
  686.     n_line = cal_number_line(text)
  687.     n_line = YSE::POP_MESSAGE::LIMIT[:limit_line] if YSE::POP_MESSAGE::LIMIT[:limit_line] > 0 && cal_number_line(text) > YSE::POP_MESSAGE::LIMIT[:limit_line]
  688.     @real_lines = n_line
  689.     self.height = fitting_height(n_line)
  690.     self.height += @msg_size_y
  691.     self.width = cal_width_line(text) + 10
  692.     self.width += @msg_size_x
  693.     self.width += new_line_x
  694.     if self.width > YSE::POP_MESSAGE::LIMIT[:limit_width] && YSE::POP_MESSAGE::LIMIT[:limit_width] > 0
  695.       self.width = YSE::POP_MESSAGE::LIMIT[:limit_width]
  696.     end
  697.     if $game_message.choice? && !QUACK::MSG::POP_CHOICE_GROW
  698.       dy = fitting_height($game_message.choices.size) - 16
  699.       self.y -= dy - 16
  700.       self.height += dy - 16
  701.       @face_window.y -= dy - 16
  702.       @name_window.y -= dy - 16 if $imported["YEA-MessageSystem"]
  703.     end
  704.     # If a chatter message with face graphic, force height to be at least big enough to show the face.
  705.     if chatter? && !source.face_name.empty?
  706.       self.height = [self.height, 86].max
  707.     end
  708.    
  709.     create_contents
  710.     update_placement
  711.   end
  712.   # alias
  713.   alias yse_pop_dispose dispose
  714.   def dispose
  715.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  716.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  717.     yse_pop_dispose
  718.   end
  719.   # alias
  720.   alias chatter_msg_input_choice input_choice
  721.   def input_choice
  722.     if !close? && pop_message? && QUACK::MSG::POP_CHOICE_GROW
  723.       f = Fiber.new { add_room_for_choices }
  724.       @choice_window.visible = false
  725.       @choice_window.set_fiber(f)
  726.       f.resume
  727.     end
  728.     chatter_msg_input_choice
  729.   end
  730.   # new
  731.   def add_room_for_choices
  732.     q = fitting_height($game_message.choices.size) - 16
  733.     i = 0
  734.     while true
  735.       i += 4
  736.       self.y -= 4
  737.       self.height += 4
  738.       @face_window.y -= 4
  739.       @name_window.y -= 4 if $imported["YEA-MessageSystem"]
  740.       break if i >= q
  741.       Fiber.yield
  742.     end
  743.     @choice_window.visible = true
  744.     @choice_window.set_fiber(nil)
  745.   end
  746.   # new
  747.   def pop_message?
  748.     @event_pop_id
  749.   end
  750. end
  751.  
  752. #==============================================================================
  753. # ?! Window_ChoiceList
  754. #==============================================================================
  755. class Window_ChoiceList < Window_Command
  756.   # alias
  757.   alias chatter_msg_init initialize
  758.   def initialize(message_window)
  759.     chatter_msg_init(message_window)
  760.     self.opacity = 0
  761.     self.z = 207
  762.   end
  763.   # new
  764.   def set_fiber(fiber)
  765.     @fiber = fiber
  766.   end
  767.   # alias
  768.   alias chatter_msg_update update
  769.   def update
  770.     chatter_msg_update
  771.     @fiber.resume if @fiber
  772.   end
  773.   # alias
  774.   alias chatter_msg_update_placement update_placement
  775.   def update_placement
  776.     if @message_window.pop_message?
  777.       self.opacity = 0
  778.       self.width = @message_window.width-26 + padding * 2
  779.       self.width = [width, Graphics.width].min
  780.       self.height = fitting_height($game_message.choices.size)
  781.       self.x = @message_window.x
  782.       self.y = @message_window.y+@message_window.height-self.height+6
  783.     else
  784.       self.opacity = 255
  785.       chatter_msg_update_placement
  786.     end
  787.   end
  788. end
  789.  
  790. #==============================================================================
  791. # ■ Window_NameMessage
  792. #==============================================================================
  793. class Window_NameMessage < Window_Base
  794.   # alias
  795.   alias quack_msg_name_init initialize
  796.   def initialize(message_window)
  797.     quack_msg_name_init(message_window)
  798.     self.z += 1
  799.   end
  800.   # new
  801.   def update_pos
  802.     set_x_position(1)
  803.     #set_y_position
  804.     self.y = @message_window.y - self.height / 1.5
  805.     #self.y = 0 if self.y < 0
  806.   end
  807.   # overwrite
  808.       #  self.y = @message_window.height
  809.       #  self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  810.       #else
  811.       #  self.y = @message_window.y - self.height / 1.25
  812.       #  self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  813.       #end
  814. end
  815.  
  816. #==============================================================================
  817. # ¡ Window_Message_Face
  818. #==============================================================================
  819.  
  820. class Window_Message_Face < Window_Base
  821.   alias quack_msg_face_pos set_position
  822.   def set_position
  823.     quack_msg_face_pos
  824.     self.y -= 4
  825.   end
  826. end
  827.  
  828. #==============================================================================
  829. # ?! Window_Quack_Message
  830. #==============================================================================
  831. class Window_Quack_Message < Window_Message
  832.   attr_accessor :active
  833.  
  834.   # overwrite
  835.   def initialize(msg_source, zz)
  836.     super()
  837.     self.z = zz
  838.     @quack_msg_source = msg_source
  839.     @active = false
  840.     @showing = true
  841.     @tag_showing = false
  842.     @background = 0
  843.     self.opacity = 255
  844.     self.visible = false
  845.     clear_name_window if $imported["YEA-MessageSystem"]
  846.   end
  847.   # overwrite
  848.   def chatter?
  849.     true
  850.   end
  851.   # overwrite
  852.   def source
  853.     @quack_msg_source
  854.   end
  855.   # overwrite
  856.   def update
  857.     if @quack_msg_source.busy?
  858.       if @quack_msg_source.expire?
  859.         close
  860.       else
  861.         self.visible = true if !self.visible && @showing
  862.         @quack_msg_source.ttl_sub
  863.       end
  864.     end
  865.     self.visible = false if self.visible && close?
  866.     super
  867.   end
  868.   # overwrite
  869.   def update_placement
  870.     return if @closing
  871.     super
  872.   end
  873.   # overwrite
  874.   def update_show_fast
  875.     return false
  876.   end
  877.   # overwrite
  878.   def process_all_text
  879.     @event_pop_id = nil
  880.     text = convert_escape_characters(@quack_msg_source.all_text)
  881.     update_placement
  882.     adjust_pop_message(text)
  883.     open_and_wait
  884.     #text = convert_escape_characters(@quack_msg_source.all_text)
  885.     pos = {}
  886.     new_page(text, pos)
  887.     process_character(text.slice!(0, 1), text, pos) until text.empty? || close?
  888.   end
  889.   # overwrite
  890.   def close
  891.     pop_message_close #super
  892.     return unless @event_pop_id
  893.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  894.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  895.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  896.     source.ev_id = nil
  897.     @name_text = ""
  898.     @showing = true
  899.   end
  900.   # overwrite
  901.   def input_pause
  902.     self.pause = true
  903.     wait(10)
  904.     Fiber.yield until close?
  905.     self.pause = false
  906.   end
  907.   # overwrite
  908.   def update_fiber
  909.     if @fiber
  910.       @fiber.resume
  911.     elsif @quack_msg_source.busy?
  912.       @fiber = Fiber.new { fiber_main }
  913.       @fiber.resume
  914.     else
  915.       @quack_msg_source.visible = false
  916.     end
  917.   end
  918.   def fiber_main
  919.     @quack_msg_source.visible = true
  920.     #update_background
  921.     update_placement
  922.     loop do
  923.       process_all_text if @quack_msg_source.has_text?
  924.       process_input
  925.       @quack_msg_source.clear
  926.       @name_window.start_close if $imported["YEA-MessageSystem"]
  927.       Fiber.yield
  928.       break unless text_continue?
  929.     end
  930.     close_and_wait
  931.     @quack_msg_source.visible = false
  932.     @fiber = nil
  933.   end
  934.   #def update_background
  935.   #  @background = @quack_msg_source.background
  936.   #  self.opacity = @background == 0 ? 255 : 0
  937.   #end
  938.   def process_input
  939.     input_pause unless @pause_skip
  940.   end
  941.   def text_continue?
  942.     @quack_msg_source.has_text?# && !settings_changed?
  943.   end
  944.   def settings_changed?
  945.     #@background != $game_message.background ||
  946.     #@position != @quack_msg_source.position
  947.     false
  948.   end
  949.   def new_page(text, pos)
  950.     contents.clear
  951.     draw_face(@quack_msg_source.face_name, @quack_msg_source.face_index, 0, 0)
  952.     reset_font_settings
  953.     pos[:x] = new_line_x
  954.     pos[:y] = 0
  955.     pos[:new_x] = new_line_x
  956.     pos[:height] = calc_line_height(text)
  957.     clear_flags
  958.   end
  959.   def new_line_x
  960.     @quack_msg_source.face_name.empty? ? 0 : 112
  961.   end
  962.   # overwrite
  963.   def input_pause
  964.     #self.pause = true
  965.     wait(10)
  966.     Fiber.yield until @quack_msg_source.expire? #Input.trigger?(:B) || Input.trigger?(:C)
  967.     #Input.update
  968.     #self.pause = false
  969.   end
  970.  
  971.   # overwrite
  972.   def create_all_windows
  973.     @name_window = Window_NameMessage.new(self) if $imported["YEA-MessageSystem"]
  974.   end
  975.   # overwrite
  976.   def dispose_all_windows
  977.     @name_window.dispose if $imported["YEA-MessageSystem"]
  978.   end
  979.   # overwrite
  980.   def update_all_windows
  981.     if $imported["YEA-MessageSystem"]
  982.       @name_window.update
  983.       @name_window.back_opacity = self.back_opacity
  984.       @name_window.opacity = self.opacity
  985.     end
  986.   end
  987.   # overwrite
  988.   def event_pop_message_update_placement
  989.   end
  990.   # overwrite
  991.   def all_close?
  992.     close? && (!$imported["YEA-MessageSystem"] || @name_window.close?)
  993.   end
  994.  
  995.   if $imported["YEA-MessageSystem"]
  996.     def close_and_wait
  997.       @name_window.force_close
  998.       window_message_close_and_wait_ams
  999.     end
  1000.   end
  1001.   # new
  1002.   def hide_me
  1003.     @showing = false
  1004.     self.visible = false
  1005.     if @bubble_tag
  1006.       @tag_showing = @bubble_tag.visible
  1007.       @bubble_tag.visible = false
  1008.     end
  1009.   end
  1010.   # new
  1011.   def show_me
  1012.     @showing = true
  1013.     @bubble_tag.visible = true if @bubble_tag && @tag_showing && !close?
  1014.   end
  1015. end
  1016.  
  1017. #==============================================================================
  1018. # ?! Scene_Map
  1019. #==============================================================================
  1020.  
  1021. class Scene_Map < Scene_Base
  1022.   # alias
  1023.   alias quack_msg_update update
  1024.   def update
  1025.     $game_message.update_chatter
  1026.     @message_window.update_placement if @message_window.open?
  1027.     quack_msg_update
  1028.   end
  1029.   # overwrite
  1030.   def create_message_window
  1031.     yse_pm_create_message_window
  1032.     @face_window = Window_Message_Face.new
  1033.     @face_window.message_window = @message_window
  1034.     if @bubble_tag_sprite || @thought_bubble_tag_sprite
  1035.     @bubble_tag_sprite.dispose
  1036.     @thought_bubble_tag_sprite.dispose
  1037.     end
  1038.     if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  1039.       @bubble_tag_sprite = Sprite.new
  1040.       @bubble_tag_sprite.visible = false
  1041.       @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  1042.       @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
  1043.       @message_window.speech_bubble_tag = @bubble_tag_sprite
  1044.      
  1045.       @thought_bubble_tag_sprite = Sprite.new
  1046.       @thought_bubble_tag_sprite.visible = false
  1047.       @thought_bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
  1048.       @thought_bubble_tag_sprite.src_rect.set(0, 0, @thought_bubble_tag_sprite.width, @thought_bubble_tag_sprite.height / 2)
  1049.       @message_window.thought_bubble_tag = @thought_bubble_tag_sprite
  1050.     end
  1051.     @message_window.face_window = @face_window
  1052.    
  1053.     $game_message.show_chatter
  1054.   end
  1055.   # overwrite
  1056.   def dispose_spriteset
  1057.     pop_message_dispose_spriteset
  1058.     return unless @bubble_tag_sprite || @thought_bubble_tag_sprite
  1059.     @bubble_tag_sprite.dispose
  1060.     @thought_bubble_tag_sprite.dispose
  1061.   end
  1062.   # alias
  1063.   alias qmsg_disp_wind dispose_all_windows
  1064.   def dispose_all_windows
  1065.     qmsg_disp_wind
  1066.     $game_message.hide_chatter
  1067.   end
  1068.   # alias
  1069.   alias qmsg_upd_encounter update_encounter
  1070.   def update_encounter
  1071.     qmsg_upd_encounter
  1072.     $game_message.clear_chatter if $game_player.encounter
  1073.   end
  1074. end
  1075.  
  1076. #==============================================================================
  1077. # ?! Scene_Battle
  1078. #==============================================================================
  1079. class Scene_Battle
  1080.   # alias
  1081.   alias quack_update_basic update_basic
  1082.   def update_basic
  1083.     quack_update_basic
  1084.     $game_message.update_chatter
  1085.   end
  1086.   # alias
  1087.   alias yse_pop_create_message_window create_message_window
  1088.   def create_message_window
  1089.     yse_pop_create_message_window
  1090.     @face_window = Window_Message_Face.new
  1091.     @face_window.message_window = @message_window
  1092.     if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  1093.       @bubble_tag_sprite = Sprite.new
  1094.       @bubble_tag_sprite.visible = false
  1095.       @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  1096.       @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
  1097.       @message_window.speech_bubble_tag = @bubble_tag_sprite
  1098.      
  1099.       @thought_bubble_tag_sprite = Sprite.new
  1100.       @thought_bubble_tag_sprite.visible = false
  1101.       @thought_bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
  1102.       @thought_bubble_tag_sprite.src_rect.set(0, 0, @thought_bubble_tag_sprite.width, @thought_bubble_tag_sprite.height / 2)
  1103.       @message_window.thought_bubble_tag = @thought_bubble_tag_sprite
  1104.  
  1105.     end
  1106.     @message_window.face_window = @face_window
  1107.    
  1108.     $game_message.show_chatter
  1109.   end
  1110.   # alias
  1111.   alias yse_pop_dispose_spriteset dispose_spriteset
  1112.   def dispose_spriteset
  1113.     yse_pop_dispose_spriteset
  1114.     return unless @bubble_tag_sprite || @thought_bubble_tag_sprite
  1115.     @bubble_tag_sprite.dispose
  1116.     @thought_bubble_tag_sprite.dispose
  1117.   end
  1118.   # alias
  1119.   alias qmsg_disp_wind dispose_all_windows
  1120.   def dispose_all_windows
  1121.     qmsg_disp_wind
  1122.     $game_message.hide_chatter
  1123.   end
  1124. end
  1125.  
  1126. #==============================================================================
  1127. # ?! Game_Interpreter
  1128. #==============================================================================
  1129. class Game_Interpreter
  1130.   # overwrite
  1131.   def command_101
  1132.     item = $data_items[20]
  1133.     if $imported["YEA-MessageSystem"]
  1134.       wait_for_message
  1135.       $game_message.face_name = @params[0]
  1136.       $game_message.face_index = @params[1]
  1137.       $game_message.background = @params[2]
  1138.       $game_message.position = @params[3]
  1139.      
  1140.       startindex = @index+1
  1141.       textline = @list[startindex].parameters[0].dup
  1142.       chatdur = 0
  1143.       textline.gsub!(/<cm:([^<>]*)>/i) { chatdur = $1.to_i;"" }
  1144.       $game_message.prepare_msg(chatdur) if chatdur != 0
  1145.       while continue_message_string?
  1146.         @index += 1
  1147.         if @list[@index].code == 401
  1148.           textline = @list[@index].parameters[0] unless @index == startindex
  1149.           if chatdur != 0; $game_message.add_chatter(textline)
  1150.           else; $game_message.add(textline)
  1151.           end
  1152.         end
  1153.         break if $game_message.texts.size >= Variable.message_rows
  1154.       end
  1155.       case next_event_code
  1156.       when 102
  1157.         @index += 1
  1158.         setup_choices(@list[@index].parameters)
  1159.       when 103
  1160.         @index += 1
  1161.         setup_num_input(@list[@index].parameters)
  1162.       when 104
  1163.         @index += 1
  1164.         setup_item_choice(@list[@index].parameters)
  1165.       end
  1166.       $game_message.fin_msg if chatdur != 0
  1167.       wait_for_message
  1168.     else
  1169.       wait_for_message
  1170.       $game_message.face_name = @params[0]
  1171.       $game_message.face_index = @params[1]
  1172.       $game_message.background = @params[2]
  1173.       $game_message.position = @params[3]
  1174.      
  1175.       startindex = @index+1
  1176.       textline = @list[startindex].parameters[0].dup
  1177.       chatdur = 0
  1178.       textline.gsub!(/<cm:([^<>]*)>/i) { chatdur = $1.to_i;"" }
  1179.       $game_message.prepare_msg(chatdur) if chatdur != 0
  1180.      
  1181.       while next_event_code == 401       # Text data
  1182.         @index += 1
  1183.         textline = @list[@index].parameters[0] unless @index == startindex
  1184.         if chatdur != 0; $game_message.add_chatter(textline)
  1185.         else; $game_message.add(textline)
  1186.         end
  1187.       end
  1188.       case next_event_code
  1189.       when 102  # Show Choices
  1190.         @index += 1
  1191.         setup_choices(@list[@index].parameters)
  1192.       when 103  # Input Number
  1193.         @index += 1
  1194.         setup_num_input(@list[@index].parameters)
  1195.       when 104  # Select Item
  1196.         @index += 1
  1197.         setup_item_choice(@list[@index].parameters)
  1198.       end
  1199.       $game_message.fin_msg if chatdur != 0
  1200.       wait_for_message
  1201.     end
  1202.   end
  1203.   # new
  1204.   def clear_chatter
  1205.     $game_message.clear_chatter
  1206.   end
  1207.   # alias
  1208.   alias qmsg_cmd301 command_301
  1209.   def command_301
  1210.     $game_message.clear_chatter
  1211.     qmsg_cmd301
  1212.   end
  1213.   # new
  1214.   def event_on_screen(evtag)
  1215.     e = $game_map.first_event_tag(evtag)
  1216.     return e.screen_x >= -32 && e.screen_x < 672 && e.screen_y >= 0 && e.screen_y < 512
  1217.   end
  1218.   # new
  1219.   def event_within_earshot(evtag)
  1220.     e = $game_map.first_event_tag(evtag)
  1221.     return e.screen_x >= -352 && e.screen_x < 992 && e.screen_y >= -240 && e.screen_y < 752
  1222.   end
  1223.   # new
  1224.   def make_chatter(evtag, dur, text, thought=false, mute=false)
  1225.     $game_message.prepare_message(dur)
  1226.     text = "<ts:0>" + text if mute
  1227.     if thought
  1228.       $game_message.create_chatter("<btt:"+evtag+">" + text)
  1229.     else
  1230.       $game_message.create_chatter("<bt:"+evtag+">" + text)
  1231.     end
  1232.     $game_message.fin_msg
  1233.   end
  1234. end
  1235.  
  1236. #==============================================================================
  1237. #
  1238. # ?\ End of File
  1239. #
  1240. #==============================================================================
RAW Paste Data