Script modification

is there a way to make this script so there's a way to make the pop up show up on the event that the message is coming from maybe like \bm[-1] which will tell it to display the message on top of the current event?

Spoiler
#==============================================================================## ¥ Yami Engine Symphony - Pop Message# -- Last Updated: 2013.01.29# -- Level: Easy# -- Requires: n/a##==============================================================================$imported = {} if $imported.nil?$imported["YES-PopMessage"] = true#==============================================================================# ¥ Updates# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 2013.01.29 - Compatible with: YEA - Ace Message System Namebox.# 2013.01.29 - Fixed a minor crash with Bubble Tag.# 2013.01.28 - Finished Script.# 2013.01.25 - Started Script.##==============================================================================# ¥ Introduction# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script provides bubble messages feature, which makes message window pop# over player's or event's head.##==============================================================================# ¥ Instructions# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# To install this script, open up your script editor and copy/paste this script# to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.## -----------------------------------------------------------------------------# Message Window text Codes - These go inside of your message window.# -----------------------------------------------------------------------------# Code: Effect:# \bm[x] - Pops message on event ID x head.# Set x to 0 for player pop.# \cbm - Cancel pops message manually.# \cbt[name] - Set bubble tag filename to name.##==============================================================================# ¥ Compatibility# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that# it will run with RPG Maker VX without adjustments.##==============================================================================#==============================================================================# ¡ Configuration#==============================================================================module YESmodule POP_MESSAGE#===========================================================================# - Limit Settings -#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-# The following below will adjust the limit options for pop message.#===========================================================================LIMIT_SETTING = { # Start.:width => 0, # Set to 0 to disable limitation.:lines => 4, # Set to 0 to disable limitation.} # End.#===========================================================================# - Effect Settings -#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-# The following below will adjust the effect options for pop message.#===========================================================================EFFECT_SETTING = { # Start.:default_face => false,# Use default face draw.# Effects for non-default face draw.:face_fade => true, # Makes face to be fading when start message.:face_move => true, # Makes face to be moving in when start message.# Bubble tag settings.:bubble_tag => true, # Enables bubble tag for pop message.:bubble_name => "BubbleTag", # Put bubble tag image into# Graphics/System:bubble_offset_y => -6,} # End.endend#==============================================================================# ¥ Editting anything past this point may potentially result in causing# computer damage, incontinence, explosion of user's head, coma, death, and/or# halitosis so edit at your own risk.#==============================================================================#==============================================================================# ¡ Window_MessageFace#==============================================================================class Window_MessageFace < Window_Base#--------------------------------------------------------------------------# initialize#--------------------------------------------------------------------------def initializesuper(0, 0, 120, 120)self.opacity = 0self.contents_opacity = 0self.close@move_x = 0end#--------------------------------------------------------------------------# draw_content_face#--------------------------------------------------------------------------def draw_content_faceif $game_message.face_name.empty?hide_faceelseself.y = - self.heightcontents.cleardraw_face($game_message.face_name, $game_message.face_index, 0, 0)endend#--------------------------------------------------------------------------# fade_time#--------------------------------------------------------------------------def fade_time17end#--------------------------------------------------------------------------# move_time#--------------------------------------------------------------------------def move_time17end#--------------------------------------------------------------------------# move_rate#--------------------------------------------------------------------------def move_rate2end#--------------------------------------------------------------------------# show_face#--------------------------------------------------------------------------def show_facereturn if $game_message.face_name.empty?self.open#---if (YES:😛OP_MESSAGE::EFFECT_SETTING[:face_fade] ||YES:😛OP_MESSAGE::EFFECT_SETTING[:face_move])self.openness = 255end#---if YES:😛OP_MESSAGE::EFFECT_SETTING[:face_fade]self.contents_opacity = 0elseself.contents_opacity = 255end#---if YES:😛OP_MESSAGE::EFFECT_SETTING[:face_move]@move_x = move_time * move_rateself.x -= @move_xendend#--------------------------------------------------------------------------# hide_face#--------------------------------------------------------------------------def hide_facecloseend#--------------------------------------------------------------------------# update#--------------------------------------------------------------------------def updatesuper#---self.contents_opacity += 255.0 / fade_time#---if @move_x > 0rate = [move_rate, @move_x].min@move_x -= rateself.x += rateendendend # Window_MessageFace#==============================================================================# ¡ Window_Message#==============================================================================class Window_Message < Window_Base#--------------------------------------------------------------------------# new method: pop_message_initialize#--------------------------------------------------------------------------def pop_message_initialize(text)if text =~ /\\BM\[(\d+)\]/isetup_pop_message($1.to_i)endif text =~ /\\CBM/icancel_pop_messageendif text =~ /\\CBT\[(.*)\]/icreate_bubble_sprite($1)@bubble_sprite.opacity = 255endend#--------------------------------------------------------------------------# new method: process_pop_message#--------------------------------------------------------------------------def process_pop_message(text)text.gsub!(/\eCBT\[(.*)\]/i) { "" }text.gsub!(/\eBM\[(\d+)\]/i) { "" }text.gsub!(/\eCBM/i) { "" }textend#--------------------------------------------------------------------------# alias method: convert_escape_characters#--------------------------------------------------------------------------alias yes_pm_convert_escape_characters convert_escape_charactersdef convert_escape_characters(text)result = yes_pm_convert_escape_characters(text)result = process_pop_message(result)resultend#--------------------------------------------------------------------------# new method: setup_pop_message#--------------------------------------------------------------------------def setup_pop_message(id)create_bubble_spriteadjust_window_sizeadjust_window_position(id)@bubble_sprite.opacity = 255end#--------------------------------------------------------------------------# new method: create_bubble_sprite#--------------------------------------------------------------------------def create_bubble_sprite(filename = nil)return unless YES:😛OP_MESSAGE::EFFECT_SETTING[:bubble_tag]filename = YES:😛OP_MESSAGE::EFFECT_SETTING[:bubble_name] unless filenamebitmap = Cache.system(filename)@bubble_sprite ||= Sprite.new@bubble_sprite.z = self.z@bubble_sprite.opacity = 0@bubble_sprite.bitmap = bitmap@bubble_sprite.src_rect.set(0, 0, bitmap.width, bitmap.height / 2)end#--------------------------------------------------------------------------# new method: adjust_window_position#--------------------------------------------------------------------------def adjust_window_position(id)hash = $game_map.eventscharacter = id <= 0 ? $game_player : hash[id]#---bitmap = Cache.character(character.character_name)sign = character.character_name[/^[\!\$]./]if sign && sign.include?('
I didn't really know where to put this topic, hope it's in the right place.)ch = bitmap.height / 4elsech = bitmap.height / 8end#---self.x = character.screen_x - self.width / 2self.y = character.screen_y - self.height - chif @bubble_sprite@bubble_sprite.x = character.screen_x - @bubble_sprite.width / 2@bubble_sprite.y = self.y + self.height@bubble_sprite.y += YES:😛OP_MESSAGE::EFFECT_SETTING[:bubble_offset_y]end#---end_x = self.x + self.widthself.x = 0 if self.x < 0self.x = Graphics.width - self.width if end_x > Graphics.widthif self.y < 0self.y = character.screen_yif @bubble_sprite@bubble_sprite.y = self.y - @bubble_sprite.height@bubble_sprite.y -= YES:😛OP_MESSAGE::EFFECT_SETTING[:bubble_offset_y]@bubble_sprite.src_rect.set(0, @bubble_sprite.height,@bubble_sprite.width, @bubble_sprite.height)endendend#--------------------------------------------------------------------------# new method: adjust_window_size#--------------------------------------------------------------------------def adjust_window_sizetext = convert_escape_characters($game_message.all_text)#---width = cal_width_line(text) + standard_padding * 2width = width + new_line_xif YES:😛OP_MESSAGE::LIMIT_SETTING[:width] > 0width = [YES:😛OP_MESSAGE::LIMIT_SETTING[:width], width]end#---lines = cal_number_line(text)if YES:😛OP_MESSAGE::LIMIT_SETTING[:lines] > 0lines = [YES:😛OP_MESSAGE::LIMIT_SETTING[:lines], lines].minendif YES:😛OP_MESSAGE::EFFECT_SETTING[:default_face]unless $game_message.face_name.empty?lines = [4, lines].maxendend#---self.width = widthself.height = fitting_height(lines)create_contentsend#--------------------------------------------------------------------------# new method: cal_number_line#--------------------------------------------------------------------------def cal_number_line(text)result = 0text.each_line { result += 1 }return resultend#--------------------------------------------------------------------------# new method: cal_width_line#--------------------------------------------------------------------------def cal_width_line(text)result = 0text.each_line { |line|result = text_size(line).width if result < text_size(line).width}return resultend#--------------------------------------------------------------------------# new method: cancel_pop_message#--------------------------------------------------------------------------def cancel_pop_messageupdate_placementreset_sizecreate_bubble_spriteend#--------------------------------------------------------------------------# new method: reset_size#--------------------------------------------------------------------------def reset_sizeself.width = window_widthself.height = window_heightupdate_paddingcreate_contentsend#--------------------------------------------------------------------------# alias method: draw_face#--------------------------------------------------------------------------alias yes_pop_message_draw_face draw_facedef draw_face(face_name, face_index, x, y, enabled = true)return unless YES:😛OP_MESSAGE::EFFECT_SETTING[:default_face]yes_pop_message_draw_face(face_name, face_index, x, y, enabled)end#--------------------------------------------------------------------------# alias method: update_placement#--------------------------------------------------------------------------alias yes_pop_message_update_placement update_placementdef update_placementyes_pop_message_update_placementself.x = 0end#--------------------------------------------------------------------------# alias method: process_all_text#--------------------------------------------------------------------------alias yes_pop_message_process_all_text process_all_textdef process_all_textpop_message_initialize($game_message.all_text)yes_pop_message_process_all_textend#--------------------------------------------------------------------------# alias method: open_and_wait#--------------------------------------------------------------------------alias yes_pop_message_open_and_wait open_and_waitdef open_and_waityes_pop_message_open_and_wait@face_window ||= Window_MessageFace.new@face_window.draw_content_face@face_window.x = self.x + 8@face_window.y += self.y + self.height@face_window.show_faceend#--------------------------------------------------------------------------# alias method: close_and_wait#--------------------------------------------------------------------------alias yes_pop_message_close_and_wait close_and_waitdef close_and_wait@face_window.hide_face@bubble_sprite.opacity = 0 if @bubble_spriteyes_pop_message_close_and_waitcancel_pop_messageend#--------------------------------------------------------------------------# alias method: update#--------------------------------------------------------------------------alias yes_pop_message_update updatedef updateyes_pop_message_updateif @face_window@face_window.update@face_window.z = self.zendif @bubble_sprite@bubble_sprite.update@bubble_sprite.z = self.zendend#--------------------------------------------------------------------------# overwrite method: adjust_message_window_size# YEA - Message System Compatible#--------------------------------------------------------------------------def adjust_message_window_sizestart_name_windowendend # Window_Message#==============================================================================# ¡ Window_NameMessage#==============================================================================if $imported["YEA-MessageSystem"]class Window_NameMessage < Window_Base#--------------------------------------------------------------------------# set_x_position#--------------------------------------------------------------------------alias yes_pm_set_x_position set_x_positiondef set_x_position(x_position)yes_pm_set_x_position(x_position)self.x += @message_window.new_line_x if x_position == 1self.z = @message_window.zendend # Window_NameMessageend#==============================================================================## ¥ End of File##==============================================================================  
[/SPOILER]
I didn't really know where to put this topic, hope it's in the right place.

