Tutorial ======== This tutorial introduces MSC 2.0, the scripting language for Minr. We'll cover the basics on scripting and provide the most important points to remember without overcomplicating things or going into too much detail. By the end, you'll know how to create dialogue scripts, use variables to track player progress, and build interactive prompts. For complete reference documentation, see the :ref:`appendix `. .. contents:: Tutorial Contents :local: What is MSC? ------------ MSC (Minr Script Code) is the scripting language developed for Minr. It lets mapmakers add interactivity to their maps: dialogues with NPCs, puzzles that track player progress, timed challenges, and more. A script is a sequence of lines that execute from top to bottom when triggered. Each line starts with an **operator** (like ``@player`` or ``@if``) that determines what that line does. Here's a simple script that greets the player: .. code-block:: msc @player Welcome to my map! @player Good luck! When triggered, this displays two messages in the player's chat. Script Types ------------ Scripts can be attached to blocks, entities, or regions. The **script type** determines how the script is triggered: - **interact**: Triggered when a player right-clicks the block. - **walk**: Triggered when a player enters the space above a block (either by walking onto the block or via jumping into the space). - **ground**: Triggered when a player stands on the block (not jumping). - **entity**: Triggered when a player right-clicks an entity (armor stand, mob, etc.). - **area**: Triggered when when a player enters a WorldGuard region. - **function**: Not triggered automatically: functions can be called explicitly from other scripts. See :ref:`functions ` for more details. Script Operators ---------------- Every line in a script starts with a single **operator** that determines what the line does. Here are the most common ones: **@player ** displays a message to the player in chat. .. code-block:: msc @player Hello and welcome to my map! **@bypass ** executes a command with elevated permissions. Use this for commands like ``/teleport`` or ``/setblock`` that players can't normally run. **@command ** tries to do the same, but only works for commands the player already has permission to use. .. code-block:: msc # This will teleport the player to coordinates (0, 100, 90) @bypass /teleport @s 0 100 90 # This will send the player to spawn. @command /spawn # A staff member running this line will give themselves 5 diamonds. But a regular player won't be able to, since they lack permission to use /give. @command /give @s minecraft:diamond 5 **@delay