Skip to content
Scrab Joséline edited this page Nov 11, 2024 · 12 revisions

The Custom Console framework enables versatile interactions with the Console, with its primary feature being the ability to create new console commands through simple .yaml configuration files.

Adding a new Console Command

To add a custom console command, all you need to do is to create a new .yaml file in Data\SKSE\CustomConsole. The .yaml files are case-insensitive. Structure the file's content as described below. (Fields marked with a star (*) are mandatory.)

Configuration Fields

  • version*: Specifies the API version. Set this to 1.
  • name*: The command's name, which acts as a prefix for referencing your script. This name must be unique.
  • alias: An optional shorthand for referencing your command. Must be unique.
  • script*: The name of the .psc script file (without extension) that contains the callback functions executed when one of your commands is called.
  • help: An optional short description offering an overview over your commands.
  • subs*: A list of one or more subcommands. Each subcommand is defined by the following fields:
    • name*: The subcommand’s name, representing the actual command to be executed. Must be unique within the file.
    • alias: An optional shorthand for the subcommand. Must also be unique within the file.
    • func*: The Papyrus function to be called. This function must be defined in the .psc script specified in the script field.
      • Ensure the function is flagged global.
      • The functions return is printed as a response into the console.
    • help: A brief description of what this subcommand/function does.
    • args: A list of arguments for the function, specified in the order required by the function. Each argument includes the following fields:
      • name*: The argument’s name.
        • You may prefix it with - for direct referencing, similar to command-line arguments.
      • alias: An optional shorthand name to refer to the argument. Must begin with -.
      • help: A brief description of what the argument does.
      • default: A default value, used if the user does not specify one.
      • selected: Indicates whether the currently selected reference can be used to populate this argument.
        • Default: false
      • required: Indicates if this argument is necessary for command execution.
        • It is recommended to define the default field for optional arguments.
        • Default: true
      • type*: Specifies the argument type. Available options include:
        • int
        • bool
        • float
        • String
        • A papyrus base-class (e.g. Form, Actor, ObjectReference, Keyword, etc.)

Example Config

version: 1
name: Candy_Generator
alias: candygen
script: CandyGenerator
help: Console functions to spawn various types of candy
subs:
  - name: SpawnSweetrolls
    alias: sweetrolls
    func: SpawnSweetrolls
    help: Spawns Sweetrolls near the specified reference location
    args:
      - name: reference
        type: ObjectReference
        selected: true
        required: true
        help: The reference near which to spawn the Sweetrolls
      - name: count
        type: int
        default: 0
        help: Specifies the number of Sweetrolls to spawn
  - name: DuplicateCandy
    alias: dupe
    func: DuplicateSweetrolls
    help: Duplicates all Sweetrolls in the targets inventory!
    args:
      - name: reference
        type: ObjectReference
        selected: true
        required: true
        help: The reference which's candy to duplicate

Clone this wiki locally