there's also something wrong with posting the script, and the spoiler thing.
wow - you've got part of your post and a spoiler tag right in the middle of your code.


Can you provide the link to the original script?
wow - you've got part of your post and a spoiler tag right in the middle of your code.

Can you provide the link to the original script?
yes, I actually don't when I got to the editor the spoiler is in the correct place and not inside the script put when i post it it's messed up

here's the link: http://symphonyan.org/rgss3/pop-message/
Looks like the part that would need to be modified (and it looks like a simple edit) would be here:

#-------------------------------------------------------------------------- # alias method: update_placement #-------------------------------------------------------------------------- alias event_pop_message_update_placement update_placement def update_placement if SceneManager.scene_is?(Scene_Map) if @event_pop_id.nil? fix_default_message event_pop_message_update_placement elsif @event_pop_id == 0 character = $game_player self.y = character.screen_y - self.height + YSE:😛OP_MESSAGE:😛OSITION[:y_buffer] self.x = character.screen_x - self.width / 2 + YSE:😛OP_MESSAGE:😛OSITION[:x_buffer] fix_position_bubble(character) set_bubble_tag(character) elsif @event_pop_id > 0 hash = @event_pop_follower ? $game_player.followers : $game_map.events character = hash[@event_pop_id] self.y = character.screen_y - self.height + YSE:😛OP_MESSAGE:😛OSITION[:y_buffer] self.x = character.screen_x - self.width / 2 + YSE:😛OP_MESSAGE:😛OSITION[:x_buffer] fix_position_bubble(character) set_bubble_tag(character) end else event_pop_message_update_placement end endShould narrow it down, at least.
Are you sure about that? How does that tell it to place the message over the current event - the one that ran the Show Text command?

