Advertisement
roninator2

Modern Algeebra's ATS - Message Box Face image Adjust

Nov 3rd, 2020 (edited)
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.75 KB | Source Code | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: Face Align                   ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║                                     ╠════════════════════╣
  7. # ║ Adjust Face position for text       ║    01 Nov 2020     ║
  8. # ╚═════════════════════════════════════╩════════════════════╝
  9. # ╔══════════════════════════════════════════════════════════╗
  10. # ║ During a conversation you have the text centered         ║
  11. # ║ * Modern Algeebra's ATS script                           ║
  12. # ║ The face image will be on the left side                  ║
  13. # ║ This will determine the size of the text written         ║
  14. # ║ and move the face graphic towards the text               ║
  15. # ╚══════════════════════════════════════════════════════════╝
  16. # ╔═════════════════════════════════════╗
  17. # ║ Terms of use:                       ║
  18. # ║ Free for all uses in RPG Maker      ║
  19. # ╚═════════════════════════════════════╝
  20.  
  21. class Window_Message < Window_Base
  22.   def new_page(text, pos)
  23.     contents.clear
  24.     face_x = 0
  25.     face_pos = 0
  26.     for i in 0..$game_message.texts.size
  27.       arrvalue = $game_message.texts[i]
  28.       next if arrvalue.nil?
  29.       result = arrvalue.to_s.clone
  30.       result.gsub!(/\i\i\[\d+\]/)          { "" }
  31.       parsetxt = convert_escape_characters(result)
  32.       arrlgth = parsetxt.length * 10
  33.       if arrlgth > face_pos
  34.         face_pos = arrlgth
  35.       end
  36.     end
  37.     face_pos = (Graphics.width - face_pos) / 2 - 20
  38.     if face_pos <= 0; face_pos = 0; end
  39.     draw_face($game_message.face_name, $game_message.face_index, face_pos, 0)
  40.     reset_font_settings
  41.     pos[:x] = new_line_x
  42.     pos[:y] = 0
  43.     pos[:new_x] = new_line_x
  44.     pos[:height] = calc_line_height(text)
  45.     clear_flags
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement