################################################################################# Dynamic Results Popup Window by Sixth################################################################################# Instructions:# Copy and paste this into it's own place in the script editor after all of the# Crafting scripts to make it work.# Read the extra instructions below to avoid error messages popping up.## Fixed everything I wanted, added a new way of displaying Exp earned.# Now everything scales dynamically, everything that should center itself is# centered.# Also cleaned up the code a bit, removed my useless blabbering too. ## However, this is now NOT a plug-and-play snippet.# Some extra settings are needed to make everything work as I intended it to work.# The following things should be inserted into the "Crafting Customize Section"# of the script:## At the - Results Pop-up Window Settings - insert the following lines at the end:# Arrow_x_Item = -8 # The horizontal offset for the arrow displayed# # after the 'Result_Msg' text# Arrow_x_Exp = -2 # The horizontal offset for the arrow displayed# # after the 'Exp_Earned' text## At the - Font Settings - insert the following line at the end:# :arrows => [["Monotype Corsiva", "Verdana", "Calibri"], 24, true, 13],## This is all that you should do before you use my snippet.# If some arrows are not centered for you, edit the Arrow's offset settings to fix it.# I made that, because different font types behave differently (different sizes,# different properties, etc.), so in order to make it possible to center them# regardless of the font type someone uses, this was necessary.# I made the arrow font settings to make sure that if someone wants to display the arrow# without actually changing the other font settings, he/she could do it.# The "Monotype Corsiva" font type can display the arrows, so you don't even# have to search for a suitable font type.## I think this will be it for now. I am not planning to change anything anymore,# but if someone wants help to change some things, my PM box is open for anyone.################################################################################==============================================================================# ■ Crafting_Results_Window#==============================================================================class Crafting_Results_Window < Window_Message #---------------------------------------------------------------------------- # ♦ Public Instance Variables #---------------------------------------------------------------------------- attr_reader :detail_window #---------------------------------------------------------------------------- # ● upgraded method: initialize #---------------------------------------------------------------------------- def initialize super self.x = (Graphics.width - window_width) * 0.5 self.y = (Graphics.height - window_height) * 0.5 self.opacity = Venka::Crafting::Result_Opacity self.back_opacity = Venka::Crafting::Result_BGOpacity @item = nil @amount = @exp = 0 @message = "" @leveled = false self.openness = 0 end #---------------------------------------------------------------------------- # ● window settings #---------------------------------------------------------------------------- def window_width; Graphics.width * 0.8; end def window_height; fitting_height(4); end #---------------------------------------------------------------------------- # ○ new method: craft #---------------------------------------------------------------------------- def craft=(craft) return if @craft_type == craft @craft_type = craft end #---------------------------------------------------------------------------- # ○ new method: detail_window #---------------------------------------------------------------------------- def detail_window=(detail_window) @detail_window = detail_window end #---------------------------------------------------------------------------- # ○ new method: update_info #---------------------------------------------------------------------------- def update_info @item = @detail_window.result_item @amount = @detail_window.result_amount @exp = @detail_window.result_exp @message = @detail_window.result_message @leveled = @detail_window.result_level refresh open wait_to_dispose end #---------------------------------------------------------------------------- # ● upgraded method: refresh #---------------------------------------------------------------------------- def refresh contents.clear set_font🙂other_text) draw_items_received(line_height, contents.width) draw_header draw_exp_received(line_height*2) if @exp > 0 draw_level_up(line_height*3) if @leveled end #---------------------------------------------------------------------------- # ○ new method: draw_items_received #---------------------------------------------------------------------------- def draw_items_received(y, width) contents.clear case @message when Venka::Crafting::Result_Msg width22 = text_size(@message).width + text_size(@item.name).width + text_size("x#{@amount}").width + 140 self.width = width22 self.x = Graphics.width/2 - width22/2 create_contents set_font🙂other_text) draw_text(0, y, contents.width, line_height, @message) w = text_size(@message).width + 5 draw_text(w, y, contents.width - w, line_height, "x#{@amount}", 2) w += text_size("x#{@amount}").width + 5 if $imported[:MAIcon_Hue] draw_icon_with_hue(@item.icon_index, @item.icon_hue, w, y) else draw_icon(@item.icon_index, contents.width - text_size(@item.name).width - 30 - text_size("x#{@amount}").width - 6, y) end change_color(@item.color) draw_text(w + 25, y, contents.width - w - 25 - text_size("x#{@amount}").width - 6, line_height, @item.name, 2) set_font🙂arrows) draw_text(text_size(@message).width + Venka::Crafting::Arrow_x_Item, y, 76, line_height, "→", 1) set_font🙂other_text) when Venka::Crafting::Failed_Msg contents.clear width22 = text_size(@message).width + 140 self.width = width22 self.x = Graphics.width/2 - width22/2 create_contents draw_text(0, y, contents.width, line_height, @message, 1) end end #---------------------------------------------------------------------------- # ○ new method: draw_exp_received #---------------------------------------------------------------------------- def draw_exp_received(y) set_font🙂other_text) draw_text(0 - text_size("→").width / 2 - 6, y, contents.width / 2, line_height, Venka::Crafting::Exp_Earned, 2) w = text_size(Venka::Crafting::Exp_Earned).width + 9 text = $craft[@craft_type].max_level? ? Venka::Crafting::Max_Exp : @exp.to_s draw_text(contents.width / 2 + text_size("→").width / 2 + 6, y, contents.width / 2, line_height, text + " Exp", 0) set_font🙂arrows) draw_text(contents.width / 2 - text_size("→").width / 2 + Venka::Crafting::Arrow_x_Exp, y, text_size("→").width, line_height, "→", 1) set_font🙂other_text) end #---------------------------------------------------------------------------- # ○ new method: draw_header #---------------------------------------------------------------------------- def draw_header set_font🙂recipe_name) draw_text(0, 0, contents.width, line_height, Venka::Crafting::Results_Text, 1) color = normal_color contents.fill_rect(0, line_height - 2, contents_width, 1, color) color.alpha = 90 contents.fill_rect(0, line_height - 1, contents_width, 1, color) end #---------------------------------------------------------------------------- # ○ new method: draw_level_up #---------------------------------------------------------------------------- def draw_level_up(y) set_font🙂button_text) draw_text(0, y, contents.width, line_height, Venka::Crafting::Lv_Gain, 1) end #---------------------------------------------------------------------------- # ○ new method: wait_to_dispose #---------------------------------------------------------------------------- def wait_to_dispose loop do Graphics.update Input.update update break if Input.trigger?(Input::C) end self.close endend