Here's what I came up with in the meantime. Put this into a new script slot BELOW the YEA script, then use

\bm[*]in a show text command when you want it over the 'current' event.
Spoiler
Code:
class Game_Message  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor :event_id                 # event triggering message  #--------------------------------------------------------------------------  # * Clear  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_Game_Message_clear clear  def clear    shaz_YESPopMessage_Game_Message_clear    event_id = nil  endendclass Game_Interpreter  #--------------------------------------------------------------------------  # * Show Text  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_Game_Interpreter_command_101 command_101  def command_101    $game_message.event_id = @event_id    shaz_YESPopMessage_Game_Interpreter_command_101  endendclass Window_Message < Window_Base  #--------------------------------------------------------------------------  # new method: pop_message_initialize  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_pop_message_initialize pop_message_initialize  def pop_message_initialize(text)    if text =~ /\\BM\[(\*)\]/i      setup_pop_message($game_message.event_id)    end    shaz_YESPopMessage_pop_message_initialize(text)  end    #--------------------------------------------------------------------------  # new method: process_pop_message  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_process_pop_message process_pop_message  def process_pop_message(text)    text.gsub!(/\eBM\[(\*)\]/i) { "" }    shaz_YESPopMessage_process_pop_message(text)    text  endend
There's also a bug in that script that will cause the game to crash if you turn off the bubble.

