This page is located on the SimsWiki. To view it in it's original form, click here.

With most Set to Next (0x001F) enumerations, we can keep calling 'Set to Next' in a loop until it returns false and we know that we have been returned each of the things that match the criteria we are using. With a few of them however, they are not able to return false to tell you that you have seen everything. These will loop round forever (but for the "Too Many iterations" error which will save you). This means you should remember the starting point before calling one of these flavours of 'Set to Next' and after each return True, check to see whether you have got back to your starting point and if so act accordingly, as if it had returned False.

Example BHAV code using Set To Next with obj on same tile


I believe the reason for the above is due to the fact that there is only one variable used for this flavour of 'Set to Next' instead of two. You would imagine that you need a variable to contain

  • the thing that you want to find other things on the same tile as
  • the place to store the returned thing that has been found on the same tile.

However, there is only one variable, so it gets updated each time to the newly found thing and thus the starting point is forgotten.

I know this applies to the following Set to Next varients