@Fergus It seems that the infinite loop was caused by the following code:
setelem op .JW + elem .JW op 1; setelem op .jw + elem .jw op 1;
That's two lines of code. In the first line, you are trying to increment #op[".JW"] by one, and in the second, you are trying to increment #op[".jw"] by one.
.jw is the wazir camel piece and I had wanted to to increase the number of them in reserve. Probably the dot is causing trouble. Do you agree?
Yes, it looks like it is causing trouble. In a test I ran, it incremented #op["JW"] and #op["jw"] by one instead of the elements you named. This is probably because the period is now used as a separator between array and element names, and the setelem command now just concatenates the array and element names by putting a period between them, and uses this concatenated name with the function for setting a user variable.
What I would recommend is to follow the instructions I have previously given for replacing piece labels without using aliases, which is in the comments for the Game Courier Developer's Guide. This would give you nice clean piece labels that you can use in your code without running into problems like this.
That's two lines of code. In the first line, you are trying to increment #op[".JW"] by one, and in the second, you are trying to increment #op[".jw"] by one.
Yes, it looks like it is causing trouble. In a test I ran, it incremented #op["JW"] and #op["jw"] by one instead of the elements you named. This is probably because the period is now used as a separator between array and element names, and the setelem command now just concatenates the array and element names by putting a period between them, and uses this concatenated name with the function for setting a user variable.
What I would recommend is to follow the instructions I have previously given for replacing piece labels without using aliases, which is in the comments for the Game Courier Developer's Guide. This would give you nice clean piece labels that you can use in your code without running into problems like this.