Change this line:

Code:
    @bubble_sprite.opacity = 255
to this:
Code:
    @bubble_sprite.opacity = 255 if YES::POP_MESSAGE::EFFECT_SETTING[:bubble_tag]
Are you sure about that? How does that tell it to place the message over the current event - the one that ran the Show Text command?

Here's what I came up with in the meantime. Put this into a new script slot BELOW the YEA script, then use

\bm[*]in a show text command when you want it over the 'current' event.
Spoiler
Code:
class Game_Message  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor :event_id                 # event triggering message  #--------------------------------------------------------------------------  # * Clear  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_Game_Message_clear clear  def clear    shaz_YESPopMessage_Game_Message_clear    event_id = nil  endendclass Game_Interpreter  #--------------------------------------------------------------------------  # * Show Text  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_Game_Interpreter_command_101 command_101  def command_101    $game_message.event_id = @event_id    shaz_YESPopMessage_Game_Interpreter_command_101  endendclass Window_Message < Window_Base  #--------------------------------------------------------------------------  # new method: pop_message_initialize  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_pop_message_initialize pop_message_initialize  def pop_message_initialize(text)    if text =~ /\\BM\[(\*)\]/i      setup_pop_message($game_message.event_id)    end    shaz_YESPopMessage_pop_message_initialize(text)  end    #--------------------------------------------------------------------------  # new method: process_pop_message  #--------------------------------------------------------------------------  alias shaz_YESPopMessage_process_pop_message process_pop_message  def process_pop_message(text)    text.gsub!(/\eBM\[(\*)\]/i) { "" }    shaz_YESPopMessage_process_pop_message(text)    text  endend
Spoiler
There's also a bug in that script that will cause the game to crash if you turn off the bubble.

Change this line:

@bubble_sprite.opacity = 255to this:
Code:
    @bubble_sprite.opacity = 255 if YES::POP_MESSAGE::EFFECT_SETTING[:bubble_tag]
Thank you. as for the line to change, there are two lines like that. Do you want me to replace both of them?
It is the one in the setup_pop_message(id) method.
ok, thanks again.
Let us know if it works, or if you have troubles. I won't close the thread yet.
Tired, so perhaps I missed it.  Well, at least you got it for him.
yep it's working.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/script-modification.19066/