Scripts

From Creation Kit
Jump to: navigation, search

Creation Kit allows scripts to be attached to various entities. Despite the differences between the entities, the user interface for managing these scripts is common. This page focuses on the description of this user interface and not the underlying concepts. For information on the concepts themselves, please see Papyrus.

ScriptManagement.jpg

Script List

The script list panel shows the scripts which have been attached to the entity. The scripts are listed in alphabetical order.

  • If a script has no properties or its properties have not been given values, its name will be prefixed with a "+" (as shown above)
  • After the script's properties are set, it's icon changes to a combination pencil and "+" (ScriptPropertiesSetIcon.jpg).
  • Since most scripts have properties that must be set before the script will function properly, these icons help to remind the user when the properties haven't been set.
  • Right-clicking on a script will bring up a context menu of operations that can be performed on that script.


Add

Used to create a new script or add a script previously created using [New Script].

AddScript.jpg

  • Filter: Used to limit the list of scripts to those whose name contains the given text
  • [New Script]: Appears at the top of the list of scripts and is used to create a script from scratch. See Add New Script for more details.
  • Show Hidden Scripts: Shows scripts that have been marked as hidden.


Usage Notes

  • If you create a script outside of the tool, it will not appear in the list of scripts until it has been compiled.
  • As elsewhere, script names are case insensitive


Add New Script

Prompts the user for basic information used to create the script header at the top of the script's source file. With the exception of the name, any of this information can be changed later by directly editing the script's source.

AddNewScript.jpg

  • Name: The name of the new script. This name will be used to refer to the script from elsewhere and is used as the name of the script's source file.
  • Extends: The name of parent script from which this script will be derived. Creation Kit will usually set this to a reasonable default.
  • Hidden: Adds the hidden flag to the script's definition.
  • Conditional: Adds the conditional flag to the script's definition.
  • Documentation String: Documentation explaining the script's purpose.

Remove

Removes the currently selected script from the list of scripts. The source file is not deleted.

Properties

Used to add properties to a script and set their values. After a property has been added, it can only be removed by deleting it from the script's source. PropertiesDialogue.jpg

  • Add Property: Adds a new property to the script.
  • Auto-Fill All: Automatically fills in any property which is named after the entity to which it refers. As an example, an ActorBase property named Atrid will be automatically filled with that object.
  • Edit Value: Allows you to set the value of this property. The area to the left of the button will provide one or more input fields to be populated, depending on the property's type.
  • Revert: TBD
  • Auto-Fill: Like "Auto-Fill All" but only fills the selected property


Add Property

Adds a new property to the script. This dialog is a template for gathering inputs that will be used to generate the property definition withing the script's source file. Please note that the dialog is very permissive and will not stop you from creating ill formed properties (e.g., initialing an ActorBase to the value 7).

AddScriptPropertyDialogue.jpg

  • Type: The property's data type
  • Array: Controls whether or not this property will be defined as an array
  • Name: The name of the property. This name will be used to refer to this property from elsewhere in the system such as from other scripts.
  • Initial Value: An optional field for specifying the value to which this property will be initialized.
    • This field should only be used for simple/primitive types such as Int, String, Float, etc.
    • This value will not appear in the properties window. What happens when a property's value is set from both places?
  • Hidden: If set, the property will be added to the script, but it will not appear in the properties window
  • Conditional: Disabled. This could add the [Property Reference|conditional] flag to the property
  • Documentation String: An optional field used to explain the property's purpose.
  • OK: The information populated in the dialog will be converted into a property statement, inserted into your script's source file and then your source file will be compiled.


Usage Notes

  • It is possible to create illegal properties using this dialog. This will be reported as a compilation error after clicking the OK button. When the compilation error dialog is dismissed, the bad property will not appear in the list of properties even though it is still in the script. You must manually edit the script's source to resolve the issue.
  • Do not give a property the same name as an existing script or type. The dialog will not prevent this, but it will result in a compilation error as explained above.
  • If you name a property after the entity it represents, the game will automatically populate the entity for you. For example, naming an ActorBase property Astrid will cause it to be automatically populated with that actor.

Context Menu

Right-clicking on a script in the Script List opens a context menu which offers a list of operations which can be performed on the given script. The menu items are a combination of new operations (e.g., edit) and operations which can also be performed via buttons.

ScriptDialogContextMenu.jpg

  • Remove Script: Removes the selected script
  • Remove All Scripts: Removes all the scripts attached to the entity, clearing the list
  • Edit Properties: Opens the Properties dialog for the script
  • Edit Source: Opens the script's source file allowing it to be manually edited
  • Open in External Editor: Opens the script's source in an external editor