BSL:BFW Scripting Language

From OniGalore
Revision as of 04:44, 3 December 2015 by Iritscen (talk | contribs) (rewrite; made page more concise; reorganized knowledge database; moved useful code snippets to BSL:Snippets)
Jump to navigation Jump to search

BFW Scripting Language (simply called BSL) is what Oni scripts are written in. Being a scripting language, it is far more limited in scope and usage than a "real" programming language, as it was designed only to move events forward in the game, not to build programs. More specifically, BSL scripts are responsible for managing the player's objectives, creating environmental effects, and driving cutscenes.

Physically speaking, they are the .bsl files inside the Oni/GameDataFolder/IGMD/ folder. Being in plain-text, scripts can be edited with any word-processing program, such as the built-in WordPad (Windows) or TextEdit (Mac); the only requirement is that you must use the suffix ".bsl" for scripts instead of ".txt" (in Windows, you may have to turn on the displaying of file extensions to see the suffix).

Getting started

- To learn BSL by example, you can read the .bsl files in Oni's IGMD folder and draw connections to the events in the game that were produced by those scripts.
- For a primer in writing BSL, see the Tutorials section below.
- For a thorough listing of what's possible in BSL (a reference, not a primer), see the knowledge database below.

Scripted mods

Scripted mods are great examples of what can be achieved simply by editing text files. They replace or add to Oni's .bsl files to create interesting and often amusing results. However, they can only change the way that game data is used; adding new characters or changing the layout of a level, for instance, would require editing the actual game data. When a new level is created for Oni, these also require new scripts to be written from scratch to take advantage of the new game assets.

One ambitious example of a scripted mods is Oni Team Arena. Based on the desire for a multiplayer mode in Oni, and inspired by Unreal Tournament, OTA augments Oni's hand-to-hand combat and gunplay with a scoring system much like Unreal Tournament's Deathmatch mode. Other scripted mods range from free-for-all arenas to objective-based missions and enhancements of the original levels. They can spice up the gameplay and provide a more exciting experience to those who have finished the game. They keep the game alive, outside of its original levels. Scripted mods can be found here, here and here.

Knowledge database

Syntax overview

BSL syntax overview table
BSL separators
; , # "
{ } ( )

Click on a separator for details

BSL operators
+ - = !
and or eq ne
< > <= >=

Click on an operator for details

BSL keywords
at float if repeat string
bool for int return using
else fork iterate schedule var
every func over sleep void

Click on a keyword for details