Basic Programming Tutorial

About this Tutorial

Works with: v1.0.7A

Made with: v1.0.3A

Needed Libraries: Console_v4 (Console_v3 won't work with v1.0.3+)

Written by: Mihail Mojsoski


Tutorial Start

Welcome to the Basic Programming Tutorial.

Here you will learn the basics of MXSPLI.

As of update v1.0.1 MXPLI is an segment oriented programming language, so that means that the code is separated by segments. Segments are pieces of code that are executed individually, and one segment can execute an other. Also MXSPLI currently has an interpreter, so raw files can be executed without compiling.

To create code in MXSPLI you will need to download the latest version of the interpreter, and to do that click here.

NOTE: In this tutorial we are going to use the v1.0.3 (updated) source, so if you get an error, tell us to update the tutorial, currently checked and working with the version specified.

Also we highly recommend using Notepad++ or any other code text editor, and we will release Syntax highlighting for Notepad++ in the future.

Basic Syntax

  • MXPLI executes the code line by line, so the ; is NOT used.
  • The main commands are CASE-SENSITIVE.
  • The variables are CASE-iNsEnSiTiVe.
  • The segments are also CASE-iNsEnSiTiVe.
  • Tabs and spaces are not required but they are highly recommended.

The functions are separated into Library Functions and Main Functions.

The Library Functions can be grouped in big groups called libraries, anyone that knows Batch-file could make a library, for the Library Creation tutorial click on the link, and they can only be used in the code function.

The Main Functions are separated into Functions and Command, the Commands can only be used inside the functions, also some smaller functions can only be used in bigger functions, for example: var function can only be used in code function.

Every big main function has a syntax rule, and it is:


The smaller functions and commands also have a syntax rule and it is the one-line rule.

Big Functions

The big functions currently (as of last updated, see in the begging of the tutorial):

AT is used to import Library Functions, and CODE is used to execute smaller functions (can be main or library).



use LIBRARY_FUNCTION as Function


The use/as command can only be used in the at function.



execute SEGMENT


The execute command can only be used in the code function.

It can be used to execute or loop segments or execute other files.

Usage for executing segments:

execute SEGMENT

Usage for executing a file:

execute file FILENAME

The file name is without extension, and it will execute the file with %ext% extension, .mcode by default.

Small Functions

The small functions currently (as of last updated, see in the begging of the tutorial):

VAR is used to declare (define) variables, or use the declared ones, and LIBRARY_FUNCTION is a small function imported from a library. If is used to compare variables.


Using the if  function you can compare two variables and go to the specified segment if if the statement is true or false depending on the function setup.


if $variable CompareOperator $variable SEGMENT else SEGMENT


The CompareOperator type is limited to only the if function and it can be a char array with length of 3 characters.

The valid CompareOperator can be one of the following:

  • EQU - equal,
  • NEQ - not equal,
  • LSS - less than,
  • LEQ - less than or equal,
  • GTR - greater than,
  • GEQ - greater than or equal.


Using the var (actually used as a prefix: $) function you can define a code segment.


$variable is "STRING"


If you want to use the variable you have defined you will need to use the %$var% function.

It sends the variable to the function or command without any

modification to the code.

You can also put %$var% inside of a string, for example:

$var1 is "Hello"
$var2 is "World"
$var3 is "%$var1% %$var2%"
Out "%$var3%"

If you run that code using our usual includes with Console, we will get output:

Hello World

Also you can do simple mathematical operations with variables (only as Int).

Library Function

The syntax about the library function depends on the library, and in this tutorial we are going to use only the Console library.

Console Library

Currently Released Functions

  • CONSOLE_OUT String (Output STRING text to the console)
  • CONSOLE_PAUSE String/NUL (Pause the console)
  • CONSOLE_COLOR C_TYPE_COLOR C_TYPE_COLOR (Change the text and background color)
  • CONSOLE_IN C_VARIABLE_NAME (Load text to variable from keyboard)
  • CONSOLE_TITLE String (Change the title of the console)
  • CONSOLE_SIZE Int Int (Parameter one is Width, Parameter two is Height)
  • CONSOLE_CLEAR NUL (Clear the text of the console)
  • CONSOLE_TIEMOUT Int (Sleep for Int seconds)

Currently Released Types

  • C_TYPE_COLOR (Based on Hex, the names are String)
  • C_VARIABLE_NAME (Based on string, starts with $)

Did you read that all, lets start programming!

First you will need to create a two files called Hello.mcode and Libs.mcode and open them in Notepad++.

In the file Hello.mcode we are going to type the main code, and in the file Start.mcode we are going to import the libraries and set the settings, we are doing this so the files won't get messy.

Now you need to open Start.mcode type the following code:

at Console
use CONSOLE_OUT as Out
use CONSOLE_IN as In
use CONSOLE_TITLE as Title
use CONSOLE_CLEAR as Clear
use CONSOLE_SIZE as Size
use CONSOLE_PAUSE as Pause
code Header
Size 100 20
Title "Our First Program"
execute file Hello

If you read the tutorial carefully you would know what this file would do, but i am going to explain it line by line anyway.

at Console

Load the Console Library.

 use CONSOLE_x as y

Use the function x of the library Console as usable function y.

code Header

Set the code section called "Header".

 Size 100 20
Title "Our First Program"

Some library functions we made usable earlier.

 execute file Hello

Execute the file "Hello.mcode".

Ok, now we made the start code and we imported all the needed (and not needed) library functions, now we need to make the program functional. To do that we need to open the file "Hello.mcode" and type this code:

code Main
$User is User
In $User "What is your name?"
Out "Hello, %$User% and welcome to my first program!"

I will also explain this code.

code Main

The segment called "Main".


Clear the console screen, (useful for console).

 $User is User

Define the variable $User with value "User".

 In $User "What is your name?"

Load text from console and display the message: What is your name?

 Out "Hello, %$User% and welcome to my first program!"

Output the text to the console: Hello, (name specified by user) and welcome to my first program!


Pause the screen.

So we got our code, what now?

Execute it, by using the "prog.bat" file.

There are two ways of doing that, by using command prompt or by drag+drop/association.

If you want to use command prompt, type the following command:

call prog.bat "DRIVE:\LOCATION\Start.mcode"

And if you want to drag and drop, you already know how to do that.

Final Result

Tested on Windows 10 64-bit with MXSPLI v1.0.3A

Last edited May 1, 2016 at 5:33 PM by MixSoft, version 12