So I found what seems to be a funny bug of some sort. Here is my situation:
I have the DemoSoldier_1 Tool and then I have 3 OBJs that I want to import.
I have Teapot01.obj, Teapot02.obj and Teapot3.obj
I’m working on a script to auto import objs and auto append them to the currently selected tool if they don’t match an existing subtool.
So I go one by one, first the zscript checks if Teapot01 is already a subtool. In this case it’s not, so it switched to SimpleBrush and imports the obj. It then saves the current tool (Teapot01) with:
[VarSet,appendTool,[IGetTitle,Tool:Current Tool,0]]
Goes back to the DemoSoldier and appends it with:
[IPress,Tool:SubTool:Append]
[IPress,[StrMerge,"PopUp:",#appendTool]]
So far so good. Now, Teapot02 comes next. It also isn’t an existing subtool so it switches to Simplebrush once again, it is then imported. I switch back again to DemoSoldier_1 and I append it, using the very same code I used above. To my surprise it actually appends the first Teapot again!!
Now, I think I have found out why this happens. Turns out, that the moment I append Teapot01 to DemoSoldier, the original Teapot01, (the one that is not appended) is renamed to Teapot02. So when I import Teapot02.obj I have two tools called Teapot02.
The problem comes when I append the tool with
[IPress,Tool:SubTool:Append]
[IPress,[StrMerge,"PopUp:",#appendTool]]
It seems to look for a Teapot02,but it just randomly picks one of them. Is there any way around this?