Jump to content

How Do You Say "Set Var To 1"


David Brasher

Recommended Posts

The scripts never compile no matter how I write them and no matter what properties I set for them.

 

I want to figure out how to change the value of a variable.

 

How do you say this line in Papyrus?

 

Set Var to 1

 

The wiki says something like:

 

Var = 1

 

That doesn't compile though.

Edited by David Brasher
Link to comment
Share on other sites

Before you can set the value of a variable, you have to define it at the top at your script.

 

 

ScriptName <insert name here> Extends <whatever>

 

Int VarA = 1 ;<-- This line defines "VarA" as integer and initialized it with 1

VarA = 1 ;<-- This doesn't work, because it's outside a sub or function

 

Event OnLoad()

VarA = 1 ;<-- This works, because "VarA" is defined and inside the sub of the "OnLoad" event

VarB = 1 ;<-- This doesn't work, because "VarB" isn't defined

EndEvent

 

 

Hope it helps.

Edited by Outlandstalker
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...