Write a documentation for script syntax of warband source module
- User
Write a documentation for script syntax of warband source module
- Assistant
Write a documentation for script syntax of warband source module
Welcome to the Mount & Blade: Warband Module System documentation. This guide provides a conceptual overview and syntax details for script creation within the Warband source module system.
The Mount & Blade: Warband Module System allows mod developers to create and modify game content using a proprietary scripting language. This guide is intended for modders who have a basic understanding of programming concepts.
A script in the Warband Module System is a collection of operations (commands) that are executed in sequence. Scripts are used to define the logic for quests, dialogues, battle outcomes, and much more.
Scripts are defined in the following manner:
("script_name",
[
# Operations go here
]
),
[ ] contain the operations that make up the script.Comments can be added to scripts using the # symbol. Anything following # on the same line is treated as a comment and ignored by the compiler.
# This is a comment
Operations are the building blocks of scripts. Each operation performs a specific action, such as assigning a value to a variable, displaying a message, or checking a condition.
(operation_name, operand1, operand2, ...)
(assign, ":variable_name", 100),
This operation assigns the value 100 to the variable ":variable_name".
Conditional operations are used to execute or skip certain operations based on conditions.
(try_begin),
(condition),
# Operations to execute if the condition is true
(try_end),
To specify an alternate set of operations to execute when the condition is false, use the following structure:
(try_begin),
(condition),
# Operations to execute if the condition is true
(else_try),
# Operations to execute if the condition is false
(try_end),
Loops allow you to execute a block of operations multiple times.
(try_for_range, ":iterator_variable", start_value, end_value),
# Operations to execute each iteration
(try_end),
This loop will iterate, assigning ":iterator_variable" values from start_value to end_value - 1.
Scripts can call other scripts using the call_script operation.
(call_script, "script_name", operand1, operand2, ...)
Variables store data that can be used and modified throughout scripts. Two main types of variables are used:
This document provides a basic overview of creating and modifying scripts within the Warband Module System. With this knowledge, you can begin to explore more complex scripting techniques and create custom content for Mount & Blade: Warband.
Remember, scripting is a powerful tool that allows for a wide range of game modifications; experimentation and practice are key to mastering the Warband Module System script syntax.