OK, I figured it out well enough to suit my purposes. The magic function that makes it all work in my case is the OBSE function GetFirstRefInCell, using its parameter for also accessing the surrounding cells. Since the IC worldspaces are smallish, a single call to GetFirstRefInCell (for flora) will access every single cell in the worldspace that has anything in it, without accessing anything beyond that. So I only needed to access 6 cells ... rather than 6 worldspaces ... to get Refs for all the flora objects I needed.
Which of course means that I didn't need to enumerate the children of the worldspace itself. I looked into that, too, and it looks like I'd need to write a dll plugin and compile it with all the OBSE stuff to get that to work. So it's a good thing I don't need to do that, because OBSE isn't compiling very well right now on my recent MSVC.
One funny thing was that I couldn't access the cells in the ICPalace using the script. When the script started parsing, if I had any ICPalaceXX cells in the script, the script would immediately stop executing.
scriptName ICmushrooms
ref nextCcell
ref nextFlora
short nextCell
short hp_flys
short hp_lotus
short hp_gcup
short hp_sblue
short other
short season
begin ScriptEffectStart
; figure out which season it is, based on the month
if GameMonth > 2
set season to (GameMonth - 3) / 4
else
set season to 3
endif
Label 10
if nextCell == 0
set nextCcell to ICMarketDistrict04
elseif nextCell == 1
set nextCcell to ICArena06
elseif nextCell == 2
set nextCcell to ICArboretum01
elseif nextCell == 3
set nextCcell to ICTalosPlazaDistrict03
elseif nextCell == 4
set nextCcell to ICElvenGardensDistrict03
else
set nextCcell to ICTempleDistrict02
endif
set nextFlora to GetFirstRefInCell nextCcell 31 2 ; loop through all flora in each worldspace
Label 20
set other to 0
if ( nextFlora ) ; continue until all refs are processed
if nextFlora.IsHarvested == 0
if nextFlora.GetIngredient == FlyAmanitaCap
set hp_flys to nextFlora.GetIngredientChance season
elseif nextFlora.GetIngredient == SacredLotusSeeds
set hp_lotus to nextFlora.GetIngredientChance season
elseif nextFlora.GetIngredient == GreenStainCupCap
set hp_gcup to nextFlora.GetIngredientChance season
elseif nextFlora.GetIngredient == SteelBlueEntolomaCap
set hp_sblue to nextFlora.GetIngredientChance season
else
set other to 1 ; nirnroot
endif
if other == 0
nextFlora.SetHarvested 1
endif
endif
set nextFlora to getNextRef
Goto 20
endif
set nextCell to nextCell + 1
if nextCell < 6
goto 10
endif
; in the IC, there are 199 fly amanitas, 63 sacred lotus, 11 green stain cups, and 27 entelomas
; -- add the correct number of each to the player
set hp_flys to (199 * hp_flys) / 100
playerRef.addItem FlyAmanitaCap hp_flys
set hp_lotus to (63 * hp_lotus) / 100
playerRef.addItem SacredLotusSeeds hp_lotus
set hp_gcup to (11 * hp_gcup) / 100
playerRef.addItem GreenStainCupCap hp_gcup
set hp_sblue to (27 * hp_sblue) / 100
playerRef.addItem SteelBlueEntolomaCap hp_sblue
end