Quick string

From Mount&Blade Modding Wiki
Revision as of 09:53, 24 June 2011 by JT (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A quick string is a string that isn't defined in advance in module_strings.py. It can be used anywhere that a string ID would normally be used — normally a string register.

Contents

[edit] Construction

A quick string is written exactly like a string literal would be, but it is prefaced with the strudel "@" symbol. For instance, the following expression:

(str_store_string, s0, "comment_you_defeated_my_friend_enemy_pragmatic")

could also be written in the code as:

(str_store_string, s0, "@You may have bested {s54}, but you cannot defeat us all.")

[edit] Caveat

[edit] Repeated strings

Good practice is to put any text you will use repeatedly into module_strings.py and avoid using quick strings. That way, if you find you have a typo or you need to refactor the text, you can simply perform one edit and all copies of the text will be updated accordingly.

[edit] Strings vs. quick strings

It is much easier to edit and localise mod text in module_strings than it is to locate and edit mod text inside module_scripts and module_dialogs, but at the same time it is easier to maintain a collaborative mod project without having to ensure that new strings are not accidentally omitted from module_strings when a new version is released.

If you are making a submod, it is probably better to maintain your text as quick strings directly in the dialogue or script. If you are making a full mod, it is better to make a genuine string in module_strings and reference that from the dialogue or script instead.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox