使用方法:调用\R[1]或\R[2]或\R[3]
module ReserveName def self.name(id) case id when 1; return "1-2-3" when 2; return "一x二x三" when 3; return "one_two_three" end return "" end end class Window_Base < Window alias convert_escape_characters_add convert_escape_characters def convert_escape_characters(text) result = convert_escape_characters_add(text) result.gsub!(/\eR\[(\d+)\]/i) { ReserveName.name($1.to_i) } result end end
module ReserveName
def self.name(id)
case id
when 1; return "1-2-3"
when 2; return "一x二x三"
when 3; return "one_two_three"
end
return ""
end
end
class Window_Base < Window
alias convert_escape_characters_add convert_escape_characters
def convert_escape_characters(text)
result = convert_escape_characters_add(text)
result.gsub!(/\eR\[(\d+)\]/i) { ReserveName.name($1.to_i) }
result
end
end
|