BSL:BFW Scripting Language: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (OSL:Oni Scripting Language moved to BSL: about time)
(wording; removed deleted Modification page and moved IGMD/global to knowledge database as it isn't really a useful tutorial, just documentation of a niche feature)
 
(57 intermediate revisions by 8 users not shown)
Line 1: Line 1:
== Oni Scripting Language (or OSL) ==
'''BungieFrameWork Scripting Language''' (simply called '''BSL''') is what Oni's level scripts are written in. Being a game scripting language, BSL is far more limited in scope and usage than a full programming language, as it was designed only to move events forward in the game, not to build complete programs. Specifically, BSL scripts are responsible for managing the player's objectives, directing AIs, creating environmental effects and choreographing cutscenes.
is what [[OSL:Scripts|Oni scripts]] are written in. It's a programming language akin to C with some shell-script features as well.
===Knowledge database===
For the theoretical minds, everything you'll ever need to know about OSL
*[[OSL:Statements|Statements]]
*[[OSL:Variables|Variables]]
*[[OSL:Functions|Functions]]
*[[OSL:Operators|Operators]]
*[[OSL:Data|Data types]]
More on modding basics
*[[OSL:IGMD|IGMD folder]]
*[[OSL:IGMD/global|global folder]]
And some random (so far) useful pages
*[[OSL:Inventory|Inventory management]]


===[[OSL:Tutorial|Tutorials]]===
Physically speaking, they are the .bsl files inside the [[IGMD|Oni/GameDataFolder/IGMD/]] folder. Being in plain-text format, scripts can be edited with any word-processing program, such as the built-in Notepad (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).
For the practical minds who don't care (too much) about the theory.
__NOTOC__
*Wanna make minor (yet cool-looking) changes to the original level logic?
==Getting started==
*Wanna script a "patch" that's effective in every level but doesn't affect the original logic?
*You may wish to first read either the Introduction or the Manual page under "Knowledge database" below. The Introduction is a quick reference, whereas the Manual includes an introductory lesson on programming concepts. It also documents known bugs in BSL and fixes/workarounds when available.
*Wanna create completely new level logic from scratch? [[OSL:Tutorial/Scratch|Here you are]]
*To learn BSL by example, you can read the .bsl files in the IGMD folder or look at some of the mods linked below and draw connections between the scripting commands and the resulting events in the game.
*For a primer in writing BSL, see the "Tutorials" section below.


==Overview==
==Script mods==
{| border="1" cellpadding="5" cellspacing="0" align="center"
Script mods are great examples of what can be achieved simply by editing text files. They replace or add to Oni's .bsl files to spice up the gameplay and provide a more exciting experience to those who have finished the game. 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 [[OBD|game data]]. When new levels are created, these naturally require new scripts to be written from scratch to work with the assets and drive events in them.
|+'''OSL syntax overview table'''
 
|-
One ambitious example of a script mod is [[AE:OTA|Oni Team Arena]]. Based on the desire for a [[multiplayer]] mode in Oni and inspired by Unreal Tournament, OTA creates a single-player "multiplayer experience" by adding bots and a scoring system. Other script mods range from free-for-all arenas to objective-based missions and enhancements of the original levels.
| align="center" style="border-bottom:3px solid grey;"|
 
{| border="0"
Script mods packaged for use with the [[Anniversary Edition]] are [http://mods.oni2.net/mods/Script listed here], and totally new levels with their own BSL files can be [http://mods.oni2.net/mods/New%20Level found here] (these mods are meant to be installed through the AE Installer). Older scripts, which need to be placed manually in IGMD, can be found [http://your-mom.oni2.net/Downloads.htm here] and [[User:Script_10k#Incomplete_.2F_ancient_scripts|here]].
|+''OSL separators''
 
|-
==Tutorials==
| align="center" width="100px" | [[OSL:statements|<tt>;</tt>]]
;[[BSL:Tutorial/Console|Playing with the developer console]]
| align="center" width="100px" | [[OSL:functions|<tt>,</tt>]]
:The fastest way to start learning BSL is to load the first level and open the dev console.
| align="center" width="100px" | [[OSL:comments|<tt>#</tt>]]
 
| align="center" width="100px" | [[OSL:data|<tt>"</tt>]]
;[[BSL:Tutorial/Scratch|New logic from scratch]]
|-
:Create completely new level logic from scratch.
| align="center" width="100px" | [[OSL:statements|<tt>{</tt>]]
 
| align="center" width="100px" | [[OSL:statements|<tt>}</tt>]]
==Knowledge database==
| align="center" width="100px" | [[OSL:functions|<tt>(</tt>]]
*[[BSL:Introduction|Introduction]]: A quick language reference, ideal for those with programming experience.
| align="center" width="100px" | [[OSL:functions|<tt>)</tt>]]
*[[BSL:Manual|Manual]]: The complete language reference on BSL, with more explanations for newbies and details for power users.
|-
*[[BSL:Functions]] & [[BSL:Variables]]: All built-in functions and variables.
| align="center" colspan="4" style="border-top:1px solid red; border-right:1px solid red; border-bottom:2px solid red; border-left:1px solid red;" |
*[[BSL:Defunct]]: Apparently-obsolete commands.
Click on a separator for details
*In-game IDs of [http://ssg.oni2.net/subfold/charas/charas.htm characters], [http://ssg.oni2.net/subfold/consoles/consoles.htm consoles] and [http://ssg.oni2.net/subfold/doors/doors.htm doors] (for use in scripts).
|}
*[[IGMD|IGMD/]]: The directory structure of the game scripts.
|-
*[[BSL:Snippets]]: Useful snippets of code.
| align="center" style="border-bottom:3px solid grey;"|
*[[IGMD/global|IGMD/global/]]: A global scripting folder which can be used for patching.
{| border="0"
*[[:Category:Scripting tasks]]: Scripting commands grouped by subject (work in progress).
|+''OSL operators''
*[[BSL:List]]: List of all scripting commands (work in progress).
|-
 
| align="center" width="100px" | [[OSL:operators|<tt>+</tt>]]
[[Category:BSL docs]]
| align="center" width="100px" | [[OSL:operators|<tt>-</tt>]]
| align="center" width="100px" | [[OSL:variables|<tt>=</tt>]]
| align="center" width="100px" | [[OSL:operators|<tt>!</tt>]]
|-
| align="center" width="100px" | [[OSL:operators|<tt>and</tt>]]
| align="center" width="100px" | [[OSL:operators|<tt>or</tt>]]
| align="center" width="100px" | [[OSL:operators|<tt>eq</tt>]]
| align="center" width="100px" | [[OSL:operators|<tt>ne</tt>]]
|-
| align="center" width="100px" | [[OSL:operators|<tt><</tt>]]
| align="center" width="100px" | [[OSL:operators|<tt>></tt>]]
| align="center" width="100px" | [[OSL:operators|<tt><=</tt>]]
| align="center" width="100px" | [[OSL:operators|<tt>>=</tt>]]
|-
| align="center" colspan="4" style="border-top:1px solid red; border-right:1px solid red; border-bottom:2px solid red; border-left:1px solid red;" |
Click on an operator for details
|}
|-
| align="center" style="border-bottom:3px solid grey;"|
{| border="0"
|+''OSL keywords''
|-
| align="center" width="75px" | [[OSL:keywords|<tt>at</tt>]]
| align="center" width="75px" | [[OSL:data|<tt>float</tt>]]
| align="center" width="75px" | [[OSL:statements|<tt>if</tt>]]
| align="center" width="75px" | [[OSL:keywords|<tt>repeat</tt>]]
| align="center" width="75px" | [[OSL:data|<tt>string</tt>]]
|-
| align="center" width="75px" | [[OSL:data|<tt>bool</tt>]]
| align="center" width="75px" | [[OSL:keywords|<tt>for</tt>]]
| align="center" width="75px" | [[OSL:data|<tt>int</tt>]]
| align="center" width="75px" | [[OSL:functions|<tt>return</tt>]]
| align="center" width="75px" | [[OSL:keywords|<tt>using</tt>]]
|-
| align="center" width="75px" | [[OSL:statements|<tt>else</tt>]]
| align="center" width="75px" | [[OSL:functions|<tt>fork</tt>]]
| align="center" width="75px" | [[OSL:keywords|<tt>iterate</tt>]]
| align="center" width="75px" | [[OSL:keywords|<tt>schedule</tt>]]
| align="center" width="75px" | [[OSL:variables|<tt>var</tt>]]
|-
| align="center" width="75px" | [[OSL:keywords|<tt>every</tt>]]
| align="center" width="75px" | [[OSL:functions|<tt>func</tt>]]
| align="center" width="75px" | [[OSL:keywords|<tt>over</tt>]]
| align="center" width="75px" | [[OSL:keywords|<tt>sleep</tt>]]
| align="center" width="75px" | [[OSL:data|<tt>void</tt>]]
|-
| align="center" colspan="5" style="border-top:1px solid red; border-right:1px solid red; border-bottom:2px solid red; border-left:1px solid red;" |
Click on a keyword for details
|}
|}

Latest revision as of 02:38, 6 May 2023

BungieFrameWork Scripting Language (simply called BSL) is what Oni's level scripts are written in. Being a game scripting language, BSL is far more limited in scope and usage than a full programming language, as it was designed only to move events forward in the game, not to build complete programs. Specifically, BSL scripts are responsible for managing the player's objectives, directing AIs, creating environmental effects and choreographing cutscenes.

Physically speaking, they are the .bsl files inside the Oni/GameDataFolder/IGMD/ folder. Being in plain-text format, scripts can be edited with any word-processing program, such as the built-in Notepad (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

  • You may wish to first read either the Introduction or the Manual page under "Knowledge database" below. The Introduction is a quick reference, whereas the Manual includes an introductory lesson on programming concepts. It also documents known bugs in BSL and fixes/workarounds when available.
  • To learn BSL by example, you can read the .bsl files in the IGMD folder or look at some of the mods linked below and draw connections between the scripting commands and the resulting events in the game.
  • For a primer in writing BSL, see the "Tutorials" section below.

Script mods

Script mods are great examples of what can be achieved simply by editing text files. They replace or add to Oni's .bsl files to spice up the gameplay and provide a more exciting experience to those who have finished the game. 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 new levels are created, these naturally require new scripts to be written from scratch to work with the assets and drive events in them.

One ambitious example of a script mod is Oni Team Arena. Based on the desire for a multiplayer mode in Oni and inspired by Unreal Tournament, OTA creates a single-player "multiplayer experience" by adding bots and a scoring system. Other script mods range from free-for-all arenas to objective-based missions and enhancements of the original levels.

Script mods packaged for use with the Anniversary Edition are listed here, and totally new levels with their own BSL files can be found here (these mods are meant to be installed through the AE Installer). Older scripts, which need to be placed manually in IGMD, can be found here and here.

Tutorials

Playing with the developer console
The fastest way to start learning BSL is to load the first level and open the dev console.
New logic from scratch
Create completely new level logic from scratch.

Knowledge database