You are using the loops for a single value each. You do not need a nested loop for that.
You could try this script for the same effect:
Place either your timer, or trigger/switch ~or even your calling script on to the specific tile that you wish to check for your items;
and connect it to this script.
Thanks for your help.
I understand the idea, but I have four locations to check, so I can't put the script on it. You means that my script is more CPU consuming than 4 floortriggers plus a timer? A silly ask: what is ift in your script? I don't see where are ift values??
I think any performance gain is negligible; it's just that it's more complicated than it needs to be, and so is harder to read than seems necessary. Loops are useful for their incrementing value, and this pair of loops only runs once each for fixed values that could be static variables.
To check four locations, just call the short version of the script from those four locations; either with triggers, switches, timers, or scripts*. The itemchk function takes its search tile from the location of the calling object; be it a plate/floor trigger, wall button, lever or script object.
ift originally meant 'Item Floor Trigger', but stopped meaning just that, so I shortened it. The ift variable is reference to whatever calls the itemChk function.
*Calling via script would be done like this: my_script.script.itemChk(self)