BBScript Introduction - super-continent/bbscript GitHub Wiki

In BBScript there are a few notable concepts which are used in almost every part of the scripts. Knowing about these is essential to learning BBScript quickly and being able to correctly structure the new script code that you want to add.

States

The most common function you will see blocks of code contained within is the state, code run inside of a state is (if known and properly labeled) enclosed by a beginState and an endState function.

Subroutines

Another common place to enclose code is within a subroutine. Subroutines are sometimes important to the engine and will be invoked without the script necessarily executing them explicitly. However a majority of the time you will see subroutines explicitly called during a state. You can think of a subroutine call as having all the code contained within that subroutine copy-pasted in place of the call, this means there is no change in any kind of scope like with state transitions. Code in subroutines is (again, if known and properly labeled) enclosed with the functions startSubroutine and endSubroutine