Advertisement
Black_Mage

Skip Message Feature RMXP Script AMS Integration

Jul 4th, 2015
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.49 KB | None | 0 0
  1. # This is an integration of Skip Message Script by Black Mage into Dubealex AMS R4.
  2. # The script need Dubealex AMS R4 to work properly.
  3. # If you're not using Dubealex AMS, then use the original script, found in the link below :
  4. # https://burningwizard.wordpress.com/2015/04/23/skip-message-feature-script-rmxp-rgss/
  5.  
  6. class Window_Message < Window_Selectable
  7.   def update
  8.     super
  9.     if @fade_in
  10.       self.contents_opacity += 24
  11.       if @input_number_window != nil
  12.         @input_number_window.contents_opacity += 24
  13.       end
  14.       if self.contents_opacity == 255
  15.         @fade_in = false
  16.       end
  17.       return
  18.     end      
  19.    
  20.     @now_text = nil if @now_text == ""
  21.  
  22.     if @now_text != nil and @mid_stop == false
  23.       if @write_wait > 0
  24.         @write_wait -= 1
  25.         return
  26.       end
  27.       text_not_skip = LETTER_BY_LETTER_MODE
  28.       while true
  29.         @max_x = @x if @max_x < @x
  30.         @max_y = @y if @max_y < @y
  31.         if (c = @now_text.slice!(/./m)) != nil
  32.           if c == "\000"
  33.             c = "\\"
  34.           end
  35.      
  36.           if c == "\001"
  37.             @now_text.sub!(/\[([0123456789ABCDEF#]+)\]/, "")
  38.             temp_color = $1
  39.             color = temp_color.to_i
  40.             leading_x = temp_color.to_s.slice!(/./m)
  41.             if leading_x == "#"
  42.               self.contents.font.color = hex_color(temp_color)
  43.               next
  44.             end
  45.             if color >= 0 and color <= 7
  46.               self.contents.font.color = text_color(color)
  47.             end
  48.             next
  49.           end
  50.  
  51.           if c == "\002"
  52.             if @gold_window == nil and @popchar <= 0
  53.               @gold_window = Window_Gold.new
  54.               @gold_window.x = 560 - @gold_window.width
  55.               if $game_temp.in_battle
  56.                 @gold_window.y = 192
  57.               else
  58.                 @gold_window.y = self.y >= 128 ? 32 : 384
  59.               end
  60.               @gold_window.opacity = self.opacity
  61.               @gold_window.back_opacity = self.back_opacity
  62.             end
  63.             c = ""
  64.           end
  65.  
  66.           if c == "\003"
  67.             @now_text.sub!(/\[([0-9]+)\]/, "")
  68.             speed = $1.to_i
  69.             if speed >= 0 and speed <= 19
  70.               @write_speed = speed
  71.             end
  72.             c = ""
  73.           end
  74.  
  75.           if c == "\004"
  76.             @now_text.sub!(/\[(.*?)\]/, "")
  77.             buftxt = $1.dup.to_s
  78.             if buftxt.match(/\//) == nil and buftxt != "" then
  79.               $soundname_on_speak = "Audio/SE/" + buftxt
  80.             else
  81.               $soundname_on_speak = buftxt.dup
  82.             end
  83.             c = ""
  84.           elsif c == "\004"
  85.             c = ""
  86.           end
  87.      
  88.           if c == "\005"
  89.             @write_wait += 5
  90.             c = ""
  91.           end
  92.      
  93.           if c == "\006"
  94.             @write_wait += 20
  95.             c = ""
  96.           end
  97.      
  98.           if c == "\016"
  99.             text_not_skip = false
  100.             c = ""
  101.           end
  102.      
  103.           if c == "\017"
  104.             text_not_skip = true
  105.             c = ""
  106.           end
  107.      
  108.           if c == "\020"
  109.             @mid_stop = true
  110.             c = ""
  111.           end
  112.      
  113.           if c == "\021"
  114.             terminate_message
  115.             return
  116.           end
  117.      
  118.           if c == "\023"
  119.             @indent = @x
  120.             c = ""
  121.           end
  122.  
  123.           if c == "\024"
  124.             @now_text.sub!(/\[([0-9]+)\]/, "")
  125.             @opacity = $1.to_i
  126.             color = self.contents.font.color
  127.             self.contents.font.name = $ams.font_type
  128.             self.contents.font.size = $ams.font_size
  129.             self.contents.font.color = Color.new(color.red, color.green, color.blue, color.alpha * @opacity / 255)
  130.             c = ""
  131.           end
  132.  
  133.           if c == "\025"
  134.             @now_text.sub!(/\[([0-9]+)\]/, "")
  135.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  136.             c = ""
  137.           end
  138.  
  139.           if c == "\026"
  140.             @now_text.sub!(/\[([0-9]+)\]/, "")
  141.             @x += $1.to_i
  142.             c = ""
  143.           end
  144.      
  145.           if c == "\027"
  146.             @now_text.sub!(/\[(.*?)\]/, "")
  147.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  148.             if $soundname_on_speak != ""
  149.               Audio.se_play($soundname_on_speak)
  150.             end
  151.             c = ""
  152.           end
  153.  
  154.           if c == "\030"
  155.             @now_text.sub!(/\[(.*?)\]/, "")
  156.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  157.             if $soundname_on_speak != ""
  158.               Audio.se_play($soundname_on_speak)
  159.             end
  160.             @x += 24
  161.             c = ""
  162.           end
  163.  
  164.           if c == "\n"
  165.             @lines += 1
  166.             @y += 1
  167.             @x = 0 + @indent + @face_indent
  168.             if @lines >= $game_temp.choice_start
  169.               @x = 8 + @indent + @face_indent
  170.               @cursor_width = @max_choice_x
  171.             end
  172.             c = ""
  173.           end
  174.      
  175.           if c == "\022"
  176.             @now_text.sub!(/\[([0-9]+)\]/, "")
  177.             @x += gaiji_draw(4 + @x, @y * line_height + (line_height - self.contents.font.size), $1.to_i)
  178.             c = ""
  179.           end
  180.      
  181.           #NEW
  182.           #Dubealex's Text Skip On/OFF Command
  183.           if c == "\100"
  184.             if @alex_skip==false
  185.               @alex_skip=true
  186.             else
  187.               @alex_skip=false
  188.             end
  189.             c = ""
  190.           end  
  191.           #end of new command
  192.                                    
  193.           if c != ""
  194.             self.contents.draw_text(0+@x, 32 * @y, 40, 32, c)
  195.             @x += self.contents.text_size(c).width
  196.             if $soundname_on_speak != "" then
  197.               Audio.se_play($soundname_on_speak)
  198.             end
  199.           end
  200.      
  201.           #SKIP_TEXT_CODE
  202.  
  203.           # B = Escape, 0 (On The NumPad), X
  204.           # C = Enter, Space Bar and C
  205.           # A = Shift, Z
  206.  
  207.           if Input.press?(Input::CTRL) # <-- Change the value on that line
  208.             text_not_skip = false
  209.           end
  210.          
  211.           if Input.press?(Input::C) # <-- Change the value on that line
  212.             if @alex_skip==false      
  213.               text_not_skip = false
  214.             end
  215.           end
  216.      
  217.         else
  218.           text_not_skip = true
  219.           break
  220.         end
  221.    
  222.         if text_not_skip
  223.           break
  224.         end
  225.       end
  226.       @write_wait += @write_speed
  227.       return
  228.     end
  229.  
  230.     if @input_number_window != nil
  231.       @input_number_window.update
  232.       if Input.trigger?(Input::C)
  233.         $game_system.se_play($data_system.decision_se)
  234.         $game_variables[$game_temp.num_input_variable_id] =
  235.         @input_number_window.number
  236.         $game_map.need_refresh = true
  237.         @input_number_window.dispose
  238.         @input_number_window = nil
  239.         terminate_message
  240.       end
  241.       return
  242.     end
  243.  
  244.     if @contents_showing
  245.       if $game_temp.choice_max == 0
  246.         self.pause = true
  247.       end
  248.       # Skip feature added by Fatra
  249.       if Input.press?(Input::CTRL)
  250.         if $game_temp.choice_max > 0
  251.         else
  252.           terminate_message
  253.         end
  254.       end  
  255.       if Input.trigger?(Input::B)
  256.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  257.           $game_system.se_play($data_system.cancel_se)
  258.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  259.           terminate_message
  260.         end
  261.       end
  262.  
  263.       if Input.trigger?(Input::C)
  264.         if $game_temp.choice_max > 0
  265.           $game_system.se_play($data_system.decision_se)
  266.           $game_temp.choice_proc.call(self.index)
  267.         end
  268.         if @mid_stop
  269.           @mid_stop = false
  270.           return
  271.         else
  272.           terminate_message
  273.         end
  274.       end
  275.       return
  276.     end
  277.  
  278.     if @fade_out == false and $game_temp.message_text != nil
  279.       @contents_showing = true
  280.       $game_temp.message_window_showing = true
  281.       refresh
  282.       Graphics.frame_reset
  283.       self.visible = true
  284.       self.contents_opacity = 0
  285.       if @input_number_window != nil
  286.         @input_number_window.contents_opacity = 0
  287.       end
  288.       @fade_in = true
  289.       return
  290.     end
  291.  
  292.     if self.visible
  293.       @fade_out = true
  294.       self.opacity -= 48
  295.       if self.opacity == 0
  296.         self.visible = false
  297.         @fade_out = false
  298.         $game_temp.message_window_showing = false
  299.       end
  300.       return
  301.     end
  302.   end
  303. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement