Jump to content

BSL:Introduction: Difference between revisions

bsl commands per bsl file has a limit
(contraindicating use of bools)
(bsl commands per bsl file has a limit)
Line 7: Line 7:


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 it is called by a function in a level script or by one of the above types of game data in that level.
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 it is called by a function in a level script or by one of the above types of game data in that level.
===BSL commands per file limitation===
The Oni engine has some limitation for how many bsl commands can be loaded with a single BSL file (at least on Windows).
If you input too many bsl commands on one bsl file, you may get errors on the developer mode console like this «Func "main", File "(called from engine)", Line 0: semantic error, function "main" does not exist.» (it can be other function other than main).
For instance you can check this files (extract the files and put them on IGMD\EnvWarehouse to experience the problem):
http://script10k.oni2.net/wikifiles/main_not_working_without_commenting_commands.zip
http://script10k.oni2.net/wikifiles/main_not_working_without_commenting_commands(functions_split).zip
http://script10k.oni2.net/wikifiles/main_split_in_two_files.zip
In all these bsl files (each of them is a different scenario) the message "This message should appear on the beginning" should appear when you load level 1.
However for "main_not_working_without_commenting_commands" it doesn't work while you don't comment the 5th line on the bsl file.
The scenario "main_not_working_without_commenting_commands(functions_split)" is the same, but in this one the main function is split in two functions, which is not enough for the error go away.
The last scenario "main_split_in_two_files" is the same as the previous but the 2 functions are split in two different files: "main.bsl" and "continuation.bsl". In this case the script works as expected, the message "This message should appear on the beginning" appears on level load.
So if you experience the error «Function "x" does not exist.» when in fact it does exist split your larger code for other functions on other BSL files. That should fix the problem.


==Syntax==
==Syntax==
489

edits