Well I basically just saved the equip slot in the variable .@s to use delequip, removed the variable resets forr random options as well as the checks for existing values. Which are unnecessary, since below you set the variables anyway into the array. Even if it's 0.
But I let the check for getitem3 stay if there is an value for an random option to use the correct getitem.
And instead of delitem I used delequip .@s;
But after the getitem stuff to save lines since it does the same thing anyway.
If you want to have a look where delequip comes to action: Costume Enchanter - GitHub
Edit:
After coming home from work I added some lines and comments:
Like I mentioned earlier, I didn't test it yet.
Regards,
Chris: