Difference between revisions of "Talk:Variables and Properties"
imported>Doulos |
imported>Cipscis |
||
Line 16: | Line 16: | ||
just gives a compile error saying that the quest doesn't have property "IntPropery." So, I'm thoroughly confused. I don't completely understand "casting," either. That may have something to do with it. --[[User:Doulos|Doulos]] 04:53, 11 February 2012 (EST) | just gives a compile error saying that the quest doesn't have property "IntPropery." So, I'm thoroughly confused. I don't completely understand "casting," either. That may have something to do with it. --[[User:Doulos|Doulos]] 04:53, 11 February 2012 (EST) | ||
: You're absolutely right that casting has something to do with it. The problem is, as the compiler tells you, that "IntProperty" doesn't exist on the type "Quest". | |||
: The important thing to remember here is that, when you wrote the script containing "IntProperty", you wrote it such that you extended "Quest". What' you've essentially done is create a new object type that is an extension of "Quest" and, as such, I ''expect'' you should be able to access your property like this (with "MyNewQuestScript" as a placeholder for the name of the script containing "IntProperty"): | |||
<source lang="papyrus">(QST as MyNewQuestScript).IntProperty += 1</source> | |||
: -- [[User:Cipscis|Cipscis]] 05:35, 11 February 2012 (EST) |
Revision as of 05:35, 11 February 2012
Conditional properties
What does it actually mean if a property is "conditional"? I'm assuming this means I can access it through conditions in spells and such, is this right? Fowl 20:24, 7 February 2012 (EST)
- The conditional keyword seems to be described here - Papyrus Introduction: Writing Custom Functions
- It's hardly the most obvious place, however. Perhaps the keyword reference should be expanded?
- -- Cipscis 20:29, 7 February 2012 (EST)
- That's awesome, thank you. I'm going to add that link to the article Fowl 19:13, 8 February 2012 (EST)
Manipulating Properties
I can't seem to get the referencing. I'm in an active magic effect (AME) script wanting to add/subtract on an Int property attached to a quest script. I have a quest property (called QST) attached to the AME script whose value is the quest whose Int property I want to manipulate. But doing a line like (from within the AME script):
QST.IntProperty += 1
just gives a compile error saying that the quest doesn't have property "IntPropery." So, I'm thoroughly confused. I don't completely understand "casting," either. That may have something to do with it. --Doulos 04:53, 11 February 2012 (EST)
- You're absolutely right that casting has something to do with it. The problem is, as the compiler tells you, that "IntProperty" doesn't exist on the type "Quest".
- The important thing to remember here is that, when you wrote the script containing "IntProperty", you wrote it such that you extended "Quest". What' you've essentially done is create a new object type that is an extension of "Quest" and, as such, I expect you should be able to access your property like this (with "MyNewQuestScript" as a placeholder for the name of the script containing "IntProperty"):
(QST as MyNewQuestScript).IntProperty += 1
- -- Cipscis 05:35, 11 February 2012 (EST)