Oblivion Mod:Cobl/Modding/Options Menu

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Overview[edit]

Cobl provides a standard options menu that modders can use to provide easy access to options settings for their mods. The menus is accessed by equipping the "+[Options]" misc. item in the player's inventory. Doing so activates a remote container containing option tokens. Option commands (typically a menu display) are activated simply by selecting an item from the options container.

To add a command to the Options Box:

  • Define a command token misc. object and its script.
  • Use a quest script or similar to add a copy of the command token to cobOptChestRef.

Complications[edit]

  • The command token should be scripted to perform its action and then remove itself from the player's inventory. (Use removeMe.)
  • In order to keep the player from using the Options Box as a general storage container, all items in the storage container are removed to the player after the options command has run. Hence there are two ways the token can be added to the user:
    1. by the user selecting the command token (cobOptChestRef.state == 20; command should execute);
    2. after the Options Box power has completed (cobOptChestRef.state != 20; command should not execute).
  • After the token is selected by/removed to the player, the options box needs to be refilled. This is best done by the command token itself. While the command token could just remove itself back to the chest, this can leave the command token in a triggered state. Hence it is better to add a new copy of the token to the chest and have the token delete itself via removeMe.

Examples[edit]

  • Cobl Main.esm
    • cobOptAboutOptions: A simple command that doesn't require a menu.
    • cobOptTimeScale: A fairly simple command that shows a menu and then handles the user's choice.
  • OOO 1.32-Cobl.esp
    • Has several options for activating/deactivating various features of OOO.