Open main menu
Home
Random
Log in
Settings
About the CreationKit Wiki
Disclaimers
the CreationKit Wiki
Search
Editing
Papyrus Introduction
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Setting variables and properties in the script== The way to set a variable and one of the ways to set a property is to [[Operator_Reference#Assignment_Operators| assign it a value]] in the script itself. You can declare it one place, and set it some place else: <syntaxhighlight lang="papyrus"> ;At the top of the script we declared a variable: Int MyStage ;... ;Later, inside an event block: MyStage = 100 </syntaxhighlight> Or you can assign it at the time you declare it: <syntaxhighlight lang="papyrus"> Int MyStage = 100 </syntaxhighlight> Note: you can set variables and properties when you declare them ''everywhere in the script'' as long as their type is a "[[Literals_Reference|Literal]]." However variables/properties of all other types (an actor for example) can be set when declared, only if declared inside a function or event. For example, declaring at top, and setting elsewhere: <syntaxhighlight lang="papyrus"> ;Delcared at top ObjectReference ThingActivatingMe ;set inside an event Event OnActivate(ObjectReference akActionRef) ThingActivatingMe = akActionRef EndEvent </syntaxhighlight> You might do the above if you wanted to hang onto the thing that activated the object for longer than the one instance of the activation. Or you could declare it and set at the same time (inside a function or event) like this: <syntaxhighlight lang="papyrus"> ;set inside an event Event OnActivate(ObjectReference akActionRef) ObjectReference ThingActivatingMe = akActionRef EndEvent </syntaxhighlight> For a more detailed discussion of how to declare and set variables and properties, see: [[Variables and Properties (Papyrus)| Variables and Properties]]
Summary:
Please note that all contributions to the CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
CreationKit:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)