18,700
edits
m (→ai2: added note to ai2_followme) |
(removed instructions on function usage, as this is covered better by BSL:Manual; rewrote legend and gave it its own section; added note on dump_docs) |
||
Line 1: | Line 1: | ||
{{TOCfloat}} | {{TOCfloat}} | ||
To learn how to declare and use functions, read the BSL manual's [[BSL:Manual#Functions|Functions]] section. This page documents Oni's built-in (or "native") scripting functions. The other half of the available scripting commands are in [[BSL:Variables]]. | |||
==About chr_index== | |||
==chr_index== | |||
<tt>chr_index</tt> is a variable required by some functions like <tt>chr_focus</tt>. This variable hold a ID for a character and each character have a <tt>chr_index</tt> associated. | <tt>chr_index</tt> is a variable required by some functions like <tt>chr_focus</tt>. This variable hold a ID for a character and each character have a <tt>chr_index</tt> associated. | ||
Line 78: | Line 31: | ||
If you want to reset <tt>chr_index</tt> you may want to use <tt>ai2_reset</tt>, which resets all characters to level initial state (take a look at <tt>ai2_reset</tt> implications before using it [[#ai2|here]]). | If you want to reset <tt>chr_index</tt> you may want to use <tt>ai2_reset</tt>, which resets all characters to level initial state (take a look at <tt>ai2_reset</tt> implications before using it [[#ai2|here]]). | ||
{{clearall}} | |||
== | ==Legend== | ||
{{Fmbox | |||
| image = none | |||
Parameter | | text = • function_name parameter_name:type - description - example<br>''Optional notes'' | ||
* | }} | ||
: | ;Parameter | ||
*parameter_name:type | |||
:You have to supply this parameter. | |||
*[parameter] | *[parameter] | ||
: | :This parameter is optional. You can use it or not. | ||
*[parameter1:type1 | parameter2:type2] | |||
:You can supply a parameter of the first type or second type. | |||
*(null) | *(null) | ||
: | :There are no parameters; you call the function by name alone. | ||
;Description | |||
The function name, parameters and description come directly from Oni (the command "dump_docs"). The description given after a dash is sometimes too short or cryptic to be of much use. Sometimes it's even a placeholder value like "bla bla bla" (thanks Bungie West). In those cases a modder may have added a note in italics under the function to explain what it really does. | |||
;Availability | |||
*<span style="color:green">Functions in this color are Windows-only</span> | |||
*<span style="color:blue">Functions in this color are Mac-only</span> | |||
==Native functions== | |||
===ai2=== | ===ai2=== | ||
'''Commands which can have an effect on all AIs (see below to use these same commands on one AI):'''<br> | '''Commands which can have an effect on all AIs (see below to use these same commands on one AI):'''<br> | ||
Line 274: | Line 233: | ||
*console_print - dumps all arguments | *console_print - dumps all arguments | ||
*co_toggle_text - cycles console text color | *co_toggle_text - cycles console text color | ||
*dump_docs - shows all registered variables and | *dump_docs - shows all registered variables and functions | ||
''These will be dumped into the file script_commands.txt, next to Oni.'' | |||
*text_console name:string - turns on the text console display | *text_console name:string - turns on the text console display | ||