Difference between revisions of "GetFirstRef"

Jump to navigation Jump to search
400 bytes removed ,  10:43, 16 June 2009
edit to match GetNextRef
imported>Shademe
(→‎Article Update: Note on the apple bug)
imported>Scruggs
(edit to match GetNextRef)
<pre>ref pDoor
...
set pDoor to AppleGetFirstRef 24 1
setwhile (pDoor to (GetFirstRef 24 1)
; do something with pDoor
Label 1
if pDoor
set pDoor to Apple
set pDoor to GetNextRef
endifloop</pre>▼
Goto 1
▲endif</pre>
Scans the list of doors in the player's current cell and the surrounding 8 cells.
 
 
==Notes==
*The first referenceReferences can changebe (deletedadded to or moved)removed byfrom thea nextcell framebetween soframes; for this functionreason shouldGetFirst/NextRef alwaysshould be used first,within anda onlyloop withthat aexecutes Label/Gotowithin loopa andsingle GetNextRefframe.
** The order of references as returned by GetFirst/NextRef is essentially undefined. It is not guaranteed that it will remain the same from one frame to the next. As stated above, a loop should be used each time. ''Usually'', however, the first ref is the most recently placed one. It is altogether unwise to rely on this, however.
* pDoor is set to an Apple before using GetNextRef because Oblivion doesn't expect the reference of a door, and won't change the variable. So far doors, containers, and magic effects have been found to cause this odd reference variable behaviour, but to be safe always set your reference variable to Apple before using GetNextRef.
** This bug has been eliminated as of v17.
*The syntax and function has changed between v13 and v14:
**The includeInactiveRefs flag was added.
Anonymous user

Navigation menu