Difference between revisions of "Talk:Enable - ObjectReference"
Jump to navigation
Jump to search
imported>HawkFest |
imported>Cipscis |
||
Line 9: | Line 9: | ||
:Nope I've tested it myself and it's a plain fact. Don't use anything between parenthesis (leave blank) when the reference is of type Light, else it won't do anything even though it compiles ok. Which doesn't mean to get rid of parenthesis btw if I read correctly, they're still mandatory... | :Nope I've tested it myself and it's a plain fact. Don't use anything between parenthesis (leave blank) when the reference is of type Light, else it won't do anything even though it compiles ok. Which doesn't mean to get rid of parenthesis btw if I read correctly, they're still mandatory... | ||
:--[[User:HawkFest|HawkFest]] ([[User talk:HawkFest|talk]]) 21:25, 21 November 2012 (EST) | :--[[User:HawkFest|HawkFest]] ([[User talk:HawkFest|talk]]) 21:25, 21 November 2012 (EST) | ||
:: Sorry, I misspoke when I said "without parentheses". Like you guessed, I meant "with empty parentheses". The point I made still stands, though. For example, here is an example script showing various ways in which Enable can be called on an ObjectReference variable: | |||
<source lang="papyrus">ScriptName Test | |||
ObjectReference rLight | |||
Function Foo() | |||
rLight.Enable() | |||
rLight.Enable(true) | |||
rLight.Enable(false) | |||
EndFunction</source> | |||
:: When I compile this function, here is the output (in Papyrus assembly) for the function "Foo": | |||
<pre> .function Foo | |||
.userFlags 0 | |||
.docString "" | |||
.return NONE | |||
.paramTable | |||
.endParamTable | |||
.localTable | |||
.local ::nonevar none | |||
.endLocalTable | |||
.code | |||
CALLMETHOD Enable rLight ::nonevar false ;@line 6 | |||
CALLMETHOD Enable rLight ::nonevar true ;@line 7 | |||
CALLMETHOD Enable rLight ::nonevar false ;@line 8 | |||
.endCode | |||
.endFunction</pre> | |||
:: As you can see, lines 6 and 8 compile to be absolutely identical - the game could not tell them apart even if it wanted to. | |||
:: Would you mind elaborating on exactly how you tested this? I'm curious as to how you could have achieved that result. Unfortunately, although I usually have access to the Papyrus compiler and assembler, I don't often have the opportunity to actually test things in Skyrim. | |||
:: -- [[User:Cipscis|Cipscis]] ([[User talk:Cipscis|talk]]) 21:34, 21 November 2012 (EST) |
Revision as of 21:34, 21 November 2012
Parentheses Must Be Left Blank
"Lights will never fade. In order for an enable/disable function to work on a light, the enable() function must be left blank for the light to be enabled or disabled."
This note doesn't seem right to me. I know, from viewing the assembly files generated by the Papyrus Compiler, that calling Enable or Disable without parentheses is *identical* to calling them with the default value specified - the game literally has no way of telling the two apart because the same output is generated for both sets of Papyrus code.
Is it possible this note was added as the result of a false positive in testing? I can't test it myself at the moment but will when I get the chance if no one else has by then.
-- Cipscis (talk) 23:38, 13 September 2012 (EDT)
- Nope I've tested it myself and it's a plain fact. Don't use anything between parenthesis (leave blank) when the reference is of type Light, else it won't do anything even though it compiles ok. Which doesn't mean to get rid of parenthesis btw if I read correctly, they're still mandatory...
- --HawkFest (talk) 21:25, 21 November 2012 (EST)
- Sorry, I misspoke when I said "without parentheses". Like you guessed, I meant "with empty parentheses". The point I made still stands, though. For example, here is an example script showing various ways in which Enable can be called on an ObjectReference variable:
ScriptName Test
ObjectReference rLight
Function Foo()
rLight.Enable()
rLight.Enable(true)
rLight.Enable(false)
EndFunction
- When I compile this function, here is the output (in Papyrus assembly) for the function "Foo":
.function Foo .userFlags 0 .docString "" .return NONE .paramTable .endParamTable .localTable .local ::nonevar none .endLocalTable .code CALLMETHOD Enable rLight ::nonevar false ;@line 6 CALLMETHOD Enable rLight ::nonevar true ;@line 7 CALLMETHOD Enable rLight ::nonevar false ;@line 8 .endCode .endFunction
- As you can see, lines 6 and 8 compile to be absolutely identical - the game could not tell them apart even if it wanted to.
- Would you mind elaborating on exactly how you tested this? I'm curious as to how you could have achieved that result. Unfortunately, although I usually have access to the Papyrus compiler and assembler, I don't often have the opportunity to actually test things in Skyrim.
- -- Cipscis (talk) 21:34, 21 November 2012 (EST)