Scripting
The Scripting section will introduce the script system of BME4.
Reading suggestions:
- BME4 uses MiniScript as its scripting language. This tutorial doesn't include a MiniScript language tutorial, please go to the MiniScript official site to learn it yourself
- After learning everything in this section, you will be able to write scripts and create maps with unique mechanics
MiniScript Simple Guide
- MiniScript official site: https://miniscript.org/
- Read official manual and quick start first
- There's an official playground
- MiniScript is a weak and dynamic typing language (similar to PHP)
- Variables will be converted to another type automatically and implicitly whenever possible, without raising exceptions
- MiniScript has these variable types:
numberstringlistmap - MiniScript doesn't have
inttype (similar to JavaScript)- All
numbers aredoubles - No exception of division by zero, and there's
INFandnan - Take care of floating point comparisons
- All
- MiniScript doesn't have
booltype (similar to C)trueis1,falseis0- In
ifstatements,0""[]{}nullare regarded as false, others as true
- MiniScript passes everything by reference whenever possible (similar to Python)
- When copying a
list, remember to use syntax likeb = a[:] - No deep copy function, so avoid using complicated data structures
- When copying a