Hi FOSE team. I just want to start by saying I absolutely love FOSE and couldn't make half of the scripts I want without your excellent toolkit. That said, I have been reluctant to report a bug I may have found fearing it may be due to my coding and not a FOSE error, but I am now fairly certain that the problem lies within the GetFirstRef and GetNextRef functions.
I made a script to perform a RefWalk and then applied a shader to refs that were not disabled and were in the line of sight of the player. This was a big help in visually determining which refs were missed. For the most part it works very well. One problem that keeps popping up, however, is that on occasion some refs fail to be found via the RefWalk. I have made some pictures to exemplify the problem.
The first picture shows a dead Molerat highlighted with its ref ID at the top of the screen. You can also see a printout of all of the refs found in the RefWalk. I added a counter to show that the RefWalk has actually cycled through twice to ensure no refs are missing from the console output. You will notice that the dead Molerat's ID of 0006FE59 is absent from the list of Refs found by the RefWalk.
http://s779.photobucket.com/albums/yy80/HupOranje/RefWalk1.jpg
In the second picture, I have moved closer to the Molerat and the RefWalk has now found the Molerat as exemplified both by the fact that its ID appears in the console output, and my code has applied the red shader to it. You will also notice that although there is only one iteration listed from the console output, that output begins with counter = 1 and ends with the null record indicating that the RefWalk has finished.
http://s779.photobucket.com/albums/yy80/HupOranje/RefWalk2.jpg
In the third picture, I have moved away from the molerat again, and its Ref ID no longer appears in the console output even though the shader applied to the Molerat is still in effect.
http://s779.photobucket.com/albums/yy80/HupOranje/RefWalk3.jpg
To ensure it was not my code that was causing the problem. I made the fourth picture using only a Refwalk script without any other code. This produced the same result as can be seen in the next picture. The Molerat's ID is not included in either iteration of the RefWalk.
http://s779.photobucket.com/albums/yy80/HupOranje/RefWalk4.jpg
Here is the code I ran to produce Pic4. It was a quest script running 5 times a second. IsOn gets set to 1 when a helmet is equipped.
scn UCMetalHelmetFXQuestScriptShort IsOnShort CountShort Count2Short FoundShort NumShort Num2Short RefNumRef rCurRefRef rOldRefBegin GameMode If IsOn == 1 Set RefNum to 1 Set rCurRef to Apple set rCurRef to GetFirstRef 200 1 1 ;All actors Label 10 printc "Ref-Walk: %.0f %n %i" RefNum rCurRef rCurRef Set RefNum to RefNum + 1 if (rCurRef) Set rCurRef to apple set rCurRef to GetNextRef Goto 10 EndIf ;CurRef EndIf ;IsOnEnd
The extra variable definitions are left overs from my larger script which produced the first three pictures. I tried this with various combinations of the GetFirstRef function using '200 0 0' & '200 1 0' as the parameters as well with the same results.
Oh, one last note. This was done with FOSE 1.1 Beta 9 and 1.2 Beta 2.