Just a short quip about something I discovered. You real scripters probably already know about it, so this is for the nubs.
When you are cycling through items you normally use a standard flow:
finditem
do whatever to item
ignore item
I was using that flow for Detecting Hidden on boxes. If I had 20 boxes on the ground, the script would find one, detect on it, ignore it, the find the next one. Once all were detected I did a ignoreitem reset to clear the ignore list and start over again.
The problem is how I had my ignoreitem. It was before the Detect portion, so if I had a count of 0 items (and reset the ignoreitem list) it would still try to detect the "unfound" item, which results in a #findType and #findID of X.
findItem %boxes G_6 ; find all boxes within 6 that are on the ground
if #findCnt = 0
ignoreitem reset ; if it doesn't find one, because I've ignored them all, then reset the ignore list
detect hidden ; detect on the found ones
ignoreitem #findID ; ignore the one I just detected
See how when I ignore the last box, the script will #findCnt 0 and reset the ignore list THEN it will try to detect hidden, but the item is that X because the count was 0.
This is how I got around it.
findItem %boxes G_6
set %findCnt #findCnt ; so I'm setting a variable to keep track of how many are found
detect hidden ; detect on the found one
ignoreitem #findID ; ignore the one I just detected
if %findCnt = 1 ; so the last one I detected on was the LAST ONE FOUND
ignoreitem reset ; since I just checked the last one found, reset the ignore list
This works well. Scripts that cycle through stuff and ignores items should have some type of safety like this to ensure you don't waste one cycle trying to do something to an item thats not found.