Difference between revisions of "Cast Reference"
m
→Examples: Cleaned up syntax a bit
imported>Taleden m (clarified each variable's type in the code examples) |
imported>Rasikko m (→Examples: Cleaned up syntax a bit) |
||
(One intermediate revision by one other user not shown) | |||
Line 67: | Line 67: | ||
; x gets 10 | ; x gets 10 | ||
x = 10.5 as int | x = 10.5 as int | ||
</source> | |||
<br> | |||
<source lang="papyrus"> | |||
; x gets -1 | |||
x = -1.9 as int | |||
</source> | </source> | ||
<br> | <br> | ||
Line 159: | Line 164: | ||
Weapon Property MyUberWeapon auto | Weapon Property MyUberWeapon auto | ||
OnTriggerEnter(ObjectReference | Event OnTriggerEnter(ObjectReference type) | ||
Weapon triggeredWeapon = (type as form) as weapon ; Cast the triggered object first to a form and then to a weapon. | Weapon triggeredWeapon = (type as form) as weapon ; Cast the triggered object first to a form and then to a weapon. | ||
Line 176: | Line 181: | ||
Keyword Property IsAnArrow auto | Keyword Property IsAnArrow auto | ||
OnTriggerEnter(ObjectReference Type) | Event OnTriggerEnter(ObjectReference Type) | ||
if(type.haskeyword(IsAnArrow)) | if(type.haskeyword(IsAnArrow)) |