ArticleslgStudy

mathematics

MexScript

MexScript is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand MexScript rather than just read about it. In short: MexScript is a multi-paradigm computer scripting language used in a number of game resource archive file handlers. It was originally created for the 16-bit command-line tool multiex, and later 32-bit versions of MultiEx Commander.

Key takeaways

  • MexScript belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect MexScript to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of MexScript from memory before moving on to harder problems.

Reference excerpt

MexScript is a multi-paradigm computer scripting language used in a number of game resource archive file handlers. It was originally created for the 16-bit command-line tool multiex, and later 32-bit versions of MultiEx Commander. It is a script that enables the end user to have the interpreting program perform a number of tasks needed to access file contents, as well as to replace file contents. The MexScript has since become one of the standards to process game archives, as is indicated by the implementation of the script (also referred to as multiex, MexCom3, BMS) in similar programs, such as Dragon UNpack, Game Extractor, FusePAK, and the more recent dialect QuickBMS.

History MexScript was created in 1997 for multiex by Mike Zuurman and fed to the tool using .INI files. The script was improved upon in later releases of MultiEx Commander. The name stems from the abbreviation of multiex to 'mex', though it is also referred to as Binary MultiEx Script (BMS) which in essence is a compiled version of MexScript. MexScript is interpreted by a Dynamic-link library called "multiex.dll" for the Windows version of MultiEx Commander, and a public version was released on the 24th of July 2003.

Implementations Besides MultiEx Commander, the MexScript has been implemented in a number of other applications. The multiex Dynamic-link library was used after initial release in a similar game archive file handler called Dragon UNpack. The scripting language itself has been implemented in the linux tool Fusepak and the Java application Game Extractor. A script exists to convert MexScript into Python for OpenMEX. There is also a dialect of MexScript/BMS called QuickBMS, that first appeared on the Xentax Foundation's Game Research Forum on April 16, 2009.

Design MexScript is a domain specific, structured functional scripting language designed for the end-user. The primary domain is the processes required to handle game resource archive formats (GRAF). GRAF is a term first coined in November 2003. The purpose of writing in the MexScript scripting language is to manipulate the contents of GRAs in order to MOD a computer game.

Script Extensive descriptions of MexScript are found on the web sites of various implementations, most notably MultiEx Commander and QuickBMS. The last release of the 16-bit implementation in 1998 of MultiEx Commander featured statements and commands as follows: ID, EVENTS, NOFILENAMES, GetLong, FlipLong, GetInt, GetString, WriteLong, GetDString, GetNullString, StrCReplace, StrEReplace, LOOP, ENDLOOP, SavePos, GoTo, SET, SETFILECNT, ADD, SUBST, SETBYTESREAD, MULTIPLY, UP, DOWN, PROMPTUSER, ExtractFILE, SETPATH, FindFileID, Case, SeparateHeader. Later dialects as implemented by MultiEx Commander or QuickBMS offer more functionality.

Data Depending on the dialect or original implementation, the data types can differ substantially. MexScript for MultiEx Commander has the following:

Long --> 32-bit value (4 bytes, Little endian) Int --> 16-bit value (2 bytes, Little endian) Byte --> 8-bit value (1 byte) ThreeByte --> 24-bit value (three bytes, Little endian) String --> null-terminated string of characters (a string ending with a 0 byte)

Scoping Variables do not have to be declared before use; their scope is then global, except when a variable that has not been used before is involved in some kind of calculation. In such a case it is declared using a SET <variable> statement. All variables can be changed at run-time, allowing for self-modifying code.

Output The scripting language typically outputs a list of files contained in a game resource archive, along with the offsets and sizes, along with information on their name and putative compression. This is done in 32-bit MultiEx Commander and other implementations using the Log statement, or CLog statement.

Control structure commands MexScript provides several common control structures.

ifelse test [ do_if_true list ] [do_if_false list] do-while condition [instruction list] for-next loops Recursion is MexScript's preferred processing paradigm.

I/O Output of the original multiex.exe was either extraction or importation of files contained in archives. The 32-bit implementation would output a list of files contained in the processed archive, along with information on their position, size, name and compression type. This list would then be fed to MultiEx Commander, or similar tools.

Syntax In the original 16-bit version, commands were to be written on one line, but later versions allowed more. Anything in a line following the hash symbol # is ignored, allowing the coder to insert comments. The QuickBMS dialect also supports C-style (/* ... */) and C++-style (//) comments. Each line ends with a semicolon ;, though it is not obligatory in many dialects.

References

External links MultiEx Commander - the official website Tutorial - Tutorial on using MexScript and QuickBMS in MultiEx Commander

Worked examples

Example 1 — a first encounter with MexScript

Start with the simplest possible case. Write down what MexScript claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to MexScript before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about MexScript ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of MexScript

In research
MexScript appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses MexScript in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
MexScript is common in secondary-school and first-year university syllabi. It links to neighbouring topics Dynamically typed programming languages, Functional languages, so understanding it makes those chapters shorter.
In everyday life
Look for MexScript outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “MexScript” →

How to study MexScript in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what MexScript means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain MexScript out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is MexScript in simple terms?

MexScript is a multi-paradigm computer scripting language used in a number of game resource archive file handlers. It was originally created for the 16-bit command-line tool multiex, and later 32-bit versions of MultiEx Commander.

Why does MexScript matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study MexScript?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on MexScript.

Tags

  • Dynamically typed programming languages
  • Functional languages

Keep exploring