AMS - Advanced Message Script - R4 (Edited)

AMS - Advanced Message Script - R4 Update: #2
By: Dubealex, Edited by FF12_master


Introduction
Firstly i want to say that i did not make this script...all ihave done is played around and added some extra features..
also, i shortened some shortcuts...so it doesn't fill up half the message box 🙂

Extra Features
  • display the icon and name of a armor
  • display the icon and name of a item
  • display the icon and name of a skill
  • display the icon and name of a weapon

Screenshots

Sorry i haven't taken any Screenshots yet...

Script

AMS Script Spoiler
  1.  
  2. #===================================================
  3. #  ¦ AMS - Advanced Message Script - R4 [Update #2]
  4. #===================================================
  5. # For more infos and update, visit:
  6. # http://www.creationasylum.net (Creation Asylum)
  7. #
  8. # Edited, Fixed and Enhanced by: Dubealex
  9. # Original Script Core by: XRXS Scripter (Jap Dudes)
  10. # HTML Hexadecimal color feature from: Phylomorphis
  11. #
  12. # Special Thanks:
  13. # Rabu: For enabling the Show Face feature in an encrypted project
  14. # FF12_Master: For adding Extra Features
  15. #
  16. # To found all my new features, search the following:   #NEW
  17. # To configure the button to skip the dialog, search:   #SKIP_TEXT_CODE
  18. #
  19. #    Edited by FF12_master :To find Edits Search for ++Edit
  20. #   -Edits-
  21. #
  22. #   -Shortened face and name box short cut-
  23. #   
  24. #   \f[i] face shortcut, were i is the file name
  25. #   \n[i] name box, were i is the decided name.
  26. #
  27. #   \oa[i]         - display the icon and name of armor i
  28. #   \oi[i]         - display the icon and name of item i
  29. #   \os[i]         - display the icon and name of skill i
  30. #   \ow[i]         - display the icon and name of weapon i
  31. #
  32. # For any extra features to be added for Personalised Games Please PM FF12_master on RMXP.org
  33. # or Simply Email [email hidden]
  34. #
  35. # 24th Febuary 2009
  36. #===================================================
  37.  
  38. LETTER_BY_LETTER_MODE = true    #Set the letter by letter mode ON/OFF
  39.  
  40. #===================================================
  41. # ? CLASS AMS Begins
  42. #===================================================
  43. class AMS
  44.  
  45.  attr_accessor :name_box_x_offset
  46.  attr_accessor :name_box_y_offset
  47.  attr_accessor :font_type
  48.  attr_accessor :name_font_type
  49.  attr_accessor :font_size
  50.  attr_accessor :name_font_size
  51.  attr_accessor :message_box_opacity
  52.  attr_accessor :name_box_skin
  53.  attr_accessor :name_box_text_color
  54.  attr_accessor :message_box_text_color
  55.  attr_accessor :message_box_skin
  56.  attr_accessor :name_box_width
  57.  attr_accessor :name_box_height
  58.  attr_accessor :message_width
  59.  attr_accessor :message_height
  60.  attr_accessor :message_x
  61.  attr_accessor :message_y_bottom
  62.  attr_accessor :message_y_middle
  63.  attr_accessor :message_y_top
  64.  attr_accessor :event_message_x_ofset
  65.  attr_accessor :event_message_y_ofset
  66.  
  67. def initialize
  68.  
  69.  
  70.  @name_box_x_offset = 0          #Choose the X axis offset of the name bos. default= 0
  71.  @name_box_y_offset = -10       #Choose the Y axis offset of the name bos. default= -10
  72.  @name_box_width = 8               #Choose the width of the Name Box. default= 8   
  73.  @name_box_height = 26            #Choose the height of the Name Box. default= 26
  74.  
  75.  @font_type = "Tahoma"            #Choose the Font Name (Case Sensitive) for message box
  76.  @name_font_type = "Tahoma"    #Choose the Font Name (Case Sensitive) for Name Box
  77.  @font_size = 21                     #Choose the default Font Size for message box text
  78.  @name_font_size = 21             #Choose the deafault Font Size for Name Box text
  79.  @name_box_text_color=0          #Choose the Text Color of the Name Box
  80.  @message_box_text_color=0      #Choose the Text Color of the Message Box
  81.  
  82.  @message_box_opacity = 240      #Choose the opacity of the message window. Default=160
  83.  @message_box_skin = "Black3"   #Choose the WindowSkin for the Message Box
  84.  @name_box_skin = "Black3"       #Choose the WindowSkin for the Name Box
  85.  
  86.  @message_width = 440             #Choose the width size of the message box. Default=480
  87.  @message_height = 160            #Choose the height size of the message box. Default=160
  88.  @message_x = 80                     #Choose the X position of the message box. Default=80
  89.  @message_y_bottom = 310         #Choose the Y bottom position of the message box. Default=304
  90.  @message_y_middle = 160         #Choose the Y middle position of the message box. Default=160
  91.  @message_y_top = 16               #Choose the Y top position of the message box. Default=16
  92.  
  93.  @event_message_x_ofset = 0      #Choose the X position offset of the event message. Default=0
  94.  @event_message_y_ofset = 48    #Choose the Y position offset of the event message. Default=48
  95.  
  96. end
  97. end
  98. #===================================================
  99. # ? CLASS AMS Ends
  100. #===================================================
  101.  
  102.  
  103. #===================================================
  104. # ? Class Window_Message Begins
  105. #===================================================
  106. class Window_Message < Window_Selectable   
  107.  
  108. alias xrxs9_initialize initialize
  109.  
  110. def initialize
  111.  
  112. @alex_skip = false
  113.  
  114. xrxs9_initialize
  115.  
  116. if $soundname_on_speak == nil then
  117.   $soundname_on_speak = ""
  118. end
  119.  
  120. $gaiji_file = "./Graphics/Gaiji/sample.png"
  121.           
  122. if FileTest.exist?($gaiji_file)
  123.   @gaiji_cache = Bitmap.new($gaiji_file)
  124. else
  125.   @gaigi_cache = nil
  126. end
  127. @opacity_text_buf = Bitmap.new(32, 32)
  128. end
  129.  
  130.  
  131. #--------------------------------------------------------------------------
  132.  
  133. alias xrxs9_terminate_message terminate_message
  134.  
  135. def terminate_message
  136.  
  137. if @name_window_frame != nil
  138.   @name_window_frame.dispose
  139.   @name_window_frame = nil
  140. end
  141.  
  142. if @name_window_text   != nil
  143.   @name_window_text.dispose
  144.   @name_window_text   = nil
  145. end
  146. xrxs9_terminate_message
  147. end
  148.  
  149. #--------------------------------------------------------------------------
  150.  
  151. def refresh
  152.  
  153. self.contents.clear
  154. self.contents.font.color = text_color($ams.message_box_text_color)
  155. self.contents.font.name = $ams.font_type
  156. self.contents.font.size = $ams.font_size
  157. self.windowskin = RPG::Cache.windowskin($ams.message_box_skin)
  158. @x = @y = @max_x = @max_y = @indent = @lines = 0
  159. @face_indent = 0
  160. @opacity = 255
  161. @cursor_width = 0
  162. @write_speed = 0
  163. @write_wait = 0
  164. @mid_stop = false
  165. @face_file = nil
  166. @popchar = -2
  167.  
  168. if $game_temp.choice_start == 0
  169.   @x = 8
  170. end
  171.  
  172. if $game_temp.message_text != nil
  173.   @now_text = $game_temp.message_text
  174.   if (/\A\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  175.        @face_file ="Faces/" + $1 + ".png"
  176.        @x = @face_indent = 128
  177.      if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  178.         self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  179.      end
  180.      @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  181.   end
  182.  
  183.   begin
  184.   last_text = @now_text.clone
  185.   @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  186.   end until @now_text == last_text
  187.   @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  188.      $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  189.     end
  190.  
  191.   #NEW
  192.   #Dubealex's Stop Skip Text ON-OFF
  193.   @now_text.gsub!(/\\[%]/) { "\100" }
  194.   #End new command
  195.     
  196.   #NEW
  197.   #Dubealex's Show Monster Name Feature
  198.     @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) do
  199.     $data_enemies[$1.to_i] != nil ? $data_enemies[$1.to_i].name : ""
  200.     end
  201.     #End new command
  202.     
  203.   #NEW
  204.   #Dubealex's Show Item Price Feature
  205.     @now_text.gsub!(/\\[Pp]rice\[([0-9]+)\]/) do
  206.     $data_items[$1.to_i] != nil ? $data_items[$1.to_i].price : ""
  207.     end
  208.     #End new command
  209.     
  210.   #NEW
  211.   #Dubealex's Show Hero Class Name Feature
  212.     @now_text.gsub!(/\\[Cc]lass\[([0-9]+)\]/) do
  213.     $data_classes[$data_actors[$1.to_i].class_id] != nil ? $data_classes[$data_actors[$1.to_i].class_id].name : ""
  214.     end
  215.     #End new command
  216.     
  217.   #NEW
  218.   #Dubealex's Show Current Map Name Feature
  219.     @now_text.gsub!(/\\[Mm]ap/) do
  220.     $game_map.name      != nil ? $game_map.name      : ""
  221.     end
  222.     #End new command
  223.     
  224.   #New
  225.     
  226.     #New
  227.     #++Edit
  228.     #Shows Icon and Weapon/Armour and Item name use \ow[i], \oa[i], \oi[i]
  229.     # armor, items, skills, and weapons
  230.         @now_text.gsub!(/\\[Oo][Aa]\[([0-9]+)\]/) {
  231.            item = $data_armors[$1.to_i]
  232.            "\014[#{$1}]" + "   " + item.name
  233.         }
  234.         @now_text.gsub!(/\\[Oo][Ii]\[([0-9]+)\]/) {
  235.            item = $data_items[$1.to_i]
  236.            "\015[#{$1}]" + "   " + item.name
  237.         }
  238.         @now_text.gsub!(/\\[Oo][Ss]\[([0-9]+)\]/) {
  239.            item = $data_skills[$1.to_i]
  240.            "\016[#{$1}]" + "   " + item.name
  241.         }
  242.         @now_text.gsub!(/\\[Oo][Ww]\[([0-9]+)\]/) {
  243.            item = $data_weapons[$1.to_i]
  244.            "\017[#{$1}]" + "   " + item.name
  245.         }
  246.     
  247.   #NEW
  248.   #Dubealex's Choose Name Box Text Color
  249.     @now_text.gsub!(/\\[Zz]\[([0-9]+)\]/) do
  250.     $ams.name_box_text_color=$1.to_i
  251.     @now_text.sub!(/\\[Zz]\[([0-9]+)\]/) { "" }
  252.     end
  253.     #End new command
  254.     
  255.     
  256.     
  257.   name_window_set = false
  258.   if (/\\[Nn]\[(.+?)\]/.match(@now_text)) != nil
  259.      name_window_set = true
  260.      name_text = $1
  261.      @now_text.sub!(/\\[Nn]\[(.*?)\]/) { "" }
  262.   end
  263.  
  264.   if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  265.      @popchar = $1.to_i
  266.      if @popchar == -1
  267.         @x = @indent = 48
  268.         @y = 4
  269.      end
  270.      @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  271.   end
  272.  
  273.   @max_choice_x = 0
  274.   if @popchar >= 0
  275.      @text_save = @now_text.clone
  276.      @max_x = 0
  277.      @max_y = 4
  278.      for i in 0..3
  279.         line = @now_text.split(/\n/)[3-i]
  280.         @max_y -= 1 if line == nil and @max_y <= 4-i
  281.         next if line == nil
  282.         line.gsub!(/\\\w\[(\w+)\]/) { "" }
  283.         cx = contents.text_size(line).width
  284.         @max_x = cx if cx > @max_x
  285.         if i >= $game_temp.choice_start
  286.            @max_choice_x = cx if cx > @max_choice_x
  287.         end
  288.      end
  289.      self.width = @max_x + 32 + @face_indent
  290.      self.height = (@max_y - 1) * 32 + 64
  291.      @max_choice_x -= 68
  292.      @max_choice_x -= @face_indent*216/128
  293.   else
  294.      @max_x = self.width - 32 - @face_indent
  295.      for i in 0..3
  296.         line = @now_text.split(/\n/)[i]
  297.         next if line == nil
  298.         line.gsub!(/\\\w\[(\w+)\]/) { "" }
  299.         cx = contents.text_size(line).width
  300.         if i >= $game_temp.choice_start
  301.            @max_choice_x = cx if cx > @max_choice_x
  302.         end
  303.      end
  304.      @max_choice_x += 8
  305.   end
  306.   @cursor_width = 0
  307.   @now_text.gsub!(/\\\\/) { "\000" }
  308.   @now_text.gsub!(/\\[Cc]\[([0123456789ABCDEF#]+)\]/) { "\001[#{$1}]" }
  309.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  310.   @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  311.   @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  312.  
  313.     #NEW
  314.     #Dubealex's Permanent Color Change
  315.     @now_text.gsub!(/\\[Cc]olor\[([0-9]+)\]/) do
  316.        $ams.message_box_text_color= $1.to_i
  317.      @now_text.sub!(/\\[Cc]\[([0-9]+)\]/) { "" }
  318.        end
  319.     #End of new command
  320.     
  321.     #NEW
  322.     #Dubealex's Font Change Feature
  323.      @now_text.gsub(/\\[Tt]\[(.*?)\]/) do
  324.        buftxt = $1.to_s
  325.        $ams.font_type = buftxt
  326.        @now_text.sub!(/\\[Tt]\[(.*?)\]/) { "" }
  327.        end
  328.     #End of new command
  329.     
  330.   @now_text.gsub!(/\\[.]/) { "\005" }
  331.   @now_text.gsub!(/\\[|]/) { "\006" }
  332.   @now_text.gsub!(/\\[|]/) { "\014" }
  333.   @now_text.gsub!(/\\[|]/) { "\015" }
  334.   @now_text.gsub!(/\\[|]/) { "\016" }
  335.   @now_text.gsub!(/\\[|]/) { "\017" }
  336.   @now_text.gsub!(/\\[>]/) { "\019" }
  337.   @now_text.gsub!(/\\[<]/) { "\031" }
  338.   @now_text.gsub!(/\\[!]/) { "\020" }
  339.   @now_text.gsub!(/\\[~]/) { "\021" }
  340.   @now_text.gsub!(/\\[Ee]\[([0-9]+)\]/) { "\022[#{$1}]" }
  341.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  342.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  343.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  344.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  345.   @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "\027[#{$1}]" }
  346.  
  347.   reset_window
  348.  
  349.   if name_window_set
  350.      color=$ams.name_box_text_color
  351.      off_x =   $ams.name_box_x_offset
  352.      off_y =   $ams.name_box_y_offset
  353.      space = 2
  354.      x = self.x + off_x - space / 2
  355.      y = self.y + off_y - space / 2
  356.      w = self.contents.text_size(name_text).width + $ams.name_box_width + space
  357.      h = $ams.name_box_height + space
  358.      @name_window_frame = Window_Frame.new(x, y, w, h)
  359.      @name_window_frame.z = self.z + 1
  360.      x = self.x + off_x + 4
  361.      y = self.y + off_y
  362.      @name_window_text   = Air_Text.new(x, y, name_text, color)
  363.      @name_window_text.z = self.z + 2
  364.   end
  365. end
  366.  
  367. reset_window
  368.  
  369. if $game_temp.choice_max > 0
  370.   @item_max = $game_temp.choice_max
  371.   self.active = true
  372.   self.index = 0
  373. end
  374.  
  375. if $game_temp.num_input_variable_id > 0
  376.   digits_max = $game_temp.num_input_digits_max
  377.   number = $game_variables[$game_temp.num_input_variable_id]
  378.   @input_number_window = Window_InputNumber.new(digits_max)
  379.   @input_number_window.number = number
  380.   @input_number_window.x = self.x + 8
  381.   @input_number_window.y = self.y + $game_temp.num_input_start * 32
  382. end
  383. end
  384.  
  385. #--------------------------------------------------------------------------
  386.  
  387. def update
  388.  
  389. super
  390.  
  391.  
  392.     
  393. if @fade_in
  394.   self.contents_opacity += 24
  395.   if @input_number_window != nil
  396.      @input_number_window.contents_opacity += 24
  397.   end
  398.   if self.contents_opacity == 255
  399.      @fade_in = false
  400.   end
  401.   return
  402. end
  403. @now_text = nil if @now_text == ""
  404.  
  405. if @now_text != nil and @mid_stop == false
  406.   if @write_wait > 0
  407.      @write_wait -= 1
  408.      return
  409.   end
  410.   text_not_skip = LETTER_BY_LETTER_MODE
  411.   while true
  412.      @max_x = @x if @max_x < @x
  413.      @max_y = @y if @max_y < @y
  414.      if (c = @now_text.slice!(/./m)) != nil
  415.         if c == "\000"
  416.            c = "\\"
  417.         end
  418.        
  419.         if c == "\001"
  420.            @now_text.sub!(/\[([0123456789ABCDEF#]+)\]/, "")
  421.            temp_color = $1
  422.            color = temp_color.to_i
  423.            leading_x = temp_color.to_s.slice!(/./m)
  424.            if leading_x == "#"
  425.               self.contents.font.color = hex_color(temp_color)
  426.               next
  427.            end
  428.            if color >= 0 and color <= 7
  429.               self.contents.font.color = text_color(color)
  430.            end
  431.            next
  432.         end
  433.  
  434.         if c == "\002"
  435.            if @gold_window == nil and @popchar <= 0
  436.               @gold_window = Window_Gold.new
  437.               @gold_window.x = 560 - @gold_window.width
  438.               if $game_temp.in_battle
  439.                  @gold_window.y = 192
  440.               else
  441.                  @gold_window.y = self.y >= 128 ? 32 : 384
  442.               end
  443.               @gold_window.opacity = self.opacity
  444.               @gold_window.back_opacity = self.back_opacity
  445.            end
  446.            c = ""
  447.         end
  448.  
  449.         if c == "\003"
  450.            @now_text.sub!(/\[([0-9]+)\]/, "")
  451.            speed = $1.to_i
  452.            if speed >= 0 and speed <= 19
  453.               @write_speed = speed
  454.            end
  455.            c = ""
  456.         end
  457.  
  458.         if c == "\004"
  459.            @now_text.sub!(/\[(.*?)\]/, "")
  460.            buftxt = $1.dup.to_s
  461.            if buftxt.match(/\//) == nil and buftxt != "" then
  462.               $soundname_on_speak = "Audio/SE/" + buftxt
  463.            else
  464.               $soundname_on_speak = buftxt.dup
  465.            end
  466.            c = ""
  467.         elsif c == "\004"
  468.            c = ""
  469.         end
  470.        
  471.         if c == "\005"
  472.            @write_wait += 5
  473.            c = ""
  474.         end
  475.        
  476.         if c == "\006"
  477.            @write_wait += 20
  478.            c = ""
  479.         end
  480.        
  481.         if c == "\019"
  482.            text_not_skip = false
  483.            c = ""
  484.         end
  485.        
  486.         if c == "\031"
  487.            text_not_skip = true
  488.            c = ""
  489.         end
  490.        
  491.         if c == "\020"
  492.            @mid_stop = true
  493.            c = ""
  494.         end
  495.        
  496.         if c == "\021"
  497.            terminate_message
  498.            return
  499.         end
  500.        
  501.         if c == "\023"
  502.            @indent = @x
  503.            c = ""
  504.         end
  505.  
  506.         if c == "\024"
  507.            @now_text.sub!(/\[([0-9]+)\]/, "")
  508.            @opacity = $1.to_i
  509.            color = self.contents.font.color
  510.            self.contents.font.name = $ams.font_type
  511.            self.contents.font.size = $ams.font_size
  512.            self.contents.font.color = Color.new(color.red, color.green, color.blue, color.alpha * @opacity / 255)
  513.            c = ""
  514.         end
  515.  
  516.         if c == "\025"
  517.            @now_text.sub!(/\[([0-9]+)\]/, "")
  518.            self.contents.font.size = [[$1.to_i, 6].max, 32].min
  519.            c = ""
  520.         end
  521.  
  522.         if c == "\026"
  523.            @now_text.sub!(/\[([0-9]+)\]/, "")
  524.            @x += $1.to_i
  525.            c = ""
  526.         end
  527.        
  528.         if c == "\027"
  529.            @now_text.sub!(/\[(.*?)\]/, "")
  530.            @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  531.            if $soundname_on_speak != ""
  532.               Audio.se_play($soundname_on_speak)
  533.            end
  534.         c = ""
  535.         end
  536.  
  537.         if c == "\030"
  538.            @now_text.sub!(/\[(.*?)\]/, "")
  539.            self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  540.            if $soundname_on_speak != ""
  541.               Audio.se_play($soundname_on_speak)
  542.            end
  543.            @x += 24
  544.            c = ""
  545.         end
  546.  
  547.         if c == "\n"
  548.            @lines += 1
  549.            @y += 1
  550.            @x = 0 + @indent + @face_indent
  551.            if @lines >= $game_temp.choice_start
  552.               @x = 8 + @indent + @face_indent
  553.               @cursor_width = @max_choice_x
  554.            end
  555.            c = ""
  556.         end
  557.        
  558.         if c == "\022"
  559.            @now_text.sub!(/\[([0-9]+)\]/, "")
  560.            @x += gaiji_draw(4 + @x, @y * line_height + (line_height - self.contents.font.size), $1.to_i)
  561.            c = ""
  562.         end
  563.        
  564.         #NEW
  565.         #Dubealex's Text Skip On/OFF Command
  566.           if c == "\100"
  567.               if @alex_skip==false
  568.                    @alex_skip=true
  569.               else
  570.                  @alex_skip=false
  571.               end
  572.              c = ""
  573.           end   
  574.           #end of new command
  575.                                                     
  576.         if c != ""
  577.            self.contents.draw_text(0+@x, 32 * @y, 40, 32, c)
  578.            @x += self.contents.text_size(c).width
  579.            if $soundname_on_speak != "" then
  580.               Audio.se_play($soundname_on_speak)
  581.            end
  582.         end
  583.        
  584.   #New
  585.     #++Edit
  586.     #Shows Icon and Weapon/Armour and Item name use \ow[i], \oa[i], \oi[i]
  587.     
  588.         # If \oa[n]
  589.      if c == "\014"
  590.         @now_text.sub!(/\[([0-9]+)\]/, "")
  591.         index = $1.to_i
  592.         @now_text.sub!("   ", " ")
  593.         item = $data_armors[index]
  594.         # draw the icon
  595.         icon = RPG::Cache.icon(item.icon_name)
  596.         line = self.contents.text_size("dj").height
  597.         self.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
  598.         @x += 24
  599.  
  600.         # go to next text
  601.         return
  602.      end
  603.      #++Edit
  604.      # If \oi[n]
  605.      if c == "\015"
  606.         @now_text.sub!(/\[([0-9]+)\]/, "")
  607.         index = $1.to_i
  608.         @now_text.sub!("   ", " ")
  609.         item = $data_items[index]
  610.         # draw the icon
  611.         icon = RPG::Cache.icon(item.icon_name)
  612.         line = self.contents.text_size("dj").height
  613.         self.contents.blt(@x + 4, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
  614.         @x += 24
  615.  
  616.         # go to next text
  617.         return
  618.      end
  619.      #++Edit
  620.      # If \os[n]
  621.      if c == "\016"
  622.         @now_text.sub!(/\[([0-9]+)\]/, "")
  623.         index = $1.to_i
  624.         @now_text.sub!("   ", " ")
  625.         item = $data_skills[index]
  626.         # draw the icon
  627.         icon = RPG::Cache.icon(item.icon_name)
  628.         line = self.contents.text_size("dj").height
  629.         self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
  630.         @x += 24
  631.  
  632.         # go to next text
  633.         return
  634.      end
  635.      #++Edit
  636.      # If \ow[n]
  637.      if c == "\017"
  638.         @now_text.sub!(/\[([0-9]+)\]/, "")
  639.         index = $1.to_i
  640.         @now_text.sub!("   ", " ")
  641.         item = $data_weapons[index]
  642.         # draw the icon
  643.         icon = RPG::Cache.icon(item.icon_name)
  644.         line = self.contents.text_size("dj").height
  645.         self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
  646.         @x += 24
  647.        
  648.         # go to next text
  649.         return
  650.      end
  651.  
  652.        
  653. #SKIP_TEXT_CODE
  654.  
  655. # B = Escape, 0 (On The NumPad), X
  656. # C = Enter, Space Bar and C
  657. # A = Shift, Z
  658.  
  659.   if Input.press?(Input::C) # <-- Change the value on that line
  660.      if @alex_skip==false         
  661.      text_not_skip = false
  662.      end
  663.         end
  664.      else
  665.         text_not_skip = true
  666.         break
  667.      end
  668.     
  669.      if text_not_skip
  670.         break
  671.      end
  672.   end
  673.   @write_wait += @write_speed
  674.   return
  675. end
  676.  
  677. if @input_number_window != nil
  678.   @input_number_window.update
  679.   if Input.trigger?(Input::C)
  680.      $game_system.se_play($data_system.decision_se)
  681.      $game_variables[$game_temp.num_input_variable_id] =
  682.         @input_number_window.number
  683.      $game_map.need_refresh = true
  684.      @input_number_window.dispose
  685.      @input_number_window = nil
  686.      terminate_message
  687.   end
  688.   return
  689. end
  690.  
  691. if @contents_showing
  692.   if $game_temp.choice_max == 0
  693.      self.pause = true
  694.   end
  695.  
  696.   if Input.trigger?(Input::B)
  697.      if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  698.         $game_system.se_play($data_system.cancel_se)
  699.         $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  700.         terminate_message
  701.      end
  702.   end
  703.  
  704.   if Input.trigger?(Input::C)
  705.      if $game_temp.choice_max > 0
  706.         $game_system.se_play($data_system.decision_se)
  707.         $game_temp.choice_proc.call(self.index)
  708.      end
  709.      if @mid_stop
  710.         @mid_stop = false
  711.         return
  712.      else
  713.         terminate_message
  714.      end
  715.   end
  716.   return
  717. end
  718.  
  719. if @fade_out == false and $game_temp.message_text != nil
  720.   @contents_showing = true
  721.   $game_temp.message_window_showing = true
  722.   refresh
  723.   Graphics.frame_reset
  724.   self.visible = true
  725.   self.contents_opacity = 0
  726.   if @input_number_window != nil
  727.      @input_number_window.contents_opacity = 0
  728.   end
  729.   @fade_in = true
  730.   return
  731. end
  732.  
  733. if self.visible
  734.   @fade_out = true
  735.   self.opacity -= 48
  736.   if self.opacity == 0
  737.      self.visible = false
  738.      @fade_out = false
  739.      $game_temp.message_window_showing = false
  740.   end
  741.   return
  742. end
  743. end
  744.  
  745. #--------------------------------------------------------------------------
  746.  
  747. def get_character(parameter)
  748.  
  749. case parameter
  750. when 0   
  751.   return $game_player
  752. else
  753.   events = $game_map.events
  754.   return events == nil ? nil : events[parameter]
  755. end
  756. end
  757.  
  758. #--------------------------------------------------------------------------
  759.  
  760. def reset_window
  761.  
  762. #MESSAGE_SIZE
  763. #MESSAGE_POSITION
  764.  
  765. if @popchar >= 0
  766.   events = $game_map.events
  767.   if events != nil
  768.      character = get_character(@popchar)
  769.      x = [[character.screen_x -   $ams.event_message_x_ofset - self.width / 2, 4].max, 636 - self.width].min
  770.      y = [[character.screen_y - $ams.event_message_y_ofset - self.height, 4].max, 476 - self.height].min
  771.      self.x = x
  772.      self.y = y
  773.   end
  774. elsif @popchar == -1
  775.   self.x = -4
  776.   self.y = -4
  777.   self.width = 648
  778.   self.height = 488
  779. else
  780.   if $game_temp.in_battle
  781.      self.y = 16
  782.   else
  783.      case $game_system.message_position
  784.      when 0   
  785.         self.y = $ams.message_y_top
  786.      when 1   
  787.         self.y = $ams.message_y_middle
  788.      when 2   
  789.         self.y = $ams.message_y_bottom
  790.      end
  791.      self.x = $ams.message_x
  792.      if @face_file == nil
  793.         self.width = $ams.message_width
  794.         self.x = $ams.message_x
  795.      else
  796.         if self.width <= 600
  797.            self.width = 600
  798.            self.x -=60
  799.           end
  800.      end
  801.      self.height = $ams.message_height
  802.   end
  803. end
  804. self.contents = Bitmap.new(self.width - 32, self.height - 32)
  805. self.contents.font.color = text_color($ams.message_box_text_color)
  806. self.contents.font.name = $ams.font_type
  807.  self.contents.font.size = $ams.font_size
  808. if @face_file != nil
  809.   self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  810. end
  811. if @popchar == -1
  812.   self.opacity = 255
  813.   self.back_opacity = 0
  814. elsif $game_system.message_frame == 0
  815.   self.opacity = 255
  816.   self.back_opacity = $ams.message_box_opacity
  817. else
  818.   self.opacity = 0
  819.   self.back_opacity = $ams.message_box_opacity
  820. end
  821. end
  822.  
  823. #--------------------------------------------------------------------------
  824.  
  825. def gaiji_draw(x, y, num)
  826.  
  827. if @gaiji_cache == nil
  828.   return 0
  829. else
  830.   if @gaiji_cache.width < num * 24
  831.      return 0
  832.   end
  833.  
  834.   if self.contents.font.size >= 20 and self.contents.font.size <= 24
  835.      size = 24
  836.   else
  837.      size = self.contents.font.size * 100 * 24 / 2200
  838.   end
  839.  
  840.   self.contents.stretch_blt(Rect.new(x, y, size, size), @gaiji_cache, Rect.new(num * 24, 0, 24, 24))
  841.  
  842.   if $soundname_on_speak != "" then
  843.      Audio.se_play($soundname_on_speak)
  844.   end
  845.   return size
  846. end
  847. end
  848.  
  849. #--------------------------------------------------------------------------
  850.  
  851. def line_height
  852. return 32
  853.  
  854. if self.contents.font.size >= 20 and self.contents.font.size <= 24
  855.   return 32
  856. else
  857.   return self.contents.font.size * 15 / 10
  858. end
  859. end
  860.  
  861. #--------------------------------------------------------------------------
  862.  
  863. def ruby_draw_text(target, x, y, str,opacity)
  864.  
  865. sizeback = target.font.size
  866. target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  867. rubysize = [rubysize, 6].max
  868. opacity = [[opacity, 0].max, 255].min
  869. split_s = str.split(/,/)
  870. split_s[0] == nil ? split_s[0] = "" : nil
  871. split_s[1] == nil ? split_s[1] = "" : nil
  872.  
  873. height = sizeback + rubysize
  874. width   = target.text_size(split_s[0]).width
  875.  
  876. target.font.size = rubysize
  877. ruby_width = target.text_size(split_s[1]).width
  878. target.font.size = sizeback
  879.  
  880. buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  881.  
  882. width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  883.  
  884. if opacity == 255
  885.   target.font.size = rubysize
  886.   target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  887.   target.font.size = sizeback
  888.   target.draw_text(x, y, width, target.font.size, split_s[0])
  889.   return width
  890. else
  891.   if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  892.      @opacity_text_buf.dispose
  893.      @opacity_text_buf = Bitmap.new(buf_width, height)
  894.   else
  895.      @opacity_text_buf.clear
  896.   end
  897.   @opacity_text_buf.font.size = rubysize
  898.   @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  899.   @opacity_text_buf.font.size = sizeback
  900.   @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  901.   if sub_x >= 0
  902.      target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  903.   else
  904.      target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  905.   end
  906.   return width
  907. end
  908. end
  909.  
  910. #--------------------------------------------------------------------------
  911.  
  912. def convart_value(option, index)
  913. option == nil ? option = "" : nil
  914. option.downcase!
  915.  
  916. case option
  917. when "i"
  918.   unless $data_items[index].name == nil
  919.      r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  920.   end
  921. when "w"
  922.   unless $data_weapons[index].name == nil
  923.      r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  924.   end
  925. when "a"
  926.   unless $data_armors[index].name == nil
  927.      r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  928.   end
  929. when "s"
  930.   unless $data_skills[index].name == nil
  931.      r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  932.   end
  933. else
  934.   r = $game_variables[index]
  935. end
  936.  
  937. r == nil ? r = "" : nil
  938. return r
  939. end
  940.  
  941. #--------------------------------------------------------------------------
  942.  
  943. def dispose
  944. terminate_message
  945.  
  946. if @gaiji_cache != nil
  947.   unless @gaiji_cache.disposed?
  948.      @gaiji_cache.dispose
  949.   end
  950. end
  951.  
  952. unless @opacity_text_buf.disposed?
  953.   @opacity_text_buf.dispose
  954. end
  955.  
  956. $game_temp.message_window_showing = false
  957. if @input_number_window != nil
  958.   @input_number_window.dispose
  959. end
  960. super
  961. end
  962.  
  963.  
  964.  
  965. #--------------------------------------------------------------------------
  966.  
  967. def update_cursor_rect
  968. if @index >= 0
  969.   n = $game_temp.choice_start + @index
  970.   self.cursor_rect.set(8 + @indent + @face_indent, n * 32, @cursor_width, 32)
  971. else
  972.   self.cursor_rect.empty
  973. end
  974. end
  975. end
  976. #=========================================
  977. # ? CLASS Window_Message Ends
  978. #=========================================
  979.  
  980.  
  981. #=========================================
  982. # ? Class Window_Frame Begins
  983. #=========================================
  984. class Window_Frame < Window_Base
  985.  
  986. def initialize(x, y, width, height)
  987. super(x, y, width, height)
  988. self.windowskin = RPG::Cache.windowskin($ams.name_box_skin)
  989. self.contents = nil
  990. end
  991.  
  992. #--------------------------------------------------------------------------
  993.  
  994. def dispose
  995. super
  996. end
  997. end
  998. #=========================================
  999. # ? CLASS Window_Frame Ends
  1000. #=========================================
  1001.  
  1002.  
  1003. #=========================================
  1004. # ? CLASS Game_Map Additional Code Begins
  1005. #=========================================
  1006. class Game_Map
  1007.  
  1008. #Dubealex's Addition (from XRXS) to show Map Name on screen
  1009. def name
  1010.  $map_infos[@map_id]
  1011. end
  1012. end
  1013. #=========================================
  1014. # ? CLASS Game_Map Additional Code Ends
  1015. #=========================================
  1016.  
  1017.  
  1018. #=========================================
  1019. # ? CLASS Scene_Title Additional Code Begins
  1020. #=========================================
  1021. class Scene_Title
  1022.  
  1023. #Dubealex's Addition (from XRXS) to show Map Name on screen
  1024.  $map_infos = load_data("Data/MapInfos.rxdata")
  1025.  for key in $map_infos.keys
  1026.     $map_infos[key] = $map_infos[key].name
  1027.  end
  1028.  
  1029.  #Dubealex's addition to save data from the AMS in the save files
  1030.  $ams = AMS.new
  1031.  
  1032. end
  1033. #=========================================
  1034. # ? CLASS Scene_Title Additional Code Ends
  1035. #=========================================
  1036.  
  1037.  
  1038. #=========================================
  1039. # ? CLASS Window_Base Additional Code Begins
  1040. #=========================================
  1041. class Window_Base < Window
  1042.  
  1043. #Dubealex Addition (from Phylomorphis) to use HTML Hex Code Colors
  1044. def hex_color(string)
  1045.   red = 0
  1046.   green = 0
  1047.   blue = 0
  1048.   if string.size != 6
  1049.      print("Hex strings must be six characters long.")
  1050.      print("White text will be used.")
  1051.      return Color.new(255, 255, 255, 255)
  1052.   end
  1053.   for i in 1..6
  1054.      s = string.slice!(/./m)
  1055.      if s == "#"
  1056.         print("Hex color string may not contain the \"#\" character.")
  1057.         print("White text will be used.")
  1058.         return Color.new(255, 255, 255, 255)
  1059.      end
  1060.      value = hex_convert(s)
  1061.      if value == -1
  1062.         print("Error converting hex value.")
  1063.         print("White text will be used.")
  1064.         return Color.new(255, 255, 255, 255)
  1065.      end
  1066.      case i
  1067.      when 1
  1068.         red += value * 16
  1069.      when 2
  1070.         red += value
  1071.      when 3
  1072.         green += value * 16
  1073.      when 4
  1074.         green += value
  1075.      when 5
  1076.         blue += value * 16
  1077.      when 6
  1078.         blue += value
  1079.      end
  1080.   end
  1081.   return Color.new(red, green, blue, 255)
  1082. end
  1083.  
  1084. #--------------------------------------------------------------------------
  1085.  
  1086. def hex_convert(character)
  1087.   case character
  1088.     when "0"
  1089.        return 0
  1090.   when "1"
  1091.        return 1
  1092.   when "2"
  1093.        return 2
  1094.   when "3"
  1095.        return 3
  1096.   when "4"
  1097.        return 4
  1098.   when "5"
  1099.        return 5
  1100.   when "6"
  1101.        return 6
  1102.   when "7"
  1103.        return 7
  1104.   when "8"
  1105.        return 8
  1106.   when "9"
  1107.        return 9
  1108.   when "A"
  1109.        return 10
  1110.   when "B"
  1111.        return 11
  1112.   when "C"
  1113.        return 12
  1114.   when "D"
  1115.        return 13
  1116.   when "E"
  1117.        return 14
  1118.   when "F"
  1119.        return 15
  1120.     end
  1121.   return -1
  1122. end
  1123. end
  1124. #=========================================
  1125. # ? CLASS Window_Base Additional Code Ends
  1126. #=========================================
  1127.  
  1128.  
  1129. #=========================================
  1130. # ? Class Air_Text Begins
  1131. #=========================================
  1132. class Air_Text < Window_Base
  1133.  
  1134. def initialize(x, y, designate_text, color=0)
  1135.  
  1136. super(x-16, y-16, 32 + designate_text.size * 12, 56)
  1137. self.opacity         = 0
  1138. self.back_opacity = 0
  1139. self.contents = Bitmap.new(self.width - 32, self.height - 32)
  1140. w = self.contents.width
  1141. h = self.contents.height
  1142. self.contents.font.name = $ams.name_font_type
  1143. self.contents.font.size = $ams.name_font_size
  1144. self.contents.font.color = text_color(color)
  1145. self.contents.draw_text(0, 0, w, h, designate_text)
  1146. end
  1147.  
  1148. #--------------------------------------------------------------------------
  1149.  
  1150. def dispose
  1151. self.contents.clear
  1152. super
  1153. end
  1154. end
  1155. #==========================================
  1156. # ? CLASS Air_Text   Ends
  1157. #==========================================
  1158.  
  1159.  
  1160. #===================================================
  1161. # ? CLASS Scene_Save Additional Code Begins
  1162. #===================================================
  1163. class Scene_Save < Scene_File
  1164.  
  1165.  alias ams_original_write_save_data write_save_data
  1166.  
  1167.  def write_save_data(file)
  1168.     ams_original_write_save_data(file)
  1169.     Marshal.dump($ams, file)
  1170.  end
  1171.  
  1172. end
  1173. #===================================================
  1174. # ? CLASS Scene_Save Additional Code Ends
  1175. #===================================================
  1176.  
  1177.  
  1178. #===================================================
  1179. # ? CLASS Scene_Load Additional Code Begins
  1180. #===================================================
  1181. class Scene_Load < Scene_File
  1182.  
  1183.  alias ams_original_read_save_data read_save_data
  1184.  
  1185.  def read_save_data(file)
  1186.     ams_original_read_save_data(file)
  1187.     $ams         = Marshal.load(file)
  1188.  end
  1189.  
  1190. end
  1191.  
Expand to see the code.


Instructions

Place above the main. and away you go =]


Compatibility

at the moment there are no known compatibiltiy problems

FAQ

Q: How do i change the face picture so that it actually fits in the window?
A:Find this lineself.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
and edit this part Rect.new(0, 0, 96, 96) to say Rect.new(0, 0, 150,150) to make it bigger

Credits and Thanks

Credits and thanks go to Dubealex, for making this script all i've done is added some extra features.

Notes

If you would like me to added any more features..please just ask and i'll see what i can do =]
lol, I think you mean Dubealex, not Dublex. And I think this has been posted before.
lol..sorry..

yh.. it may have been posted before but.. i added some new features..
This script is fairly good but it's been dropped by the maker. So I would suggest using a different message script solely based on reliability but I will take a look at changes you have made.
i'll try this :)
.. the changes i made are pretty good, i think its one of the best ams' i've seen
Umm a few problums... First off you need to add some stuff to download also like for instance Black 3 for the message box and text it would be alot easyer to just put the original download link then under that tell them to replace his script with your's that way we can get all the graphics etc..But besides that it look's pretty good.
well Black3 is just the name of the Window skin.. So just change line 83 and 84

@message_box_skin = "Black3" < change to the name of your windowskin #Choose the WindowSkin for the Message Box
@name_box_skin = "Black3" #Choose the WindowSkin for the Name Box

.. .. hope that solves your problem 🙂
how do i adjust the face limit size so that i can fit in a larger face or change the position ion which it shows?


I changed the face indent:

Line 74: @x = @face_indent = 170

But the face still gets cut off as it is a size of 120 wide and 90 heigh.

Also If i wanted to change the position where the face shows, which line do i go to change the X & Y position.

Thanks
the position.. you just change x and y..

but the as for the indent..im not quitew sure... i'll have a play around and tell you ok . 🙂
OK so its just a matter of changing x and y? Sweet!!! Umm do you know which line there on by any chance? Thanks FF12_Master
hum... i'll have a look...ill get right back to you.

Edit:

you could try at line 159 adding.

@Face.x = ?
@Face.y = ?

(? = the number where you want the face to appear..)
please let me know if this works.. if not... ill see what i can do ok ?
Yeah it dosent work....Hmm. It just goes to an error (NoMethod Error Occured. Undefined method=x)
hum..give me a minute..i'll have a look through.
Just to show you what i mean to the exact: this is the pic.
http://img8.imageshack.us/img8/158/facek.png
notice how the face is cut off.
BTW thanks for the help anyway.... cause i cant script for *^%#@
can you upload it to imagehost.org please..since i cantuse imageshack in school lol ty..

also try using this.

@face_file.x =
@face_file.y =

add before line 166 .. might work.. not 100% sure.

Edit:

hey no problem.. thats why im here after all... im not a great scriupter..but im learning..and it seems to be paying off 🙂

Really important Edit:

I just read over the previous posts...
you want to see a face file you have there allready right..but its too big and gets cut off ?

well go to line 87 and change
@message_height = 160
to
@message_height = 200... (More or less) so that it changes the hieght of the message file to allow your bigger face file to be viewed....Might help ?

Oh and BTW.. the face indent changes how fare away the text is from the face file.. (just to let you know)
Image
I tryed your sugeestion and i come up with the same error again.
its not the height. its the width. and if i could move the picture from out of the text box all togther is kinda what im getting at. other wise i might just have to go with the good old... show picture at location x= y= .... erase pic 1 lol
try this

line 86:
@message_width = 440

to @message_width = 460
i found the line 806 YAYA allows you to change the size rectangle of the image
so it works now?

806? thats for the font name?
Image
Sure does.... Thanks FF12 MASTA!
Hey.. no problem..

..Oh just to point out..it's FF12_Master... :haha: :thumb:
Since AMS is based on older version of XRXS message system, it does not have some features like 'multiple message window'.(I know AMS also does not have bold and italic commands, but it's not hard to add) How about adding such feature, if possible?
..hum.. mutliple Message window..

i can see what i can do... i let you know.. im not if its possible...but...its worth a shot
I haveny really got very far with the multiple windows..but if there any other features you would like me to add please let me know..either by posting or Pming..or you can contact my by MSn (im allways on)

[email hidden]

and just to let you know i will be trying to take request on custom scripts..so if you have am idea in mind.. please let me know and i can try to do my best and make it. 😀
I have already heavily edited my AMS script to the point where I couldn't use yours if I wanted to.

I do thank you for the icon portion of the script since I was looking for something similar :)
No probs...

If there is anything you want me to add.. or anything i have missed..
then please tell me..

Also.. if you can tell me the name of your AMS... and what the problem is.. i can either add it to the not compatible list..or try and make it compatible.
Finally! A script that works for me. The abs script crashes for a lot of scripts, especially the AMS scripts. This works great. Well done.

Thanks.
No Problem.

Glad it works for you :thumb:
I'm really new to scripting. I've mastered all of facets of RMXP but was wondering if I could get some help with this AMS. I've got all the code saved on a text file but the problem is I don't know where to put it on the script editor in RMXP.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=62414