BSL:Introduction: Difference between revisions

whoops! forgot that various game data types can trigger BSL; if anyone knows of other types, please add them
m (link fix)
(whoops! forgot that various game data types can trigger BSL; if anyone knows of other types, please add them)
Line 2: Line 2:
{{TOClimit|2}}
{{TOClimit|2}}
==Files==
==Files==
When Oni loads a level, it also loads and parses all .bsl files in the folder in [[IGMD]] which contains that level's scripts (the name of the folder being specified by the level's [[ONLV]] resource). Like C, the code automatically begins running with the function called "main", regardless of which .bsl file it is found in (Oni's scripts always place it in a file called *_main.bsl).
When Oni loads a level, it also loads and parses all .bsl files in the folder in [[IGMD]] which contains that level's scripts (the name of the folder being specified by the level's [[ONLV]] resource). Like C, the code automatically begins running at the time of level-load with the function called "main", regardless of which .bsl file it is found in (Oni's scripts always place it in a file called *_main.bsl).


Note that the optional [[IGMD/global|global]] folder is also loaded for all levels, but any function found in a .bsl file in global/ will be stranded, only accessible by [[Developer Mode|developer console]], unless you edit a function in some level's existing BSL file so that it calls your global function.
Unlike C, there are other "entry points" in the code. For instance, characters can call script functions upon death and trigger volumes can call functions when they are entered or exited. See [[CHAR]], [[OBD:BINA/OBJC/CONS|BINA CONS]], [[OBD:BINA/OBJC/DOOR|BINA DOOR]], [[NEUT]], and [[TRGV]] for all known places in the game data that can trigger BSL functions.
 
Note that the optional [[IGMD/global|global]] folder is also loaded for all levels, but any function found in a .bsl file in global/ will be stranded, only accessible by [[Developer Mode|developer console]], unless you edit an existing function in a level script, or one of the above types of game data in some level, so that it calls your global function.


==Syntax==
==Syntax==