Next: Advanced tweaking, Previous: Coding guidelines, Up: Hacker's guide [Contents][Index]

### 3.10 Using the console

The console can be activated by passing `--display-console` when starting the game or by using the system options menu.

When the console is activated, a `lw6>` prompt should appear in the terminal which launched the program. If you started Liquid War 6 by clicking on an icon, console probably won’t work at all since `stdout` and `stdin` won’t be attached to anything.

The console allows you to type arbitray Scheme/Guile code.

Try, for instance:

    (+ 1 2)
    (display "foo\n")

You can really break things with this console, it gives you a direct access to all the program internals. At least, all the values which are accessible through the script interface, that is, many of them.

You can call any internal C function which has been exported to Guile, here are some examples:

    (c-lw6sys-timestamp)
    (c-lw6bot-get-backends)
    (c-lw6sys-sleep 2.0)
    (lw6-config-get-number "zoom")
    (lw6-config-set-number! "zoom" 0.9)
    (lw6-config-get-number "zoom")

While syntax (and possibly other) errors will be trapped by the interpreter, note that if you break things inside the game by, say, changing some global value, or in a general manner cause an error elsewhere in the code, the game will really raise a fatal error and stop. That’s how you can “break things”.

Still, this console is a very powerfull tool, very usefull for debugging but also for tweaking the game without restarting it and/or navigating through the menu interface.