BSL:BFW Scripting Language: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(I'm getting tired of having to click twice to get here...)
m (changed windows suggested edit program from wordpad to notepad, the later doesn't include any formatting data so should be preferable to edit plain text data)
(47 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== Oni Scripting Language (or OSL) ==
'''[[Modding_Oni#Introduction_to_the_Oni_engine|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, directing AIs, creating environmental effects, and driving 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.


== Editing Scripts ==
Physically speaking, they are the .bsl files inside the [[IGMD|Oni/GameDataFolder/IGMD/]] folder. Being in plain-text, 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).
__NOTOC__
==Getting started==
*You may wish to first read either the "Introduction" or the "Manual" page under "Knowledge database" below.
*To learn BSL by example, you can read the .bsl files in Oni's IGMD folder or look at the "Scripted mods" section 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.


Scripts can be edited with and word-processing program, such as NotePad. They can be edited simply by typing inside the file.
==Scripted mods==
Script files can be generated by creating a *.txt document, then changing the extension from txt to bsl.
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 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 for Oni, these naturally require new scripts to be written from scratch to take advantage of the new game assets.


== Scripted Mods ==
One ambitious example of a scripted mod is [[AE:OTA|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. Scripted mods can be found [http://mods.oni2.net/mods/Script here], [http://your-mom.oni2.net/Downloads.htm here] and [[User:Script_10k#Minor_Scripts|here]]. New levels, with their own BSL files, can be found [http://mods.oni2.net/mods/New%20Level here] (mod packages found on the Mod Depot are meant to be installed through the [[AE]]).


Scripted Mods are great examples of editing scripts. They edit the *.bsl files to create interesting, and often amusing results. They can change everything from the fog, to how the characters and level interact. However, they cannot add characters or change the level layout, only its contents, as they are handled by the Binaries. Information on [[OBD: Oni Binary Data]] . They are great examples of what can be achieved simply by typing into a file. The possibilities are simply endless.  
==Tutorials==
;[[BSL:Tutorial/Console|Playing with the developer console]]
:The fastest way to start learning BSL is to just load the first level and open the dev console.


Probably the best specimens of Scripted Mods are the [[ONK:OTA|Oni Team Arena]] scripts. Based on an idea for multiplayer Oni, and inspired by Unreal Tournament, they augment Oni's hand-to-hand combat and gunplay integration with a scoring system much like Unreal Tournament's DeathMatch. More information about this exciting project can be found at the page listed above.
;[[BSL:Tutorial/Modification|Original logic modification]]
:There are lots of cool things to do by merely looking at the original scripts and changing a few parameters.


All other scripted mods are basically anything you can imagine. From free-for-all arenas to objective based missions and enhancements of the original level, they spice up the games original levels and provide a more exciting experience to those who have finished the game. They keep the game alive, outside of its original levels.
;[[IGMD/global|Patching]]
:Want to script a "patch" that's effective in every level?


Downloads of OTA Mods are available at the OTA page. ([[ONK:OTA|Oni Team Arena]])
;[[BSL:Tutorial/Scratch|New logic from scratch]]
Downloads for other scripted mods mave been gathered here : [http://your-mom.oni2.net/Downloads.htm Script Download Page] [http://script10000.oni2.net/scripts.html and here.]
:Create completely new level logic from scratch.


== What Are Scripts? ==
==Knowledge database==
*[[BSL:Introduction|Introduction]] (a quick reference, ideal for those with programming experience)
*[[BSL:Manual|Manual]] (the complete reference on BSL, with more details and explanations for newbies)
*[[:Category:Scripting tasks|Scripting commands grouped by subject]] (work in progress)
*[[BSL:List|List of all scripting commands]] (work in progress)
*[[IGMD|File documentation for game scripts]]
*[[BSL:Snippets|Useful snippets of BSL]]


Scripts are the files that dictate the in-game processes in Oni, which include level logic, environment effects, as well as cutscenes. They are the *.bsl files inside the folder ...Oni/GameDataFolder/IMGD/. By editing scripts, you can alter how the game plays.
[[Category:BSL docs]]
 
===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]]===
For the practical minds who don't care (too much) about the theory.
*Wanna make minor (yet cool-looking) changes to the original level logic?
*Wanna script a "patch" that's effective in every level but doesn't affect the original logic?
*Wanna create completely new level logic from scratch? [[OSL:Tutorial/Scratch|Here you are]]
 
==Overview==
{| border="1" cellpadding="5" cellspacing="0" align="center"
|+'''OSL syntax overview table'''
|-
| align="center" style="border-bottom:3px solid grey;"|
{| border="0"
|+''OSL separators''
|-
| align="center" width="100px" | [[OSL:statements|<tt>;</tt>]]
| align="center" width="100px" | [[OSL:functions|<tt>,</tt>]]
| align="center" width="100px" | [[OSL:comments|<tt>#</tt>]]
| align="center" width="100px" | [[OSL:data|<tt>"</tt>]]
|-
| align="center" width="100px" | [[OSL:statements|<tt>{</tt>]]
| align="center" width="100px" | [[OSL:statements|<tt>}</tt>]]
| align="center" width="100px" | [[OSL:functions|<tt>(</tt>]]
| align="center" width="100px" | [[OSL:functions|<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 a separator for details
|}
|-
| align="center" style="border-bottom:3px solid grey;"|
{| border="0"
|+''OSL operators''
|-
| align="center" width="100px" | [[OSL:operators|<tt>+</tt>]]
| 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
|}
|}

Revision as of 14:52, 27 February 2017

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, directing AIs, 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 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.
  • To learn BSL by example, you can read the .bsl files in Oni's IGMD folder or look at the "Scripted mods" section 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.

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 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 for Oni, these naturally require new scripts to be written from scratch to take advantage of the new game assets.

One ambitious example of a scripted mod 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. Scripted mods can be found here, here and here. New levels, with their own BSL files, can be found here (mod packages found on the Mod Depot are meant to be installed through the AE).

Tutorials

Playing with the developer console
The fastest way to start learning BSL is to just load the first level and open the dev console.
Original logic modification
There are lots of cool things to do by merely looking at the original scripts and changing a few parameters.
Patching
Want to script a "patch" that's effective in every level?
New logic from scratch
Create completely new level logic from scratch.

Knowledge database