Skip to content

BBScript: BBScript 2

Alteras1 edited this page Jun 11, 2024 · 2 revisions

BBScript 2

BBScript 2 is a more powerful version of BBScript with major changes to the syntax that it is not compatible. Variables between the two versions are shared, but syntax are separate and the usage of BBScript 2 requires a version declaration in the bbcode.

Usage

To use BBScript 2, make sure you follow the standard syntax. The site will attempt to determine which version the script is based on the syntax. Or you can explicitly declare the version number version=2 in the script tag options.

[script class=className on=event version=2]
(print "hello world")
[script]

Syntax

Similar to BBScript 1, BBScript 2 follows an operator first syntax, more often called Polish Notation. This means the operator/function name comes first before the arguments. BBScript 2 requires that all commands be wrapped in parentheses ().

For example, adding together the numbers 1, 2, and 3 would be:

(+ 1 2 3)

Unlike BBScript 1, BBScript 2 does not require each command to be on a new line, and does not require exact whitespaces. As such, users are able to organize their scripts however they wish.

(print "hello world")
(setTimeout 5 (group
        (print "another print")
        (print "yet another!")
    ))

Functions

BBScript 2 has a much more expanded set of operations and functions available as compared to BBScript 1. They are broadly categorized as: