07-22-2009, 04:25 AM
The description of this script is somewhat confusing.
This script provides a means of using shortcuts for commonly used lines in show messages.
In other words you get a \st[id] tag which will be substituted with another string in-game. This string can be evaluated dynamically given you more freedom than simple common phrases.
@PK8:
The substitution should happen before the original Special Characters conversion. (Assuming you want other tags in the substituted strings to be parsed)
Of course this script should be placed below any other script aliasing convert_special_characters. (Well, almost all. There might be some weird case)
Additionally I suggest using ' instead of " for the example customizations. The reason is that with ' you can just write \c[2] for a color change while with " you must write \\c[2]. Of course the need for escaping ' should be noted.
I am not finished with your script yet >:3
*hugs*
- Zeriab
This script provides a means of using shortcuts for commonly used lines in show messages.
In other words you get a \st[id] tag which will be substituted with another string in-game. This string can be evaluated dynamically given you more freedom than simple common phrases.
@PK8:
The substitution should happen before the original Special Characters conversion. (Assuming you want other tags in the substituted strings to be parsed)
Of course this script should be placed below any other script aliasing convert_special_characters. (Well, almost all. There might be some weird case)
Code:
#==============================================================================
# ** Window_Message
#------------------------------------------------------------------------------
# This message window is used to display text.
#==============================================================================
class Window_Message < Window_Selectable
alias pk8_game_strings_convert_special_characters :convert_special_characters
#--------------------------------------------------------------------------
# * Convert Special Characters
#--------------------------------------------------------------------------
def convert_special_characters
# This adds the \ST command in your messages.
@text.gsub!(/\\ST\[([0-9\-]+)\]/i) { $game_strings[$1.to_i] }
@text.gsub!(/\\ST\[\'([\w\W]+)\']/i) { $game_strings[$1.to_s] }
@text.gsub!(/\\ST\[\"([\w\W]+)\"]/i) { $game_strings[$1.to_s] }
@text.gsub!(/\\ST\[([\w\W]+)]/i) { $game_strings[$1.to_s] }
# Original conversion
pk8_game_strings_convert_special_characters
end
end
Additionally I suggest using ' instead of " for the example customizations. The reason is that with ' you can just write \c[2] for a color change while with " you must write \\c[2]. Of course the need for escaping ' should be noted.
I am not finished with your script yet >:3
*hugs*
- Zeriab