Difference between revisions of "Scripts"

2,607 bytes added ,  10:58, 12 July 2015
Added additional sub-sections.
imported>Bug64
m
imported>Bug64
(Added additional sub-sections.)
Line 1: Line 1:


When a script can be attached to an entity you will see a dialog similar to the one shown below.
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 [[:Category:Papyrus|Papyrus]].


[[File:ScriptManagement.jpg]]
[[File: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)
* 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 "+" ([[File:ScriptPropertiesSetIcon.jpg]]).   
* After the script's properties are set, it's icon changes to a combination pencil and "+" ([[File: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.
* 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|context menu]] of operations that can be performed on that script.




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


[[File:AddScript.jpg]]
[[File:AddScript.jpg]]


* '''Filter''': Text entered into this field will limit the list of scripts displayed to those whose name contains the given text  
* '''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 below for more details.
* '''[New Script]''': Appears at the top of the list of scripts and is used to create a script from scratch.  See [[#Add New Script|Add New Script]] for more details.
* '''Show Hidden Scripts''': Shows scripts that have been marked as [[Flag Reference#Script Flags|hidden]].   
* '''Show Hidden Scripts''': Shows scripts that have been marked as [[Flag Reference#Script Flags|hidden]].   




'''Usage Notes'''
* If you create a script outside of the tool, it will ''not'' appear in the list of scripts.
* If you create a script outside of the tool, it will ''not'' appear in the list of scripts.


== Add New Script ==
== Add New Script ==
Prompts the user for basic information used to create the script header.  With the exception of the name, any of this information can be changed later by directly editing the script's source.
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.


[[File:AddNewScript.jpg]]
[[File:AddNewScript.jpg]]
Line 31: Line 37:
* '''Conditional''': Adds the [[Flag Reference#Script Flags|conditional]] flag to the script's definition.
* '''Conditional''': Adds the [[Flag Reference#Script Flags|conditional]] flag to the script's definition.
* '''Documentation String''': Documentation explaining the script's purpose.
* '''Documentation String''': Documentation explaining the script's purpose.


= Remove =
= Remove =
Line 36: Line 43:


= Properties =
= Properties =
Used to add properties to a script and set their values.  After a property has been added, it must be removed by deleting it from the script's source.
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.
[[File:PropertiesDialogue.jpg]]
[[File:PropertiesDialogue.jpg]]


* '''Add Property''': Adds a new property to the script.   
* '''Add Property''': Adds a new property to the script.   
* '''Auto-Fill All''': ''TBD''
* '''Auto-Fill All''': ''TBD''
* '''Edit Value''': Allows you to set the initial 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.
* '''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''
* '''Revert''': ''TBD''
* '''Auto-Fill''': Like "Auto-Fill All" but only fills the selected property
* '''Auto-Fill''': Like "Auto-Fill All" but only fills the selected property


== Add Property ==
== Add Property ==
Adds a new property to the script. New properties will appear at the bottom of the script.
Adds a new property to the script. This dialog is a template for gathering inputs that will be used to generate the [[Property Reference|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).
 
[[File:AddScriptPropertyDialogue.jpg]]
 
* '''Type''': The property's data type
* '''Array''': Controls whether or not this property will be defined as an [[Arrays (Papyrus)|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|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.
 
[[File:ScriptDialogContextMenu.jpg]]
 
* list of menu items


[picture goes here]


* If you mark the property hidden, it's still added to the script but will not appear in this window
[[Category:Game Systems]]
* It is possible to create illegal properties using this dialog (such as using an invalid name for a property).  This will be reported as a compilation error after clicking the OK button on the Add Property dialog.  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 edit the script's source to resolve the issue.
Anonymous user