Jump to content

Developer Mode: Difference between revisions

m (also using official name for pause screen)
(→‎Runtime scripting: minor rewrite)
Line 561: Line 561:


===Runtime scripting===
===Runtime scripting===
====Basic idea====
Almost anything that you can write in a [[BSL]] script you can enter at runtime with the console. One major thing you can't do is register new variables and functions. You can only call existing functions and get/set the values of existing variables. "Existing" means either built-in ones (see [[BSL:Functions]] and [[BSL:Variables]]), or ones found in the level scripts, or ones defined by scripts you may have added to the current level.
(Almost) anything you write in scripts you can enter at runtime with the console. The only thing you can't do is register new variables and functions.


You can call existing functions, check on the values of existing variables. "Existing" means either built-in ones, or part of the original level logic, or part of your own scripts for the given level.
While typing on the console line, you'll see a suggested autocompletion for the command you're typing; Tab accepts the autocomplete, and then Tab or Shift-Tab will cycle forward/backward through adjacent commands in ASCIIbetical order (A…Z comes before a…z). Previous commands from the current session can be retrieved with the up/down arrows. You can't insert/delete text in the middle of a command; you have to use Backspace. Copy and Paste are not available either.


If a function/variable was succesfully registered by Oni during level load, you will be able to refer to them from the console.
If you press an illegal key during console input (such as F1), the input display will freeze; hit Tab a few times to fix.


You will even be able to browse the registered variables/functions with the '''Tab''' key, while typing at the console. '''Tab''' autocompletes the command being typed, then cycles through all available commands in (hex)alphabetical order (A...Z come before a...z). '''Shift+Tab''' lets you go back.
===Cheating===
 
There are a few commands which you can type in as equivalents to regular cheat codes, and more that you can't do with cheats:
Previous commands can be navigated with up and down arrows. You can't insert/delete text in the middle of a command; you have to use '''Backspace'''.
*"chr_nocollision 0 1" and "chr_nocollision 0 0" enable/disable no-clip, allowing you to walk through walls. When in no-clip mode, you can't fall; thus, jumping makes you flail in midair, and eventually you die (so try not to jump).
 
*"give_powerup shield" gives you a force shield (which you can't get with '''fatloot''').
The only keys that have an effect while the console is active are: '''Escape''', '''Enter''', '''Backspace''', '''(Shift+)Tab''', ASCII character keys and the arrow keys.
*See [[Cheats]] for the BSL equivalents to various other cheats.
 
If you press an illegal key during console input (such as F1), the input display will freeze; hit '''Tab''' a few times to fix.
 
====Limitations====
Obviously, if Oni is experiencing graphical issues and you have no console output, runtime scripting can be a bit frustrating. Even more so if console ''input'' is invisible -- you're in for some ''blindfolded'' scripting then. Still, there are a few commands which you can type in as equivalents to regular cheats:
:'''chr_nocollision 0 1''' and '''chr_nocollision 0 0''' enable/disable no-clipping. When in no-clipping mode, you can't fall down; thus, jumping makes you flail in midair, and eventually you die (so be careful about that)
:'''give_powerup shield''' gives you a force shield (which you can't have with '''fatloot''')
:'''dump_docs''' prints all the registered commands/variables to a file in your Oni folder (so you know just what you can type)


[[Category:Engine docs]][[Category:OniX-affected articles]]
[[Category:Engine docs]][[Category:OniX-affected articles]]