Tuple

From Mount&Blade Modding Wiki
Revision as of 02:06, 26 June 2012 by JT (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A tuple is a construct consisting of multiple variables grouped into a single variable. They are used for script tuples and for object tuples. Tuples are used to define every object in the Mount & Blade module system; the entire list of objects contained in a single module file is an array of object tuples, and most blocks of code are also arrays of script tuples.

The syntax of a Python tuple is a parenthesis, followed by any arbitrary number of comma-separated values, followed by a closing parenthesis.

(store_party_size,":party_size","$g_talk_troop_party")

This example tuple is a single construct in the Python language, very simply three variables attached to each other: the operation store_party_size (an integer), the local variable ":party_size" (a string), and the global variable "$g_talk_troop_party" (also a string). In the Mount & Blade engine, this tuple is interpreted by the opcode parser and will save the size of the conversation partner's party into the local variable for use in scripting. By the compiler, this is interpreted very simply as a number and two strings, and is exported in raw format by the module system to a text file containing this information.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox