Jump to content

Modding errors: Difference between revisions

moved bsl per file limitation from introduction to here
(bsl file commands limitation)
(moved bsl per file limitation from introduction to here)
Line 104: Line 104:
===BSL errors===
===BSL errors===
* ''Func "main", File "(called from engine)", Line 0: semantic error, '''function''' "main" '''does not exist'''''.  
* ''Func "main", File "(called from engine)", Line 0: semantic error, '''function''' "main" '''does not exist'''''.  
Or either the function "main" wasn't found in any bsl file (This can also happen with any other function) or the bsl file has to many commands ([http://wiki.oni2.net/w/index.php?title=BSL:Introduction#Files this bsl limitation] triggers this message), if the later make sure you split your bsl in more bsl files (creating additional functions if necessary, more information [http://wiki.oni2.net/w/index.php?title=BSL:Introduction#Files here]).
Or either the function "main" wasn't found in any bsl file (This can also happen with any other function) or the bsl file has to many commands (see [[Modding_errors#BSL_commands_per_file_limitation|here]]), if the later make sure you split your bsl in more bsl files (creating additional functions if necessary, more information [[Modding_errors#BSL_commands_per_file_limitation|below]]).
* ''Func "(null)", File "test.bsl", Line 3: semantic error, '''Identifier''' "main" already declared'' - In this case the function "main" is double, it can be found in the file "test.bsl" at line 3. (It's not the first but the last line of the double function.)
* ''Func "(null)", File "test.bsl", Line 3: semantic error, '''Identifier''' "main" already declared'' - In this case the function "main" is double, it can be found in the file "test.bsl" at line 3. (It's not the first but the last line of the double function.)
* ''Func "(null)", File "main.bsl", Line 1: Illegal token, got "func" expected ";"'' - The variable declaration didn't ended with a semicolon.
* ''Func "(null)", File "main.bsl", Line 1: Illegal token, got "func" expected ";"'' - The variable declaration didn't ended with a semicolon.
Line 123: Line 123:
* ''Func "(null)", File "(called from console)", Line 1: Illegal token, got "ammo" expected ";"''
* ''Func "(null)", File "(called from console)", Line 1: Illegal token, got "ammo" expected ";"''
** Correct use of this function is: ''chr_givepowerup 0 ammo 1''
** Correct use of this function is: ''chr_givepowerup 0 ammo 1''
====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.


==OniSplit error messages==
==OniSplit error messages==
489

edits